Eitan, good day. Thu, Dec 30, 2010 at 07:03:44PM -0500, Eitan Adler wrote: > 1) When clicking the "View" button on the license window (using the > withlicense.sh script) I fork() and then exec less. Less opens fine - > but when I hit "q" it seems that any actions I took in less also took > place in the ncurses program. If I use rfork(RFPROC|RFCFDG) then it > never shows less on the screen. I suspect this is because in the > former case they share the same stdin and stdout and in the latter > case less doesn't get any std* streams. > Is there a way to avoid this problem?
The attached patch should fix it. The problem is that you should leave the Ncurses mode before spawning external programs. You seem to be trying to do it in the child process (commented endwin()), but it should be done inside the parent process, since it is the one who does Ncurses. And the most logical way is to - leave the curses mode; - invoke anything you like and wait() for it; - enter the curses mode again + refresh the windows. -- Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]
From 1c6ca9f805e965796e7321d04868c1278d4ec7a9 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin <r...@freebsd.org> Date: Fri, 31 Dec 2010 10:47:46 +0300 Subject: [PATCH] Save/restore terminal around the pager invocation We should leave Ncurses mode before the pager is spawned and return to the saved mode once we're done with the pager. Signed-off-by: Eygene Ryabinkin <r...@freebsd.org> --- dialog4ports.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dialog4ports.c b/dialog4ports.c index cdec074..026b0b9 100644 --- a/dialog4ports.c +++ b/dialog4ports.c @@ -888,6 +888,8 @@ main(int argc, char* argv[]) if (curItem == licenceItems[licenceVIEW]) { char const * const pager = getenv("PAGER"); //const int pid = rfork(RFPROC|RFCFDG); + def_prog_mode(); + endwin(); const int pid = fork(); if (pid == 0) { //endwin(); @@ -903,6 +905,8 @@ main(int argc, char* argv[]) else { wait(pid); } + reset_prog_mode(); + wrefresh(curscr); } } else if (whichLocation == EXIT) { -- 1.7.3.2
pgpp4HNAfCu0C.pgp
Description: PGP signature