summaryrefslogtreecommitdiff
path: root/ncurses/base/lib_printw.c
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses/base/lib_printw.c')
-rw-r--r--ncurses/base/lib_printw.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/ncurses/base/lib_printw.c b/ncurses/base/lib_printw.c
index 56528f6..d901b72 100644
--- a/ncurses/base/lib_printw.c
+++ b/ncurses/base/lib_printw.c
@@ -1,5 +1,6 @@
/****************************************************************************
- * Copyright (c) 1998-2009,2012 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 <curses.priv.h>
-MODULE_ID("$Id: lib_printw.c,v 1.23 2012/09/03 17:55:28 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,16 +78,15 @@ 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, ...)
{
- va_list argp;
int code;
#ifdef TRACE
@@ -98,17 +98,18 @@ mvprintw(int y, int x, const char *fmt,...)
#endif
if ((code = move(y, x)) != ERR) {
+ 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, ...)
{
- va_list argp;
int code;
#ifdef TRACE
@@ -120,8 +121,10 @@ mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
#endif
if ((code = wmove(win, y, x)) != ERR) {
+ va_list argp;
+
va_start(argp, fmt);
- code = vwprintw(win, fmt, argp);
+ code = vw_printw(win, fmt, argp);
va_end(argp);
}
returnCode(code);
@@ -144,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);
+}