Another cleanup patch from Jeff Garzik <jgarzik@mandrakesoft.com>
authorEric Andersen <andersen@codepoet.org>
Mon, 19 Mar 2001 23:49:41 +0000 (23:49 -0000)
committerEric Andersen <andersen@codepoet.org>
Mon, 19 Mar 2001 23:49:41 +0000 (23:49 -0000)
14 files changed:
cmdedit.c
console-tools/loadacm.c
coreutils/expr.c
coreutils/test.c
coreutils/usleep.c
expr.c
loadacm.c
mkfs_minix.c
networking/telnet.c
shell/cmdedit.c
telnet.c
test.c
usleep.c
util-linux/mkfs_minix.c

index ffe7afab2a86a2f362ef5e3e92d14d6cea6a9ae9..e317b86fa69149d5a3a9352bd938efd7b5267056 100644 (file)
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -113,7 +113,7 @@ void *xcalloc(size_t size, size_t se)
 }
 
 #define error_msg(s, d)                   fprintf(stderr, s, d)
-#endif
+#endif /* TEST */
 
 
 struct history {
index 81b973b026f8dc6b88f131f2ae2c5bf237df4cdd..e5a29b6a1755013405dd18b529f3f661af2c5b3f 100644 (file)
 typedef unsigned short unicode;
 
 static long int ctoi(unsigned char *s, int *is_unicode);
-int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
-int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
-unicode utf8_to_ucs2(char *buf);
-int screen_map_load(int fd, FILE * fp);
+static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
+static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
+static unicode utf8_to_ucs2(char *buf);
+static int screen_map_load(int fd, FILE * fp);
 
 int loadacm_main(int argc, char **argv)
 {
@@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv)
        return EXIT_SUCCESS;
 }
 
-int screen_map_load(int fd, FILE * fp)
+static int screen_map_load(int fd, FILE * fp)
 {
        struct stat stbuf;
        unicode wbuf[E_TABSZ];
@@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp)
  *
  * FIXME: ignores everything after second word
  */
-int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
+static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
 {
        char buffer[256];                       /* line buffer reading file */
        char *p, *q;                            /* 1st + 2nd words in line */
@@ -213,7 +213,7 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
 }
 
 
-int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
+static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
 {
        char buffer[256];
        int in, on;
@@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
  *
  * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
  */
-long int ctoi(unsigned char *s, int *is_unicode)
+static long int ctoi(unsigned char *s, int *is_unicode)
 {
        int i;
        size_t ls;
@@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode)
 }
 
 
-void saveoldmap(int fd, char *omfil)
-{
-       FILE *fp;
-       char buf[E_TABSZ];
-
-#ifdef GIO_UNISCRNMAP
-       unicode xbuf[E_TABSZ];
-       int is_old_map = 0;
-
-       if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) {
-               perror_msg("GIO_UNISCRNMAP ioctl error");
-#endif
-               if (ioctl(fd, GIO_SCRNMAP, buf))
-                       perror_msg_and_die("GIO_SCRNMAP ioctl error");
-               else
-                       is_old_map = 1;
-#ifdef GIO_UNISCRNMAP
-       }
-#endif
-
-       fp = xfopen(omfil, "w");
-#ifdef GIO_UNISCRNMAP
-       if (is_old_map) {
-#endif
-               if (fwrite(buf, E_TABSZ, 1, fp) != 1)
-                       perror_msg_and_die("Error writing map to file");
-#ifdef GIO_UNISCRNMAP
-       } else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) {
-               perror_msg_and_die("Error writing map to file");
-       }
-#endif
-
-       fclose(fp);
-}
-
-unicode utf8_to_ucs2(char *buf)
+static unicode utf8_to_ucs2(char *buf)
 {
        int utf_count = 0;
        long utf_char = 0;
index 10aaa6be1fe4dfb32fd2c370b44dfadb594604e2..4a537bf33077d5490b6f3793a25d0a5f5ab0541e 100644 (file)
@@ -225,7 +225,7 @@ int name (l, r) VALUE *l; VALUE *r;         \
 }
 
 #define arithdivf(name, op)                    \
