From b186f0c9b7ecc3299c80d42d4addcb03673b40f5 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 20 Sep 2009 17:18:22 +0200 Subject: [PATCH] top(1): Raise WARNS to 6 and fix warnings. --- contrib/top/display.c | 2 -- contrib/top/display.h | 1 + contrib/top/machine.h | 1 - contrib/top/top.c | 17 ++--------------- contrib/top/top.h | 2 -- usr.bin/top/Makefile | 2 -- usr.bin/top/machine.c | 3 ++- 7 files changed, 5 insertions(+), 23 deletions(-) diff --git a/contrib/top/display.c b/contrib/top/display.c index a4c4c3c886..e9c3ac431b 100644 --- a/contrib/top/display.c +++ b/contrib/top/display.c @@ -61,8 +61,6 @@ static int display_width = MAX_COLS; #define lineindex(l) ((l)*display_width) -char *printable(char *str); - /* things initialized by display_init and used thruout */ /* buffer of proc information lines for display updating */ diff --git a/contrib/top/display.h b/contrib/top/display.h index a5a32947b4..969950c39d 100644 --- a/contrib/top/display.h +++ b/contrib/top/display.h @@ -33,3 +33,4 @@ void display_header(int t); void new_message(int type, const char *msgfmt, ...); void clear_message(void); int readline(char *buffer, int size, int numeric); +char *printable(char *str); diff --git a/contrib/top/machine.h b/contrib/top/machine.h index 4bed00094e..d68c80b64b 100644 --- a/contrib/top/machine.h +++ b/contrib/top/machine.h @@ -71,5 +71,4 @@ struct process_select char *format_header(const char *); char *format_next_process(caddr_t, char *(*func)(long)); -char *printable(char *); int machine_init(struct statics *statics); diff --git a/contrib/top/top.c b/contrib/top/top.c index 958ed8db22..424843a23d 100644 --- a/contrib/top/top.c +++ b/contrib/top/top.c @@ -64,10 +64,6 @@ char stdoutbuf[Buffersize]; /* build Signal masks */ #define Smask(s) (1 << ((s) - 1)) -/* for getopt: */ -extern int optind; -extern char *optarg; - /* imported from screen.c */ extern int overstrike; @@ -83,9 +79,6 @@ volatile sig_atomic_t leaveflag; volatile sig_atomic_t tstopflag; volatile sig_atomic_t winchflag; -/* internal routines */ -void quit(int signo); - /* values which need to be accessed by signal handlers */ static int max_topn; /* maximum displayable processes */ @@ -95,12 +88,6 @@ static void reset_display(void); const char *myname = "top"; jmp_buf jmp_int; -#ifdef ORDER -extern int (*proc_compares[])(const void *, const void *); -#else -extern int proc_compare(const void *, const void *); -#endif - /* pointers to display routines */ void (*d_loadave)(int, double *) = i_loadave; void (*d_procstates)(int, int *) = i_procstates; @@ -138,8 +125,8 @@ main(int argc, char **argv) char *env_top; char **preset_argv; int preset_argc = 0; - char **av; - int ac; + char **av = NULL; + int ac = 0; char dostates = No; char do_unames = Yes; char interactive = Maybe; diff --git a/contrib/top/top.h b/contrib/top/top.h index 78b2e571a9..7b9e6d82d1 100644 --- a/contrib/top/top.h +++ b/contrib/top/top.h @@ -17,8 +17,6 @@ extern int n_cpus; /* Log base 2 of 1024 is 10 (2^10 == 1024) */ #define LOG1024 10 -extern int screen_width; - char *version_string(void); /* Special atoi routine returns either a non-negative number or one of: */ diff --git a/usr.bin/top/Makefile b/usr.bin/top/Makefile index ee1fbe84fe..1ceadc70ee 100644 --- a/usr.bin/top/Makefile +++ b/usr.bin/top/Makefile @@ -1,7 +1,6 @@ # $FreeBSD: src/usr.bin/top/Makefile,v 1.5.6.2 2002/08/11 17:09:54 dwmalone Exp $ # $DragonFly: src/usr.bin/top/Makefile,v 1.8 2007/08/27 16:50:59 pavalos Exp $ PROG= top -WARNS?= 4 TOPDIR= ${.CURDIR}/../../contrib/top .PATH: ${TOPDIR} @@ -26,7 +25,6 @@ DPADD= ${LIBTERMCAP} ${LIBM} ${LIBKVM} ${LIBKINFO} LDADD= -ltermcap -lm -lkvm -lkinfo BINGRP= kmem BINMODE=2555 -WARNS?= 0 top.1: top.x top.local.1 cat ${.ALLSRC} > top.1 diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 7615f1bd5a..19e082c2b3 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -56,14 +56,15 @@ #include #include #include "top.h" +#include "display.h" #include "machine.h" +#include "screen.h" #include "utils.h" #if 0 static int check_nlist(struct nlist *); static int getkval(unsigned long, int *, int, char *); #endif -extern char* printable(char *); int swapmode(int *retavail, int *retfree); static int smpmode; static int namelength; -- 2.11.4.GIT