[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.59 and 1.60

version 1.59, 2007/11/01 19:25:32 version 1.60, 2007/11/04 18:45:48
Line 75 
Line 75 
 char do_unames = Yes;  char do_unames = Yes;
 struct process_select ps;  struct process_select ps;
 char interactive = Maybe;  char interactive = Maybe;
 char warnings = 0;  
 double delay = Default_DELAY;  double delay = Default_DELAY;
 char *order_name = NULL;  char *order_name = NULL;
 int topn = Default_TOPN;  int topn = Default_TOPN;
Line 193 
Line 192 
                                 displays = i;                                  displays = i;
                                 break;                                  break;
                         }                          }
                         warnx("warning: display count should be positive "                          new_message(MT_delayed,
                               "warning: display count should be positive "
                             "-- option ignored");                              "-- option ignored");
                         warnings++;  
                         break;                          break;
   
                 case 's':                  case 's':
Line 204 
Line 203 
                         if (delay >= 0 && delay <= 1000000 && *endp == '\0')                          if (delay >= 0 && delay <= 1000000 && *endp == '\0')
                                 break;                                  break;
   
                         warnx("warning: delay should be a non-negative number"                          new_message(MT_delayed,
                               "warning: delay should be a non-negative number"
                             " -- using default");                              " -- using default");
                         delay = Default_DELAY;                          delay = Default_DELAY;
                         warnings++;  
                         break;                          break;
   
                 case 'q':       /* be quick about it */                  case 'q':       /* be quick about it */
Line 217 
Line 216 
                                 (void) nice(-20);                                  (void) nice(-20);
                                 break;                                  break;
                         }                          }
                         warnx("warning: `-q' option can only be used by root");                          new_message(MT_delayed,
                         warnings++;                              "warning: `-q' option can only be used by root");
                         break;                          break;
   
                 case 'o':       /* select sort order */                  case 'o':       /* select sort order */
Line 238 
Line 237 
         /* get count of top processes to display (if any) */          /* get count of top processes to display (if any) */
         if (optind < ac) {          if (optind < ac) {
                 if ((topn = atoiwi(av[optind])) == Invalid) {                  if ((topn = atoiwi(av[optind])) == Invalid) {
                         warnx("warning: process count should "                          new_message(MT_delayed,
                               "warning: process count should "
                             "be a non-negative number -- using default");                              "be a non-negative number -- using default");
                         warnings++;  
                         topn = Infinity;                          topn = Infinity;
                 }                  }
 #if Default_TOPN == Infinity  #if Default_TOPN == Infinity
Line 317 
Line 316 
         if (order_name != NULL) {          if (order_name != NULL) {
                 if ((order_index = string_index(order_name,                  if ((order_index = string_index(order_name,
                     statics.order_names)) == -1) {                      statics.order_names)) == -1) {
                         char **pp;                          char **pp, msg[80];
   
                         warnx("'%s' is not a recognized sorting order",                          snprintf(msg, sizeof(msg),
                               "'%s' is not a recognized sorting order",
                             order_name);                              order_name);
                         fprintf(stderr, "\tTry one of these:");                          strlcat(msg, ". Valid are:", sizeof(msg));
                         pp = statics.order_names;                          pp = statics.order_names;
                         while (*pp != NULL)                          while (*pp != NULL) {
                                 fprintf(stderr, " %s", *pp++);                                  strlcat(msg, " ", sizeof(msg));
                         fputc('\n', stderr);                                  strlcat(msg, *pp++, sizeof(msg));
                         exit(1);                          }
                           new_message(MT_delayed, msg);
                 }                  }
         }          }
   
Line 340 
Line 341 
         max_topn = display_init(&statics);          max_topn = display_init(&statics);
   
         /* print warning if user requested more processes than we can display */          /* print warning if user requested more processes than we can display */
         if (topn > max_topn) {          if (topn > max_topn)
                 warnx("warning: this terminal can only display %d processes",                  new_message(MT_delayed,
                       "warning: this terminal can only display %d processes",
                     max_topn);                      max_topn);
                 warnings++;  
         }  
         /* adjust for topn == Infinity */          /* adjust for topn == Infinity */
         if (topn == Infinity) {          if (topn == Infinity) {
                 /*                  /*
Line 393 
Line 393 
         if (smart_terminal)          if (smart_terminal)
                 (void) signal(SIGWINCH, sigwinch);                  (void) signal(SIGWINCH, sigwinch);
         sigprocmask(SIG_SETMASK, &oldmask, NULL);          sigprocmask(SIG_SETMASK, &oldmask, NULL);
         if (warnings) {  
                 fputs("....", stderr);  
                 fflush(stderr); /* why must I do this? */  
                 sleep((unsigned)(3 * warnings));  
                 fputc('\n', stderr);  
         }  
 restart:  restart:
   
         /*          /*

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60