summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/dd/conv_tab.c5
-rw-r--r--libexec/rpc.rusersd/Makefile2
-rw-r--r--libexec/rpc.rusersd/extern.h38
-rw-r--r--libexec/rpc.rusersd/rusers_proc.c6
-rw-r--r--libexec/rpc.rusersd/rusersd.c2
-rw-r--r--libexec/talkd/announce.c2
-rw-r--r--libexec/talkd/extern.h3
-rw-r--r--libexec/talkd/process.c2
-rw-r--r--libexec/talkd/table.c5
-rw-r--r--libexec/talkd/talkd.c10
-rw-r--r--usr.bin/cksum/extern.h3
-rw-r--r--usr.bin/m4/expr.c2
-rw-r--r--usr.bin/m4/extern.h1
-rw-r--r--usr.bin/m4/gnum4.c2
-rw-r--r--usr.bin/m4/main.c2
-rw-r--r--usr.bin/m4/parser.y9
-rw-r--r--usr.sbin/mtree/mtree.c3
-rw-r--r--usr.sbin/newsyslog/newsyslog.c44
-rw-r--r--usr.sbin/services_mkdb/Makefile2
-rw-r--r--usr.sbin/services_mkdb/extern.h32
-rw-r--r--usr.sbin/services_mkdb/services_mkdb.c2
-rw-r--r--usr.sbin/services_mkdb/uniq.c2
22 files changed, 133 insertions, 46 deletions
diff --git a/bin/dd/conv_tab.c b/bin/dd/conv_tab.c
index 9bfd10921823..07449fd0f572 100644
--- a/bin/dd/conv_tab.c
+++ b/bin/dd/conv_tab.c
@@ -41,6 +41,11 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <stdint.h>
+
+#include "dd.h"
+#include "extern.h"
+
/*
* There are currently six tables:
*
diff --git a/libexec/rpc.rusersd/Makefile b/libexec/rpc.rusersd/Makefile
index 6305343ff9f9..df2be379d086 100644
--- a/libexec/rpc.rusersd/Makefile
+++ b/libexec/rpc.rusersd/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
PROG = rpc.rusersd
-SRCS = rusersd.c rusers_proc.c
+SRCS = rusersd.c rusers_proc.c extern.h
MAN = rpc.rusersd.8
DPADD= ${LIBRPCSVC} ${LIBUTIL}
diff --git a/libexec/rpc.rusersd/extern.h b/libexec/rpc.rusersd/extern.h
new file mode 100644
index 000000000000..b1a8309bf85f
--- /dev/null
+++ b/libexec/rpc.rusersd/extern.h
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 1993, John Brezak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+extern int from_inetd;
+
+void rusers_service(struct svc_req *, SVCXPRT *);
diff --git a/libexec/rpc.rusersd/rusers_proc.c b/libexec/rpc.rusersd/rusers_proc.c
index 6b34fa72cd28..ff2ebc4c63ed 100644
--- a/libexec/rpc.rusersd/rusers_proc.c
+++ b/libexec/rpc.rusersd/rusers_proc.c
@@ -53,6 +53,8 @@ static const char rcsid[] =
#endif
#include <rpcsvc/rnusers.h>
+#include "extern.h"
+
#ifndef _PATH_DEV
#define _PATH_DEV "/dev"
#endif
@@ -61,10 +63,6 @@ static utmpidle utmp_idle[MAXUSERS];
static utmp old_utmp[MAXUSERS];
static struct utmpx utmp_list[MAXUSERS];
-extern int from_inetd;
-
-void rusers_service(struct svc_req *, SVCXPRT *);
-
#ifdef XIDLE
static Display *dpy;
diff --git a/libexec/rpc.rusersd/rusersd.c b/libexec/rpc.rusersd/rusersd.c
index 009bbfde85e4..0ad468650a9f 100644
--- a/libexec/rpc.rusersd/rusersd.c
+++ b/libexec/rpc.rusersd/rusersd.c
@@ -43,7 +43,7 @@ static const char rcsid[] =
#include <syslog.h>
#include <rpcsvc/rnusers.h>
-extern void rusers_service(struct svc_req *, SVCXPRT *);
+#include "extern.h"
int from_inetd = 1;
diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c
index 869197e5c52c..83c96b724c01 100644
--- a/libexec/talkd/announce.c
+++ b/libexec/talkd/announce.c
@@ -60,8 +60,6 @@ static const char rcsid[] =
#include "ttymsg.h"
#include "extern.h"
-extern char hostname[];
-
/*
* Announce an invitation to talk.
*/
diff --git a/libexec/talkd/extern.h b/libexec/talkd/extern.h
index cb231a95d134..a91cb25a71e1 100644
--- a/libexec/talkd/extern.h
+++ b/libexec/talkd/extern.h
@@ -25,6 +25,9 @@
* $FreeBSD$
*/
+extern int debug;
+extern char hostname[];
+
int announce(CTL_MSG *, const char *);
int delete_invite(u_int32_t);
void do_announce(CTL_MSG *, CTL_RESPONSE *);
diff --git a/libexec/talkd/process.c b/libexec/talkd/process.c
index 18ddc42aff1f..1c5108fc7d59 100644
--- a/libexec/talkd/process.c
+++ b/libexec/talkd/process.c
@@ -63,8 +63,6 @@ static const char rcsid[] =
#include "extern.h"
-extern int debug;
-
void
process_request(CTL_MSG *mp, CTL_RESPONSE *rp)
{
diff --git a/libexec/talkd/table.c b/libexec/talkd/table.c
index dcaed9c2a3e3..5ad7b61bdf7a 100644
--- a/libexec/talkd/table.c
+++ b/libexec/talkd/table.c
@@ -64,8 +64,7 @@ static const char rcsid[] =
#define NIL ((TABLE_ENTRY *)0)
-extern int debug;
-struct timeval tp;
+static struct timeval tp;
typedef struct table_entry TABLE_ENTRY;
@@ -78,7 +77,7 @@ struct table_entry {
static void delete(TABLE_ENTRY *);
-TABLE_ENTRY *table = NIL;
+static TABLE_ENTRY *table = NIL;
/*
* Look in the table for an invitation that matches the current
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index e81cec6eb74d..56ce4414c106 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -69,13 +69,13 @@ static const char rcsid[] =
#include "extern.h"
-CTL_MSG request;
-CTL_RESPONSE response;
+static CTL_MSG request;
+static CTL_RESPONSE response;
-int debug = 0;
-long lastmsgtime;
+int debug = 0;
+static long lastmsgtime;
-char hostname[MAXHOSTNAMELEN];
+char hostname[MAXHOSTNAMELEN];
#define TIMEOUT 30
#define MAXIDLE 120
diff --git a/usr.bin/cksum/extern.h b/usr.bin/cksum/extern.h
index 7cfe5079d092..84ec8d2cd153 100644
--- a/usr.bin/cksum/extern.h
+++ b/usr.bin/cksum/extern.h
@@ -32,6 +32,9 @@
#include <sys/cdefs.h>
+extern uint32_t crc_total;
+extern uint32_t crc32_total;
+
__BEGIN_DECLS
int crc(int, uint32_t *, off_t *);
void pcrc(char *, uint32_t, off_t);
diff --git a/usr.bin/m4/expr.c b/usr.bin/m4/expr.c
index 85bd8f1e912b..8a64217b5768 100644
--- a/usr.bin/m4/expr.c
+++ b/usr.bin/m4/expr.c
@@ -24,7 +24,7 @@ __FBSDID("$FreeBSD$");
#include "extern.h"
int32_t end_result;
-const char *copy_toeval;
+static const char *copy_toeval;
int yyerror(const char *msg);
extern void yy_scan_string(const char *);
diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h
index 9054d22860b7..ccb2e77045e7 100644
--- a/usr.bin/m4/extern.h
+++ b/usr.bin/m4/extern.h
@@ -43,6 +43,7 @@ extern unsigned long expansion_id;
/* expr.c */
extern int expr(const char *);
+extern int32_t end_result;
/* gnum4.c */
extern void addtoincludepath(const char *);
diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c
index 861279c06f31..342751a15215 100644
--- a/usr.bin/m4/gnum4.c
+++ b/usr.bin/m4/gnum4.c
@@ -59,7 +59,7 @@ int mimic_gnu = 0;
* Then M4PATH env variable
*/
-struct path_entry {
+static struct path_entry {
char *name;
struct path_entry *next;
} *first, *last;
diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c
index 6b3cad43855d..c8de97c8bbf4 100644
--- a/usr.bin/m4/main.c
+++ b/usr.bin/m4/main.c
@@ -85,7 +85,7 @@ struct keyblk {
int ktyp; /* keyword type */
};
-struct keyblk keywrds[] = { /* m4 keywords to be installed */
+static struct keyblk keywrds[] = { /* m4 keywords to be installed */
{ "include", INCLTYPE },
{ "sinclude", SINCTYPE },
{ "define", DEFITYPE },
diff --git a/usr.bin/m4/parser.y b/usr.bin/m4/parser.y
index 14959738bdff..2239cf39c18d 100644
--- a/usr.bin/m4/parser.y
+++ b/usr.bin/m4/parser.y
@@ -17,10 +17,17 @@
*
* $FreeBSD$
*/
+
#include <math.h>
+#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
+
+#include "mdef.h"
+#include "extern.h"
+
#define YYSTYPE int32_t
-extern int32_t end_result;
+
extern int yylex(void);
extern int yyerror(const char *);
%}
diff --git a/usr.sbin/mtree/mtree.c b/usr.sbin/mtree/mtree.c
index 49e3e6b56405..e90a5bbca1d3 100644
--- a/usr.sbin/mtree/mtree.c
+++ b/usr.sbin/mtree/mtree.c
@@ -52,7 +52,8 @@ __FBSDID("$FreeBSD$");
#include "extern.h"
int ftsoptions = FTS_PHYSICAL;
-int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag, wflag;
+int dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, wflag;
+static int cflag, Uflag;
u_int keys;
char fullpath[MAXPATHLEN];
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 67a363e55114..875f9113abdc 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -145,7 +145,7 @@ struct compress_types {
const char *path; /* Path to compression program */
};
-const struct compress_types compress_type[COMPRESS_TYPES] = {
+static const struct compress_types compress_type[COMPRESS_TYPES] = {
{ "", "", "" }, /* no compression */
{ "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP }, /* gzip compression */
{ "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2 }, /* bzip2 compression */
@@ -206,42 +206,44 @@ typedef enum {
} fk_entry;
STAILQ_HEAD(cflist, conf_entry);
-SLIST_HEAD(swlisthead, sigwork_entry) swhead = SLIST_HEAD_INITIALIZER(swhead);
-SLIST_HEAD(zwlisthead, zipwork_entry) zwhead = SLIST_HEAD_INITIALIZER(zwhead);
+static SLIST_HEAD(swlisthead, sigwork_entry) swhead =
+ SLIST_HEAD_INITIALIZER(swhead);
+static SLIST_HEAD(zwlisthead, zipwork_entry) zwhead =
+ SLIST_HEAD_INITIALIZER(zwhead);
STAILQ_HEAD(ilist, include_entry);
int dbg_at_times; /* -D Show details of 'trim_at' code */
-int archtodir = 0; /* Archive old logfiles to other directory */
-int createlogs; /* Create (non-GLOB) logfiles which do not */
+static int archtodir = 0; /* Archive old logfiles to other directory */
+static int createlogs; /* Create (non-GLOB) logfiles which do not */
/* already exist. 1=='for entries with */
/* C flag', 2=='for all entries'. */
int verbose = 0; /* Print out what's going on */
-int needroot = 1; /* Root privs are necessary */
+static int needroot = 1; /* Root privs are necessary */
int noaction = 0; /* Don't do anything, just show it */
-int norotate = 0; /* Don't rotate */
-int nosignal; /* Do not send any signals */
-int enforcepid = 0; /* If PID file does not exist or empty, do nothing */
-int force = 0; /* Force the trim no matter what */
-int rotatereq = 0; /* -R = Always rotate the file(s) as given */
+static int norotate = 0; /* Don't rotate */
+static int nosignal; /* Do not send any signals */
+static int enforcepid = 0; /* If PID file does not exist or empty, do nothing */
+static int force = 0; /* Force the trim no matter what */
+static int rotatereq = 0; /* -R = Always rotate the file(s) as given */
/* on the command (this also requires */
/* that a list of files *are* given on */
/* the run command). */
-char *requestor; /* The name given on a -R request */
-char *timefnamefmt = NULL; /* Use time based filenames instead of .0 etc */
-char *archdirname; /* Directory path to old logfiles archive */
-char *destdir = NULL; /* Directory to treat at root for logs */
-const char *conf; /* Configuration file to use */
+static char *requestor; /* The name given on a -R request */
+static char *timefnamefmt = NULL;/* Use time based filenames instead of .0 */
+static char *archdirname; /* Directory path to old logfiles archive */
+static char *destdir = NULL; /* Directory to treat at root for logs */
+static const char *conf; /* Configuration file to use */
struct ptime_data *dbg_timenow; /* A "timenow" value set via -D option */
-struct ptime_data *timenow; /* The time to use for checking at-fields */
+static struct ptime_data *timenow; /* The time to use for checking at-fields */
#define DAYTIME_LEN 16
-char daytime[DAYTIME_LEN]; /* The current time in human readable form,
- * used for rotation-tracking messages. */
-char hostname[MAXHOSTNAMELEN]; /* hostname */
+static char daytime[DAYTIME_LEN];/* The current time in human readable form,
+ * used for rotation-tracking messages. */
+static char hostname[MAXHOSTNAMELEN]; /* hostname */
-const char *path_syslogpid = _PATH_SYSLOGPID;
+static const char *path_syslogpid = _PATH_SYSLOGPID;
static struct cflist *get_worklist(char **files);
static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,
diff --git a/usr.sbin/services_mkdb/Makefile b/usr.sbin/services_mkdb/Makefile
index 659cdb8163e5..e61c6dfa7d16 100644
--- a/usr.sbin/services_mkdb/Makefile
+++ b/usr.sbin/services_mkdb/Makefile
@@ -2,7 +2,7 @@
PROG= services_mkdb
MAN= services_mkdb.8
-SRCS= services_mkdb.c uniq.c
+SRCS= services_mkdb.c uniq.c extern.h
DPADD+= ${LIBUTIL}
LDADD+= -lutil
diff --git a/usr.sbin/services_mkdb/extern.h b/usr.sbin/services_mkdb/extern.h
new file mode 100644
index 000000000000..f0976ef87a06
--- /dev/null
+++ b/usr.sbin/services_mkdb/extern.h
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+extern const HASHINFO hinfo;
diff --git a/usr.sbin/services_mkdb/services_mkdb.c b/usr.sbin/services_mkdb/services_mkdb.c
index f4cf62ac414f..d81488cf15eb 100644
--- a/usr.sbin/services_mkdb/services_mkdb.c
+++ b/usr.sbin/services_mkdb/services_mkdb.c
@@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <stringlist.h>
+#include "extern.h"
+
static char tname[MAXPATHLEN];
#define PMASK 0xffff
diff --git a/usr.sbin/services_mkdb/uniq.c b/usr.sbin/services_mkdb/uniq.c
index 0674b4bbc407..b6d06d44fd9c 100644
--- a/usr.sbin/services_mkdb/uniq.c
+++ b/usr.sbin/services_mkdb/uniq.c
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <fcntl.h>
-extern const HASHINFO hinfo;
+#include "extern.h"
void uniq(const char *);
static int comp(const char *, char **, size_t *);