[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.7 and 1.8

version 1.7, 2003/04/06 20:39:20 version 1.8, 2003/06/12 22:30:23
Line 66 
Line 66 
  */   */
   
 void  void
 show_help()  show_help(void)
   
 {  {
     printf("Top version %s, %s\n", version_string(), copyright);      printf("Top version %s, %s\n", version_string(), copyright);
     fputs("\n\n\      fputs("\n\n\
Line 112 
Line 111 
  *  Utility routines that help with some of the commands.   *  Utility routines that help with some of the commands.
  */   */
   
 static char *next_field(str)  static char *
   next_field(char *str)
 char *str;  
   
 {  {
     if ((str = strchr(str, ' ')) == NULL)      if ((str = strchr(str, ' ')) == NULL)
     {      {
Line 126 
Line 123 
   
     /* if there is nothing left of the string, return NULL */      /* if there is nothing left of the string, return NULL */
     /* This fix is dedicated to Greg Earle */      /* This fix is dedicated to Greg Earle */
     return(*str == '\0' ? NULL : str);      return (*str == '\0' ? NULL : str);
 }  }
   
 static int scanint(str, intp)  static int scanint(char *str, int *intp)
   
 char *str;  
 int  *intp;  
   
 {  {
     int val = 0;      int val = 0;
     char ch;      char ch;
Line 208 
Line 201 
   
 #define STRMAX 80  #define STRMAX 80
   
 static char *err_string()  static char *
   err_string(void)
 {  {
     struct errs *errp;      struct errs *errp;
     int  cnt = 0;      int  cnt = 0;
Line 270 
Line 263 
  *      the string "str".   *      the string "str".
  */   */
   
 static size_t str_adderr(str, len, err)  static size_t
   str_adderr(char *str, size_t len, int err)
 char *str;  
 size_t len;  
 int err;  
   
 {  {
     char *msg;      char *msg;
     size_t msglen;      size_t msglen;
   
     msg = err == 0 ? "Not a number" : strerror(err);      msg = err == 0 ? "Not a number" : strerror(err);
   
     if ((msglen = strlcat(str, ": ", len)) >= len)      if ((msglen = strlcat(str, ": ", len)) >= len)
         return(msglen);          return(msglen);
   
     return(strlcat(str, msg, len));      return(strlcat(str, msg, len));
 }  }
   
Line 292 
Line 283 
  *      is set (indicating that a comma should NOT be added to the front).   *      is set (indicating that a comma should NOT be added to the front).
  */   */
   
 static size_t str_addarg(str, len, arg, first)  static size_t
   str_addarg(char *str, size_t len, char *arg, int first)
 char *str;  
 size_t len;  
 char *arg;  
 int  first;  
   
 {  {
     size_t msglen;      size_t msglen;
   
Line 307 
Line 293 
         if ((msglen = strlcat(str, ", ", len)) >= len)          if ((msglen = strlcat(str, ", ", len)) >= len)
             return(msglen);              return(msglen);
     }      }
     return(strlcat(str, arg, len));  
       return (strlcat(str, arg, len));
 }  }
   
 /*  /*
Line 315 
Line 302 
  *      for sorting errors.   *      for sorting errors.
  */   */
   
 static int err_compar(e1, e2)  static int
   err_compar(const void *e1, const void *e2)
 const void *e1, *e2;  
   
 {  {
     const struct errs *p1 = (struct errs *)e1;      const struct errs *p1 = (struct errs *)e1;
     const struct errs *p2 = (struct errs *)e2;      const struct errs *p2 = (struct errs *)e2;
Line 335 
Line 320 
  *  error_count() - return the number of errors currently logged.   *  error_count() - return the number of errors currently logged.
  */   */
   
 int error_count()  int
   error_count(void)
 {  {
     return(errcnt);      return(errcnt);
 }  }
Line 345 
Line 330 
  *  show_errors() - display on stdout the current log of errors.   *  show_errors() - display on stdout the current log of errors.
  */   */
   
 void show_errors()  void
   show_errors(void)
 {  {
     int cnt = 0;      int cnt = 0;
     struct errs *errp = errs;      struct errs *errp = errs;
Line 365 
Line 350 
  *              command does; invoked in response to 'k'.   *              command does; invoked in response to 'k'.
  */   */
   
 char *kill_procs(str)  char *
   kill_procs(char *str)
 char *str;  
   
 {  {
     char *nptr;      char *nptr;
     int signum = SIGTERM;       /* default */      int signum = SIGTERM;       /* default */
Line 455 
Line 438 
  *              "renice" command does; invoked in response to 'r'.   *              "renice" command does; invoked in response to 'r'.
  */   */
   
 char *renice_procs(str)  char *
   renice_procs(char *str)
 char *str;  
   
 {  {
     char negate;      char negate;
     int prio;      int prio;
Line 520 
Line 501 
     /* return appropriate error string */      /* return appropriate error string */
     return(err_string());      return(err_string());
 }  }
   

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8