=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/commands.c,v retrieving revision 1.7 retrieving revision 1.8 diff -c -r1.7 -r1.8 *** src/usr.bin/top/commands.c 2003/04/06 20:39:20 1.7 --- src/usr.bin/top/commands.c 2003/06/12 22:30:23 1.8 *************** *** 1,4 **** ! /* $OpenBSD: commands.c,v 1.7 2003/04/06 20:39:20 tdeval Exp $ */ /* * Top users/processes display for Unix --- 1,4 ---- ! /* $OpenBSD: commands.c,v 1.8 2003/06/12 22:30:23 pvalchev Exp $ */ /* * Top users/processes display for Unix *************** *** 66,73 **** */ void ! show_help() ! { printf("Top version %s, %s\n", version_string(), copyright); fputs("\n\n\ --- 66,72 ---- */ void ! show_help(void) { printf("Top version %s, %s\n", version_string(), copyright); fputs("\n\n\ *************** *** 112,121 **** * Utility routines that help with some of the commands. */ ! static char *next_field(str) ! ! char *str; ! { if ((str = strchr(str, ' ')) == NULL) { --- 111,118 ---- * Utility routines that help with some of the commands. */ ! static char * ! next_field(char *str) { if ((str = strchr(str, ' ')) == NULL) { *************** *** 126,139 **** /* if there is nothing left of the string, return NULL */ /* This fix is dedicated to Greg Earle */ ! return(*str == '\0' ? NULL : str); } ! static int scanint(str, intp) ! ! char *str; ! int *intp; ! { int val = 0; char ch; --- 123,132 ---- /* if there is nothing left of the string, return NULL */ /* This fix is dedicated to Greg Earle */ ! return (*str == '\0' ? NULL : str); } ! static int scanint(char *str, int *intp) { int val = 0; char ch; *************** *** 208,215 **** #define STRMAX 80 ! static char *err_string() ! { struct errs *errp; int cnt = 0; --- 201,208 ---- #define STRMAX 80 ! static char * ! err_string(void) { struct errs *errp; int cnt = 0; *************** *** 270,288 **** * the string "str". */ ! static size_t str_adderr(str, len, err) ! ! char *str; ! size_t len; ! int err; ! { char *msg; size_t msglen; msg = err == 0 ? "Not a number" : strerror(err); if ((msglen = strlcat(str, ": ", len)) >= len) return(msglen); return(strlcat(str, msg, len)); } --- 263,279 ---- * the string "str". */ ! static size_t ! str_adderr(char *str, size_t len, int err) { char *msg; size_t msglen; msg = err == 0 ? "Not a number" : strerror(err); + if ((msglen = strlcat(str, ": ", len)) >= len) return(msglen); + return(strlcat(str, msg, len)); } *************** *** 292,304 **** * is set (indicating that a comma should NOT be added to the front). */ ! static size_t str_addarg(str, len, arg, first) ! ! char *str; ! size_t len; ! char *arg; ! int first; ! { size_t msglen; --- 283,290 ---- * is set (indicating that a comma should NOT be added to the front). */ ! static size_t ! str_addarg(char *str, size_t len, char *arg, int first) { size_t msglen; *************** *** 307,313 **** if ((msglen = strlcat(str, ", ", len)) >= len) return(msglen); } ! return(strlcat(str, arg, len)); } /* --- 293,300 ---- if ((msglen = strlcat(str, ", ", len)) >= len) return(msglen); } ! ! return (strlcat(str, arg, len)); } /* *************** *** 315,324 **** * for sorting errors. */ ! static int err_compar(e1, e2) ! ! const void *e1, *e2; ! { const struct errs *p1 = (struct errs *)e1; const struct errs *p2 = (struct errs *)e2; --- 302,309 ---- * for sorting errors. */ ! static int ! err_compar(const void *e1, const void *e2) { const struct errs *p1 = (struct errs *)e1; const struct errs *p2 = (struct errs *)e2; *************** *** 335,342 **** * error_count() - return the number of errors currently logged. */ ! int error_count() ! { return(errcnt); } --- 320,327 ---- * error_count() - return the number of errors currently logged. */ ! int ! error_count(void) { return(errcnt); } *************** *** 345,352 **** * show_errors() - display on stdout the current log of errors. */ ! void show_errors() ! { int cnt = 0; struct errs *errp = errs; --- 330,337 ---- * show_errors() - display on stdout the current log of errors. */ ! void ! show_errors(void) { int cnt = 0; struct errs *errp = errs; *************** *** 365,374 **** * command does; invoked in response to 'k'. */ ! char *kill_procs(str) ! ! char *str; ! { char *nptr; int signum = SIGTERM; /* default */ --- 350,357 ---- * command does; invoked in response to 'k'. */ ! char * ! kill_procs(char *str) { char *nptr; int signum = SIGTERM; /* default */ *************** *** 455,464 **** * "renice" command does; invoked in response to 'r'. */ ! char *renice_procs(str) ! ! char *str; ! { char negate; int prio; --- 438,445 ---- * "renice" command does; invoked in response to 'r'. */ ! char * ! renice_procs(char *str) { char negate; int prio; *************** *** 520,523 **** /* return appropriate error string */ return(err_string()); } - --- 501,503 ----