From 7a3f53ba446ae2600763ee37b7f8dcc91de3ec5f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 2 Aug 2015 21:51:41 -0500 Subject: Mark command-local functions static. --- toys/other/acpi.c | 17 +++++++---------- toys/other/blkid.c | 2 +- toys/other/chcon.c | 2 +- toys/other/lspci.c | 2 +- toys/other/rev.c | 2 +- toys/other/tac.c | 2 +- toys/other/taskset.c | 2 +- toys/other/vmstat.c | 2 +- toys/posix/chmod.c | 2 +- toys/posix/cmp.c | 2 +- toys/posix/date.c | 2 +- toys/posix/id.c | 2 +- toys/posix/nl.c | 2 +- toys/posix/split.c | 2 +- toys/posix/strings.c | 2 +- 15 files changed, 21 insertions(+), 24 deletions(-) diff --git a/toys/other/acpi.c b/toys/other/acpi.c index 44fd03b..363cfb9 100644 --- a/toys/other/acpi.c +++ b/toys/other/acpi.c @@ -25,10 +25,7 @@ config ACPI #include "toys.h" GLOBALS( - int ac; - int bat; - int therm; - int cool; + int ac, bat, therm, cool; char *cpath; ) @@ -44,7 +41,7 @@ int read_int_at(int dirfd, char *name) return ret; } -int acpi_callback(struct dirtree *tree) +static int acpi_callback(struct dirtree *tree) { int dfd, fd, len, on; @@ -85,11 +82,11 @@ done: return 0; } -int temp_callback(struct dirtree *tree) +static int temp_callback(struct dirtree *tree) { int dfd, temp; - if (tree->name[0]=='.') return 0; + if (*tree->name=='.') return 0; if (!tree->parent || !tree->parent->parent) return DIRTREE_RECURSE|DIRTREE_SYMFOLLOW; errno = 0; @@ -98,17 +95,17 @@ int temp_callback(struct dirtree *tree) if ((0 < (temp = read_int_at(dfd, "temp"))) || !errno) { //some tempertures are in milli-C, some in deci-C //reputedly some are in deci-K, but I have not seen them - if (((temp >= 1000) || (temp <= -1000)) && (temp%100 == 0)) - temp /= 100; + if (((temp >= 1000) || (temp <= -1000)) && (temp%100 == 0)) temp /= 100; printf("Thermal %d: %d.%d degrees C\n", TT.therm++, temp/10, temp%10); } close(dfd); } free(TT.cpath); + return 0; } -int cool_callback(struct dirtree *tree) +static int cool_callback(struct dirtree *tree) { int dfd=5, cur, max; diff --git a/toys/other/blkid.c b/toys/other/blkid.c index 725f163..c18cc9c 100644 --- a/toys/other/blkid.c +++ b/toys/other/blkid.c @@ -57,7 +57,7 @@ static const struct fstype fstypes[] = { }; /* TODO if no args use proc/partitions */ -void do_blkid(int fd, char *name) +static void do_blkid(int fd, char *name) { int off, i, j; char *type; diff --git a/toys/other/chcon.c b/toys/other/chcon.c index a2bbb66..6dbdd13 100644 --- a/toys/other/chcon.c +++ b/toys/other/chcon.c @@ -21,7 +21,7 @@ config CHCON #define FOR_chcon #include "toys.h" -int do_chcon(struct dirtree *try) +static int do_chcon(struct dirtree *try) { char *path, *con = *toys.optargs; diff --git a/toys/other/lspci.c b/toys/other/lspci.c index c9b22ab..077ce75 100644 --- a/toys/other/lspci.c +++ b/toys/other/lspci.c @@ -37,7 +37,7 @@ GLOBALS( FILE *db; ) -int do_lspci(struct dirtree *new) +static int do_lspci(struct dirtree *new) { char *p = toybuf, *vendor = toybuf+9, *device = toybuf+18, driver[256], *vbig = 0, *dbig = 0, **fields; diff --git a/toys/other/rev.c b/toys/other/rev.c index b5720a3..4cf7214 100644 --- a/toys/other/rev.c +++ b/toys/other/rev.c @@ -15,7 +15,7 @@ config REV #include "toys.h" -void do_rev(int fd, char *name) +static void do_rev(int fd, char *name) { char *c; diff --git a/toys/other/tac.c b/toys/other/tac.c index 538d1b0..d5f72fd 100644 --- a/toys/other/tac.c +++ b/toys/other/tac.c @@ -15,7 +15,7 @@ config TAC #include "toys.h" -void do_tac(int fd, char *name) +static void do_tac(int fd, char *name) { struct arg_list *list = NULL; char *c; diff --git a/toys/other/taskset.c b/toys/other/taskset.c index 2851923..4ade5f1 100644 --- a/toys/other/taskset.c +++ b/toys/other/taskset.c @@ -120,7 +120,7 @@ void taskset_main(void) } } -int do_nproc(struct dirtree *new) +static int do_nproc(struct dirtree *new) { if (!new->parent) return DIRTREE_RECURSE; if (!strncmp(new->name, "cpu", 3) && isdigit(new->name[3])) TT.nproc++; diff --git a/toys/other/vmstat.c b/toys/other/vmstat.c index c11e46b..9a38e45 100644 --- a/toys/other/vmstat.c +++ b/toys/other/vmstat.c @@ -39,7 +39,7 @@ struct vmstat_proc { // All the elements of vmstat_proc are the same size, so we can populate it as // a big array, then read the elements back out by name -void get_vmstat_proc(struct vmstat_proc *vmstat_proc) +static void get_vmstat_proc(struct vmstat_proc *vmstat_proc) { char *vmstuff[] = { "/proc/stat", "cpu ", 0, 0, 0, 0, 0, 0, "intr ", "ctxt ", "procs_running ", "procs_blocked ", "/proc/meminfo", diff --git a/toys/posix/chmod.c b/toys/posix/chmod.c index 64369b6..4292439 100644 --- a/toys/posix/chmod.c +++ b/toys/posix/chmod.c @@ -39,7 +39,7 @@ GLOBALS( char *mode; ) -int do_chmod(struct dirtree *try) +static int do_chmod(struct dirtree *try) { mode_t mode; diff --git a/toys/posix/cmp.c b/toys/posix/cmp.c index 2dae113..829da75 100644 --- a/toys/posix/cmp.c +++ b/toys/posix/cmp.c @@ -28,7 +28,7 @@ GLOBALS( // This handles opening the file and -void do_cmp(int fd, char *name) +static void do_cmp(int fd, char *name) { int i, len1, len2, min_len, size = sizeof(toybuf)/2; long byte_no = 1, line_no = 1; diff --git a/toys/posix/date.c b/toys/posix/date.c index d4c4524..3093f81 100644 --- a/toys/posix/date.c +++ b/toys/posix/date.c @@ -53,7 +53,7 @@ GLOBALS( // Handle default posix date format: mmddhhmm[[cc]yy] // returns 0 success, nonzero for error -int parse_posixdate(char *str, struct tm *tm) +static int parse_posixdate(char *str, struct tm *tm) { int len; diff --git a/toys/posix/id.c b/toys/posix/id.c index aa43072..01610bc 100644 --- a/toys/posix/id.c +++ b/toys/posix/id.c @@ -82,7 +82,7 @@ static void showid(char *header, unsigned u, char *s) printf("%s%u(%s)", header, u, s); } -void do_id(char *username) +static void do_id(char *username) { int flags, i, ngroups; struct passwd *pw; diff --git a/toys/posix/nl.c b/toys/posix/nl.c index c7e7b92..60c0a52 100644 --- a/toys/posix/nl.c +++ b/toys/posix/nl.c @@ -40,7 +40,7 @@ GLOBALS( long lcount; ) -void do_nl(int fd, char *name) +static void do_nl(int fd, char *name) { FILE *f = xfdopen(fd, "r"); int w = TT.w, slen = strlen(TT.s); diff --git a/toys/posix/split.c b/toys/posix/split.c index aabf931..075a414 100644 --- a/toys/posix/split.c +++ b/toys/posix/split.c @@ -35,7 +35,7 @@ GLOBALS( char *outfile; ) -void do_split(int infd, char *in) +static void do_split(int infd, char *in) { unsigned long bytesleft, linesleft, filenum, len, pos; int outfd = -1; diff --git a/toys/posix/strings.c b/toys/posix/strings.c index a872cf6..e87ccde 100644 --- a/toys/posix/strings.c +++ b/toys/posix/strings.c @@ -29,7 +29,7 @@ GLOBALS( long num; ) -void do_strings(int fd, char *filename) +static void do_strings(int fd, char *filename) { int nread, i, wlen = TT.num, count = 0; off_t offset = 0; -- cgit v1.2.3