=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/commands.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- src/usr.bin/top/commands.c 2007/02/23 13:31:45 1.27 +++ src/usr.bin/top/commands.c 2007/05/29 00:56:56 1.28 @@ -1,4 +1,4 @@ -/* $OpenBSD: commands.c,v 1.27 2007/02/23 13:31:45 millert Exp $ */ +/* $OpenBSD: commands.c,v 1.28 2007/05/29 00:56:56 otto Exp $ */ /* * Top users/processes display for Unix @@ -60,46 +60,6 @@ static int err_compar(const void *, const void *); /* - * show_help() - display the help screen; invoked in response to - * either 'h' or '?'. - */ -void -show_help(void) -{ - printf("Top version %s, %s\n", version_string(), copyright); - puts("These single-character commands are available:\n" - "\n" - "h | ? - help; show this text\n" - "^L - redraw screen\n" - "q - quit"); - - /* not all commands are available with overstrike terminals */ - if (overstrike) { - puts("\n" - "Other commands are also available, but this terminal is not\n" - "sophisticated enough to handle those commands gracefully.\n"); - } else { - puts( - "+ - reset any g, p, or u filters\n" - "C - toggle the display of command line arguments\n" - "d count - show `count' displays, then exit\n" - "e - list errors generated by last \"kill\" or \"renice\" command\n" - "g string - filter on command name (g+ selects all commands)\n" - "I | i - toggle the display of idle processes\n" - "k [-sig] pid - send signal `-sig' to process `pid'\n" - "n|# count - show `count' processes\n" - "o field - specify sort order (size, res, cpu, time, pri)\n" - "p pid - display process by `pid' (p+ selects all processes)\n" - "r count pid - renice process `pid' to nice value `count'\n" - "S - toggle the display of system processes\n" - "s time - change delay between displays to `time' seconds\n" - "T - toggle the display of threads\n" - "u user - display processes for `user' (u+ selects all users)\n" - "\n"); - } -} - -/* * Utility routines that help with some of the commands. */ static char * @@ -151,13 +111,8 @@ #define ERRMAX 20 -struct errs { /* structure for a system-call error */ - int err; /* value of errno (that is, the actual error) */ - char *arg; /* argument that caused the error */ -}; - -static struct errs errs[ERRMAX]; -static int errcnt; +struct errs errs[ERRMAX]; +int errcnt; static char *err_toomany = " too many errors occurred"; static char *err_listem = " Many errors occurred. Press `e' to display the list of errors."; @@ -270,8 +225,8 @@ static int err_compar(const void *e1, const void *e2) { - const struct errs *p1 = (struct errs *) e1; - const struct errs *p2 = (struct errs *) e2; + const struct errs *p1 = (const struct errs *) e1; + const struct errs *p2 = (const struct errs *) e2; int result; if ((result = p1->err - p2->err) == 0) @@ -286,23 +241,6 @@ error_count(void) { return (errcnt); -} - -/* - * show_errors() - display on stdout the current log of errors. - */ -void -show_errors(void) -{ - struct errs *errp = errs; - int cnt = 0; - - printf("%d error%s:\n\n", errcnt, errcnt == 1 ? "" : "s"); - while (cnt++ < errcnt) { - printf("%5s: %s\n", errp->arg, - errp->err == 0 ? "Not a number" : strerror(errp->err)); - errp++; - } } /*