diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-03-19 23:49:41 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-03-19 23:49:41 +0000 |
| commit | 8775faaeafdb04c8fc390a822a4588a95c98e4b2 (patch) | |
| tree | 1ccb6d69a226fdc1efb283cc1b0d2cc321f5b942 | |
| parent | 9fcedc7b123534eb437ac0366fbb2588862f9d4c (diff) | |
| download | busybox-w32-8775faaeafdb04c8fc390a822a4588a95c98e4b2.tar.gz busybox-w32-8775faaeafdb04c8fc390a822a4588a95c98e4b2.tar.bz2 busybox-w32-8775faaeafdb04c8fc390a822a4588a95c98e4b2.zip | |
Another cleanup patch from Jeff Garzik <jgarzik@mandrakesoft.com>
git-svn-id: svn://busybox.net/trunk/busybox@2163 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | cmdedit.c | 2 | ||||
| -rw-r--r-- | console-tools/loadacm.c | 53 | ||||
| -rw-r--r-- | coreutils/expr.c | 2 | ||||
| -rw-r--r-- | coreutils/test.c | 4 | ||||
| -rw-r--r-- | coreutils/usleep.c | 2 | ||||
| -rw-r--r-- | expr.c | 2 | ||||
| -rw-r--r-- | loadacm.c | 53 | ||||
| -rw-r--r-- | mkfs_minix.c | 2 | ||||
| -rw-r--r-- | networking/telnet.c | 4 | ||||
| -rw-r--r-- | shell/cmdedit.c | 2 | ||||
| -rw-r--r-- | telnet.c | 4 | ||||
| -rw-r--r-- | test.c | 4 | ||||
| -rw-r--r-- | usleep.c | 2 | ||||
| -rw-r--r-- | util-linux/mkfs_minix.c | 2 |
14 files changed, 36 insertions, 102 deletions
| @@ -113,7 +113,7 @@ void *xcalloc(size_t size, size_t se) | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | #define error_msg(s, d) fprintf(stderr, s, d) | 115 | #define error_msg(s, d) fprintf(stderr, s, d) |
| 116 | #endif | 116 | #endif /* TEST */ |
| 117 | 117 | ||
| 118 | 118 | ||
| 119 | struct history { | 119 | struct history { |
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index 81b973b02..e5a29b6a1 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c | |||
| @@ -24,10 +24,10 @@ | |||
| 24 | typedef unsigned short unicode; | 24 | typedef unsigned short unicode; |
| 25 | 25 | ||
| 26 | static long int ctoi(unsigned char *s, int *is_unicode); | 26 | static long int ctoi(unsigned char *s, int *is_unicode); |
| 27 | int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]); | 27 | static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]); |
| 28 | int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode); | 28 | static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode); |
| 29 | unicode utf8_to_ucs2(char *buf); | 29 | static unicode utf8_to_ucs2(char *buf); |
| 30 | int screen_map_load(int fd, FILE * fp); | 30 | static int screen_map_load(int fd, FILE * fp); |
| 31 | 31 | ||
| 32 | int loadacm_main(int argc, char **argv) | 32 | int loadacm_main(int argc, char **argv) |
| 33 | { | 33 | { |
| @@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv) | |||
| 51 | return EXIT_SUCCESS; | 51 | return EXIT_SUCCESS; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | int screen_map_load(int fd, FILE * fp) | 54 | static int screen_map_load(int fd, FILE * fp) |
| 55 | { | 55 | { |
| 56 | struct stat stbuf; | 56 | struct stat stbuf; |
| 57 | unicode wbuf[E_TABSZ]; | 57 | unicode wbuf[E_TABSZ]; |
| @@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp) | |||
| 141 | * | 141 | * |
| 142 | * FIXME: ignores everything after second word | 142 | * FIXME: ignores everything after second word |
| 143 | */ | 143 | */ |
| 144 | int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode) | 144 | static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode) |
| 145 | { | 145 | { |
| 146 | char buffer[256]; /* line buffer reading file */ | 146 | char buffer[256]; /* line buffer reading file */ |
| 147 | char *p, *q; /* 1st + 2nd words in line */ | 147 | 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) | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | 215 | ||
| 216 | int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) | 216 | static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) |
| 217 | { | 217 | { |
| 218 | char buffer[256]; | 218 | char buffer[256]; |
| 219 | int in, on; | 219 | int in, on; |
| @@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) | |||
| 255 | * | 255 | * |
| 256 | * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones. | 256 | * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones. |
| 257 | */ | 257 | */ |
| 258 | long int ctoi(unsigned char *s, int *is_unicode) | 258 | static long int ctoi(unsigned char *s, int *is_unicode) |
| 259 | { | 259 | { |
| 260 | int i; | 260 | int i; |
| 261 | size_t ls; | 261 | size_t ls; |
| @@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode) | |||
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | 304 | ||
| 305 | void saveoldmap(int fd, char *omfil) | 305 | static unicode utf8_to_ucs2(char *buf) |
| 306 | { | ||
| 307 | FILE *fp; | ||
| 308 | char buf[E_TABSZ]; | ||
| 309 | |||
| 310 | #ifdef GIO_UNISCRNMAP | ||
| 311 | unicode xbuf[E_TABSZ]; | ||
| 312 | int is_old_map = 0; | ||
| 313 | |||
| 314 | if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) { | ||
| 315 | perror_msg("GIO_UNISCRNMAP ioctl error"); | ||
| 316 | #endif | ||
| 317 | if (ioctl(fd, GIO_SCRNMAP, buf)) | ||
| 318 | perror_msg_and_die("GIO_SCRNMAP ioctl error"); | ||
| 319 | else | ||
| 320 | is_old_map = 1; | ||
| 321 | #ifdef GIO_UNISCRNMAP | ||
| 322 | } | ||
| 323 | #endif | ||
| 324 | |||
| 325 | fp = xfopen(omfil, "w"); | ||
| 326 | #ifdef GIO_UNISCRNMAP | ||
| 327 | if (is_old_map) { | ||
| 328 | #endif | ||
| 329 | if (fwrite(buf, E_TABSZ, 1, fp) != 1) | ||
| 330 | perror_msg_and_die("Error writing map to file"); | ||
| 331 | #ifdef GIO_UNISCRNMAP | ||
| 332 | } else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) { | ||
| 333 | perror_msg_and_die("Error writing map to file"); | ||
| 334 | } | ||
| 335 | #endif | ||
| 336 | |||
| 337 | fclose(fp); | ||
| 338 | } | ||
| 339 | |||
| 340 | unicode utf8_to_ucs2(char *buf) | ||
| 341 | { | 306 | { |
| 342 | int utf_count = 0; | 307 | int utf_count = 0; |
| 343 | long utf_char = 0; | 308 | long utf_char = 0; |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 10aaa6be1..4a537bf33 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
| @@ -225,7 +225,7 @@ int name (l, r) VALUE *l; VALUE *r; \ | |||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | #define arithdivf(name, op) \ | 227 | #define arithdivf(name, op) \ |
| 228 | int name (l, r) VALUE *l; VALUE *r; \ | 228 | static int name (l, r) VALUE *l; VALUE *r; \ |
| 229 | { \ | 229 | { \ |
| 230 | if (!toarith (l) || !toarith (r)) \ | 230 | if (!toarith (l) || !toarith (r)) \ |
| 231 | error_msg_and_die ( "non-numeric argument"); \ | 231 | error_msg_and_die ( "non-numeric argument"); \ |
diff --git a/coreutils/test.c b/coreutils/test.c index ab9c23e4b..79db8cbb6 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
| @@ -110,10 +110,10 @@ enum token_types { | |||
| 110 | PAREN | 110 | PAREN |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | struct t_op { | 113 | static const struct t_op { |
| 114 | const char *op_text; | 114 | const char *op_text; |
| 115 | short op_num, op_type; | 115 | short op_num, op_type; |
| 116 | } const ops [] = { | 116 | } ops [] = { |
| 117 | {"-r", FILRD, UNOP}, | 117 | {"-r", FILRD, UNOP}, |
| 118 | {"-w", FILWR, UNOP}, | 118 | {"-w", FILWR, UNOP}, |
| 119 | {"-x", FILEX, UNOP}, | 119 | {"-x", FILEX, UNOP}, |
diff --git a/coreutils/usleep.c b/coreutils/usleep.c index 92e4437c5..6023bf430 100644 --- a/coreutils/usleep.c +++ b/coreutils/usleep.c | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | * | 21 | * |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | /* getopt not needed */ | ||
| 25 | |||
| 24 | #include <stdlib.h> | 26 | #include <stdlib.h> |
| 25 | #include <unistd.h> | 27 | #include <unistd.h> |
| 26 | #include "busybox.h" | 28 | #include "busybox.h" |
| @@ -225,7 +225,7 @@ int name (l, r) VALUE *l; VALUE *r; \ | |||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | #define arithdivf(name, op) \ | 227 | #define arithdivf(name, op) \ |
| 228 | int name (l, r) VALUE *l; VALUE *r; \ | 228 | static int name (l, r) VALUE *l; VALUE *r; \ |
| 229 | { \ | 229 | { \ |
| 230 | if (!toarith (l) || !toarith (r)) \ | 230 | if (!toarith (l) || !toarith (r)) \ |
| 231 | error_msg_and_die ( "non-numeric argument"); \ | 231 | error_msg_and_die ( "non-numeric argument"); \ |
| @@ -24,10 +24,10 @@ | |||
| 24 | typedef unsigned short unicode; | 24 | typedef unsigned short unicode; |
| 25 | 25 | ||
| 26 | static long int ctoi(unsigned char *s, int *is_unicode); | 26 | static long int ctoi(unsigned char *s, int *is_unicode); |
| 27 | int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]); | 27 | static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]); |
| 28 | int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode); | 28 | static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode); |
| 29 | unicode utf8_to_ucs2(char *buf); | 29 | static unicode utf8_to_ucs2(char *buf); |
| 30 | int screen_map_load(int fd, FILE * fp); | 30 | static int screen_map_load(int fd, FILE * fp); |
| 31 | 31 | ||
| 32 | int loadacm_main(int argc, char **argv) | 32 | int loadacm_main(int argc, char **argv) |
| 33 | { | 33 | { |
| @@ -51,7 +51,7 @@ int loadacm_main(int argc, char **argv) | |||
| 51 | return EXIT_SUCCESS; | 51 | return EXIT_SUCCESS; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | int screen_map_load(int fd, FILE * fp) | 54 | static int screen_map_load(int fd, FILE * fp) |
| 55 | { | 55 | { |
| 56 | struct stat stbuf; | 56 | struct stat stbuf; |
| 57 | unicode wbuf[E_TABSZ]; | 57 | unicode wbuf[E_TABSZ]; |
| @@ -141,7 +141,7 @@ int screen_map_load(int fd, FILE * fp) | |||
| 141 | * | 141 | * |
| 142 | * FIXME: ignores everything after second word | 142 | * FIXME: ignores everything after second word |
| 143 | */ | 143 | */ |
| 144 | int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode) | 144 | static int uni_screen_map_read_ascii(FILE * fp, unicode buf[], int *is_unicode) |
| 145 | { | 145 | { |
| 146 | char buffer[256]; /* line buffer reading file */ | 146 | char buffer[256]; /* line buffer reading file */ |
| 147 | char *p, *q; /* 1st + 2nd words in line */ | 147 | 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) | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | 215 | ||
| 216 | int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) | 216 | static int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) |
| 217 | { | 217 | { |
| 218 | char buffer[256]; | 218 | char buffer[256]; |
| 219 | int in, on; | 219 | int in, on; |
| @@ -255,7 +255,7 @@ int old_screen_map_read_ascii(FILE * fp, unsigned char buf[]) | |||
| 255 | * | 255 | * |
| 256 | * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones. | 256 | * CAVEAT: will report valid UTF mappings using only 1 byte as 8-bit ones. |
| 257 | */ | 257 | */ |
| 258 | long int ctoi(unsigned char *s, int *is_unicode) | 258 | static long int ctoi(unsigned char *s, int *is_unicode) |
| 259 | { | 259 | { |
| 260 | int i; | 260 | int i; |
| 261 | size_t ls; | 261 | size_t ls; |
| @@ -302,42 +302,7 @@ long int ctoi(unsigned char *s, int *is_unicode) | |||
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | 304 | ||
| 305 | void saveoldmap(int fd, char *omfil) | 305 | static unicode utf8_to_ucs2(char *buf) |
| 306 | { | ||
| 307 | FILE *fp; | ||
| 308 | char buf[E_TABSZ]; | ||
| 309 | |||
| 310 | #ifdef GIO_UNISCRNMAP | ||
| 311 | unicode xbuf[E_TABSZ]; | ||
| 312 | int is_old_map = 0; | ||
| 313 | |||
| 314 | if (ioctl(fd, GIO_UNISCRNMAP, xbuf)) { | ||
| 315 | perror_msg("GIO_UNISCRNMAP ioctl error"); | ||
| 316 | #endif | ||
| 317 | if (ioctl(fd, GIO_SCRNMAP, buf)) | ||
| 318 | perror_msg_and_die("GIO_SCRNMAP ioctl error"); | ||
| 319 | else | ||
| 320 | is_old_map = 1; | ||
| 321 | #ifdef GIO_UNISCRNMAP | ||
| 322 | } | ||
| 323 | #endif | ||
| 324 | |||
| 325 | fp = xfopen(omfil, "w"); | ||
| 326 | #ifdef GIO_UNISCRNMAP | ||
| 327 | if (is_old_map) { | ||
| 328 | #endif | ||
| 329 | if (fwrite(buf, E_TABSZ, 1, fp) != 1) | ||
| 330 | perror_msg_and_die("Error writing map to file"); | ||
| 331 | #ifdef GIO_UNISCRNMAP | ||
| 332 | } else if (fwrite(xbuf, sizeof(unicode) * E_TABSZ, 1, fp) != 1) { | ||
| 333 | perror_msg_and_die("Error writing map to file"); | ||
| 334 | } | ||
| 335 | #endif | ||
| 336 | |||
| 337 | fclose(fp); | ||
| 338 | } | ||
| 339 | |||
| 340 | unicode utf8_to_ucs2(char *buf) | ||
| 341 | { | 306 | { |
| 342 | int utf_count = 0; | 307 | int utf_count = 0; |
| 343 | long utf_char = 0; | 308 | long utf_char = 0; |
diff --git a/mkfs_minix.c b/mkfs_minix.c index a83fa7961..70374eae9 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
| @@ -382,7 +382,7 @@ static void mark_good_blocks(void) | |||
| 382 | mark_zone(good_blocks_table[blk]); | 382 | mark_zone(good_blocks_table[blk]); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | inline int next(int zone) | 385 | static int next(int zone) |
| 386 | { | 386 | { |
| 387 | if (!zone) | 387 | if (!zone) |
| 388 | zone = FIRSTZONE - 1; | 388 | zone = FIRSTZONE - 1; |
diff --git a/networking/telnet.c b/networking/telnet.c index d47bf699b..edcc5081f 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
| @@ -85,7 +85,7 @@ enum { | |||
| 85 | typedef unsigned char byte; | 85 | typedef unsigned char byte; |
| 86 | 86 | ||
| 87 | /* use globals to reduce size ??? */ /* test this hypothesis later */ | 87 | /* use globals to reduce size ??? */ /* test this hypothesis later */ |
| 88 | struct Globalvars { | 88 | static struct Globalvars { |
| 89 | int netfd; /* console fd:s are 0 and 1 (and 2) */ | 89 | int netfd; /* console fd:s are 0 and 1 (and 2) */ |
| 90 | /* same buffer used both for network and console read/write */ | 90 | /* same buffer used both for network and console read/write */ |
| 91 | char * buf; /* allocating so static size is smaller */ | 91 | char * buf; /* allocating so static size is smaller */ |
| @@ -108,7 +108,7 @@ struct Globalvars { | |||
| 108 | struct Globalvars * Gptr; | 108 | struct Globalvars * Gptr; |
| 109 | #define G (*Gptr) | 109 | #define G (*Gptr) |
| 110 | #else | 110 | #else |
| 111 | struct Globalvars G; | 111 | static struct Globalvars G; |
| 112 | #endif | 112 | #endif |
| 113 | 113 | ||
| 114 | static inline void iacflush() | 114 | static inline void iacflush() |
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index ffe7afab2..e317b86fa 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
| @@ -113,7 +113,7 @@ void *xcalloc(size_t size, size_t se) | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | #define error_msg(s, d) fprintf(stderr, s, d) | 115 | #define error_msg(s, d) fprintf(stderr, s, d) |
| 116 | #endif | 116 | #endif /* TEST */ |
| 117 | 117 | ||
| 118 | 118 | ||
| 119 | struct history { | 119 | struct history { |
| @@ -85,7 +85,7 @@ enum { | |||
| 85 | typedef unsigned char byte; | 85 | typedef unsigned char byte; |
| 86 | 86 | ||
| 87 | /* use globals to reduce size ??? */ /* test this hypothesis later */ | 87 | /* use globals to reduce size ??? */ /* test this hypothesis later */ |
| 88 | struct Globalvars { | 88 | static struct Globalvars { |
| 89 | int netfd; /* console fd:s are 0 and 1 (and 2) */ | 89 | int netfd; /* console fd:s are 0 and 1 (and 2) */ |
| 90 | /* same buffer used both for network and console read/write */ | 90 | /* same buffer used both for network and console read/write */ |
| 91 | char * buf; /* allocating so static size is smaller */ | 91 | char * buf; /* allocating so static size is smaller */ |
| @@ -108,7 +108,7 @@ struct Globalvars { | |||
| 108 | struct Globalvars * Gptr; | 108 | struct Globalvars * Gptr; |
| 109 | #define G (*Gptr) | 109 | #define G (*Gptr) |
| 110 | #else | 110 | #else |
| 111 | struct Globalvars G; | 111 | static struct Globalvars G; |
| 112 | #endif | 112 | #endif |
| 113 | 113 | ||
| 114 | static inline void iacflush() | 114 | static inline void iacflush() |
| @@ -110,10 +110,10 @@ enum token_types { | |||
| 110 | PAREN | 110 | PAREN |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | struct t_op { | 113 | static const struct t_op { |
| 114 | const char *op_text; | 114 | const char *op_text; |
| 115 | short op_num, op_type; | 115 | short op_num, op_type; |
| 116 | } const ops [] = { | 116 | } ops [] = { |
| 117 | {"-r", FILRD, UNOP}, | 117 | {"-r", FILRD, UNOP}, |
| 118 | {"-w", FILWR, UNOP}, | 118 | {"-w", FILWR, UNOP}, |
| 119 | {"-x", FILEX, UNOP}, | 119 | {"-x", FILEX, UNOP}, |
| @@ -21,6 +21,8 @@ | |||
| 21 | * | 21 | * |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | /* getopt not needed */ | ||
| 25 | |||
| 24 | #include <stdlib.h> | 26 | #include <stdlib.h> |
| 25 | #include <unistd.h> | 27 | #include <unistd.h> |
| 26 | #include "busybox.h" | 28 | #include "busybox.h" |
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index a83fa7961..70374eae9 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
| @@ -382,7 +382,7 @@ static void mark_good_blocks(void) | |||
| 382 | mark_zone(good_blocks_table[blk]); | 382 | mark_zone(good_blocks_table[blk]); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | inline int next(int zone) | 385 | static int next(int zone) |
| 386 | { | 386 | { |
| 387 | if (!zone) | 387 | if (!zone) |
| 388 | zone = FIRSTZONE - 1; | 388 | zone = FIRSTZONE - 1; |
