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

Diff for /src/usr.bin/top/commands.c between version 1.29 and 1.30

version 1.29, 2010/03/23 16:16:09 version 1.30, 2010/04/01 05:05:19
Line 66 
Line 66 
 static char *  static char *
 next_field(char *str)  next_field(char *str)
 {  {
         if ((str = strchr(str, ' ')) == NULL)          char *spaces = " \t";
           size_t span;
   
           span = strcspn(str, spaces);
           if (span == strlen(str))
                 return (NULL);                  return (NULL);
   
         *str = '\0';          str += span;
         while (*++str == ' ')   /* loop */          *str++  = '\0';
                 ;  
   
         /* if there is nothing left of the string, return NULL */          while (strcspn(str, spaces) == 0)
         /* This fix is dedicated to Greg Earle */                  str++;
         return (*str == '\0' ? NULL : str);  
           if (*str == '\0')
                   return (NULL);
   
           return(str);
 }  }
   
 /*  /*
Line 266 
Line 273 
         int signum = SIGTERM, procnum;          int signum = SIGTERM, procnum;
         uid_t uid, puid;          uid_t uid, puid;
         char tempbuf[TEMPBUFSIZE];          char tempbuf[TEMPBUFSIZE];
         char *nptr;          char *nptr, *tmp;
   
           tmp = tempbuf;
   
         /* reset error array */          /* reset error array */
         ERR_RESET;          ERR_RESET;
   
Line 278 
Line 287 
         while (isspace(*str))          while (isspace(*str))
                 str++;                  str++;
   
         if (str[0] == '-') {          if (*str == '-') {
                   str++;
   
                 /* explicit signal specified */                  /* explicit signal specified */
                 if ((nptr = next_field(str)) == NULL)                  if ((nptr = next_field(str)) == NULL)
                         return (" kill: no processes specified");                          return (" kill: no processes specified");
   
                 if (isdigit(str[1])) {                  if (isdigit(*str)) {
                         (void) scan_arg(str + 1, &signum, nptr);                          (void) scan_arg(str, &signum, tmp);
                         if (signum <= 0 || signum >= NSIG)                          if (signum <= 0 || signum >= NSIG)
                                 return (" invalid signal number");                                  return (" invalid signal number");
                 } else {                  } else {
                         /* translate the name into a number */                          /* translate the name into a number */
                         for (signum = 0; signum < NSIG; signum++) {                          for (signum = 0; signum < NSIG; signum++) {
                                 if (strcasecmp(sys_signame[signum], str + 1) == 0)                                  if (strcasecmp(sys_signame[signum],
                                       str) == 0)
                                         break;                                          break;
                         }                          }
   

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30