diff options
author | Eitan Adler <eadler@FreeBSD.org> | 2018-06-12 07:14:12 +0000 |
---|---|---|
committer | Eitan Adler <eadler@FreeBSD.org> | 2018-06-12 07:14:12 +0000 |
commit | ccf22059e0a2af3bb6220f076c9bed89df23e029 (patch) | |
tree | 9b88b2cf07c6ca3997c0e539c10e662bb4320f11 /usr.bin/top | |
parent | c8aa5e526fc02c360b09718a7dcb5db1876dca05 (diff) | |
download | src-ccf22059e0a2af3bb6220f076c9bed89df23e029.tar.gz src-ccf22059e0a2af3bb6220f076c9bed89df23e029.zip |
top(1): style and related
- style(9)
- remove now-defunct comments
- remove getuid check for low delay
- expand range of format_k
Notes
Notes:
svn path=/head/; revision=334989
Diffstat (limited to 'usr.bin/top')
-rw-r--r-- | usr.bin/top/commands.c | 3 | ||||
-rw-r--r-- | usr.bin/top/machine.h | 4 | ||||
-rw-r--r-- | usr.bin/top/top.c | 5 | ||||
-rw-r--r-- | usr.bin/top/top.h | 3 | ||||
-rw-r--r-- | usr.bin/top/utils.c | 4 | ||||
-rw-r--r-- | usr.bin/top/utils.h | 2 |
6 files changed, 8 insertions, 13 deletions
diff --git a/usr.bin/top/commands.c b/usr.bin/top/commands.c index a391a9ce9334..72beb8065379 100644 --- a/usr.bin/top/commands.c +++ b/usr.bin/top/commands.c @@ -195,7 +195,8 @@ static char err_listem[] = #define STRMAX 80 -char *err_string(void) +char * +err_string(void) { struct errs *errp; int cnt = 0; diff --git a/usr.bin/top/machine.h b/usr.bin/top/machine.h index 4a57c12532fd..be879053c081 100644 --- a/usr.bin/top/machine.h +++ b/usr.bin/top/machine.h @@ -53,10 +53,6 @@ struct system_info int ncpus; }; -/* cpu_states is an array of percentages * 10. For example, - the (integer) value 105 is 10.5% (or .105). - */ - /* * the process_select struct tells get_process_info what processes * and information we are interested in seeing diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index b178b6ee4a98..ebf1d195f895 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -925,7 +925,7 @@ restart: new_message(MT_standout, "Seconds to delay: "); if ((i = readline(tempbuf1, 8, true)) > -1) { - if ((delay = i) == 0 && getuid() != 0) + if ((delay = i) == 0) { delay = 1; } @@ -1034,8 +1034,7 @@ restart: putchar('\r'); break; case CMD_viewtog: - if (++displaymode == DISP_MAX) - displaymode = 0; + displaymode = displaymode == DISP_IO ? DISP_CPU : DISP_IO; header_text = format_header(uname_field); display_header(true); d_header = i_header; diff --git a/usr.bin/top/top.h b/usr.bin/top/top.h index 19af6bcd41be..5038aa202178 100644 --- a/usr.bin/top/top.h +++ b/usr.bin/top/top.h @@ -1,7 +1,6 @@ /*- * Top - a top users display for Berkeley Unix * - * General (global) definitions * $FreeBSD$ */ @@ -11,7 +10,7 @@ #include <unistd.h> /* Number of lines of header information on the standard screen */ -extern int Header_lines; /* 7 */ +extern int Header_lines; /* Maximum number of columns allowed for display */ #define MAX_COLS 512 diff --git a/usr.bin/top/utils.c b/usr.bin/top/utils.c index 2a7134904fe0..2673352b8cc3 100644 --- a/usr.bin/top/utils.c +++ b/usr.bin/top/utils.c @@ -124,7 +124,7 @@ itoa7(int val) /* * digits(val) - return number of decimal digits in val. Only works for - * non-negative numbers. If val <= 0 then digits(val) == 0. + * non-negative numbers. */ int __pure2 @@ -319,7 +319,7 @@ format_time(long seconds) #define NUM_STRINGS 8 char * -format_k(int amt) +format_k(long amt) { static char retarray[NUM_STRINGS][16]; static int index = 0; diff --git a/usr.bin/top/utils.h b/usr.bin/top/utils.h index f40f58818d0b..67f23b433bbb 100644 --- a/usr.bin/top/utils.h +++ b/usr.bin/top/utils.h @@ -19,7 +19,7 @@ int digits(int); const char * const *argparse(char *, int *); long percentages(int, int *, long *, long *, long *); char *format_time(long); -char *format_k(int); +char *format_k(long); char *format_k2(unsigned long long); int string_index(const char *string, const char * const *array); int find_pid(pid_t pid); |