diff options
-rw-r--r-- | lib/args.c | 2 | ||||
-rw-r--r-- | lib/deflate.c | 12 | ||||
-rw-r--r-- | lib/dirtree.c | 4 | ||||
-rw-r--r-- | lib/env.c | 2 | ||||
-rw-r--r-- | lib/lib.c | 2 | ||||
-rw-r--r-- | lib/lib.h | 4 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | toys/lsb/seq.c | 6 | ||||
-rw-r--r-- | toys/other/timeout.c | 2 | ||||
-rw-r--r-- | toys/other/watch.c | 10 | ||||
-rw-r--r-- | toys/other/watchdog.c | 3 | ||||
-rw-r--r-- | toys/posix/chgrp.c | 2 | ||||
-rw-r--r-- | toys/posix/logger.c | 3 | ||||
-rw-r--r-- | toys/posix/patch.c | 2 | ||||
-rw-r--r-- | toys/posix/ps.c | 2 | ||||
-rw-r--r-- | toys/posix/test.c | 2 |
16 files changed, 31 insertions, 29 deletions
@@ -228,7 +228,7 @@ static int gotflag(struct getoptflagstate *gof, struct opts *opt, int shrt) // Parse this command's options string into struct getoptflagstate, which // includes a struct opts linked list in reverse order (I.E. right-to-left) -int parse_optflaglist(struct getoptflagstate *gof) +static int parse_optflaglist(struct getoptflagstate *gof) { char *options = toys.which->options; long *nextarg = (long *)&this; diff --git a/lib/deflate.c b/lib/deflate.c index 8c724429..cdc4f8d3 100644 --- a/lib/deflate.c +++ b/lib/deflate.c @@ -37,7 +37,7 @@ struct bitbuf { }; // malloc a struct bitbuf -struct bitbuf *bitbuf_init(int fd, int size) +static struct bitbuf *bitbuf_init(int fd, int size) { struct bitbuf *bb = xzalloc(sizeof(struct bitbuf)+size); @@ -49,7 +49,7 @@ struct bitbuf *bitbuf_init(int fd, int size) // Advance bitpos without the overhead of recording bits // Loads more data when input buffer empty -void bitbuf_skip(struct bitbuf *bb, int bits) +static void bitbuf_skip(struct bitbuf *bb, int bits) { int pos = bb->bitpos + bits, len = bb->len << 3; @@ -75,7 +75,7 @@ static inline int bitbuf_bit(struct bitbuf *bb) } // Fetch the next X bits from the bitbuf, little endian -unsigned bitbuf_get(struct bitbuf *bb, int bits) +static unsigned bitbuf_get(struct bitbuf *bb, int bits) { int result = 0, offset = 0; @@ -98,7 +98,7 @@ unsigned bitbuf_get(struct bitbuf *bb, int bits) return result; } -void bitbuf_flush(struct bitbuf *bb) +static void bitbuf_flush(struct bitbuf *bb) { if (!bb->bitpos) return; @@ -107,7 +107,7 @@ void bitbuf_flush(struct bitbuf *bb) bb->bitpos = 0; } -void bitbuf_put(struct bitbuf *bb, int data, int len) +static void bitbuf_put(struct bitbuf *bb, int data, int len) { while (len) { int click = bb->bitpos >> 3, blow, blen; @@ -411,7 +411,7 @@ static int is_gzip(struct bitbuf *bb) return 1; } -void gzip_crc(struct deflate *dd, char *data, int len) +static void gzip_crc(struct deflate *dd, char *data, int len) { int i; unsigned crc, *crc_table = dd->crctable; diff --git a/lib/dirtree.c b/lib/dirtree.c index 8c3b6a1c..43ecbd85 100644 --- a/lib/dirtree.c +++ b/lib/dirtree.c @@ -113,8 +113,8 @@ int dirtree_parentfd(struct dirtree *node) // returns NULL. If !callback return top node unchanged. // If !new return DIRTREE_ABORTVAL -struct dirtree *dirtree_handle_callback(struct dirtree *new, - int (*callback)(struct dirtree *node)) +static struct dirtree *dirtree_handle_callback(struct dirtree *new, + int (*callback)(struct dirtree *node)) { int flags; @@ -8,7 +8,7 @@ extern char **environ; // Returns the number of bytes taken by the environment variables. For use // when calculating the maximum bytes of environment+argument data that can // be passed to exec for find(1) and xargs(1). -long environ_bytes() +long environ_bytes(void) { long bytes = sizeof(char *); char **ev; @@ -926,7 +926,7 @@ void sigatexit(void *handler) } // Output a nicely formatted table of all the signals. -void list_signals() +void list_signals(void) { int i = 0, count = 0; unsigned cols = 80; @@ -287,7 +287,7 @@ int human_readable(char *buf, unsigned long long num, int style); // env.c -long environ_bytes(); +long environ_bytes(void); char *xsetenv(char *name, char *val); void xunsetenv(char *name); char *xpop_env(char *name); // because xpopenv() looks like xpopen_v() @@ -404,7 +404,7 @@ struct mtab_list *xgetmountlist(char *path); void generic_signal(int signal); void exit_signal(int signal); void sigatexit(void *handler); -void list_signals(); +void list_signals(void); mode_t string_to_mode(char *mode_str, mode_t base); void mode_to_string(mode_t mode, char *buf); @@ -146,7 +146,7 @@ void toy_init(struct toy_list *which, char *argv[]) // Run an internal toybox command. // Only returns if it can't run command internally, otherwise xexit() when done. -void toy_exec_which(struct toy_list *which, char *argv[]) +static void toy_exec_which(struct toy_list *which, char *argv[]) { // Return if we can't find it (which includes no multiplexer case), if (!which || (which->flags&TOYFLAG_NOFORK)) return; diff --git a/toys/lsb/seq.c b/toys/lsb/seq.c index beeaed3f..7a931c64 100644 --- a/toys/lsb/seq.c +++ b/toys/lsb/seq.c @@ -53,7 +53,8 @@ static double parsef(char *s) } // fast integer conversion to decimal string -char *itoa(char *s, int i) +// TODO move to lib? +static char *itoa(char *s, int i) { char buf[16], *ff = buf; unsigned n = i; @@ -69,10 +70,9 @@ char *itoa(char *s, int i) return s; } -char *flush_toybuf(char *ss) +static char *flush_toybuf(char *ss) { if (ss-toybuf<TT.buflen) return ss; - xwrite(1, toybuf, ss-toybuf); return toybuf; diff --git a/toys/other/timeout.c b/toys/other/timeout.c index 55b3dca1..1e125300 100644 --- a/toys/other/timeout.c +++ b/toys/other/timeout.c @@ -55,7 +55,7 @@ static void handler(int i) // timeval inexplicably makes up a new type for microseconds, despite timespec's // nanoseconds field (needing to store 1000* the range) using "long". Bravo. -void xparsetimeval(char *s, struct timeval *tv) +static void xparsetimeval(char *s, struct timeval *tv) { long ll; diff --git a/toys/other/watch.c b/toys/other/watch.c index fa5e71c5..af650045 100644 --- a/toys/other/watch.c +++ b/toys/other/watch.c @@ -33,7 +33,7 @@ GLOBALS( ) // When a child process exits, stop tracking them. Handle errors for -be -void watch_child(int sig) +static void watch_child(int sig) { int status; pid_t pid = wait(&status); @@ -41,8 +41,8 @@ void watch_child(int sig) status = WIFEXITED(status) ? WEXITSTATUS(status) : WTERMSIG(status)+127; if (status) { // TODO should this be beep()? - if (toys.optflags&FLAG_b) putchar('\b'); - if (toys.optflags&FLAG_e) { + if (FLAG(b)) putchar('\b'); + if (FLAG(e)) { printf("Exit status %d\r\n", status); tty_reset(); _exit(status); @@ -55,7 +55,7 @@ void watch_child(int sig) // Return early for low-ascii characters with special behavior, // discard remaining low ascii, escape other unprintable chars normally -int watch_escape(FILE *out, int cols, int wc) +static int watch_escape(FILE *out, int cols, int wc) { if (wc==27 || (wc>=7 && wc<=13)) return -1; if (wc < 32) return 0; @@ -99,7 +99,7 @@ void watch_main(void) start_redraw(&width, &height); // redraw the header - if (!(toys.optflags&FLAG_t)) { + if (!FLAG(t)) { time_t t = time(0); int pad, ctimelen; diff --git a/toys/other/watchdog.c b/toys/other/watchdog.c index 232d82c0..0402d3ee 100644 --- a/toys/other/watchdog.c +++ b/toys/other/watchdog.c @@ -29,7 +29,8 @@ GLOBALS( int fd; ) -void safe_shutdown(int ignored) { +static void safe_shutdown(int ignored) +{ write(TT.fd, "V", 1); close(TT.fd); error_exit("safely exited watchdog."); diff --git a/toys/posix/chgrp.c b/toys/posix/chgrp.c index 1e56d973..807ac824 100644 --- a/toys/posix/chgrp.c +++ b/toys/posix/chgrp.c @@ -100,7 +100,7 @@ void chgrp_main(void) if (CFG_TOYBOX_FREE && ischown) free(own); } -void chown_main() +void chown_main(void) { chgrp_main(); } diff --git a/toys/posix/logger.c b/toys/posix/logger.c index fae3fddb..906d64f4 100644 --- a/toys/posix/logger.c +++ b/toys/posix/logger.c @@ -30,7 +30,8 @@ GLOBALS( // find str in names[], accepting unambiguous short matches // returns offset into array of match, or -1 if no match -int arrayfind(char *str, char *names[], int len) +// TODO: move to lib? +static int arrayfind(char *str, char *names[], int len) { int j, i, ll = 0, maybe = -1; diff --git a/toys/posix/patch.c b/toys/posix/patch.c index e0f13dd7..f0aad4ee 100644 --- a/toys/posix/patch.c +++ b/toys/posix/patch.c @@ -259,7 +259,7 @@ done: } // read a filename that has been quoted or escaped -char *unquote_file(char *filename) +static char *unquote_file(char *filename) { char *s = filename, *t; diff --git a/toys/posix/ps.c b/toys/posix/ps.c index 7013dc57..304fe006 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -1280,7 +1280,7 @@ static void default_ko(char *s, void *fields, char *err, struct arg_list *arg) if (x) help_help(); } -void common_setup(void) +static void common_setup(void) { char buf[128]; int i; diff --git a/toys/posix/test.c b/toys/posix/test.c index d1ea1663..3fadf3ad 100644 --- a/toys/posix/test.c +++ b/toys/posix/test.c @@ -49,7 +49,7 @@ config TEST_GLUE #include "toys.h" // Consume 3, 2, or 1 argument test, returning result and *count used. -int do_test(char **args, int *count) +static int do_test(char **args, int *count) { char c, *s; int i; |