Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2012 14:49:43 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241737 - in head: bin/date bin/ed libexec/rtld-aout sbin/camcontrol sbin/geom/core usr.bin/at usr.bin/calendar usr.bin/chat usr.bin/ctlstat usr.bin/elfdump usr.bin/fetch usr.bin/finger...
Message-ID:  <201210191449.q9JEnhfn015510@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Fri Oct 19 14:49:42 2012
New Revision: 241737
URL: http://svn.freebsd.org/changeset/base/241737

Log:
  More -Wmissing-variable-declarations fixes.
  
  In addition to adding `static' where possible:
  
  - bin/date: Move `retval' into extern.h to make it visible to date.c.
  - bin/ed: Move globally used variables into ed.h.
  - sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
  - usr.bin/calendar: Remove unneeded variables.
  - usr.bin/chat: Make `line' local instead of global.
  - usr.bin/elfdump: Comment out unneeded function.
  - usr.bin/rlogin: Use _Noreturn instead of __dead2.
  - usr.bin/tset: Pull `Ospeed' into extern.h.
  - usr.sbin/mfiutil: Put global variables in mfiutil.h.
  - usr.sbin/pkg: Remove unused `os_corres'.
  - usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.

Modified:
  head/bin/date/extern.h
  head/bin/date/netdate.c
  head/bin/ed/buf.c
  head/bin/ed/ed.h
  head/bin/ed/io.c
  head/bin/ed/re.c
  head/libexec/rtld-aout/shlib.c
  head/sbin/camcontrol/camcontrol.c
  head/sbin/camcontrol/camcontrol.h
  head/sbin/camcontrol/fwdownload.c
  head/sbin/camcontrol/modeedit.c
  head/sbin/geom/core/geom.c
  head/usr.bin/at/privs.h
  head/usr.bin/calendar/calendar.c
  head/usr.bin/calendar/dates.c
  head/usr.bin/calendar/day.c
  head/usr.bin/calendar/io.c
  head/usr.bin/chat/chat.c
  head/usr.bin/ctlstat/ctlstat.c
  head/usr.bin/elfdump/elfdump.c
  head/usr.bin/fetch/fetch.c
  head/usr.bin/finger/finger.c
  head/usr.bin/gencat/gencat.c
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/regex/xmalloc.c
  head/usr.bin/gzip/zuncompress.c
  head/usr.bin/msgs/msgs.c
  head/usr.bin/ncal/ncal.c
  head/usr.bin/rlogin/rlogin.c
  head/usr.bin/rpcgen/rpc_main.c
  head/usr.bin/rpcgen/rpc_svcout.c
  head/usr.bin/rpcgen/rpc_util.c
  head/usr.bin/sort/sort.c
  head/usr.bin/stat/stat.c
  head/usr.bin/tftp/main.c
  head/usr.bin/tset/extern.h
  head/usr.bin/tset/map.c
  head/usr.bin/tset/term.c
  head/usr.sbin/acpi/acpidump/acpi.c
  head/usr.sbin/acpi/acpidump/acpi_user.c
  head/usr.sbin/cpucontrol/cpucontrol.c
  head/usr.sbin/ctladm/ctladm.c
  head/usr.sbin/ctladm/util.c
  head/usr.sbin/gpioctl/gpioctl.c
  head/usr.sbin/ip6addrctl/ip6addrctl.c
  head/usr.sbin/mfiutil/mfi_flash.c
  head/usr.sbin/mfiutil/mfi_show.c
  head/usr.sbin/mfiutil/mfiutil.c
  head/usr.sbin/mfiutil/mfiutil.h
  head/usr.sbin/nfscbd/nfscbd.c
  head/usr.sbin/nfsd/nfsd.c
  head/usr.sbin/pkg/elf_tables.h
  head/usr.sbin/pkg_install/version/perform.c
  head/usr.sbin/pmccontrol/pmccontrol.c
  head/usr.sbin/pmcstat/pmcpl_calltree.c
  head/usr.sbin/pmcstat/pmcstat.c
  head/usr.sbin/pmcstat/pmcstat_log.c
  head/usr.sbin/pmcstat/pmcstat_log.h
  head/usr.sbin/quotaon/quotaon.c
  head/usr.sbin/repquota/repquota.c
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/bin/date/extern.h
==============================================================================
--- head/bin/date/extern.h	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/bin/date/extern.h	Fri Oct 19 14:49:42 2012	(r241737)
@@ -30,4 +30,6 @@
  * $FreeBSD$
  */
 
+extern int retval;
+
 int	netsettime(time_t);

Modified: head/bin/date/netdate.c
==============================================================================
--- head/bin/date/netdate.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/bin/date/netdate.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$");
 #define	WAITACK		2	/* seconds */
 #define	WAITDATEACK	5	/* seconds */
 
-extern int retval;
-
 /*
  * Set the date in the machines controlled by timedaemons by communicating the
  * new date to the local timedaemon.  If the timedaemon is in the master state,

Modified: head/bin/ed/buf.c
==============================================================================
--- head/bin/ed/buf.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/bin/ed/buf.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -185,9 +185,6 @@ get_addressed_line_node(long n)
 	return lp;
 }
 
-
-extern int newline_added;
-
 static char sfn[15] = "";			/* scratch file name */
 
 /* open_sbuf: open scratch file */

Modified: head/bin/ed/ed.h
==============================================================================
--- head/bin/ed/ed.h	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/bin/ed/ed.h	Fri Oct 19 14:49:42 2012	(r241737)
@@ -277,3 +277,9 @@ extern int lineno;
 extern long second_addr;
 extern long u_addr_last;
 extern long u_current_addr;
+extern long rows;
+extern int cols;
+extern int newline_added;
+extern int des;
+extern int scripted;
+extern int patlock;

Modified: head/bin/ed/io.c
==============================================================================
--- head/bin/ed/io.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/bin/ed/io.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -30,9 +30,6 @@ __FBSDID("$FreeBSD$");
 
 #include "ed.h"
 
-
-extern int scripted;
-
 /* read_file: read a named file/pipe into the buffer; return line count */
 long
 read_file(char *fn, long n)
@@ -58,9 +55,6 @@ read_file(char *fn, long n)
 	return current_addr - n;
 }
 
-
-extern int des;
-
 static char *sbuf;		/* file i/o buffer */
 static int sbufsz;		/* file i/o buffer size */
 int newline_added;		/* if set, newline appended to input file */
@@ -298,9 +292,6 @@ get_tty_line(void)
 #define ESCAPES "\a\b\f\n\r\t\v\\"
 #define ESCCHARS "abfnrtv\\"
 
-extern int rows;
-extern int cols;
-
 /* put_tty_line: print text to stdout */
 int
 put_tty_line(const char *s, int l, long n, int gflag)

Modified: head/bin/ed/re.c
==============================================================================
--- head/bin/ed/re.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/bin/ed/re.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -31,9 +31,6 @@ __FBSDID("$FreeBSD$");
 
 #include "ed.h"
 
-
-extern int patlock;
-
 const char *errmsg = "";
 
 /* get_compiled_pattern: return pointer to compiled pattern from command

Modified: head/libexec/rtld-aout/shlib.c
==============================================================================
--- head/libexec/rtld-aout/shlib.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/libexec/rtld-aout/shlib.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -62,7 +62,7 @@
 char	 **search_dirs;
 int	n_search_dirs;
 
-const char	*standard_search_dirs[] = {
+static const char *standard_search_dirs[] = {
 	STANDARD_SEARCH_DIRS
 };
 

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/sbin/camcontrol/camcontrol.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -5783,9 +5783,10 @@ bailout:
 #endif /* MINIMALISTIC */
 
 void
-usage(int verbose)
+usage(int printlong)
 {
-	fprintf(verbose ? stdout : stderr,
+
+	fprintf(printlong ? stdout : stderr,
 "usage:  camcontrol <command>  [device id][generic args][command args]\n"
 "        camcontrol devlist    [-v]\n"
 #ifndef MINIMALISTIC
@@ -5834,7 +5835,7 @@ usage(int verbose)
 "        camcontrol fwdownload [dev_id][generic args] <-f fw_image> [-y][-s]\n"
 #endif /* MINIMALISTIC */
 "        camcontrol help\n");
-	if (!verbose)
+	if (!printlong)
 		return;
 #ifndef MINIMALISTIC
 	fprintf(stdout,

Modified: head/sbin/camcontrol/camcontrol.h
==============================================================================
--- head/sbin/camcontrol/camcontrol.h	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/sbin/camcontrol/camcontrol.h	Fri Oct 19 14:49:42 2012	(r241737)
@@ -40,8 +40,10 @@ struct get_hook
 	int got;
 };
 
+extern int verbose;
+
 int fwdownload(struct cam_device *device, int argc, char **argv,
-	       char *combinedopt, int verbose, int retry_count, int timeout,
+	       char *combinedopt, int printerrors, int retry_count, int timeout,
 	       const char */*type*/);
 void mode_sense(struct cam_device *device, int mode_page, int page_control,
 		int dbd, int retry_count, int timeout, u_int8_t *data,
@@ -58,5 +60,5 @@ char *cget(void *hook, char *name);
 int iget(void *hook, char *name);
 void arg_put(void *hook, int letter, void *arg, int count, char *name);
 int get_confirmation(void);
-void usage(int verbose);
+void usage(int printlong);
 #endif /* _CAMCONTROL_H */

Modified: head/sbin/camcontrol/fwdownload.c
==============================================================================
--- head/sbin/camcontrol/fwdownload.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/sbin/camcontrol/fwdownload.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -131,7 +131,7 @@ static char	*fw_read_img(const char *fw_
 		    const struct fw_vendor *vp, int *num_bytes);
 static int	 fw_download_img(struct cam_device *cam_dev,
 		    const struct fw_vendor *vp, char *buf, int img_size,
-		    int sim_mode, int verbose, int retry_count, int timeout,
+		    int sim_mode, int printerrors, int retry_count, int timeout,
 		    const char */*name*/, const char */*type*/);
 
 /*
@@ -238,7 +238,7 @@ bailout1:
  */
 static int
 fw_download_img(struct cam_device *cam_dev, const struct fw_vendor *vp,
-    char *buf, int img_size, int sim_mode, int verbose, int retry_count,
+    char *buf, int img_size, int sim_mode, int printerrors, int retry_count,
     int timeout, const char *imgname, const char *type)
 {
 	struct scsi_write_buffer cdb;
@@ -290,7 +290,7 @@ fw_download_img(struct cam_device *cam_d
 	ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
 	if (cam_send_ccb(cam_dev, ccb) < 0) {
 		warnx("Error sending identify/test unit ready");
-		if (verbose)
+		if (printerrors)
 			cam_error_print(cam_dev, ccb, CAM_ESF_ALL,
 			    CAM_EPF_ALL, stderr);
 		cam_freeccb(ccb);
@@ -298,7 +298,7 @@ fw_download_img(struct cam_device *cam_d
 	}
 	if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
 		warnx("Device is not ready");
-		if (verbose)
+		if (printerrors)
 			cam_error_print(cam_dev, ccb, CAM_ESF_ALL,
 			    CAM_EPF_ALL, stderr);
 		cam_freeccb(ccb);
@@ -372,7 +372,7 @@ fw_download_img(struct cam_device *cam_d
 			/* Execute the command. */
 			if (cam_send_ccb(cam_dev, ccb) < 0) {
 				warnx("Error writing image to device");
-				if (verbose)
+				if (printerrors)
 					cam_error_print(cam_dev, ccb, CAM_ESF_ALL,
 						   CAM_EPF_ALL, stderr);
 				goto bailout;
@@ -398,7 +398,7 @@ bailout:
 
 int
 fwdownload(struct cam_device *device, int argc, char **argv,
-    char *combinedopt, int verbose, int retry_count, int timeout,
+    char *combinedopt, int printerrors, int retry_count, int timeout,
     const char *type)
 {
 	const struct fw_vendor *vp;
@@ -450,7 +450,7 @@ fwdownload(struct cam_device *device, in
 	if (sim_mode)
 		fprintf(stdout, "Running in simulation mode\n");
 
-	if (fw_download_img(device, vp, buf, img_size, sim_mode, verbose,
+	if (fw_download_img(device, vp, buf, img_size, sim_mode, printerrors,
 	    retry_count, timeout, fw_img_path, type) != 0) {
 		fprintf(stderr, "Firmware download failed\n");
 		goto fail;

Modified: head/sbin/camcontrol/modeedit.c
==============================================================================
--- head/sbin/camcontrol/modeedit.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/sbin/camcontrol/modeedit.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$");
 #include <camlib.h>
 #include "camcontrol.h"
 
-int verbose = 0;
-
 #define	DEFAULT_SCSI_MODE_DB	"/usr/share/misc/scsi_modes"
 #define	DEFAULT_EDITOR		"vi"
 #define	MAX_FORMAT_SPEC		4096	/* Max CDB format specifier. */

Modified: head/sbin/geom/core/geom.c
==============================================================================
--- head/sbin/geom/core/geom.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/sbin/geom/core/geom.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -74,7 +74,7 @@ static void std_status(struct gctl_req *
 static void std_load(struct gctl_req *req, unsigned flags);
 static void std_unload(struct gctl_req *req, unsigned flags);
 
-struct g_command std_commands[] = {
+static struct g_command std_commands[] = {
 	{ "help", 0, std_help, G_NULL_OPTS, NULL },
 	{ "list", 0, std_list,
 	    {

Modified: head/usr.bin/at/privs.h
==============================================================================
--- head/usr.bin/at/privs.h	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/at/privs.h	Fri Oct 19 14:49:42 2012	(r241737)
@@ -59,15 +59,13 @@
  * to the real userid before calling any of them.
  */
 
-#ifndef MAIN
-extern
-#endif
-uid_t real_uid, effective_uid;
+extern uid_t real_uid, effective_uid;
+extern gid_t real_gid, effective_gid;
 
-#ifndef MAIN 
-extern
-#endif
+#ifdef MAIN
+uid_t real_uid, effective_uid;
 gid_t real_gid, effective_gid;
+#endif
 
 #define RELINQUISH_PRIVS { \
 	real_uid = getuid(); \

Modified: head/usr.bin/calendar/calendar.c
==============================================================================
--- head/usr.bin/calendar/calendar.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/calendar/calendar.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -60,8 +60,8 @@ __FBSDID("$FreeBSD$");
 struct passwd	*pw;
 int		doall = 0;
 int		debug = 0;
-char		*DEBUG = NULL;
-time_t		f_time = 0;
+static char	*DEBUG = NULL;
+static time_t	f_time = 0;
 double		UTCOffset = UTCOFFSET_NOTSET;
 int		EastLongitude = LONGITUDE_NOTSET;
 

Modified: head/usr.bin/calendar/dates.c
==============================================================================
--- head/usr.bin/calendar/dates.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/calendar/dates.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -43,7 +43,7 @@ struct cal_year {
 	int firstdayofweek; /* 0 .. 6 */
 	struct cal_month *months;
 	struct cal_year	*nextyear;
-} cal_year;
+};
 
 struct cal_month {
 	int month;			/* 01 .. 12 */
@@ -52,7 +52,7 @@ struct cal_month {
 	struct cal_year *year;		/* points back */
 	struct cal_day *days;
 	struct cal_month *nextmonth;
-} cal_month;
+};
 
 struct cal_day {
 	int dayofmonth;			/* 01 .. 31 */
@@ -62,19 +62,18 @@ struct cal_day {
 	struct cal_month *month;	/* points back */
 	struct cal_year	*year;		/* points back */
 	struct event *events;
-} cal_day;
+};
 
 int debug_remember = 0;
-struct cal_year	*hyear = NULL;
+static struct cal_year *hyear = NULL;
 
 /* 1-based month, 0-based days, cumulative */
-int *cumdays;
 int	cumdaytab[][14] = {
 	{0, -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364},
 	{0, -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
 };
 /* 1-based month, individual */
-int *mondays;
+static int *mondays;
 int	mondaytab[][14] = {
 	{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},
 	{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30},

Modified: head/usr.bin/calendar/day.c
==============================================================================
--- head/usr.bin/calendar/day.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/calendar/day.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 
 #include "calendar.h"
 
-time_t			time1, time2;
+static time_t		time1, time2;
 const struct tm		tm0;
 char			dayname[100];
 int			year1, year2;

Modified: head/usr.bin/calendar/io.c
==============================================================================
--- head/usr.bin/calendar/io.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/calendar/io.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -60,10 +60,10 @@ __FBSDID("$FreeBSD$");
 #include "calendar.h"
 
 const char *calendarFile = "calendar";	/* default calendar file */
-const char *calendarHomes[] = {".calendar", _PATH_INCLUDE};	/* HOME */
-const char *calendarNoMail = "nomail";	/* don't sent mail if this file exist */
+static const char *calendarHomes[] = {".calendar", _PATH_INCLUDE}; /* HOME */
+static const char *calendarNoMail = "nomail";/* don't sent mail if file exist */
 
-char	path[MAXPATHLEN];
+static char path[MAXPATHLEN];
 
 struct fixs neaster, npaskha, ncny, nfullmoon, nnewmoon;
 struct fixs nmarequinox, nsepequinox, njunsolstice, ndecsolstice;

Modified: head/usr.bin/chat/chat.c
==============================================================================
--- head/usr.bin/chat/chat.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/chat/chat.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -109,40 +109,39 @@ __FBSDID("$FreeBSD$");
 #define	MAX_REPORTS		50
 #define	DEFAULT_CHAT_TIMEOUT	45
 
-int echo          = 0;
-int verbose       = 0;
-int to_log        = 1;
-int to_stderr     = 0;
-int Verbose       = 0;
-int quiet         = 0;
-int exit_code     = 0;
-FILE* report_fp   = (FILE *) 0;
-char *report_file = (char *) 0;
-char *chat_file   = (char *) 0;
-char *phone_num   = (char *) 0;
-char *phone_num2  = (char *) 0;
-int timeout       = DEFAULT_CHAT_TIMEOUT;
+static int echo;
+static int verbose;
+static int to_log;
+static int to_stderr;
+static int Verbose;
+static int quiet;
+static int exit_code;
+static FILE* report_fp;
+static char *report_file;
+static char *chat_file;
+static char *phone_num;
+static char *phone_num2;
+static int timeout = DEFAULT_CHAT_TIMEOUT;
 
 static char blank[] = "";
 
-int have_tty_parameters = 0;
+static int have_tty_parameters;
 
 #define term_parms struct termios
 #define get_term_param(param) tcgetattr(0, param)
 #define set_term_param(param) tcsetattr(0, TCSANOW, param)
-struct termios saved_tty_parameters;
+static struct termios saved_tty_parameters;
 
-char *abort_string[MAX_ABORTS], *fail_reason = (char *)0,
-	fail_buffer[50];
-int n_aborts = 0, abort_next = 0, timeout_next = 0, echo_next = 0;
-int clear_abort_next = 0;
-
-char *report_string[MAX_REPORTS] ;
-char  report_buffer[50] ;
-int n_reports = 0, report_next = 0, report_gathering = 0 ; 
-int clear_report_next = 0;
+static char *abort_string[MAX_ABORTS], *fail_reason, fail_buffer[50];
+static int n_aborts, abort_next, timeout_next, echo_next;
+static int clear_abort_next;
+
+static char *report_string[MAX_REPORTS];
+static char  report_buffer[50];
+static int n_reports, report_next, report_gathering;
+static int clear_report_next;
 
-int say_next = 0, hup_next = 0;
+static int say_next, hup_next;
 
 void *dup_mem(void *b, size_t c);
 void *copy_of(char *s);
@@ -396,14 +395,13 @@ usage(void)
     exit(1);
 }
 
-char line[1024];
-
 /*
  * Send a message to syslog and/or stderr.
  */
 void
 chat_logf(const char *fmt, ...)
 {
+    char line[1024];
     va_list args;
 
     va_start(args, fmt);
@@ -422,6 +420,7 @@ chat_logf(const char *fmt, ...)
 void
 fatal(int code, const char *fmt, ...)
 {
+    char line[1024];
     va_list args;
 
     va_start(args, fmt);
@@ -434,7 +433,7 @@ fatal(int code, const char *fmt, ...)
     terminate(code);
 }
 
-int alarmed = 0;
+static int alarmed;
 
 SIGTYPE sigalrm(int signo __unused)
 {

Modified: head/usr.bin/ctlstat/ctlstat.c
==============================================================================
--- head/usr.bin/ctlstat/ctlstat.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/ctlstat/ctlstat.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -329,7 +329,7 @@ compute_stats(struct ctl_lun_io_stats *c
 #define	PRINT_BINTIME(prefix, bt) \
 	printf("%s %jd s %ju frac\n", prefix, (intmax_t)(bt).sec, \
 	       (uintmax_t)(bt).frac)
-const char *iotypes[] = {"NO IO", "READ", "WRITE"};
+static const char *iotypes[] = {"NO IO", "READ", "WRITE"};
 
 static void
 ctlstat_dump(struct ctlstat_context *ctx) {

Modified: head/usr.bin/elfdump/elfdump.c
==============================================================================
--- head/usr.bin/elfdump/elfdump.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/elfdump/elfdump.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -83,7 +83,7 @@ enum elf_member {
 
 typedef enum elf_member elf_member_t;
 
-int elf32_offsets[] = {
+static int elf32_offsets[] = {
 	0,
 
 	offsetof(Elf32_Dyn, d_tag), offsetof(Elf32_Dyn, d_un.d_ptr),
@@ -124,7 +124,7 @@ int elf32_offsets[] = {
 	offsetof(Elf32_Rela, r_addend)
 };
 
-int elf64_offsets[] = {
+static int elf64_offsets[] = {
 	0,
 
 	offsetof(Elf64_Dyn, d_tag), offsetof(Elf64_Dyn, d_un.d_ptr),
@@ -266,23 +266,23 @@ e_machines(u_int mach)
 	return (machdesc);
 }
 
-const char *e_types[] = {
+static const char *e_types[] = {
 	"ET_NONE", "ET_REL", "ET_EXEC", "ET_DYN", "ET_CORE"
 };
 
-const char *ei_versions[] = {
+static const char *ei_versions[] = {
 	"EV_NONE", "EV_CURRENT"
 };
 
-const char *ei_classes[] = {
+static const char *ei_classes[] = {
 	"ELFCLASSNONE", "ELFCLASS32", "ELFCLASS64"
 };
 
-const char *ei_data[] = {
+static const char *ei_data[] = {
 	"ELFDATANONE", "ELFDATA2LSB", "ELFDATA2MSB"
 };
 
-const char *ei_abis[256] = {
+static const char *ei_abis[256] = {
 	"ELFOSABI_SYSV", "ELFOSABI_HPUX", "ELFOSABI_NETBSD", "ELFOSABI_LINUX",
 	"ELFOSABI_HURD", "ELFOSABI_86OPEN", "ELFOSABI_SOLARIS", "ELFOSABI_AIX",
 	"ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64",
@@ -290,12 +290,12 @@ const char *ei_abis[256] = {
 	[255] = "ELFOSABI_STANDALONE"
 };
 
-const char *p_types[] = {
+static const char *p_types[] = {
 	"PT_NULL", "PT_LOAD", "PT_DYNAMIC", "PT_INTERP", "PT_NOTE",
 	"PT_SHLIB", "PT_PHDR", "PT_TLS"
 };
 
-const char *p_flags[] = {
+static const char *p_flags[] = {
 	"", "PF_X", "PF_W", "PF_X|PF_W", "PF_R", "PF_X|PF_R", "PF_W|PF_R",
 	"PF_X|PF_W|PF_R"
 };
@@ -339,44 +339,47 @@ sh_types(u_int64_t sht) {
 	}
 }
 
-const char *sh_flags[] = {
+static const char *sh_flags[] = {
 	"", "SHF_WRITE", "SHF_ALLOC", "SHF_WRITE|SHF_ALLOC", "SHF_EXECINSTR",
 	"SHF_WRITE|SHF_EXECINSTR", "SHF_ALLOC|SHF_EXECINSTR",
 	"SHF_WRITE|SHF_ALLOC|SHF_EXECINSTR"
 };
 
-const char *st_types[] = {
+static const char *st_types[] = {
 	"STT_NOTYPE", "STT_OBJECT", "STT_FUNC", "STT_SECTION", "STT_FILE"
 };
 
-const char *st_bindings[] = {
+static const char *st_bindings[] = {
 	"STB_LOCAL", "STB_GLOBAL", "STB_WEAK"
 };
 
-char *dynstr;
-char *shstrtab;
-char *strtab;
-FILE *out;
-
-u_int64_t elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_quarter(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member);
-u_int64_t elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member);
-
-void elf_print_ehdr(Elf32_Ehdr *e);
-void elf_print_phdr(Elf32_Ehdr *e, void *p);
-void elf_print_shdr(Elf32_Ehdr *e, void *sh);
-void elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str);
-void elf_print_dynamic(Elf32_Ehdr *e, void *sh);
-void elf_print_rel(Elf32_Ehdr *e, void *r);
-void elf_print_rela(Elf32_Ehdr *e, void *ra);
-void elf_print_interp(Elf32_Ehdr *e, void *p);
-void elf_print_got(Elf32_Ehdr *e, void *sh);
-void elf_print_hash(Elf32_Ehdr *e, void *sh);
-void elf_print_note(Elf32_Ehdr *e, void *sh);
+static char *dynstr;
+static char *shstrtab;
+static char *strtab;
+static FILE *out;
+
+static u_int64_t elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member);
+static u_int64_t elf_get_quarter(Elf32_Ehdr *e, void *base,
+    elf_member_t member);
+#if 0
+static u_int64_t elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member);
+#endif
+static u_int64_t elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member);
+static u_int64_t elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member);
+
+static void elf_print_ehdr(Elf32_Ehdr *e);
+static void elf_print_phdr(Elf32_Ehdr *e, void *p);
+static void elf_print_shdr(Elf32_Ehdr *e, void *sh);
+static void elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str);
+static void elf_print_dynamic(Elf32_Ehdr *e, void *sh);
+static void elf_print_rel(Elf32_Ehdr *e, void *r);
+static void elf_print_rela(Elf32_Ehdr *e, void *ra);
+static void elf_print_interp(Elf32_Ehdr *e, void *p);
+static void elf_print_got(Elf32_Ehdr *e, void *sh);
+static void elf_print_hash(Elf32_Ehdr *e, void *sh);
+static void elf_print_note(Elf32_Ehdr *e, void *sh);
 
-void usage(void);
+static void usage(void);
 
 int
 main(int ac, char **av)
@@ -551,7 +554,7 @@ main(int ac, char **av)
 	return 0;
 }
 
-void
+static void
 elf_print_ehdr(Elf32_Ehdr *e)
 {
 	u_int64_t class;
@@ -606,7 +609,7 @@ elf_print_ehdr(Elf32_Ehdr *e)
 	fprintf(out, "\te_shstrndx: %jd\n", (intmax_t)shstrndx);
 }
 
-void
+static void
 elf_print_phdr(Elf32_Ehdr *e, void *p)
 {
 	u_int64_t phentsize;
@@ -648,7 +651,7 @@ elf_print_phdr(Elf32_Ehdr *e, void *p)
 	}
 }
 
-void
+static void
 elf_print_shdr(Elf32_Ehdr *e, void *sh)
 {
 	u_int64_t shentsize;
@@ -696,7 +699,7 @@ elf_print_shdr(Elf32_Ehdr *e, void *sh)
 	}
 }
 
-void
+static void
 elf_print_symtab(Elf32_Ehdr *e, void *sh, char *str)
 {
 	u_int64_t offset;
@@ -735,7 +738,7 @@ elf_print_symtab(Elf32_Ehdr *e, void *sh
 	}
 }
 
-void
+static void
 elf_print_dynamic(Elf32_Ehdr *e, void *sh)
 {
 	u_int64_t offset;
@@ -795,7 +798,7 @@ elf_print_dynamic(Elf32_Ehdr *e, void *s
 	}
 }
 
-void
+static void
 elf_print_rela(Elf32_Ehdr *e, void *sh)
 {
 	u_int64_t offset;
@@ -827,7 +830,7 @@ elf_print_rela(Elf32_Ehdr *e, void *sh)
 	}
 }
 
-void
+static void
 elf_print_rel(Elf32_Ehdr *e, void *sh)
 {
 	u_int64_t offset;
@@ -856,7 +859,7 @@ elf_print_rel(Elf32_Ehdr *e, void *sh)
 	}
 }
 
-void
+static void
 elf_print_interp(Elf32_Ehdr *e, void *p)
 {
 	u_int64_t offset;
@@ -868,7 +871,7 @@ elf_print_interp(Elf32_Ehdr *e, void *p)
 	fprintf(out, "\t%s\n", s);
 }
 
-void
+static void
 elf_print_got(Elf32_Ehdr *e, void *sh)
 {
 	u_int64_t offset;
@@ -891,12 +894,12 @@ elf_print_got(Elf32_Ehdr *e, void *sh)
 	}
 }
 
-void
+static void
 elf_print_hash(Elf32_Ehdr *e __unused, void *sh __unused)
 {
 }
 
-void
+static void
 elf_print_note(Elf32_Ehdr *e, void *sh)
 {
 	u_int64_t offset;
@@ -922,7 +925,7 @@ elf_print_note(Elf32_Ehdr *e, void *sh)
 	}
 }
 
-u_int64_t
+static u_int64_t
 elf_get_byte(Elf32_Ehdr *e, void *base, elf_member_t member)
 {
 	u_int64_t val;
@@ -942,7 +945,7 @@ elf_get_byte(Elf32_Ehdr *e, void *base, 
 	return val;
 }
 
-u_int64_t
+static u_int64_t
 elf_get_quarter(Elf32_Ehdr *e, void *base, elf_member_t member)
 {
 	u_int64_t val;
@@ -982,7 +985,8 @@ elf_get_quarter(Elf32_Ehdr *e, void *bas
 	return val;
 }
 
-u_int64_t
+#if 0
+static u_int64_t
 elf_get_half(Elf32_Ehdr *e, void *base, elf_member_t member)
 {
 	u_int64_t val;
@@ -1021,8 +1025,9 @@ elf_get_half(Elf32_Ehdr *e, void *base, 
 
 	return val;
 }
+#endif
 
-u_int64_t
+static u_int64_t
 elf_get_word(Elf32_Ehdr *e, void *base, elf_member_t member)
 {
 	u_int64_t val;
@@ -1062,7 +1067,7 @@ elf_get_word(Elf32_Ehdr *e, void *base, 
 	return val;
 }
 
-u_int64_t
+static u_int64_t
 elf_get_quad(Elf32_Ehdr *e, void *base, elf_member_t member)
 {
 	u_int64_t val;
@@ -1102,7 +1107,7 @@ elf_get_quad(Elf32_Ehdr *e, void *base, 
 	return val;
 }
 
-void
+static void
 usage(void)
 {
 	fprintf(stderr, "usage: elfdump -a | -cdeGhinprs [-w file] file\n");

Modified: head/usr.bin/fetch/fetch.c
==============================================================================
--- head/usr.bin/fetch/fetch.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/fetch/fetch.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -51,47 +51,47 @@ __FBSDID("$FreeBSD$");
 #define TIMEOUT		120
 
 /* Option flags */
-int	 A_flag;	/*    -A: do not follow 302 redirects */
-int	 a_flag;	/*    -a: auto retry */
-off_t	 B_size;	/*    -B: buffer size */
-int	 b_flag;	/*!   -b: workaround TCP bug */
-char    *c_dirname;	/*    -c: remote directory */
-int	 d_flag;	/*    -d: direct connection */
-int	 F_flag;	/*    -F: restart without checking mtime  */
-char	*f_filename;	/*    -f: file to fetch */
-char	*h_hostname;	/*    -h: host to fetch from */
-int	 i_flag;	/*    -i: specify input file for mtime comparison */
-char	*i_filename;	/*        name of input file */
-int	 l_flag;	/*    -l: link rather than copy file: URLs */
-int	 m_flag;	/* -[Mm]: mirror mode */
-char	*N_filename;	/*    -N: netrc file name */
-int	 n_flag;	/*    -n: do not preserve modification time */
-int	 o_flag;	/*    -o: specify output file */
-int	 o_directory;	/*        output file is a directory */
-char	*o_filename;	/*        name of output file */
-int	 o_stdout;	/*        output file is stdout */
-int	 once_flag;	/*    -1: stop at first successful file */
-int	 p_flag;	/* -[Pp]: use passive FTP */
-int	 R_flag;	/*    -R: don't delete partially transferred files */
-int	 r_flag;	/*    -r: restart previously interrupted transfer */
-off_t	 S_size;        /*    -S: require size to match */
-int	 s_flag;        /*    -s: show size, don't fetch */
-long	 T_secs;	/*    -T: transfer timeout in seconds */
-int	 t_flag;	/*!   -t: workaround TCP bug */
-int	 U_flag;	/*    -U: do not use high ports */
-int	 v_level = 1;	/*    -v: verbosity level */
-int	 v_tty;		/*        stdout is a tty */
-pid_t	 pgrp;		/*        our process group */
-long	 w_secs;	/*    -w: retry delay */
-int	 family = PF_UNSPEC;	/* -[46]: address family to use */
-
-int	 sigalrm;	/* SIGALRM received */
-int	 siginfo;	/* SIGINFO received */
-int	 sigint;	/* SIGINT received */
-
-long	 ftp_timeout = TIMEOUT;		/* default timeout for FTP transfers */
-long	 http_timeout = TIMEOUT;	/* default timeout for HTTP transfers */
-char	*buf;		/* transfer buffer */
+static int	 A_flag;	/*    -A: do not follow 302 redirects */
+static int	 a_flag;	/*    -a: auto retry */
+static off_t	 B_size;	/*    -B: buffer size */
+static int	 b_flag;	/*!   -b: workaround TCP bug */
+static char    *c_dirname;	/*    -c: remote directory */
+static int	 d_flag;	/*    -d: direct connection */
+static int	 F_flag;	/*    -F: restart without checking mtime  */
+static char	*f_filename;	/*    -f: file to fetch */
+static char	*h_hostname;	/*    -h: host to fetch from */
+static int	 i_flag;	/*    -i: specify file for mtime comparison */
+static char	*i_filename;	/*        name of input file */
+static int	 l_flag;	/*    -l: link rather than copy file: URLs */
+static int	 m_flag;	/* -[Mm]: mirror mode */
+static char	*N_filename;	/*    -N: netrc file name */
+static int	 n_flag;	/*    -n: do not preserve modification time */
+static int	 o_flag;	/*    -o: specify output file */
+static int	 o_directory;	/*        output file is a directory */
+static char	*o_filename;	/*        name of output file */
+static int	 o_stdout;	/*        output file is stdout */
+static int	 once_flag;	/*    -1: stop at first successful file */
+static int	 p_flag;	/* -[Pp]: use passive FTP */
+static int	 R_flag;	/*    -R: don't delete partial files */
+static int	 r_flag;	/*    -r: restart previous transfer */
+static off_t	 S_size;        /*    -S: require size to match */
+static int	 s_flag;        /*    -s: show size, don't fetch */
+static long	 T_secs;	/*    -T: transfer timeout in seconds */
+static int	 t_flag;	/*!   -t: workaround TCP bug */
+static int	 U_flag;	/*    -U: do not use high ports */
+static int	 v_level = 1;	/*    -v: verbosity level */
+static int	 v_tty;		/*        stdout is a tty */
+static pid_t	 pgrp;		/*        our process group */
+static long	 w_secs;	/*    -w: retry delay */
+static int	 family = PF_UNSPEC;	/* -[46]: address family to use */
+
+static int	 sigalrm;	/* SIGALRM received */
+static int	 siginfo;	/* SIGINFO received */
+static int	 sigint;	/* SIGINT received */
+
+static long	 ftp_timeout = TIMEOUT;	/* default timeout for FTP transfers */
+static long	 http_timeout = TIMEOUT;/* default timeout for HTTP transfers */
+static char	*buf;		/* transfer buffer */
 
 
 /*

Modified: head/usr.bin/finger/finger.c
==============================================================================
--- head/usr.bin/finger/finger.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/finger/finger.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -87,7 +87,8 @@ __FBSDID("$FreeBSD$");
 
 DB *db;
 time_t now;
-int entries, gflag, kflag, lflag, mflag, pplan, sflag, oflag;
+static int kflag, mflag, sflag;
+int entries, gflag, lflag, pplan, oflag;
 sa_family_t family = PF_UNSPEC;
 int d_first = -1;
 char tbuf[1024];

Modified: head/usr.bin/gencat/gencat.c
==============================================================================
--- head/usr.bin/gencat/gencat.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/gencat/gencat.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -96,7 +96,7 @@ struct _setT {
 	LIST_ENTRY(_setT) entries;
 };
 
-LIST_HEAD(sethead, _setT) sethead;
+static LIST_HEAD(sethead, _setT) sethead;
 static struct _setT *curSet;
 
 static char *curline = NULL;

Modified: head/usr.bin/grep/grep.c
==============================================================================
--- head/usr.bin/grep/grep.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/grep/grep.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -82,14 +82,15 @@ int		 eflags = REG_STARTEND;
 bool		 matchall;
 
 /* Searching patterns */
-unsigned int	 patterns, pattern_sz;
+unsigned int	 patterns;
+static unsigned int pattern_sz;
 struct pat	*pattern;
 regex_t		*r_pattern;
 fastmatch_t	*fg_pattern;
 
 /* Filename exclusion/inclusion patterns */
-unsigned int	 fpatterns, fpattern_sz;
-unsigned int	 dpatterns, dpattern_sz;
+unsigned int	fpatterns, dpatterns;
+static unsigned int fpattern_sz, dpattern_sz;
 struct epat	*dpattern, *fpattern;
 
 /* For regex errors  */

Modified: head/usr.bin/grep/regex/xmalloc.c
==============================================================================
--- head/usr.bin/grep/regex/xmalloc.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/grep/regex/xmalloc.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -39,9 +39,9 @@ typedef struct {
 } hashTable;
 
 static int xmalloc_peak;
-int xmalloc_current;
+static int xmalloc_current;
 static int xmalloc_peak_blocks;
-int xmalloc_current_blocks;
+static int xmalloc_current_blocks;
 static int xmalloc_fail_after;
 
 #define TABLE_BITS 8

Modified: head/usr.bin/gzip/zuncompress.c
==============================================================================
--- head/usr.bin/gzip/zuncompress.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/gzip/zuncompress.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -77,10 +77,9 @@ static char_type magic_header[] =
 static char_type rmask[9] =
 	{0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
 
-/* XXX zuncompress global */
-off_t total_compressed_bytes;
-size_t compressed_prelen;
-char *compressed_pre;
+static off_t total_compressed_bytes;
+static size_t compressed_prelen;
+static char *compressed_pre;
 
 struct s_zstate {
 	FILE *zs_fp;			/* File stream for I/O */

Modified: head/usr.bin/msgs/msgs.c
==============================================================================
--- head/usr.bin/msgs/msgs.c	Fri Oct 19 14:29:03 2012	(r241736)
+++ head/usr.bin/msgs/msgs.c	Fri Oct 19 14:49:42 2012	(r241737)
@@ -105,47 +105,47 @@ __FBSDID("$FreeBSD$");
 
 typedef	char	bool;
 
-FILE	*msgsrc;
-FILE	*newmsg;
-const char *sep = "-";
-char	inbuf[BUFSIZ];
-char	fname[MAXPATHLEN];
-char	cmdbuf[MAXPATHLEN + MAXPATHLEN];
-char	subj[128];
-char	from[128];
-char	date[128];
-char	*ptr;
-char	*in;
-bool	local;
-bool	ruptible;
-bool	totty;
-bool	seenfrom;
-bool	seensubj;
-bool	blankline;
-bool	printing = NO;
-bool	mailing = NO;
-bool	quitit = NO;
-bool	sending = NO;
-bool	intrpflg = NO;
-uid_t	uid;
-int	msg;
-int	prevmsg;
-int	lct;
-int	nlines;
-int	Lpp = 0;
-time_t	t;
-time_t	keep;
+static FILE	*msgsrc;
+static FILE	*newmsg;
+static const char *sep = "-";
+static char	inbuf[BUFSIZ];
+static char	fname[MAXPATHLEN];
+static char	cmdbuf[MAXPATHLEN + MAXPATHLEN];
+static char	subj[128];
+static char	from[128];
+static char	date[128];
+static char	*ptr;
+static char	*in;
+static bool	local;
+static bool	ruptible;
+static bool	totty;
+static bool	seenfrom;
+static bool	seensubj;
+static bool	blankline;
+static bool	printing = NO;
+static bool	mailing = NO;
+static bool	quitit = NO;
+static bool	sending = NO;
+static bool	intrpflg = NO;
+static uid_t	uid;
+static int	msg;
+static int	prevmsg;
+static int	lct;
+static int	nlines;
+static int	Lpp = 0;
+static time_t	t;
+static time_t	keep;
 
 /* option initialization */
-bool	hdrs = NO;
-bool	qopt = NO;
-bool	hush = NO;
-bool	send_msg = NO;
-bool	locomode = NO;
-bool	use_pager = NO;
-bool	clean = NO;
-bool	lastcmd = NO;
-jmp_buf	tstpbuf;
+static bool	hdrs = NO;
+static bool	qopt = NO;
+static bool	hush = NO;
+static bool	send_msg = NO;
+static bool	locomode = NO;
+static bool	use_pager = NO;
+static bool	clean = NO;
+static bool	lastcmd = NO;
+static jmp_buf	tstpbuf;
 
 static void	ask(const char *);
 static void	gfrsub(FILE *);
@@ -155,7 +155,7 @@ static char	*nxtfld(char *);
 static void	onsusp(int);
 static void	onintr(int);
 static void	prmesg(int);
-static void usage(void);
+static void	usage(void);
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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