First pass at updating top(1):
[dragonfly.git] / contrib / top / patches / top.c.patch
1 $DragonFly: src/contrib/top/patches/Attic/top.c.patch,v 1.1 2004/05/29 05:11:15 hmp Exp $
2 Index: contrib/top/top.c
3 ===================================================================
4 RCS file: /cvs/DragonFly/src/contrib/top/top.c,v
5 retrieving revision 1.2
6 diff -u -p -u -r1.2 top.c
7 --- contrib/top/top.c   17 Jun 2003 04:24:07 -0000      1.2
8 +++ contrib/top/top.c   29 May 2004 01:02:10 -0000
9 @@ -193,9 +193,9 @@ char *argv[];
10      fd_set readfds;
11  
12  #ifdef ORDER
13 -    static char command_chars[] = "\f qh?en#sdkriIuto";
14 +    static char command_chars[] = "\f qh?en#sdkriIutTSo";
15  #else
16 -    static char command_chars[] = "\f qh?en#sdkriIut";
17 +    static char command_chars[] = "\f qh?en#sdkriIutTS";
18  #endif
19  /* these defines enumerate the "strchr"s of the commands in command_chars */
20  #define CMD_redraw     0
21 @@ -215,8 +215,10 @@ char *argv[];
22  #define CMD_idletog2    13
23  #define CMD_user       14
24  #define CMD_selftog    15
25 +#define CMD_threads    16
26 +#define CMD_system     17
27  #ifdef ORDER
28 -#define CMD_order       16
29 +#define CMD_order       18
30  #endif
31  
32      /* set the buffer for stdout */
33 @@ -245,6 +247,7 @@ char *argv[];
34      ps.idle    = Yes;
35      ps.self    = -1;
36      ps.system  = No;
37 +    ps.threads = No;
38      ps.uid     = -1;
39      ps.command = NULL;
40  
41 @@ -271,7 +274,7 @@ char *argv[];
42             optind = 1;
43         }
44  
45 -       while ((i = getopt(ac, av, "SIbinquvs:d:U:o:t")) != EOF)
46 +       while ((i = getopt(ac, av, "SITNbinquvs:d:U:o:t")) != EOF)
47         {
48             switch(i)
49             {
50 @@ -300,6 +303,10 @@ char *argv[];
51               case 'I':                   /* show idle processes */
52                 ps.idle = !ps.idle;
53                 break;
54 +       
55 +             case 'T':
56 +               ps.threads = !ps.threads;       /* show threads */
57 +               break;
58  
59               case 'i':                 /* go interactive regardless */
60                 interactive = Yes;
61 @@ -928,6 +935,22 @@ restart:
62                                 putchar('\r');
63                                 break;
64  
65 +                           case CMD_threads:
66 +                               ps.threads = !ps.threads;
67 +                               new_message(MT_standout | MT_delayed,
68 +                                  " %sisplaying threads.",
69 +                                  ps.threads ? "D" : "Not d");
70 +                               putchar('\r');
71 +                               break;
72 +
73 +                           case CMD_system:
74 +                               ps.system = !ps.system;
75 +                               new_message(MT_standout | MT_delayed,
76 +                                  " %sisplaying system processes.",
77 +                                  ps.system ? "D" : "Not d");
78 +                               putchar('\r');
79 +                               break;
80 +
81                             case CMD_user:
82                                 new_message(MT_standout,
83                                     "Username to show: ");