1 /****************************************************************************
2 * Copyright 2018-2019,2020 Thomas E. Dickey *
3 * Copyright 1998-2012,2016 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Thomas E. Dickey 1997-on *
32 ****************************************************************************/
37 ** The routines printw(), wprintw() and friends.
41 #include <curses.priv.h>
43 MODULE_ID("$Id: lib_printw.c,v 1.28 2020/02/02 23:34:34 tom Exp $")
46 printw(const char *fmt, ...)
54 T((T_CALLED("printw(%s%s)"),
55 _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
60 code = vw_printw(stdscr, fmt, argp);
67 wprintw(WINDOW *win, const char *fmt, ...)
75 T((T_CALLED("wprintw(%p,%s%s)"),
76 (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
81 code = vw_printw(win, fmt, argp);
88 mvprintw(int y, int x, const char *fmt, ...)
95 T((T_CALLED("mvprintw(%d,%d,%s%s)"),
96 y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
100 if ((code = move(y, x)) != ERR) {
104 code = vw_printw(stdscr, fmt, argp);
111 mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
118 T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"),
119 y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
123 if ((code = wmove(win, y, x)) != ERR) {
127 code = vw_printw(win, fmt, argp);
134 vwprintw(WINDOW *win, const char *fmt, va_list argp)
139 SCREEN *sp = _nc_screen_of(win);
142 T((T_CALLED("vwprintw(%p,%s,va_list)"), (void *) win, _nc_visbuf(fmt)));
144 buf = NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_ARGx fmt, argp);
146 code = waddstr(win, buf);
152 vw_printw(WINDOW *win, const char *fmt, va_list argp)
157 SCREEN *sp = _nc_screen_of(win);
160 T((T_CALLED("vw_printw(%p,%s,va_list)"), (void *) win, _nc_visbuf(fmt)));
162 buf = NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_ARGx fmt, argp);
164 code = waddstr(win, buf);