From owner-svn-src-all@freebsd.org Tue Apr 24 17:37:31 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 E229EFACF9D; Tue, 24 Apr 2018 17:37:30 +0000 (UTC) (envelope-from lidl@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 93F807F128; Tue, 24 Apr 2018 17:37:30 +0000 (UTC) (envelope-from lidl@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 76285163D1; Tue, 24 Apr 2018 17:37:30 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3OHbUgu042738; Tue, 24 Apr 2018 17:37:30 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3OHbUmj042734; Tue, 24 Apr 2018 17:37:30 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201804241737.w3OHbUmj042734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Tue, 24 Apr 2018 17:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332948 - stable/11/contrib/top X-SVN-Group: stable-11 X-SVN-Commit-Author: lidl X-SVN-Commit-Paths: stable/11/contrib/top X-SVN-Commit-Revision: 332948 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.25 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, 24 Apr 2018 17:37:31 -0000 Author: lidl Date: Tue Apr 24 17:37:29 2018 New Revision: 332948 URL: https://svnweb.freebsd.org/changeset/base/332948 Log: MFC r332671: top: fix warnings from clang/gcc Add includes for and where necessary, and rename a few internal functions to have a "top_" prefix to avoid clashes with standard names from curses.h/termcap.h headers. Top now compiles without warnings on both gcc and clang. Modified: stable/11/contrib/top/display.c stable/11/contrib/top/screen.c stable/11/contrib/top/screen.h stable/11/contrib/top/top.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/top/display.c ============================================================================== --- stable/11/contrib/top/display.c Tue Apr 24 17:35:13 2018 (r332947) +++ stable/11/contrib/top/display.c Tue Apr 24 17:37:29 2018 (r332948) @@ -32,7 +32,9 @@ #include +#include #include +#include #include #include @@ -255,7 +257,7 @@ double *avenrun; register int i; /* i_loadave also clears the screen, since it is first */ - clear(); + top_clear(); /* mpid == -1 implies this system doesn't have an _mpid */ if (mpid != -1) @@ -796,7 +798,7 @@ i_message() } if (next_msg[0] != '\0') { - standout(next_msg); + top_standout(next_msg); msglen = strlen(next_msg); next_msg[0] = '\0'; } @@ -1076,7 +1078,7 @@ caddr_t a1, a2, a3; i = strlen(next_msg); if ((type & MT_delayed) == 0) { - type & MT_standout ? standout(next_msg) : + type & MT_standout ? top_standout(next_msg) : fputs(next_msg, stdout); (void) clear_eol(msglen - i); msglen = i; @@ -1088,7 +1090,7 @@ caddr_t a1, a2, a3; { if ((type & MT_delayed) == 0) { - type & MT_standout ? standout(next_msg) : fputs(next_msg, stdout); + type & MT_standout ? top_standout(next_msg) : fputs(next_msg, stdout); msglen = strlen(next_msg); next_msg[0] = '\0'; } Modified: stable/11/contrib/top/screen.c ============================================================================== --- stable/11/contrib/top/screen.c Tue Apr 24 17:35:13 2018 (r332947) +++ stable/11/contrib/top/screen.c Tue Apr 24 17:37:29 2018 (r332948) @@ -45,6 +45,8 @@ # endif # endif #endif +#include +#include #include "screen.h" #include "boolean.h" @@ -432,10 +434,7 @@ get_screensize() } void -standout(msg) - -char *msg; - +top_standout(char *msg) { if (smart_terminal) { @@ -450,8 +449,7 @@ char *msg; } void -clear() - +top_clear() { if (smart_terminal) { @@ -460,10 +458,7 @@ clear() } int -clear_eol(len) - -int len; - +clear_eol(int len) { if (smart_terminal && !overstrike && len > 0) { @@ -496,12 +491,8 @@ go_home() /* This has to be defined as a subroutine for tputs (instead of a macro) */ -void -putstdout(ch) - -char ch; - +int +putstdout(int ch) { - putchar(ch); + return putchar(ch); } - Modified: stable/11/contrib/top/screen.h ============================================================================== --- stable/11/contrib/top/screen.h Tue Apr 24 17:35:13 2018 (r332947) +++ stable/11/contrib/top/screen.h Tue Apr 24 17:37:29 2018 (r332948) @@ -28,10 +28,10 @@ extern int screen_length; extern int screen_width; /* a function that puts a single character on stdout */ -void putstdout(char ch); +int putstdout(int ch); int clear_eol(int len); -void standout(char *msg); -void clear(void); +void top_standout(char *msg); +void top_clear(void); void go_home(void); void reinit_screen(void); void get_screensize(void); Modified: stable/11/contrib/top/top.c ============================================================================== --- stable/11/contrib/top/top.c Tue Apr 24 17:35:13 2018 (r332947) +++ stable/11/contrib/top/top.c Tue Apr 24 17:37:29 2018 (r332948) @@ -39,6 +39,7 @@ char *copyright = #include #include +#include #include #include #include @@ -79,7 +80,7 @@ int pcpu_stats = No; sigret_t leave(); sigret_t tstop(); #ifdef SIGWINCH -sigret_t winch(); +sigret_t top_winch(int); #endif volatile sig_atomic_t leaveflag; @@ -681,7 +682,7 @@ char *argv[]; (void) signal(SIGQUIT, leave); (void) signal(SIGTSTP, tstop); #ifdef SIGWINCH - (void) signal(SIGWINCH, winch); + (void) signal(SIGWINCH, top_winch); #endif #ifdef SIGRELSE sigrelse(SIGINT); @@ -896,7 +897,7 @@ restart: max_topn = display_resize(); /* reset the signal handler */ - (void) signal(SIGWINCH, winch); + (void) signal(SIGWINCH, top_winch); reset_display(); winchflag = 0; @@ -970,9 +971,9 @@ restart: case CMD_help1: /* help */ case CMD_help2: reset_display(); - clear(); + top_clear(); show_help(); - standout("Hit any key to continue: "); + top_standout("Hit any key to continue: "); fflush(stdout); (void) read(0, &ch, 1); break; @@ -988,9 +989,9 @@ restart: else { reset_display(); - clear(); + top_clear(); show_errors(); - standout("Hit any key to continue: "); + top_standout("Hit any key to continue: "); fflush(stdout); (void) read(0, &ch, 1); } @@ -1299,10 +1300,7 @@ int i; } #ifdef SIGWINCH -sigret_t winch(i) /* SIGWINCH handler */ - -int i; - +sigret_t top_winch(int i) /* SIGWINCH handler */ { winchflag = 1; }