From e9ca0e5a2a5afaaba1d2f59abf2fbe2a4dab18d3 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Wed, 8 Mar 2000 02:33:52 +0000 Subject: Synchronize with potato-branch again: debian/changelog: update to 1.6.10 scripts/dpkg-divert.pl: reinstate last writeability-patch. Modified to not abort on ENOENT: this indicates a directory does not (yet) exist. If this happens don't try to rename. scripts/update-alternatives.pl: + update usage-warning to reflect the new --config option + Document some global variables + Switch back to auto-mode when removing a manually selected alternative dselect/{dselect.h,main.cc,pkglist.cc}: remove CAN_RESIZE stuff dselect/methlist.cc: don't abort if getch fails due to interrupted syscall dselect/pkglist.cc: don't abort if getch fails due to interrupted syscall dselect/baselist.cc: put debug-statement in sigwinchhandler and actually resize the current terminal before redisplaying the screen --- dselect/baselist.cc | 4 ++++ dselect/dselect.h | 11 ----------- dselect/main.cc | 30 ------------------------------ dselect/methlist.cc | 3 +++ dselect/pkglist.cc | 7 +++---- 5 files changed, 10 insertions(+), 45 deletions(-) (limited to 'dselect') diff --git a/dselect/baselist.cc b/dselect/baselist.cc index 3f326c6e5..3b3d6e7d0 100644 --- a/dselect/baselist.cc +++ b/dselect/baselist.cc @@ -45,9 +45,13 @@ void mywerase(WINDOW *win) { baselist *baselist::signallist= 0; void baselist::sigwinchhandler(int) { + struct winsize size; + if (debug) fprintf(debug,"baselist::sigwinchhandler(), signallist=%p\n",signallist); baselist *p= signallist; p->enddisplay(); endwin(); initscr(); + if (ioctl(fileno(stdout), TIOCGWINSZ, &size) != 0) ohshite(_("ioctl(TIOCGWINSZ) failed")); + resizeterm(size.ws_row, size.ws_col); wrefresh(curscr); p->startdisplay(); if (doupdate() == ERR) ohshite(_("doupdate in SIGWINCH handler failed")); } diff --git a/dselect/dselect.h b/dselect/dselect.h index 838d167eb..e08549ee4 100644 --- a/dselect/dselect.h +++ b/dselect/dselect.h @@ -27,17 +27,6 @@ #include -#if defined(SIGWINCH) && defined(TIOCGWINSZ) && defined(NCURSES_VERSION) -#define CAN_RESIZE 1 -#else -#define CAN_RESIZE 0 -#endif - -#if CAN_RESIZE -static RETSIGTYPE adjust(int sig); -static int interrupted; -#endif - struct helpmenuentry { char key; const struct helpmessage *msg; diff --git a/dselect/main.cc b/dselect/main.cc index ca30400d7..469f8a98e 100644 --- a/dselect/main.cc +++ b/dselect/main.cc @@ -103,32 +103,6 @@ static void usage(void) { stdout)) werr("stdout"); } -#if CAN_RESIZE -/* - * This uses functions that are "unsafe", but it seems to work on SunOS and - * Linux. The 'wrefresh(curscr)' is needed to force the refresh to start from - * the top of the screen -- some xterms mangle the bitmap while resizing. - * - * Borrowed from the ncurses example view.c - */ -static RETSIGTYPE adjust(int sig) -{ - if (waiting || sig == 0) { - struct winsize size; - - if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { - resizeterm(size.ws_row, size.ws_col); - wrefresh(curscr); /* Linux needs this */ - show_all(); - } - interrupted = FALSE; - } else { - interrupted = TRUE; - } - (void) signal(SIGWINCH, adjust); /* some systems need this */ -} -#endif /* CAN_RESIZE */ - /* These are called by C code, so need to have C calling convention */ extern "C" { @@ -338,10 +312,6 @@ int main(int, const char *const *argv) { bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); -#if CAN_RESIZE - (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ -#endif - if (setjmp(ejbuf)) { /* expect warning about possible clobbering of argv */ cursesoff(); error_unwind(ehflag_bombout); exit(2); diff --git a/dselect/methlist.cc b/dselect/methlist.cc index 726caf421..2e033ff4f 100644 --- a/dselect/methlist.cc +++ b/dselect/methlist.cc @@ -24,6 +24,7 @@ #include #include #include +#include extern "C" { #include @@ -156,7 +157,9 @@ quitaction methodlist::display() { if (doupdate() == ERR) ohshite(_("doupdate failed")); signallist= this; if (sigprocmask(SIG_UNBLOCK,&sigwinchset,0)) ohshite(_("failed to unblock SIGWINCH")); + do response= getch(); + while (response == ERR && errno == EINTR); if (sigprocmask(SIG_BLOCK,&sigwinchset,0)) ohshite(_("failed to re-block SIGWINCH")); if (response == ERR) ohshite(_("getch failed")); interp= (*bindings)(response); diff --git a/dselect/pkglist.cc b/dselect/pkglist.cc index ac493a6cf..b0c82adee 100644 --- a/dselect/pkglist.cc +++ b/dselect/pkglist.cc @@ -24,6 +24,7 @@ #include #include #include +#include extern "C" { #include @@ -497,15 +498,13 @@ pkginfo **packagelist::display() { if (debug) fprintf(debug,"packagelist[%p]::display() entering loop\n",this); for (;;) { -#if CAN_RESIZE - if (interrupted) - adjust(0); -#endif if (whatinfo_height) wcursyncup(whatinfowin); if (doupdate() == ERR) ohshite("doupdate failed"); signallist= this; if (sigprocmask(SIG_UNBLOCK,&sigwinchset,0)) ohshite("failed to unblock SIGWINCH"); + do response= getch(); + while (response == ERR && errno == EINTR); if (sigprocmask(SIG_BLOCK,&sigwinchset,0)) ohshite("failed to re-block SIGWINCH"); if (response == ERR) ohshite("getch failed"); interp= (*bindings)(response); -- cgit v1.2.3