From owner-svn-src-all@freebsd.org Tue Jun 12 07:14:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5695A10054F8; Tue, 12 Jun 2018 07:14:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A8CA71B1E; Tue, 12 Jun 2018 07:14:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF919272B5; Tue, 12 Jun 2018 07:14:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5C7EDmE005287; Tue, 12 Jun 2018 07:14:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5C7ECp5005281; Tue, 12 Jun 2018 07:14:12 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806120714.w5C7ECp5005281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Tue, 12 Jun 2018 07:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334989 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 334989 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2018 07:14:14 -0000 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 /* 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);