summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/top/commands.c72
-rw-r--r--usr.bin/top/display.c173
-rw-r--r--usr.bin/top/display.h4
-rw-r--r--usr.bin/top/machine.c51
-rw-r--r--usr.bin/top/screen.c47
-rw-r--r--usr.bin/top/top.c43
-rw-r--r--usr.bin/top/username.c33
-rw-r--r--usr.bin/top/utils.c69
-rw-r--r--usr.bin/top/version.c6
9 files changed, 171 insertions, 327 deletions
diff --git a/usr.bin/top/commands.c b/usr.bin/top/commands.c
index 3b58e4b308b..b587a022c15 100644
--- a/usr.bin/top/commands.c
+++ b/usr.bin/top/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.7 2003/04/06 20:39:20 tdeval Exp $ */
+/* $OpenBSD: commands.c,v 1.8 2003/06/12 22:30:23 pvalchev Exp $ */
/*
* Top users/processes display for Unix
@@ -66,8 +66,7 @@ static int err_compar(const void *, const void *);
*/
void
-show_help()
-
+show_help(void)
{
printf("Top version %s, %s\n", version_string(), copyright);
fputs("\n\n\
@@ -112,10 +111,8 @@ u - display processes for only one user (+ selects all users)\n\
* Utility routines that help with some of the commands.
*/
-static char *next_field(str)
-
-char *str;
-
+static char *
+next_field(char *str)
{
if ((str = strchr(str, ' ')) == NULL)
{
@@ -126,14 +123,10 @@ char *str;
/* if there is nothing left of the string, return NULL */
/* This fix is dedicated to Greg Earle */
- return(*str == '\0' ? NULL : str);
+ return (*str == '\0' ? NULL : str);
}
-static int scanint(str, intp)
-
-char *str;
-int *intp;
-
+static int scanint(char *str, int *intp)
{
int val = 0;
char ch;
@@ -208,8 +201,8 @@ static char *err_listem =
#define STRMAX 80
-static char *err_string()
-
+static char *
+err_string(void)
{
struct errs *errp;
int cnt = 0;
@@ -270,19 +263,17 @@ static char *err_string()
* the string "str".
*/
-static size_t str_adderr(str, len, err)
-
-char *str;
-size_t len;
-int err;
-
+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,13 +283,8 @@ int err;
* 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;
-
+static size_t
+str_addarg(char *str, size_t len, char *arg, int first)
{
size_t msglen;
@@ -307,7 +293,8 @@ int first;
if ((msglen = strlcat(str, ", ", len)) >= len)
return(msglen);
}
- return(strlcat(str, arg, len));
+
+ return (strlcat(str, arg, len));
}
/*
@@ -315,10 +302,8 @@ int first;
* for sorting errors.
*/
-static int err_compar(e1, e2)
-
-const void *e1, *e2;
-
+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,8 +320,8 @@ const void *e1, *e2;
* error_count() - return the number of errors currently logged.
*/
-int error_count()
-
+int
+error_count(void)
{
return(errcnt);
}
@@ -345,8 +330,8 @@ int error_count()
* show_errors() - display on stdout the current log of errors.
*/
-void show_errors()
-
+void
+show_errors(void)
{
int cnt = 0;
struct errs *errp = errs;
@@ -365,10 +350,8 @@ void show_errors()
* command does; invoked in response to 'k'.
*/
-char *kill_procs(str)
-
-char *str;
-
+char *
+kill_procs(char *str)
{
char *nptr;
int signum = SIGTERM; /* default */
@@ -455,10 +438,8 @@ char *str;
* "renice" command does; invoked in response to 'r'.
*/
-char *renice_procs(str)
-
-char *str;
-
+char *
+renice_procs(char *str)
{
char negate;
int prio;
@@ -520,4 +501,3 @@ char *str;
/* return appropriate error string */
return(err_string());
}
-
diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c
index 360d5aec8bf..a1adf0f81fb 100644
--- a/usr.bin/top/display.c
+++ b/usr.bin/top/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.11 2002/07/15 17:20:36 deraadt Exp $ */
+/* $OpenBSD: display.c,v 1.12 2003/06/12 22:30:23 pvalchev Exp $ */
/*
* Top users/processes display for Unix
@@ -105,8 +105,8 @@ static int string_count();
static void summary_format();
static void line_update();
-int display_resize()
-
+int
+display_resize(void)
{
int display_lines;
@@ -142,10 +142,8 @@ int display_resize()
return(smart_terminal ? display_lines : Largest);
}
-int display_init(statics)
-
-struct statics *statics;
-
+int
+display_init(struct statics *statics)
{
int display_lines;
char **pp;
@@ -190,11 +188,8 @@ struct statics *statics;
return(display_lines);
}
-void i_loadave(mpid, avenrun)
-
-pid_t mpid;
-double *avenrun;
-
+void
+i_loadave(pid_t mpid, double *avenrun)
{
int i;
@@ -218,11 +213,8 @@ double *avenrun;
lmpid = mpid;
}
-void u_loadave(mpid, avenrun)
-
-pid_t mpid;
-double *avenrun;
-
+void
+u_loadave(pid_t mpid, double *avenrun)
{
int i;
@@ -257,10 +249,8 @@ double *avenrun;
}
}
-void i_timeofday(tod)
-
-time_t *tod;
-
+void
+i_timeofday(time_t *tod)
{
/*
* Display the current time.
@@ -304,11 +294,8 @@ static char procstates_buffer[128];
* lastline is valid
*/
-void i_procstates(total, brkdn)
-
-int total;
-int *brkdn;
-
+void
+i_procstates(int total, int *brkdn)
{
int i;
@@ -333,11 +320,8 @@ int *brkdn;
memcpy(lprocstates, brkdn, num_procstates * sizeof(int));
}
-void u_procstates(total, brkdn)
-
-int total;
-int *brkdn;
-
+void
+u_procstates(int total, int *brkdn)
{
static char new[128];
int i;
@@ -393,8 +377,8 @@ static int cpustates_column;
/* cpustates_tag() calculates the correct tag to use to label the line */
-static char *cpustates_tag()
-
+static char *
+cpustates_tag(void)
{
char *use;
@@ -417,10 +401,8 @@ static char *cpustates_tag()
return(use);
}
-void i_cpustates(states)
-
-int *states;
-
+void
+i_cpustates(int *states)
{
int i = 0;
int value;
@@ -451,10 +433,8 @@ int *states;
memcpy(lcpustates, states, num_cpustates * sizeof(int));
}
-void u_cpustates(states)
-
-int *states;
-
+void
+u_cpustates(int *states)
{
int value;
char **names = cpustate_names;
@@ -498,8 +478,8 @@ int *states;
}
}
-void z_cpustates()
-
+void
+z_cpustates(void)
{
int i = 0;
char **names = cpustate_names;
@@ -536,10 +516,8 @@ void z_cpustates()
static char memory_buffer[MAX_COLS];
-void i_memory(stats)
-
-int *stats;
-
+void
+i_memory(int *stats)
{
if (fputs("\nMemory: ", stdout) == EOF)
exit(1);
@@ -551,10 +529,8 @@ int *stats;
exit(1);
}
-void u_memory(stats)
-
-int *stats;
-
+void
+u_memory(int *stats)
{
static char new[MAX_COLS];
@@ -582,8 +558,8 @@ static int msglen = 0;
/* Invariant: msglen is always the length of the message currently displayed
on the screen (even when next_msg doesn't contain that message). */
-void i_message()
-
+void
+i_message(void)
{
while (lastline < y_message)
{
@@ -604,8 +580,8 @@ void i_message()
}
}
-void u_message()
-
+void
+u_message(void)
{
i_message();
}
@@ -618,10 +594,8 @@ static int header_length;
* Assumptions: cursor is on the previous line and lastline is consistent
*/
-void i_header(text)
-
-char *text;
-
+void
+i_header(char *text)
{
header_length = strlen(text);
if (header_status == ON)
@@ -639,10 +613,8 @@ char *text;
}
/*ARGSUSED*/
-void u_header(text)
-
-char *text; /* ignored */
-
+void
+u_header(char *text)
{
if (header_status == ERASE)
{
@@ -660,11 +632,8 @@ char *text; /* ignored */
* Assumptions: lastline is consistent
*/
-void i_process(line, thisline)
-
-int line;
-char *thisline;
-
+void
+i_process(int line, char *thisline)
{
char *p;
char *base;
@@ -692,11 +661,8 @@ char *thisline;
memset(p, 0, display_width - (p - base));
}
-void u_process(linenum, linebuf)
-
-int linenum;
-char *linebuf;
-
+void
+u_process(int linenum, char *linebuf)
{
char *optr;
int screen_line = linenum + Header_lines;
@@ -741,10 +707,8 @@ char *linebuf;
}
}
-void u_endscreen(hi)
-
-int hi;
-
+void
+u_endscreen(int hi)
{
int screen_line = hi + Header_lines;
int i;
@@ -804,10 +768,8 @@ int hi;
}
}
-void display_header(t)
-
-int t;
-
+void
+display_header(int t)
{
if (t)
{
@@ -820,12 +782,8 @@ int t;
}
/*VARARGS2*/
-void new_message(type, msgfmt, a1, a2, a3)
-
-int type;
-char *msgfmt;
-caddr_t a1, a2, a3;
-
+void
+new_message(int type, char *msgfmt, caddr_t a1, caddr_t a2, caddr_t a3)
{
int i;
@@ -869,8 +827,8 @@ caddr_t a1, a2, a3;
}
}
-void clear_message()
-
+void
+clear_message(void)
{
if (clear_eol(msglen) == 1)
{
@@ -879,12 +837,8 @@ void clear_message()
}
}
-int readline(buffer, size, numeric)
-
-char *buffer;
-int size;
-int numeric;
-
+int
+readline(char *buffer, int size, int numeric)
{
char *ptr = buffer;
char ch;
@@ -972,10 +926,8 @@ int numeric;
/* internal support routines */
-static int string_count(pp)
-
-char **pp;
-
+static int
+string_count(char **pp)
{
int cnt;
@@ -987,12 +939,8 @@ char **pp;
return(cnt);
}
-static void summary_format(str, numbers, names)
-
-char *str;
-int *numbers;
-char **names;
-
+static void
+summary_format(char *str, int *numbers, char **names)
{
char *p;
int num;
@@ -1038,13 +986,8 @@ char **names;
}
}
-static void line_update(old, new, start, line)
-
-char *old;
-char *new;
-int start;
-int line;
-
+static void
+line_update(char *old, char *new, int start, int line)
{
int ch;
int diff;
@@ -1168,10 +1111,8 @@ int line;
* to the original buffer is returned.
*/
-char *printable(str)
-
-char *str;
-
+char *
+printable(char *str)
{
char *ptr;
char ch;
diff --git a/usr.bin/top/display.h b/usr.bin/top/display.h
index e23b80397c6..5900f59e314 100644
--- a/usr.bin/top/display.h
+++ b/usr.bin/top/display.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.h,v 1.4 2002/07/15 17:20:36 deraadt Exp $ */
+/* $OpenBSD: display.h,v 1.5 2003/06/12 22:30:23 pvalchev Exp $ */
/*
* Top users/processes display for Unix
@@ -55,7 +55,7 @@ extern void i_process(int, char *);
extern void u_process(int, char *);
extern void u_endscreen(int);
extern void display_header(int);
-extern void new_message(); /* XXX */
+extern void new_message(); /* XXX */
extern void clear_message(void);
extern int readline(char *, int, int);
extern char *printable(char *);
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index 26f29f9537a..6dd238e7483 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machine.c,v 1.28 2002/07/02 03:05:47 tholo Exp $ */
+/* $OpenBSD: machine.c,v 1.29 2003/06/12 22:30:23 pvalchev Exp $ */
/*-
* Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
@@ -170,7 +170,7 @@ static int pageshift; /* log base 2 of the pagesize */
int maxslp;
int
-getstathz()
+getstathz(void)
{
struct clockinfo cinf;
size_t size = sizeof(cinf);
@@ -184,8 +184,7 @@ getstathz()
}
int
-machine_init(statics)
- struct statics *statics;
+machine_init(struct statics *statics)
{
int pagesize;
@@ -221,8 +220,7 @@ machine_init(statics)
}
char *
-format_header(uname_field)
- char *uname_field;
+format_header(char *uname_field)
{
char *ptr;
@@ -293,9 +291,7 @@ get_system_info(si)
static struct handle handle;
struct kinfo_proc *
-getprocs(op, arg, cnt)
- int op, arg;
- int *cnt;
+getprocs(int op, int arg, int *cnt)
{
size_t size = sizeof(int);
int mib[4] = {CTL_KERN, KERN_PROC, op, arg};
@@ -336,11 +332,8 @@ getprocs(op, arg, cnt)
}
caddr_t
-get_process_info(si, sel, compare)
- struct system_info *si;
- struct process_select *sel;
- int (*compare)(const void *, const void *);
-
+get_process_info(struct system_info *si, struct process_select *sel,
+ int (*compare)(const void *, const void *))
{
int show_idle, show_system, show_uid, show_command;
int total_procs, active_procs, i;
@@ -409,10 +402,7 @@ get_process_info(si, sel, compare)
char fmt[MAX_COLS]; /* static area where result is built */
char *
-format_next_process(handle, get_userid)
- caddr_t handle;
- char *(*get_userid)();
-
+format_next_process(caddr_t handle, char *(*get_userid)())
{
char waddr[sizeof(void *) * 2 + 3]; /* Hexify void pointer */
struct kinfo_proc *pp;
@@ -520,8 +510,7 @@ static unsigned char sorted_state[] =
/* compare_cpu - the comparison function for sorting by cpu percentage */
int
-compare_cpu(v1, v2)
- const void *v1, *v2;
+compare_cpu(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
struct proc **pp2 = (struct proc **) v2;
@@ -546,8 +535,7 @@ compare_cpu(v1, v2)
/* compare_size - the comparison function for sorting by total memory usage */
int
-compare_size(v1, v2)
- const void *v1, *v2;
+compare_size(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
struct proc **pp2 = (struct proc **) v2;
@@ -572,8 +560,7 @@ compare_size(v1, v2)
/* compare_res - the comparison function for sorting by resident set size */
int
-compare_res(v1, v2)
- const void *v1, *v2;
+compare_res(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
struct proc **pp2 = (struct proc **) v2;
@@ -598,8 +585,7 @@ compare_res(v1, v2)
/* compare_time - the comparison function for sorting by CPU time */
int
-compare_time(v1, v2)
- const void *v1, *v2;
+compare_time(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
struct proc **pp2 = (struct proc **) v2;
@@ -624,8 +610,7 @@ compare_time(v1, v2)
/* compare_prio - the comparison function for sorting by CPU time */
int
-compare_prio(v1, v2)
- const void *v1, *v2;
+compare_prio(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
struct proc **pp2 = (struct proc **) v2;
@@ -668,8 +653,7 @@ int (*proc_compares[]) () = {
* reflects this ordering.
*/
int
-proc_compare(v1, v2)
- const void *v1, *v2;
+proc_compare(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
struct proc **pp2 = (struct proc **) v2;
@@ -720,8 +704,7 @@ proc_compare(v1, v2)
* and "renice" commands.
*/
int
-proc_owner(pid)
- pid_t pid;
+proc_owner(pid_t pid)
{
struct kinfo_proc **prefp, *pp;
int cnt;
@@ -742,9 +725,7 @@ proc_owner(pid)
* to be based on the new swapctl(2) system call.
*/
static int
-swapmode(used, total)
- int *used;
- int *total;
+swapmode(int *used, int *total)
{
int nswap, rnswap, i;
struct swapent *swdev;
diff --git a/usr.bin/top/screen.c b/usr.bin/top/screen.c
index ad3da6f715a..c1f33f09d4f 100644
--- a/usr.bin/top/screen.c
+++ b/usr.bin/top/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.8 2002/07/15 17:20:36 deraadt Exp $ */
+/* $OpenBSD: screen.c,v 1.9 2003/06/12 22:30:23 pvalchev Exp $ */
/*
* Top users/processes display for Unix
@@ -77,10 +77,8 @@ static struct termios new_settings;
static char is_a_terminal = No;
-void init_termcap(interactive)
-
-int interactive;
-
+void
+init_termcap(int interactive)
{
char *bufptr;
char *PCptr;
@@ -201,8 +199,8 @@ int interactive;
}
}
-void init_screen()
-
+void
+init_screen(void)
{
/* get the old settings for safe keeping */
if (tcgetattr(STDOUT_FILENO, &old_settings) != -1)
@@ -235,8 +233,8 @@ void init_screen()
}
}
-void end_screen()
-
+void
+end_screen(void)
{
/* move to the lower left, clear the line and send "te" */
if (smart_terminal)
@@ -254,8 +252,8 @@ void end_screen()
}
}
-void reinit_screen()
-
+void
+reinit_screen(void)
{
/* install our settings if it is a terminal */
if (is_a_terminal)
@@ -270,8 +268,8 @@ void reinit_screen()
}
}
-void get_screensize()
-
+void
+get_screensize(void)
{
struct winsize ws;
@@ -292,10 +290,8 @@ void get_screensize()
lower_left[sizeof(lower_left) -1] = 0;
}
-void standout(msg)
-
-char *msg;
-
+void
+standout(char *msg)
{
if (smart_terminal)
{
@@ -320,10 +316,8 @@ void clear()
}
}
-int clear_eol(len)
-
-int len;
-
+int
+clear_eol(int len)
{
if (smart_terminal && !overstrike && len > 0)
{
@@ -345,8 +339,8 @@ int len;
return(-1);
}
-void go_home()
-
+void
+go_home(void)
{
if (smart_terminal)
{
@@ -356,10 +350,8 @@ void go_home()
/* This has to be defined as a subroutine for tputs (instead of a macro) */
-int putstdout(ch)
-
-int ch;
-
+int
+putstdout(int ch)
{
int ret;
@@ -368,4 +360,3 @@ int ch;
exit(1);
return (ret);
}
-
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index 9516070885b..2b1ceddffe0 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: top.c,v 1.18 2002/07/15 17:20:36 deraadt Exp $ */
+/* $OpenBSD: top.c,v 1.19 2003/06/12 22:30:23 pvalchev Exp $ */
const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre";
@@ -116,11 +116,8 @@ void (*d_header)() = i_header;
void (*d_process)() = i_process;
-int main(argc, argv)
-
-int argc;
-char *argv[];
-
+int
+main(int argc, char *argv[])
{
int i;
int active_procs;
@@ -953,8 +950,8 @@ restart:
* screen will get redrawn.
*/
-static void reset_display()
-
+static void
+reset_display(void)
{
d_loadave = i_loadave;
d_procstates = i_procstates;
@@ -969,46 +966,36 @@ static void reset_display()
* signal handlers
*/
-void leave(unused) /* exit under normal conditions -- INT handler */
-
-int unused;
-
+void
+leave(int unused) /* exit under normal conditions -- INT handler */
{
leaveflag = 1;
}
-void tstop(i) /* SIGTSTP handler */
-
-int i;
-
+void
+tstop(int i) /* SIGTSTP handler */
{
tstopflag = 1;
}
#ifdef SIGWINCH
-void winch(i) /* SIGWINCH handler */
-
-int i;
-
+void
+winch(int i) /* SIGWINCH handler */
{
winchflag = 1;
}
#endif
-void quit(status) /* exit under duress */
-
-int status;
-
+void
+quit(int status) /* exit under duress */
{
end_screen();
exit(status);
/*NOTREACHED*/
}
-void onalrm(unused) /* SIGALRM handler */
-
-int unused;
-
+void
+onalrm(int unused) /* SIGALRM handler */
{
/* this is only used in batch mode to break out of the pause() */
/* return; */
diff --git a/usr.bin/top/username.c b/usr.bin/top/username.c
index 9a11dfe44d0..6cd4bd9793b 100644
--- a/usr.bin/top/username.c
+++ b/usr.bin/top/username.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: username.c,v 1.7 2002/07/15 17:20:36 deraadt Exp $ */
+/* $OpenBSD: username.c,v 1.8 2003/06/12 22:30:23 pvalchev Exp $ */
/*
* Top users/processes display for Unix
@@ -75,8 +75,8 @@ static int get_user(uid_t);
/* We depend on that for hash_table and YOUR compiler had BETTER do it! */
struct hash_el hash_table[Table_size];
-void init_hash()
-
+void
+init_hash(void)
{
/*
* There used to be some steps we had to take to initialize things.
@@ -85,10 +85,8 @@ void init_hash()
*/
}
-char *username(uid)
-
-uid_t uid;
-
+char *
+username(uid_t uid)
{
int hashindex;
@@ -101,10 +99,8 @@ uid_t uid;
return(hash_table[hashindex].name);
}
-uid_t userid(username)
-
-char *username;
-
+uid_t
+userid(char *username)
{
struct passwd *pwd;
@@ -124,12 +120,9 @@ char *username;
return(pwd->pw_uid);
}
-static int enter_user(uid, name, wecare)
-
-uid_t uid;
-char *name;
-int wecare; /* 1 = enter it always, 0 = nice to have */
-
+/* wecare: 1 = enter it always, 0 = nice to have */
+static int
+enter_user(uid_t uid, char *name, int wecare)
{
int hashindex;
@@ -161,10 +154,8 @@ int wecare; /* 1 = enter it always, 0 = nice to have */
* and cache any entries we pass over while looking.
*/
-static int get_user(uid)
-
-uid_t uid;
-
+static int
+get_user(uid_t uid)
{
struct passwd *pwd;
diff --git a/usr.bin/top/utils.c b/usr.bin/top/utils.c
index beef9df2894..86184e80fd6 100644
--- a/usr.bin/top/utils.c
+++ b/usr.bin/top/utils.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utils.c,v 1.8 2003/04/25 23:58:36 deraadt Exp $ */
+/* $OpenBSD: utils.c,v 1.9 2003/06/12 22:30:23 pvalchev Exp $ */
/*
* Top users/processes display for Unix
@@ -40,10 +40,8 @@
#include "top.h"
-int atoiwi(str)
-
-char *str;
-
+int
+atoiwi(char *str)
{
int len;
@@ -81,10 +79,8 @@ char *str;
* digits.
*/
-char *itoa(val)
-
-int val;
-
+char *
+itoa(int val)
{
char *ptr;
static char buffer[16]; /* result is built here */
@@ -112,10 +108,8 @@ int val;
* a front end to a more general routine for efficiency.
*/
-char *itoa7(val)
-
-int val;
-
+char *
+itoa7(int val)
{
char *ptr;
static char buffer[25]; /* result is built here */
@@ -143,10 +137,8 @@ int val;
* positive numbers. If val <= 0 then digits(val) == 0.
*/
-int digits(val)
-
-int val;
-
+int
+digits(int val)
{
int cnt = 0;
@@ -163,11 +155,8 @@ int val;
* to the END of the string "to".
*/
-char *strecpy(to, from)
-
-char *to;
-char *from;
-
+char *
+strecpy(char *to, char *from)
{
while ((*to++ = *from++) != '\0');
return(--to);
@@ -177,11 +166,8 @@ char *from;
* string_index(string, array) - find string in array and return index
*/
-int string_index(string, array)
-
-char *string;
-char **array;
-
+int
+string_index(char *string, char **array)
{
int i = 0;
@@ -204,11 +190,8 @@ char **array;
* squat about quotes.
*/
-char **argparse(line, cntp)
-
-char *line;
-int *cntp;
-
+char **
+argparse(char *line, int *cntp)
{
char *from;
char *to;
@@ -289,14 +272,8 @@ int *cntp;
* useful on BSD mchines for calculating cpu state percentages.
*/
-int percentages(cnt, out, new, old, diffs)
-
-int cnt;
-int *out;
-long *new;
-long *old;
-long *diffs;
-
+int
+percentages(int cnt, int *out, long *new, long *old, long *diffs)
{
int i;
long change;
@@ -353,10 +330,8 @@ long *diffs;
exceed 9999.9, we use "???".
*/
-char *format_time(seconds)
-
-time_t seconds;
-
+char *
+format_time(time_t seconds)
{
static char result[10];
@@ -412,10 +387,8 @@ time_t seconds;
#define NUM_STRINGS 8
-char *format_k(amt)
-
-int amt;
-
+char *
+format_k(int amt)
{
static char retarray[NUM_STRINGS][16];
static int index = 0;
diff --git a/usr.bin/top/version.c b/usr.bin/top/version.c
index 5b1af4988a1..d3b8086a5d3 100644
--- a/usr.bin/top/version.c
+++ b/usr.bin/top/version.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.c,v 1.4 2003/04/06 18:48:15 deraadt Exp $ */
+/* $OpenBSD: version.c,v 1.5 2003/06/12 22:30:23 pvalchev Exp $ */
/*
* Top users/processes display for Unix
@@ -34,8 +34,8 @@
#include "top.h"
#include "patchlevel.h"
-char *version_string()
-
+char *
+version_string(void)
{
static char version[16];