[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ncurses strangeness?



When you say, "exits (as I expect)", what exactly do you mean by
that statement?  Does it not quit?  Is the terminal messed up?  Does your
terminal just hang?


I have compiled your program on cygwin, and while
it exits when a 'q' is pressed, it does not clean up after itself.  I have
to do a 'stty sane' afterwards to make the screen act normally.  The
way to fix that is to add an endwin() statement before each of your
exit statements.


On Mon, 1 Oct 2001 20:39:44 +0100, Paul.Emsley@chem.gla.ac.uk wrote:

>
>       Hi, 
>
>       I will toying with ncurses and found this strange behaviour:
>
>       On GNU/Linux, the program exits (as I expect) when "q" is pressed.
>
>       On GNU/Hurd, it does not.
>
>       [I compiled also for SGI IRIX (using curses) and the program
>       does exit, but also logs me out(!).] 
>
>       My C programming skills are sadly week, so it may also due to a
>       bug in the program...
>
>      Help?
>
>      Thanks, 
>
>      Paul.
>
>--
>
>
>#include <ncurses.h>
>
>int 
>wait_and_check_for_quit() {
>  
>  int max_loop = 10;
>  int i;
>  int chr;
>
>  for (i=0; i<max_loop; i++) { 
>
>    chr=getch();
>    if (chr == 'q') { 
>      exit(0);
>    }
>    usleep(100000);			/* 0.1 seconds */
>  }
>  /* we got to the end and q has not been pressed */
>  return FALSE;
>}
>
>
>int
>main(int argc, char **argv) {
>
>  initscr();
>  noecho();
>  cbreak(); 
>  keypad (stdscr, TRUE);
>
>  leaveok(stdscr, TRUE);   /* no cursor */
>  nodelay(stdscr, TRUE);   /* don't wait for keypress */
>
>   while(1) {
>     if (wait_and_check_for_quit() == TRUE) { /* let's exit */
>       return 0;
>     }
>   }
>
>}
>
>
>
>
>      
>
>
>-- 
>To UNSUBSCRIBE, email to debian-hurd-request@lists.debian.org
>with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>





Reply to: