diff options
author | ed <ed@FreeBSD.org> | 2012-10-19 05:43:38 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2012-10-19 05:43:38 +0000 |
commit | fbb83e78c0ca90b09e1e9c0a76030f46f419dcaf (patch) | |
tree | 4ffbcf3b1f945e0ae5715cc8c2500ff622b14872 /bin | |
parent | c6ac8508b2ea2c486313c4fbfef377e83807af8f (diff) | |
download | FreeBSD-src-fbb83e78c0ca90b09e1e9c0a76030f46f419dcaf.zip FreeBSD-src-fbb83e78c0ca90b09e1e9c0a76030f46f419dcaf.tar.gz |
Fix warnings found by -Wmising-variable-declarations.
This self-written compiler warning, which is hopefully going to be
committed into LLVM sources soon, warns about potentially missing
`static' keywords, similar to -Wmissing-prototypes.
- bin/pax: Move external declaration of chdname and s_mask into extern.h.
- bin/setfacl: Move setfacl.c-specific stuff out of setfacl.h.
- sbin/mount_fusefs: Remove char *progname; use getprogname().
- others: add `static' where possible.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ed/buf.c | 12 | ||||
-rw-r--r-- | bin/ed/cbc.c | 20 | ||||
-rw-r--r-- | bin/ed/glbl.c | 10 | ||||
-rw-r--r-- | bin/ed/io.c | 4 | ||||
-rw-r--r-- | bin/ed/main.c | 31 | ||||
-rw-r--r-- | bin/ed/sub.c | 10 | ||||
-rw-r--r-- | bin/ed/undo.c | 6 | ||||
-rw-r--r-- | bin/getfacl/getfacl.c | 2 | ||||
-rw-r--r-- | bin/pax/ar_io.c | 1 | ||||
-rw-r--r-- | bin/pax/ar_subs.c | 1 | ||||
-rw-r--r-- | bin/pax/extern.h | 3 | ||||
-rw-r--r-- | bin/pax/options.c | 1 | ||||
-rw-r--r-- | bin/rcp/rcp.c | 15 | ||||
-rw-r--r-- | bin/setfacl/setfacl.c | 29 | ||||
-rw-r--r-- | bin/setfacl/setfacl.h | 32 |
15 files changed, 90 insertions, 87 deletions
diff --git a/bin/ed/buf.c b/bin/ed/buf.c index b4b78a5..2f3559a 100644 --- a/bin/ed/buf.c +++ b/bin/ed/buf.c @@ -35,10 +35,10 @@ __FBSDID("$FreeBSD$"); #include "ed.h" -FILE *sfp; /* scratch file pointer */ -off_t sfseek; /* scratch file position */ -int seek_write; /* seek before writing */ -line_t buffer_head; /* incore buffer */ +static FILE *sfp; /* scratch file pointer */ +static off_t sfseek; /* scratch file position */ +static int seek_write; /* seek before writing */ +static line_t buffer_head; /* incore buffer */ /* get_sbuf_line: get a line of text from the scratch file; return pointer to the text */ @@ -188,7 +188,7 @@ get_addressed_line_node(long n) extern int newline_added; -char sfn[15] = ""; /* scratch file name */ +static char sfn[15] = ""; /* scratch file name */ /* open_sbuf: open scratch file */ int @@ -244,7 +244,7 @@ quit(int n) } -unsigned char ctab[256]; /* character translation table */ +static unsigned char ctab[256]; /* character translation table */ /* init_buffers: open scratch buffer; initialize line queue */ void diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c index 52e9999..08e48cd 100644 --- a/bin/ed/cbc.c +++ b/bin/ed/cbc.c @@ -68,28 +68,24 @@ __FBSDID("$FreeBSD$"); * global variables and related macros */ -enum { /* encrypt, decrypt, authenticate */ - MODE_ENCRYPT, MODE_DECRYPT, MODE_AUTHENTICATE -} mode = MODE_ENCRYPT; - #ifdef DES -DES_cblock ivec; /* initialization vector */ -DES_cblock pvec; /* padding vector */ +static DES_cblock ivec; /* initialization vector */ +static DES_cblock pvec; /* padding vector */ #endif -char bits[] = { /* used to extract bits from a char */ +static char bits[] = { /* used to extract bits from a char */ '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' }; -int pflag; /* 1 to preserve parity bits */ +static int pflag; /* 1 to preserve parity bits */ #ifdef DES -DES_key_schedule schedule; /* expanded DES key */ +static DES_key_schedule schedule; /* expanded DES key */ #endif -unsigned char des_buf[8]; /* shared buffer for get_des_char/put_des_char */ -int des_ct = 0; /* count for get_des_char/put_des_char */ -int des_n = 0; /* index for put_des_char/get_des_char */ +static unsigned char des_buf[8];/* shared buffer for get_des_char/put_des_char */ +static int des_ct = 0; /* count for get_des_char/put_des_char */ +static int des_n = 0; /* index for put_des_char/get_des_char */ /* init_des_cipher: initialize DES */ void diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c index 11dcc19..5524700 100644 --- a/bin/ed/glbl.c +++ b/bin/ed/glbl.c @@ -135,11 +135,11 @@ exec_global(int interact, int gflag) } -line_t **active_list; /* list of lines active in a global command */ -long active_last; /* index of last active line in active_list */ -long active_size; /* size of active_list */ -long active_ptr; /* active_list index (non-decreasing) */ -long active_ndx; /* active_list index (modulo active_last) */ +static line_t **active_list; /* list of lines active in a global command */ +static long active_last; /* index of last active line in active_list */ +static long active_size; /* size of active_list */ +static long active_ptr; /* active_list index (non-decreasing) */ +static long active_ndx; /* active_list index (modulo active_last) */ /* set_active_node: add a line node to the global-active list */ int diff --git a/bin/ed/io.c b/bin/ed/io.c index 63fe10c..29c5612 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -61,8 +61,8 @@ read_file(char *fn, long n) extern int des; -char *sbuf; /* file i/o buffer */ -int sbufsz; /* file i/o buffer size */ +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 */ /* read_stream: read a stream into the editor buffer; return status */ diff --git a/bin/ed/main.c b/bin/ed/main.c index f414d40..98bb300 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -66,40 +66,40 @@ __FBSDID("$FreeBSD$"); #ifdef _POSIX_SOURCE -sigjmp_buf env; +static sigjmp_buf env; #else -jmp_buf env; +static jmp_buf env; #endif /* static buffers */ char stdinbuf[1]; /* stdin buffer */ -char *shcmd; /* shell command buffer */ -int shcmdsz; /* shell command buffer size */ -int shcmdi; /* shell command buffer index */ +static char *shcmd; /* shell command buffer */ +static int shcmdsz; /* shell command buffer size */ +static int shcmdi; /* shell command buffer index */ char *ibuf; /* ed command-line buffer */ int ibufsz; /* ed command-line buffer size */ char *ibufp; /* pointer to ed command-line buffer */ /* global flags */ int des = 0; /* if set, use crypt(3) for i/o */ -int garrulous = 0; /* if set, print all error messages */ +static int garrulous = 0; /* if set, print all error messages */ int isbinary; /* if set, buffer contains ASCII NULs */ int isglobal; /* if set, doing a global command */ int modified; /* if set, buffer modified since last write */ int mutex = 0; /* if set, signals set "sigflags" */ -int red = 0; /* if set, restrict shell/directory access */ +static int red = 0; /* if set, restrict shell/directory access */ int scripted = 0; /* if set, suppress diagnostics */ int sigflags = 0; /* if set, signals received while mutex set */ -int sigactive = 0; /* if set, signal handlers are enabled */ +static int sigactive = 0; /* if set, signal handlers are enabled */ -char old_filename[PATH_MAX] = ""; /* default filename */ +static char old_filename[PATH_MAX] = ""; /* default filename */ long current_addr; /* current address in editor buffer */ long addr_last; /* last address in editor buffer */ int lineno; /* script line number */ -const char *prompt; /* command-line prompt */ -const char *dps = "*"; /* default command-line prompt */ +static const char *prompt; /* command-line prompt */ +static const char *dps = "*"; /* default command-line prompt */ -const char usage[] = "usage: %s [-] [-sx] [-p string] [file]\n"; +static const char *usage = "usage: %s [-] [-sx] [-p string] [file]\n"; /* ed: line editor */ int @@ -254,7 +254,8 @@ top: /*NOTREACHED*/ } -long first_addr, second_addr, addr_cnt; +long first_addr, second_addr; +static long addr_cnt; /* extract_addr_range: get line addresses from the command buffer until an illegal address is seen; return status */ @@ -1241,8 +1242,8 @@ display_lines(long from, long to, int gflag) #define MAXMARK 26 /* max number of marks */ -line_t *mark[MAXMARK]; /* line markers */ -int markno; /* line marker count */ +static line_t *mark[MAXMARK]; /* line markers */ +static int markno; /* line marker count */ /* mark_line_node: set a line node mark */ int diff --git a/bin/ed/sub.c b/bin/ed/sub.c index 1c44328..d12a5c9 100644 --- a/bin/ed/sub.c +++ b/bin/ed/sub.c @@ -32,9 +32,9 @@ __FBSDID("$FreeBSD$"); #include "ed.h" -char *rhbuf; /* rhs substitution buffer */ -int rhbufsz; /* rhs substitution buffer size */ -int rhbufi; /* rhs substitution buffer index */ +static char *rhbuf; /* rhs substitution buffer */ +static int rhbufsz; /* rhs substitution buffer size */ +static int rhbufi; /* rhs substitution buffer index */ /* extract_subst_tail: extract substitution tail from the command buffer */ int @@ -105,8 +105,8 @@ extract_subst_template(void) } -char *rbuf; /* substitute_matching_text buffer */ -int rbufsz; /* substitute_matching_text buffer size */ +static char *rbuf; /* substitute_matching_text buffer */ +static int rbufsz; /* substitute_matching_text buffer size */ /* search_and_replace: for each line in a range, change text matching a pattern according to a substitution template; return status */ diff --git a/bin/ed/undo.c b/bin/ed/undo.c index 6a8ca9e..603e39f 100644 --- a/bin/ed/undo.c +++ b/bin/ed/undo.c @@ -32,9 +32,9 @@ __FBSDID("$FreeBSD$"); #define USIZE 100 /* undo stack size */ -undo_t *ustack = NULL; /* undo stack */ -long usize = 0; /* stack size variable */ -long u_p = 0; /* undo stack pointer */ +static undo_t *ustack = NULL; /* undo stack */ +static long usize = 0; /* stack size variable */ +static long u_p = 0; /* undo stack pointer */ /* push_undo_stack: return pointer to initialized undo node */ undo_t * diff --git a/bin/getfacl/getfacl.c b/bin/getfacl/getfacl.c index ea376c7..45d6b45 100644 --- a/bin/getfacl/getfacl.c +++ b/bin/getfacl/getfacl.c @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -int more_than_one = 0; +static int more_than_one = 0; static void usage(void) diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index c3b35a7..4914c85 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -85,7 +85,6 @@ const char *gzip_program; /* name of gzip program */ static pid_t zpid = -1; /* pid of child process */ static int get_phys(void); -extern sigset_t s_mask; static void ar_start_gzip(int, const char *, int); /* diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c index bc808ab..4a3e5e7 100644 --- a/bin/pax/ar_subs.c +++ b/bin/pax/ar_subs.c @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); static void wr_archive(ARCHD *, int is_app); static int get_arc(void); static int next_head(ARCHD *); -extern sigset_t s_mask; /* * Routines which control the overall operation modes of pax as specified by diff --git a/bin/pax/extern.h b/bin/pax/extern.h index e716792..4375694 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -186,7 +186,7 @@ void options(int, char **); OPLIST * opt_next(void); int opt_add(const char *); int bad_opt(void); -char *chdname; +extern char *chdname; /* * pat_rep.c @@ -231,6 +231,7 @@ extern int exit_val; extern int docrc; extern char *dirptr; extern const char *argv0; +extern sigset_t s_mask; extern FILE *listf; extern char *tempfile; extern char *tempbase; diff --git a/bin/pax/options.c b/bin/pax/options.c index 5fd641f..32d967e 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -81,6 +81,7 @@ static void cpio_usage(void); #define GETLINE_OUT_OF_MEM 2 static int getline_error; +char *chdname; #define GZIP_CMD "gzip" /* command to run as gzip */ #define COMPRESS_CMD "compress" /* command to run as compress */ diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c index 3357705..186dde6 100644 --- a/bin/rcp/rcp.c +++ b/bin/rcp/rcp.c @@ -76,12 +76,13 @@ __FBSDID("$FreeBSD$"); #define OPTIONS "46dfprt" -struct passwd *pwd; -u_short port; -uid_t userid; -int errs, rem; -int pflag, iamremote, iamrecursive, targetshouldbedirectory; -int family = PF_UNSPEC; +static struct passwd *pwd; +static u_short port; +static uid_t userid; +static int errs, rem; +int iamremote; +static int pflag, iamrecursive, targetshouldbedirectory; +static int family = PF_UNSPEC; static int argc_copy; static const char **argv_copy; @@ -89,7 +90,7 @@ static const char **argv_copy; static char period[] = "."; #define CMDNEEDS 64 -char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */ +static char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */ int response(void); void rsource(char *, struct stat *); diff --git a/bin/setfacl/setfacl.c b/bin/setfacl/setfacl.c index e1f3023..c69f0ba 100644 --- a/bin/setfacl/setfacl.c +++ b/bin/setfacl/setfacl.c @@ -42,6 +42,35 @@ __FBSDID("$FreeBSD$"); #include "setfacl.h" +/* file operations */ +#define OP_MERGE_ACL 0x00 /* merge acl's (-mM) */ +#define OP_REMOVE_DEF 0x01 /* remove default acl's (-k) */ +#define OP_REMOVE_EXT 0x02 /* remove extended acl's (-b) */ +#define OP_REMOVE_ACL 0x03 /* remove acl's (-xX) */ +#define OP_REMOVE_BY_NUMBER 0x04 /* remove acl's (-xX) by acl entry number */ +#define OP_ADD_ACL 0x05 /* add acls entries at a given position */ + +/* TAILQ entry for acl operations */ +struct sf_entry { + uint op; + acl_t acl; + uint entry_number; + TAILQ_ENTRY(sf_entry) next; +}; +static TAILQ_HEAD(, sf_entry) entrylist; + +/* TAILQ entry for files */ +struct sf_file { + const char *filename; + TAILQ_ENTRY(sf_file) next; +}; +static TAILQ_HEAD(, sf_file) filelist; + +uint have_mask; +uint need_mask; +uint have_stdin; +uint n_flag; + static void add_filename(const char *filename); static void usage(void); diff --git a/bin/setfacl/setfacl.h b/bin/setfacl/setfacl.h index 84fdd92..c4afbfc 100644 --- a/bin/setfacl/setfacl.h +++ b/bin/setfacl/setfacl.h @@ -33,30 +33,6 @@ #include <sys/acl.h> #include <sys/queue.h> -/* file operations */ -#define OP_MERGE_ACL 0x00 /* merge acl's (-mM) */ -#define OP_REMOVE_DEF 0x01 /* remove default acl's (-k) */ -#define OP_REMOVE_EXT 0x02 /* remove extended acl's (-b) */ -#define OP_REMOVE_ACL 0x03 /* remove acl's (-xX) */ -#define OP_REMOVE_BY_NUMBER 0x04 /* remove acl's (-xX) by acl entry number */ -#define OP_ADD_ACL 0x05 /* add acls entries at a given position */ - -/* TAILQ entry for acl operations */ -struct sf_entry { - uint op; - acl_t acl; - uint entry_number; - TAILQ_ENTRY(sf_entry) next; -}; -TAILQ_HEAD(, sf_entry) entrylist; - -/* TAILQ entry for files */ -struct sf_file { - const char *filename; - TAILQ_ENTRY(sf_file) next; -}; -TAILQ_HEAD(, sf_file) filelist; - /* files.c */ acl_t get_acl_from_file(const char *filename); /* merge.c */ @@ -74,9 +50,9 @@ void *zmalloc(size_t size); const char *brand_name(int brand); int branding_mismatch(int brand1, int brand2); -uint have_mask; -uint need_mask; -uint have_stdin; -uint n_flag; +extern uint have_mask; +extern uint need_mask; +extern uint have_stdin; +extern uint n_flag; #endif /* _SETFACL_H */ |