-int name (l, r) VALUE *l; VALUE *r;            \
+static int name (l, r) VALUE *l; VALUE *r;             \
 {                                              \
   if (!toarith (l) || !toarith (r))            \
     error_msg_and_die ( "non-numeric argument");       \
index ab9c23e4b629f718503afa073ab8b3ae169d09a6..79db8cbb62c65306c79d33b614fd6abd2fcea5e4 100644 (file)
@@ -110,10 +110,10 @@ enum token_types {
        PAREN
 };
 
-struct t_op {
+static const struct t_op {
        const char *op_text;
        short op_num, op_type;
-} const ops [] = {
+} ops [] = {
        {"-r",  FILRD,  UNOP},
        {"-w",  FILWR,  UNOP},
        {"-x",  FILEX,  UNOP},
index 92e4437c5d0194c2079d7c78024090c106198a38..6023bf430db3f05cb339bcefebcf3ebf010e9afd 100644 (file)
@@ -21,6 +21,8 @@
  *
  */
 
+/* getopt not needed */
+
 #include <stdlib.h>
 #include <unistd.h>
 #include "busybox.h"
diff --git a/expr.c b/expr.c
index 10aaa6be1fe4dfb32fd2c370b44dfadb594604e2..4a537bf33077d5490b6f3793a25d0a5f5ab0541e 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -225,7 +225,7 @@ int name (l, r) VALUE *l; VALUE *r;         \
 }
 
 #define arithdivf(name, op)                    \
-int name (l, r) VALUE *l; VALUE *r;            \
+static int name (l, r) VALUE *l; VALUE *r;             \
 {                                              \
   if (!toarith (l) || !toarith (r))            \
     error_msg_and_die ( "non-numeric argument");       \
index 81b973b026f8dc6b88f131f2ae2c5bf237df4cdd..e5a29b6a1755013405dd18b529f3f661af2c5b3f 100644 (file)
--- a/loadacm.c
+++ b/loadacm.c
 typedef unsigned short unicode;
 
 static long int ctoi(unsigned char *s, int *is_unicode);
-int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
-int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
-unicode utf8_to_ucs2(char *buf);
-int screen_map_load(int fd, FILE * fp);
+static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]);
+static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode);
+static unicode utf8_to_ucs2(char *buf);
+static int screen_map_load(int fd, FILE * fp);
 
 int loadacm_main(int argc, char **argv)
 {
@@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv)
        return EXIT_SUCCESS;
 }
 
-int screen_map_load(int fd, FILE * fp)
+static int screen_map_load(int fd, FILE * fp)
 {
        struct stat stbuf;
        unicode wbuf[E_TABSZ];
@@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp)
  *
  * FIXME: ignores everything after second word
  */
-int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
+static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
 {
        char buffer[256];                       /* line buffer reading file */
        char *p, *q;                            /* 1st + 2nd words in line */
@@ -213,7 +213,7 @@ int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode)
 }
 
 
-int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
+static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
 {
        char buffer[256];
        int in, on;
@@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[])
  *
  * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones.
  */
-long int ctoi(unsigned char *s, int *is_unicode)
+static long int ctoi(unsigned char *s, int *is_unicode)
 {
        int i;
        size_t ls;
@@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode)
 }
 
 
-void saveoldmap(int fd, char *omfil)
-{
-       FILE *fp;
-       char buf[E_TABSZ];
-
-#ifdef GIO_UNISCRNMAP
-       unicode xbuf[E_TABSZ];
-       int is_old_map = 0;
-
-       if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) {
-               perror_msg("GIO_UNISCRNMAP ioctl error");
-#endif
-               if (ioctl(fd, GIO_SCRNMAP, buf))
-                       perror_msg_and_die("GIO_SCRNMAP ioctl error");
-               else
-                       is_old_map = 1;
-#ifdef GIO_UNISCRNMAP
-       }
-#endif
-
-       fp = xfopen(omfil, "w");
-#ifdef GIO_UNISCRNMAP
-       if (is_old_map) {
-#endif
-               if (fwrite(buf, E_TABSZ, 1, fp) != 1)
-                       perror_msg_and_die("Error writing map to file");
-#ifdef GIO_UNISCRNMAP
-       } else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) {
-               perror_msg_and_die("Error writing map to file");
-       }
-#endif
-
-       fclose(fp);
-}
-
-unicode utf8_to_ucs2(char *buf)
+static unicode utf8_to_ucs2(char *buf)
 {
        int utf_count = 0;
        long utf_char = 0;
index a83fa796166dd10c96bc92970fdf6132559b4f83..70374eae908248bfd62a3c42f74661cc29e4139c 100644 (file)
@@ -382,7 +382,7 @@ static void mark_good_blocks(void)
                mark_zone(good_blocks_table[blk]);
 }
 
