Mark command-local functions static.
authorRob Landley <rob@landley.net>
Mon, 3 Aug 2015 02:51:41 +0000 (21:51 -0500)
committerRob Landley <rob@landley.net>
Mon, 3 Aug 2015 02:51:41 +0000 (21:51 -0500)
15 files changed:
toys/other/acpi.c
toys/other/blkid.c
toys/other/chcon.c
toys/other/lspci.c
toys/other/rev.c
toys/other/tac.c
toys/other/taskset.c
toys/other/vmstat.c
toys/posix/chmod.c
toys/posix/cmp.c
toys/posix/date.c
toys/posix/id.c
toys/posix/nl.c
toys/posix/split.c
toys/posix/strings.c

index 44fd03b..363cfb9 100644 (file)
@@ -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;
 
index 725f163..c18cc9c 100644 (file)
@@ -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;
index a2bbb66..6dbdd13 100644 (file)
@@ -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;
 
index c9b22ab..077ce75 100644 (file)
@@ -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;
index b5720a3..4cf7214 100644 (file)
@@ -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;
 
index 538d1b0..d5f72fd 100644 (file)
@@ -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;
index 2851923..4ade5f1 100644 (file)
@@ -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++;
index c11e46b..9a38e45 100644 (file)
@@ -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",
index 64369b6..4292439 100644 (file)
@@ -39,7 +39,7 @@ GLOBALS(
   char *mode;
 )
 
-int do_chmod(struct dirtree *try)
+static int do_chmod(struct dirtree *try)
 {
   mode_t mode;
 
index 2dae113..829da75 100644 (file)
@@ -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;
index d4c4524..3093f81 100644 (file)
@@ -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;
 
index aa43072..01610bc 100644 (file)
@@ -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;
index c7e7b92..60c0a52 100644 (file)
@@ -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);
index aabf931..075a414 100644 (file)
@@ -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;
index a872cf6..e87ccde 100644 (file)
@@ -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;