From 664c417af5d16e217557468ba747a369e8e1ab6b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 7 Feb 2021 17:19:44 -0600 Subject: Add lots of "static" annotations, make a couple things use FLAG() macros, etc. --- toys/lsb/seq.c | 6 +++--- toys/other/timeout.c | 2 +- toys/other/watch.c | 10 +++++----- toys/other/watchdog.c | 3 ++- toys/posix/chgrp.c | 2 +- toys/posix/logger.c | 3 ++- toys/posix/patch.c | 2 +- toys/posix/ps.c | 2 +- toys/posix/test.c | 2 +- 9 files changed, 17 insertions(+), 15 deletions(-) (limited to 'toys') 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=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; -- cgit v1.2.3