|
From: Bartels, E. <Enn...@ea...> - 2004-12-03 08:04:20
|
Hi
Sorry attachment is not shown in the
mailing list now add it inside
the mail.
Here is the code of the curses_test.c file:
---------------------------------------------
/* Test program by Enno Bartels
*/
#include <curses.h>
/*! Curses window pointer */
WINDOW *p_win_g;
int
main (int argc, char **p_argv)
{
int go = 1;
int loop_number = 0;
int keyboard = 0;
int valgrind_uninitialised_test_variable;
/***************/
/* INIT CURSES */
/***************/
/* Clear the keyboard buffer */
fflush (stdin);
/* Initialize screen, clears screen, returns pointer */
p_win_g = initscr ();
/* Typed characters immediately available to program */
cbreak ();
/* No echo of typed characters on the screen */
noecho ();
/* No new line for faster cursor motion */
nonl ();
/* No waiting until a key is pressed */
nodelay (p_win_g, TRUE);
/* Single value for function and arrow keys */
keypad (p_win_g, TRUE);
/************************/
/* Do something in loop */
/************************/
do
{
/* Print the loop number on screen */
mvprintw (10,10, "Loop number: %d", loop_number);
/* Query the keyboard */
keyboard = wgetch (p_win_g);
/* Analyse keyboard key */
if (keyboard == 'q')
{
go = 0;
}
/* Print an uninitialised variable */
if (loop_number == 6)
{
mvprintw (13, 10, "valgrind_uninitialised_test_variable = %d ",
valgrind_uninitialised_test_variable);
mvprintw (14, 10, " shown at loop %d ", loop_number);
}
/* Increase loop counter */
loop_number++;
/* Sleep one second */
sleep (1);
} while (go == 1);
/*****************/
/* FINISH CURSES */
/*****************/
/* Update the screen */
wrefresh (p_win_g);
/* End curses session */
endwin ();
} /* End of main */
|