[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.14 and 1.15

version 1.14, 2004/05/09 22:14:15 version 1.15, 2004/06/27 00:48:22
Line 156 
Line 156 
 #define ERRMAX 20  #define ERRMAX 20
   
 struct errs {                   /* structure for a system-call error */  struct errs {                   /* structure for a system-call error */
         int             errno;  /* value of errno (that is, the actual error) */          int             err;    /* value of errno (that is, the actual error) */
         char           *arg;    /* argument that caused the error */          char           *arg;    /* argument that caused the error */
 };  };
   
Line 173 
Line 173 
                 return(err_toomany); \                  return(err_toomany); \
         } else { \          } else { \
                 errs[errcnt].arg = (p); \                  errs[errcnt].arg = (p); \
                 errs[errcnt++].errno = (e); \                  errs[errcnt++].err = (e); \
         }          }
   
 #define STRMAX 80  #define STRMAX 80
Line 205 
Line 205 
         /* loop thru the sorted list, building an error string */          /* loop thru the sorted list, building an error string */
         while (cnt < errcnt) {          while (cnt < errcnt) {
                 errp = &(errs[cnt++]);                  errp = &(errs[cnt++]);
                 if (errp->errno != currerr) {                  if (errp->err != currerr) {
                         if (currerr != -1) {                          if (currerr != -1) {
                                 if (str_adderr(string, sizeof string, currerr) >                                  if (str_adderr(string, sizeof string, currerr) >
                                     sizeof string - 2)                                      sizeof string - 2)
Line 214 
Line 214 
                                 /* we know there's more */                                  /* we know there's more */
                                 (void) strlcat(string, "; ", sizeof string);                                  (void) strlcat(string, "; ", sizeof string);
                         }                          }
                         currerr = errp->errno;                          currerr = errp->err;
                         first = Yes;                          first = Yes;
                 }                  }
                 if (str_addarg(string, sizeof string, errp->arg, first) >=                  if (str_addarg(string, sizeof string, errp->arg, first) >=
Line 278 
Line 278 
         const struct errs *p2 = (struct errs *) e2;          const struct errs *p2 = (struct errs *) e2;
         int result;          int result;
   
         if ((result = p1->errno - p2->errno) == 0)          if ((result = p1->err - p2->err) == 0)
                 return (strcmp(p1->arg, p2->arg));                  return (strcmp(p1->arg, p2->arg));
         return (result);          return (result);
 }  }
Line 304 
Line 304 
         printf("%d error%s:\n\n", errcnt, errcnt == 1 ? "" : "s");          printf("%d error%s:\n\n", errcnt, errcnt == 1 ? "" : "s");
         while (cnt++ < errcnt) {          while (cnt++ < errcnt) {
                 printf("%5s: %s\n", errp->arg,                  printf("%5s: %s\n", errp->arg,
                     errp->errno == 0 ? "Not a number" : strerror(errp->errno));                      errp->err == 0 ? "Not a number" : strerror(errp->err));
                 errp++;                  errp++;
         }          }
 }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15