[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getch always returns -1 after shell
From: |
Thomas Dickey |
Subject: |
Re: getch always returns -1 after shell |
Date: |
Tue, 28 Jan 2003 05:50:36 -0500 |
User-agent: |
Mutt/1.3.27i |
On Mon, Jan 27, 2003 at 09:50:13PM -0600, Tim Mooney wrote:
> 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 "always" is a little unclear - "always" on the first occurrence, or
even on repeated calls?
> >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.
yes - ncurses "allows" initscr to be called more than once, but it is known
to produce core dumps on other implementations.
> * 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.
the only thing that comes to mind is if - for example - he's running on some
platform where the subshell is able to modify the terminal modes where the
ncurses application could not. I'm told that could happen on HPUX if ncurses
is not privileged and the shell is su'd to root.
> * 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
>
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-ncurses
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
- 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, 2003/01/27
- Re: getch always returns -1 after shell,
Thomas Dickey <=