More -Wmissing-variable-declarations fixes.

In addition to adding missing `static' keywords:
- bin/dd: Pull in `extern.h' to guarantee consistency with source file.
- libexec/rpc.rusersd: Move shared globals into an extern.h.
- libexec/talkd: Move `debug' and `hostname' into extern.h.
- usr.bin/cksum: Put counters in extern.h, as they are used by ckdist/mtree.
- usr.bin/m4: Move `end_result' into extern.h.
- usr.sbin/services_mkdb: Move shared globals into an extern.h.
This commit is contained in:
Ed Schouten 2012-10-20 10:33:15 +00:00
parent 186475e2dd
commit eccad22277
22 changed files with 133 additions and 46 deletions

View File

@ -41,6 +41,11 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <stdint.h>
#include "dd.h"
#include "extern.h"
/*
* There are currently six tables:
*

View File

@ -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}

View File

@ -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 *);

View File

@ -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;

View File

@ -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;

View File

@ -60,8 +60,6 @@ static const char rcsid[] =
#include "ttymsg.h"
#include "extern.h"
extern char hostname[];
/*
* Announce an invitation to talk.
*/

View File

@ -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 *);

View File

@ -63,8 +63,6 @@ static const char rcsid[] =
#include "extern.h"
extern int debug;
void
process_request(CTL_MSG *mp, CTL_RESPONSE *rp)
{

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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 *);

View File

@ -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 *);

View File

@ -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;

View File

@ -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 },

View File

@ -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 *);
%}

View File

@ -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];

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <stringlist.h>
#include "extern.h"
static char tname[MAXPATHLEN];
#define PMASK 0xffff

View File

@ -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 *);