[BACK]Return to top.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / top

Diff for /src/usr.bin/top/top.c between version 1.77 and 1.78

version 1.77, 2012/04/20 16:36:11 version 1.78, 2012/06/05 18:52:53
Line 126 
Line 126 
   
         fprintf(stderr,          fprintf(stderr,
             "usage: %s [-1bCHIinqSu] [-d count] [-g string] [-o field] "              "usage: %s [-1bCHIinqSu] [-d count] [-g string] [-o field] "
             "[-p pid] [-s time]\n\t[-U user] [number]\n",              "[-p pid] [-s time]\n\t[-U [-]user] [number]\n",
             __progname);              __progname);
 }  }
   
Line 149 
Line 149 
                         break;                          break;
   
                 case 'U':       /* display only username's processes */                  case 'U':       /* display only username's processes */
                         if ((ps.uid = userid(optarg)) == (uid_t)-1)                          if (optarg[0] == '-') {
                                   if ((ps.huid = userid(optarg+1)) == (uid_t)-1)
                                           new_message(MT_delayed, "%s: unknown user",
                                               optarg);
                           } else if ((ps.uid = userid(optarg)) == (uid_t)-1)
                                 new_message(MT_delayed, "%s: unknown user",                                  new_message(MT_delayed, "%s: unknown user",
                                     optarg);                                      optarg);
                         break;                          break;
Line 282 
Line 286 
         ps.idle = Yes;          ps.idle = Yes;
         ps.system = No;          ps.system = No;
         ps.uid = (uid_t)-1;          ps.uid = (uid_t)-1;
           ps.huid = (uid_t)-1;
         ps.pid = (pid_t)-1;          ps.pid = (pid_t)-1;
         ps.command = NULL;          ps.command = NULL;
   
Line 540 
Line 545 
         char ch, *iptr;          char ch, *iptr;
         int change, i;          int change, i;
         struct pollfd pfd[1];          struct pollfd pfd[1];
         uid_t uid;          uid_t uid, huid;
         static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P1";          static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P1";
   
         /*          /*
Line 774 
Line 779 
                         new_message(MT_standout,                          new_message(MT_standout,
                             "Username to show: ");                              "Username to show: ");
                         if (readline(tempbuf, sizeof(tempbuf)) > 0) {                          if (readline(tempbuf, sizeof(tempbuf)) > 0) {
                                 if (tempbuf[0] == '+' &&                                  if ((tempbuf[0] == '+' || tempbuf[0] == '-') &&
                                     tempbuf[1] == '\0') {                                      tempbuf[1] == '\0') {
                                         ps.uid = (uid_t)-1;                                          ps.uid = (uid_t)-1;
                                           ps.huid = (uid_t)-1;
                                   } else if (tempbuf[0] == '-') {
                                           if ((huid = userid(tempbuf+1)) == (uid_t)-1) {
                                                   new_message(MT_standout,
                                                       " %s: unknown user", tempbuf+1);
                                                   no_command = Yes;
                                           } else {
                                                   ps.huid = huid;
                                                   ps.uid = (uid_t)-1;
                                           }
                                 } else if ((uid = userid(tempbuf)) == (uid_t)-1) {                                  } else if ((uid = userid(tempbuf)) == (uid_t)-1) {
                                         new_message(MT_standout,                                                  new_message(MT_standout,
                                             " %s: unknown user", tempbuf);                                                      " %s: unknown user", tempbuf);
                                         no_command = Yes;                                                  no_command = Yes;
                                 } else                                  } else {
                                         ps.uid = uid;                                          ps.uid = uid;
                                           ps.huid = (uid_t)-1;
                                   }
                                 putr();                                  putr();
                         } else                          } else
                                 clear_message();                                  clear_message();
Line 899 
Line 916 
   
                 case CMD_add:                  case CMD_add:
                         ps.uid = (uid_t)-1;     /* uid */                          ps.uid = (uid_t)-1;     /* uid */
                           ps.huid = (uid_t)-1;
                         ps.pid = (pid_t)-1;     /* pid */                          ps.pid = (pid_t)-1;     /* pid */
                         ps.system = old_system;                          ps.system = old_system;
                         ps.command = NULL;      /* grep */                          ps.command = NULL;      /* grep */

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78