diff --git a/usr.bin/systat/cmds.c b/usr.bin/systat/cmds.c index 3be39627c253..b63ab294d9d1 100644 --- a/usr.bin/systat/cmds.c +++ b/usr.bin/systat/cmds.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmds.c,v 1.26 2003/08/07 11:15:57 agc Exp $ */ +/* $NetBSD: cmds.c,v 1.27 2004/07/03 18:54:47 mycroft Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/29/95"; #endif -__RCSID("$NetBSD: cmds.c,v 1.26 2003/08/07 11:15:57 agc Exp $"); +__RCSID("$NetBSD: cmds.c,v 1.27 2004/07/03 18:54:47 mycroft Exp $"); #endif /* not lint */ #include @@ -53,15 +53,10 @@ command(char *cmd) struct command *c; struct mode *p; char *args; - sigset_t set; if (cmd[0] == '\0') return; - sigemptyset(&set); - sigaddset(&set, SIGALRM); - sigprocmask(SIG_BLOCK, &set, NULL); - args = cmd; cmd = strsep(&args, " \t"); @@ -95,7 +90,7 @@ command(char *cmd) error("%s: Unknown command.", cmd); done: - sigprocmask(SIG_UNBLOCK, &set, NULL); + ; } void diff --git a/usr.bin/systat/globalcmds.c b/usr.bin/systat/globalcmds.c index cd9de0484883..da62f47467fc 100644 --- a/usr.bin/systat/globalcmds.c +++ b/usr.bin/systat/globalcmds.c @@ -1,4 +1,4 @@ -/* $NetBSD: globalcmds.c,v 1.10 2002/11/16 15:59:31 itojun Exp $ */ +/* $NetBSD: globalcmds.c,v 1.11 2004/07/03 18:54:47 mycroft Exp $ */ /*- * Copyright (c) 1999 @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: globalcmds.c,v 1.10 2002/11/16 15:59:31 itojun Exp $"); +__RCSID("$NetBSD: globalcmds.c,v 1.11 2004/07/03 18:54:47 mycroft Exp $"); #endif /* not lint */ #include @@ -130,7 +130,6 @@ global_interval(char *args) return; } - alarm(0); naptime = interval; display(0); status(); @@ -155,7 +154,7 @@ global_quit(char *args) void global_stop(char *args) { - alarm(0); + timeout(-1); mvaddstr(CMDLINE, 0, "Refresh disabled."); clrtoeol(); } diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c index ba7060277c03..3a7e446eea55 100644 --- a/usr.bin/systat/keyboard.c +++ b/usr.bin/systat/keyboard.c @@ -1,4 +1,4 @@ -/* $NetBSD: keyboard.c,v 1.17 2004/07/03 18:31:36 mycroft Exp $ */ +/* $NetBSD: keyboard.c,v 1.18 2004/07/03 18:54:47 mycroft Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: keyboard.c,v 1.17 2004/07/03 18:31:36 mycroft Exp $"); +__RCSID("$NetBSD: keyboard.c,v 1.18 2004/07/03 18:54:47 mycroft Exp $"); #endif /* not lint */ #include @@ -53,10 +53,6 @@ keyboard(void) int ch, rch; char *line; int i, linesz; - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGALRM); linesz = COLS - 2; /* XXX does not get updated on SIGWINCH */ if ((line = malloc(linesz)) == NULL) { @@ -71,12 +67,14 @@ keyboard(void) while (col == 0 || (ch != '\r' && ch != '\n')) { refresh(); ch = getch(); - if (ch == -1 && ferror(stdin)) { - clearerr(stdin); + if (ch == ERR) { + display(0); continue; } - if (ch == KEY_RESIZE) + if (ch == KEY_RESIZE) { redraw(0); + continue; + } ch &= 0177; rch = ch; if (col == 0) { @@ -87,14 +85,10 @@ keyboard(void) display(0); break; case CTRL('l'): - sigprocmask(SIG_BLOCK, &set, NULL); wrefresh(curscr); - sigprocmask(SIG_UNBLOCK, &set, NULL); break; case CTRL('g'): - sigprocmask(SIG_BLOCK, &set, NULL); status(); - sigprocmask(SIG_UNBLOCK, &set, NULL); break; case '?': case 'H': diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c index b1fa09507915..449bbdce875d 100644 --- a/usr.bin/systat/main.c +++ b/usr.bin/systat/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.36 2004/07/03 18:31:36 mycroft Exp $ */ +/* $NetBSD: main.c,v 1.37 2004/07/03 18:54:47 mycroft Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: main.c,v 1.36 2004/07/03 18:31:36 mycroft Exp $"); +__RCSID("$NetBSD: main.c,v 1.37 2004/07/03 18:54:47 mycroft Exp $"); #endif /* not lint */ #include @@ -228,7 +228,6 @@ main(int argc, char **argv) dellave = 0.0; - signal(SIGALRM, display); display(0); noecho(); cbreak(); @@ -264,13 +263,8 @@ void display(int signo) { int j; - sigset_t set; struct mode *p; - sigemptyset(&set); - sigaddset(&set, SIGALRM); - sigprocmask(SIG_BLOCK, &set, NULL); - /* Get the load average over the last minute. */ (void)getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])); (*curmode->c_fetch)(); @@ -311,24 +305,16 @@ display(int signo) allcounter++; } - sigprocmask(SIG_UNBLOCK, &set, NULL); - alarm(naptime); + timeout(naptime * 1000); } void redraw(int signo) { - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGALRM); - sigprocmask(SIG_BLOCK, &set, NULL); - resizeterm(LINES, COLS); CMDLINE = LINES - 1; labels(); - sigprocmask(SIG_UNBLOCK, &set, NULL); display(0); }