Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2018 07:14:12 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334989 - head/usr.bin/top
Message-ID:  <201806120714.w5C7ECp5005281@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Tue Jun 12 07:14:12 2018
New Revision: 334989
URL: https://svnweb.freebsd.org/changeset/base/334989

Log:
  top(1): style and related
  
  - style(9)
  - remove now-defunct comments
  - remove getuid check for low delay
  - expand range of format_k

Modified:
  head/usr.bin/top/commands.c
  head/usr.bin/top/machine.h
  head/usr.bin/top/top.c
  head/usr.bin/top/top.h
  head/usr.bin/top/utils.c
  head/usr.bin/top/utils.h

Modified: head/usr.bin/top/commands.c
==============================================================================
--- head/usr.bin/top/commands.c	Tue Jun 12 06:53:31 2018	(r334988)
+++ head/usr.bin/top/commands.c	Tue Jun 12 07:14:12 2018	(r334989)
@@ -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;

Modified: head/usr.bin/top/machine.h
==============================================================================
--- head/usr.bin/top/machine.h	Tue Jun 12 06:53:31 2018	(r334988)
+++ head/usr.bin/top/machine.h	Tue Jun 12 07:14:12 2018	(r334989)
@@ -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

Modified: head/usr.bin/top/top.c
==============================================================================
--- head/usr.bin/top/top.c	Tue Jun 12 06:53:31 2018	(r334988)
+++ head/usr.bin/top/top.c	Tue Jun 12 07:14:12 2018	(r334989)
@@ -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;

Modified: head/usr.bin/top/top.h
==============================================================================
--- head/usr.bin/top/top.h	Tue Jun 12 06:53:31 2018	(r334988)
+++ head/usr.bin/top/top.h	Tue Jun 12 07:14:12 2018	(r334989)
@@ -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

Modified: head/usr.bin/top/utils.c
==============================================================================
--- head/usr.bin/top/utils.c	Tue Jun 12 06:53:31 2018	(r334988)
+++ head/usr.bin/top/utils.c	Tue Jun 12 07:14:12 2018	(r334989)
@@ -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;

Modified: head/usr.bin/top/utils.h
==============================================================================
--- head/usr.bin/top/utils.h	Tue Jun 12 06:53:31 2018	(r334988)
+++ head/usr.bin/top/utils.h	Tue Jun 12 07:14:12 2018	(r334989)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806120714.w5C7ECp5005281>