=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/top.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- src/usr.bin/top/top.c 2009/07/18 06:12:41 1.67 +++ src/usr.bin/top/top.c 2009/12/10 13:16:02 1.68 @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.67 2009/07/18 06:12:41 jmc Exp $ */ +/* $OpenBSD: top.c,v 1.68 2009/12/10 13:16:02 tedu Exp $ */ /* * Top users/processes display for Unix @@ -83,6 +83,7 @@ int old_threads = No; int show_args = No; pid_t hlpid = -1; +int combine_cpus = 0; #if Default_TOPN == Infinity char topn_specified = No; @@ -116,6 +117,7 @@ #define CMD_grep 20 #define CMD_add 21 #define CMD_hl 22 +#define CMD_cpus 23 static void usage(void) @@ -123,7 +125,7 @@ extern char *__progname; fprintf(stderr, - "usage: %s [-bCIinqSTu] [-d count] [-g string] [-o field] " + "usage: %s [-1bCIinqSTu] [-d count] [-g string] [-o field] " "[-p pid] [-s time]\n\t[-U user] [number]\n", __progname); } @@ -134,12 +136,14 @@ char *endp; int i; - while ((i = getopt(ac, av, "STICbinqus:d:p:U:o:g:")) != -1) { + while ((i = getopt(ac, av, "1STICbinqus:d:p:U:o:g:")) != -1) { switch (i) { + case '1': + combine_cpus = 1; + break; case 'C': show_args = Yes; break; - case 'u': /* toggle uid/username display */ do_unames = !do_unames; break; @@ -516,7 +520,7 @@ int change, i; struct pollfd pfd[1]; uid_t uid; - static char command_chars[] = "\f qh?en#sdkriIuSopCTg+P"; + static char command_chars[] = "\f qh?en#sdkriIuSopCTg+P1"; /* * assume valid command unless told @@ -899,7 +903,11 @@ ps.command = NULL; /* grep */ hlpid = -1; break; - + case CMD_cpus: + combine_cpus = !combine_cpus; + max_topn = display_resize(); + reset_display(); + break; default: new_message(MT_standout, " BAD CASE IN SWITCH!"); putr();