Author: eadler
Date: Mon May 21 01:16:26 2018
New Revision: 333954
URL: https://svnweb.freebsd.org/changeset/base/333954

Log:
  top(1): pull function declarations and externs into headers

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

Modified: head/usr.bin/top/commands.c
==============================================================================
--- head/usr.bin/top/commands.c Mon May 21 01:06:59 2018        (r333953)
+++ head/usr.bin/top/commands.c Mon May 21 01:16:26 2018        (r333954)
@@ -35,11 +35,6 @@
 #include "utils.h"
 #include "machine.h"
 
-extern char *copyright;
-
-/* imported from screen.c */
-extern int overstrike;
-
 static int err_compar(const void *p1, const void *p2);
 
 struct errs            /* structure for a system-call error */

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c  Mon May 21 01:06:59 2018        (r333953)
+++ head/usr.bin/top/machine.c  Mon May 21 01:16:26 2018        (r333954)
@@ -43,6 +43,7 @@
 
 #include "top.h"
 #include "machine.h"
+#include "display.h"
 #include "screen.h"
 #include "utils.h"
 #include "layout.h"
@@ -52,7 +53,7 @@
 #define        UPUNAMELEN      15
 
 extern struct process_select ps;
-extern char* printable(char *);
+extern struct timeval timeout;
 static int smpmode;
 enum displaymodes displaymode;
 #ifdef TOP_USERNAME_LEN
@@ -67,9 +68,6 @@ static int jidlength;
 static int swaplength;
 static int cmdlengthdelta;
 
-/* Prototypes for top internals */
-void quit(int);
-
 /* get_process_info passes back a handle.  This is what it looks like: */
 
 struct handle {
@@ -233,9 +231,6 @@ static int pageshift;               /* log base 2 of the 
pagesize *
 #define ki_swap(kip) \
     ((kip)->ki_swrss > (kip)->ki_rssize ? (kip)->ki_swrss - (kip)->ki_rssize : 
0)
 
-/* useful externals */
-long percentages(int cnt, int *out, long *new, long *old, long *diffs);
-
 /*
  * Sorting orders.  The first element is the default.
  */
@@ -470,7 +465,6 @@ format_header(char *uname_field)
 
 static int swappgsin = -1;
 static int swappgsout = -1;
-extern struct timeval timeout;
 
 
 void

Modified: head/usr.bin/top/top.c
==============================================================================
--- head/usr.bin/top/top.c      Mon May 21 01:06:59 2018        (r333953)
+++ head/usr.bin/top/top.c      Mon May 21 01:16:26 2018        (r333954)
@@ -3,7 +3,6 @@ char *copyright =
 
 /*
  *  Top users/processes display for Unix
- *  Version 3
  *
  *  This program may be freely redistributed,
  *  but this entire comment MUST remain intact.
@@ -16,23 +15,6 @@ char *copyright =
  * $FreeBSD$
  */
 
-/*
- *  See the file "Changes" for information on version-to-version changes.
- */
-
-/*
- *  This file contains "main" and other high-level routines.
- */
-
-/*
- * The following preprocessor variables, when defined, are used to
- * distinguish between different Unix implementations:
- *
- *     SIGHOLD  - use SVR4 sighold function when defined
- *     SIGRELSE - use SVR4 sigrelse function when defined
- *     FD_SET   - macros FD_SET and FD_ZERO are used when defined
- */
-
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/jail.h>
@@ -48,7 +30,6 @@ char *copyright =
 #include <string.h>
 #include <unistd.h>
 
-/* includes specific to top */
 #include "commands.h"
 #include "display.h"           /* interface to display package */
 #include "screen.h"            /* interface to screen package */
@@ -70,13 +51,7 @@ 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;
-
 static int fmt_flags = 0;
 int pcpu_stats = No;
 
@@ -85,13 +60,10 @@ static sigret_t leave(int);
 static sigret_t tstop(int);
 static sigret_t top_winch(int);
 
-volatile sig_atomic_t leaveflag;
-volatile sig_atomic_t tstopflag;
-volatile sig_atomic_t winchflag;
+static volatile sig_atomic_t leaveflag;
+static volatile sig_atomic_t tstopflag;
+static volatile sig_atomic_t winchflag;
 
-/* internal routines */
-void quit(int);
-
 /* values which need to be accessed by signal handlers */
 static int max_topn;           /* maximum displayable processes */
 
@@ -102,7 +74,6 @@ jmp_buf jmp_int;
 
 char *username(int);
 
-extern int (*compares[])(const void*, const void*);
 time_t time(time_t *tloc);
 
 caddr_t get_process_info(struct system_info *si, struct process_select *sel,

Modified: head/usr.bin/top/top.h
==============================================================================
--- head/usr.bin/top/top.h      Mon May 21 01:06:59 2018        (r333953)
+++ head/usr.bin/top/top.h      Mon May 21 01:16:26 2018        (r333954)
@@ -44,9 +44,17 @@ enum displaymodes { DISP_CPU = 0, DISP_IO, DISP_MAX };
 extern enum displaymodes displaymode;
 
 extern int pcpu_stats;
+extern int  overstrike;
 
+extern int (*compares[])(const void*, const void*);
+
 char* kill_procs(char *);
 char* renice_procs(char *);
+
+extern char *copyright;
+/* internal routines */
+void quit(int);
+
 
 /*
  *  The space command forces an immediate update.  Sometimes, on loaded
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to