]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/lib_printw.c
ncurses 4.1
[ncurses.git] / ncurses / lib_printw.c
1
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21
22
23
24 /*
25 **      lib_printw.c
26 **
27 **      The routines printw(), wprintw() and friends.
28 **
29 */
30
31 #include <curses.priv.h>
32
33 MODULE_ID("$Id: lib_printw.c,v 1.3 1997/02/16 00:07:23 tom Exp $")
34
35 int printw(const char *fmt, ...)
36 {
37 va_list argp;
38 char buf[BUFSIZ];
39
40         T(("printw(%s,...) called", _nc_visbuf(fmt)));
41
42         va_start(argp, fmt);
43         vsprintf(buf, fmt, argp);
44         va_end(argp);
45         return(waddstr(stdscr, buf));
46 }
47
48
49
50 int wprintw(WINDOW *win, const char *fmt, ...)
51 {
52 va_list argp;
53 char buf[BUFSIZ];
54
55         T(("wprintw(%p,%s,...) called", win, _nc_visbuf(fmt)));
56
57         va_start(argp, fmt);
58         vsprintf(buf, fmt, argp);
59         va_end(argp);
60         return(waddstr(win, buf));
61 }
62
63
64
65 int mvprintw(int y, int x, const char *fmt, ...)
66 {
67 va_list argp;
68 char buf[BUFSIZ];
69
70         va_start(argp, fmt);
71         vsprintf(buf, fmt, argp);
72         va_end(argp);
73         return(move(y, x) == OK ? waddstr(stdscr, buf) : ERR);
74 }
75
76
77
78 int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
79 {
80 va_list argp;
81 char buf[BUFSIZ];
82
83         va_start(argp, fmt);
84         vsprintf(buf, fmt, argp);
85         va_end(argp);
86         return(wmove(win, y, x) == OK ? waddstr(win, buf) : ERR);
87 }
88
89 int vwprintw(WINDOW *win, const char *fmt, va_list argp)
90 {
91 char buf[BUFSIZ];
92
93         vsprintf(buf, fmt, argp);
94         return(waddstr(win, buf));
95 }