* newdemo.c - A demo program using PDCurses. The program illustrate
* the use of colours for text output.
*
- * $Id: newdemo.c,v 1.44 2017/09/04 11:49:55 tom Exp $
+ * $Id: newdemo.c,v 1.47 2019/12/14 23:25:29 tom Exp $
*/
#include <test.priv.h>
static void
trap(int sig GCC_UNUSED)
{
- exit_curses();
+ stop_curses();
ExitProgram(EXIT_FAILURE);
}
WaitForUser(WINDOW *win)
{
time_t t;
- chtype key;
nodelay(win, TRUE);
t = time((time_t *) 0);
+
while (1) {
+ chtype key;
if ((int) (key = (chtype) wgetch(win)) != ERR) {
if (key == 'q' || key == 'Q')
return 1;
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
WINDOW *win;
- int w, x, y, i, j, k;
+ int x, y, i, k;
char buffer[SIZEOF(messages) * 80];
- const char *message;
int width, height;
chtype save[80];
- chtype c;
setlocale(LC_ALL, "");
- CATCHALL(trap);
-
- initscr();
+ InitAndCatch(initscr(), trap);
if (has_colors())
start_color();
cbreak();
height = 14; /* Create a drawing window */
win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
if (win == NULL) {
- exit_curses();
+ stop_curses();
ExitProgram(EXIT_FAILURE);
}
while (1) {
+ int w;
+ int j;
+ chtype c;
+ const char *message;
+
set_colors(win, 1, COLOR_WHITE, COLOR_BLUE);
werase(win);
if (WaitForUser(win) == 1)
break;
}
- exit_curses();
+ stop_curses();
ExitProgram(EXIT_SUCCESS);
}