X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_printw.c;h=d901b727a91c0a04486c9de9367bce9ff7982515;hp=617c5faada24f01a81b83caf71b73b41d0783d4b;hb=7f4b9f390624835ceb0849965a7f6ff2dcb39d00;hpb=76a479337308b4b5e749fa8c38b7b7f482998c5b diff --git a/ncurses/base/lib_printw.c b/ncurses/base/lib_printw.c index 617c5faa..d901b727 100644 --- a/ncurses/base/lib_printw.c +++ b/ncurses/base/lib_printw.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2016 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,10 +40,10 @@ #include -MODULE_ID("$Id: lib_printw.c,v 1.24 2016/05/28 23:11:26 tom Exp $") +MODULE_ID("$Id: lib_printw.c,v 1.28 2020/02/02 23:34:34 tom Exp $") NCURSES_EXPORT(int) -printw(const char *fmt,...) +printw(const char *fmt, ...) { va_list argp; int code; @@ -56,14 +57,14 @@ printw(const char *fmt,...) #endif va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); + code = vw_printw(stdscr, fmt, argp); va_end(argp); returnCode(code); } NCURSES_EXPORT(int) -wprintw(WINDOW *win, const char *fmt,...) +wprintw(WINDOW *win, const char *fmt, ...) { va_list argp; int code; @@ -77,14 +78,14 @@ wprintw(WINDOW *win, const char *fmt,...) #endif va_start(argp, fmt); - code = vwprintw(win, fmt, argp); + code = vw_printw(win, fmt, argp); va_end(argp); returnCode(code); } NCURSES_EXPORT(int) -mvprintw(int y, int x, const char *fmt,...) +mvprintw(int y, int x, const char *fmt, ...) { int code; @@ -100,14 +101,14 @@ mvprintw(int y, int x, const char *fmt,...) va_list argp; va_start(argp, fmt); - code = vwprintw(stdscr, fmt, argp); + code = vw_printw(stdscr, fmt, argp); va_end(argp); } returnCode(code); } NCURSES_EXPORT(int) -mvwprintw(WINDOW *win, int y, int x, const char *fmt,...) +mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...) { int code; @@ -123,7 +124,7 @@ mvwprintw(WINDOW *win, int y, int x, const char *fmt,...) va_list argp; va_start(argp, fmt); - code = vwprintw(win, fmt, argp); + code = vw_printw(win, fmt, argp); va_end(argp); } returnCode(code); @@ -146,3 +147,21 @@ vwprintw(WINDOW *win, const char *fmt, va_list argp) } returnCode(code); } + +NCURSES_EXPORT(int) +vw_printw(WINDOW *win, const char *fmt, va_list argp) +{ + char *buf; + int code = ERR; +#if NCURSES_SP_FUNCS + SCREEN *sp = _nc_screen_of(win); +#endif + + T((T_CALLED("vw_printw(%p,%s,va_list)"), (void *) win, _nc_visbuf(fmt))); + + buf = NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_ARGx fmt, argp); + if (buf != 0) { + code = waddstr(win, buf); + } + returnCode(code); +}