5 static char printscanbuf
[513]; /* buffer used during I/O */
7 /****************************************************************/
8 /* Wprintw(win,fmt,args) does a printf() in window 'win'. */
9 /****************************************************************/
10 int wprintw(WINDOW
*win
, const char *fmt
, ...)
15 vsprintf(printscanbuf
, fmt
, args
);
16 if (waddstr(win
, printscanbuf
) == ERR
) return(ERR
);
17 return(strlen(printscanbuf
));
20 /****************************************************************/
21 /* Printw(fmt,args) does a printf() in stdscr. */
22 /****************************************************************/
23 int printw(const char *fmt
, ...)
28 vsprintf(printscanbuf
, fmt
, args
);
29 if (waddstr(stdscr
, printscanbuf
) == ERR
) return(ERR
);
30 return(strlen(printscanbuf
));
33 /****************************************************************/
34 /* Mvprintw(fmt,args) moves the stdscr cursor to a new posi- */
35 /* tion, then does a printf() in stdscr. */
36 /****************************************************************/
37 int mvprintw(int y
, int x
, const char *fmt
, ...)
42 if (wmove(stdscr
, y
, x
) == ERR
) return(ERR
);
43 vsprintf(printscanbuf
, fmt
, args
);
44 if (waddstr(stdscr
, printscanbuf
) == ERR
) return(ERR
);
45 return(strlen(printscanbuf
));
48 /****************************************************************/
49 /* Mvwprintw(win,fmt,args) moves the window 'win's cursor to */
50 /* A new position, then does a printf() in window 'win'. */
51 /****************************************************************/
52 int mvwprintw(WINDOW
*win
, int y
, int x
, const char *fmt
, ...)
57 if (wmove(win
, y
, x
) == ERR
) return(ERR
);
58 vsprintf(printscanbuf
, fmt
, args
);
59 if (waddstr(win
, printscanbuf
) == ERR
) return(ERR
);
60 return(strlen(printscanbuf
));
63 /****************************************************************/
64 /* Wscanw(win,fmt,args) gets a string via window 'win', then */
65 /* Scans the string using format 'fmt' to extract the values */
66 /* And put them in the variables pointed to the arguments. */
67 /****************************************************************/
68 int wscanw(WINDOW
*win
, const char *fmt
, ...)
73 wrefresh(win
); /* set cursor */
74 if (wgetstr(win
, printscanbuf
) == ERR
) /* get string */
76 return(vsscanf(printscanbuf
, fmt
, args
));
79 /****************************************************************/
80 /* Scanw(fmt,args) gets a string via stdscr, then scans the */
81 /* String using format 'fmt' to extract the values and put them */
82 /* In the variables pointed to the arguments. */
83 /****************************************************************/
84 int scanw(const char *fmt
, ...)
89 wrefresh(stdscr
); /* set cursor */
90 if (wgetstr(stdscr
, printscanbuf
) == ERR
) /* get string */
92 return(vsscanf(printscanbuf
, fmt
, args
));
95 /****************************************************************/
96 /* Mvscanw(y,x,fmt,args) moves stdscr's cursor to a new posi- */
97 /* Tion, then gets a string via stdscr and scans the string */
98 /* Using format 'fmt' to extract the values and put them in the */
99 /* Variables pointed to the arguments. */
100 /****************************************************************/
101 int mvscanw(int y
, int x
, const char *fmt
, ...)
106 if (wmove(stdscr
, y
, x
) == ERR
) return(ERR
);
107 wrefresh(stdscr
); /* set cursor */
108 if (wgetstr(stdscr
, printscanbuf
) == ERR
) /* get string */
110 return(vsscanf(printscanbuf
, fmt
, args
));
113 /****************************************************************/
114 /* Mvwscanw(win,y,x,fmt,args) moves window 'win's cursor to a */
115 /* New position, then gets a string via 'win' and scans the */
116 /* String using format 'fmt' to extract the values and put them */
117 /* In the variables pointed to the arguments. */
118 /****************************************************************/
119 int mvwscanw(WINDOW
*win
, int y
, int x
, const char *fmt
, ...)
124 if (wmove(win
, y
, x
) == ERR
) return(ERR
);
125 wrefresh(win
); /* set cursor */
126 if (wgetstr(win
, printscanbuf
) == ERR
) /* get string */
128 return(vsscanf(printscanbuf
, fmt
, args
));