-inline int next(int zone)
+static int next(int zone)
 {
        if (!zone)
                zone = FIRSTZONE - 1;
index d47bf699b27bdc250e770d7ab3d3d4452e164994..edcc5081fd701697d3fe69723835dcbc58830d97 100644 (file)
@@ -85,7 +85,7 @@ enum {
 typedef unsigned char byte;
 
 /* use globals to reduce size ??? */ /* test this hypothesis later */
-struct Globalvars {
+static struct Globalvars {
        int             netfd; /* console fd:s are 0 and 1 (and 2) */
     /* same buffer used both for network and console read/write */
        char *  buf; /* allocating so static size is smaller */
@@ -108,7 +108,7 @@ struct Globalvars {
 struct Globalvars * Gptr;
 #define G (*Gptr)
 #else
-struct Globalvars G;
+static struct Globalvars G;
 #endif
 
 static inline void iacflush()
index ffe7afab2a86a2f362ef5e3e92d14d6cea6a9ae9..e317b86fa69149d5a3a9352bd938efd7b5267056 100644 (file)
@@ -113,7 +113,7 @@ void *xcalloc(size_t size, size_t se)
 }
 
 #define error_msg(s, d)                   fprintf(stderr, s, d)
-#endif
+#endif /* TEST */
 
 
 struct history {
index d47bf699b27bdc250e770d7ab3d3d4452e164994..edcc5081fd701697d3fe69723835dcbc58830d97 100644 (file)
--- a/telnet.c
+++ b/telnet.c
@@ -85,7 +85,7 @@ enum {
 typedef unsigned char byte;
 
 /* use globals to reduce size ??? */ /* test this hypothesis later */
-struct Globalvars {
+static struct Globalvars {
        int             netfd; /* console fd:s are 0 and 1 (and 2) */
     /* same buffer used both for network and console read/write */
        char *  buf; /* allocating so static size is smaller */
@@ -108,7 +108,7 @@ struct Globalvars {
 struct Globalvars * Gptr;
 #define G (*Gptr)
 #else
-struct Globalvars G;
+static struct Globalvars G;
 #endif
 
 static inline void iacflush()
diff --git a/test.c b/test.c
index ab9c23e4b629f718503afa073ab8b3ae169d09a6..79db8cbb62c65306c79d33b614fd6abd2fcea5e4 100644 (file)
--- a/test.c
+++ b/test.c
@@ -110,10 +110,10 @@ enum token_types {
        PAREN
 };
 
-struct t_op {
+static const struct t_op {
        const char *op_text;
        short op_num, op_type;
-} const ops [] = {
+} ops [] = {
        {"-r",  FILRD,  UNOP},
        {"-w",  FILWR,  UNOP},
        {"-x",  FILEX,  UNOP},
index 92e4437c5d0194c2079d7c78024090c106198a38..6023bf430db3f05cb339bcefebcf3ebf010e9afd 100644 (file)
--- a/usleep.c
+++ b/usleep.c
@@ -21,6 +21,8 @@
  *
  */
 
+/* getopt not needed */
+
 #include <stdlib.h>
 #include <unistd.h>
 #include "busybox.h"
index a83fa796166dd10c96bc92970fdf6132559b4f83..70374eae908248bfd62a3c42f74661cc29e4139c 100644 (file)
@@ -382,7 +382,7 @@ static void mark_good_blocks(void)
                mark_zone(good_blocks_table[blk]);
 }
 
-inline int next(int zone)
+static int next(int zone)
 {
        if (!zone)
                zone = FIRSTZONE - 1;