[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getch always returns -1 after shell
From: |
Tim Mooney |
Subject: |
Re: getch always returns -1 after shell |
Date: |
Mon, 27 Jan 2003 21:50:13 -0600 (CST) |
In regard to: getch always returns -1 after shell, jon wackley said (at...:
>Hi,
>
>I have a problem with ncurses-5.3, I use the following pseudo-code;
>
> def_prog_mode();
> endwin();
> /* spawn some shell processing */
> refresh();
>
>Everything seems fine until the next execution of getch(). getch always
>returns -1, (ERR). Is there something special I have to do to ensure
>the input state is consistent before and after spawning shell commands?
>Any suggestions where to look to track down this problem? The term is a
>"sun-cmd".
Hmmm, I would think that you're on the right track. *Years* ago (like
93-94) I hacked a curses-based menu program to support shell escapes
via system, and the notes and comments I had say:
* After carefully reading the *excellent* curses (sysv, curses.3v)
* manpage on Solbourne OS/MP, here's the scoop:
* 1. initscr should be called only *ONCE*. It does global variable
* setup.
* 2. before each system() call or shell escape, you should call endwin.
* this will reset the terminal state, and get things ready for the
* the next program to execute.
* 3. After finishing a shell escape or system call, either wrefresh or
* doupdate() should be called- and they will reset the proper terminal
* modes.
The menu made extensive use of getch, and I never had a problem with
errors. My guess is you're on the right track. Why it's not working,
I don't know.
Tim
--
Tim Mooney address@hidden
Information Technology Services (701) 231-1076 (Voice)
Room 242-J6, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
- getch always returns -1 after shell, jon wackley, 2003/01/27
- Re: getch always returns -1 after shell, Thomas Dickey, 2003/01/27
- Re: getch always returns -1 after shell, jon wackley, 2003/01/27
- Re: getch always returns -1 after shell, jon wackley, 2003/01/27
- Re: getch always returns -1 after shell, Thomas Dickey, 2003/01/27
- Re: getch always returns -1 after shell, jon wackley, 2003/01/27
- Re: getch always returns -1 after shell, Thomas Dickey, 2003/01/28
Re: getch always returns -1 after shell,
Tim Mooney <=