diff options
-rw-r--r-- | coreutils/date.c | 16 | ||||
-rw-r--r-- | coreutils/dd.c | 2 | ||||
-rw-r--r-- | coreutils/expr.c | 2 | ||||
-rw-r--r-- | coreutils/stat.c | 14 | ||||
-rw-r--r-- | coreutils/stty.c | 18 | ||||
-rw-r--r-- | coreutils/tr.c | 2 | ||||
-rw-r--r-- | shell/ash.c | 11 | ||||
-rw-r--r-- | shell/lash.c | 3 | ||||
-rw-r--r-- | util-linux/ipcrm.c | 3 | ||||
-rw-r--r-- | util-linux/mount.c | 4 |
10 files changed, 40 insertions, 35 deletions
diff --git a/coreutils/date.c b/coreutils/date.c index dfc8b2f40..d2d77f413 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -69,15 +69,15 @@ int date_main(int argc, char **argv) | |||
69 | if (!isofmt_arg) { | 69 | if (!isofmt_arg) { |
70 | ifmt = 0; /* default is date */ | 70 | ifmt = 0; /* default is date */ |
71 | } else { | 71 | } else { |
72 | const char * const isoformats[] = | 72 | static const char * const isoformats[] = |
73 | {"date", "hours", "minutes", "seconds"}; | 73 | { "date", "hours", "minutes", "seconds" }; |
74 | 74 | ||
75 | for (ifmt = 0; ifmt < 4; ifmt++) | 75 | for (ifmt = 0; ifmt < 4; ifmt++) |
76 | if (!strcmp(isofmt_arg, isoformats[ifmt])) { | 76 | if (!strcmp(isofmt_arg, isoformats[ifmt])) |
77 | break; | 77 | goto found; |
78 | } | 78 | /* parse error */ |
79 | if (ifmt == 4) /* parse error */ | 79 | bb_show_usage(); |
80 | bb_show_usage(); | 80 | found: ; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
@@ -207,7 +207,7 @@ int date_main(int argc, char **argv) | |||
207 | date_fmt[i++] = '%'; | 207 | date_fmt[i++] = '%'; |
208 | date_fmt[i++] = 'S'; | 208 | date_fmt[i++] = 'S'; |
209 | } | 209 | } |
210 | format_utc: | 210 | format_utc: |
211 | date_fmt[i++] = '%'; | 211 | date_fmt[i++] = '%'; |
212 | date_fmt[i] = (opt & DATE_OPT_UTC) ? 'Z' : 'z'; | 212 | date_fmt[i] = (opt & DATE_OPT_UTC) ? 'Z' : 'z'; |
213 | } | 213 | } |
diff --git a/coreutils/dd.c b/coreutils/dd.c index 518c5fed2..4507b5e0c 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -75,7 +75,7 @@ int dd_main(int argc, char **argv) | |||
75 | trunc_flag = 1 << 2, | 75 | trunc_flag = 1 << 2, |
76 | twobufs_flag = 1 << 3, | 76 | twobufs_flag = 1 << 3, |
77 | }; | 77 | }; |
78 | const char * const keywords[] = { | 78 | static const char * const keywords[] = { |
79 | "bs=", "count=", "seek=", "skip=", "if=", "of=", | 79 | "bs=", "count=", "seek=", "skip=", "if=", "of=", |
80 | #if ENABLE_FEATURE_DD_IBS_OBS | 80 | #if ENABLE_FEATURE_DD_IBS_OBS |
81 | "ibs=", "obs=", "conv=", "notrunc", "sync", "noerror", | 81 | "ibs=", "obs=", "conv=", "notrunc", "sync", "noerror", |
diff --git a/coreutils/expr.c b/coreutils/expr.c index f75f6e0de..b6bd383f6 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -278,7 +278,7 @@ static VALUE *eval7(void) | |||
278 | static VALUE *eval6(void) | 278 | static VALUE *eval6(void) |
279 | { | 279 | { |
280 | VALUE *l, *r, *v = NULL /* silence gcc */, *i1, *i2; | 280 | VALUE *l, *r, *v = NULL /* silence gcc */, *i1, *i2; |
281 | const char * const keywords[] = { | 281 | static const char * const keywords[] = { |
282 | "quote", "length", "match", "index", "substr", NULL | 282 | "quote", "length", "match", "index", "substr", NULL |
283 | }; | 283 | }; |
284 | 284 | ||
diff --git a/coreutils/stat.c b/coreutils/stat.c index 397e395d8..7c5631764 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -68,7 +68,7 @@ static char const *human_time(time_t t) | |||
68 | static char const *human_fstype(long f_type) | 68 | static char const *human_fstype(long f_type) |
69 | { | 69 | { |
70 | int i; | 70 | int i; |
71 | const struct types { | 71 | static const struct types { |
72 | long type; | 72 | long type; |
73 | const char * const fs; | 73 | const char * const fs; |
74 | } humantypes[] = { | 74 | } humantypes[] = { |
@@ -109,13 +109,13 @@ static char const *human_fstype(long f_type) | |||
109 | { 0x62656572, "sysfs" }, | 109 | { 0x62656572, "sysfs" }, |
110 | { 0, "UNKNOWN" } | 110 | { 0, "UNKNOWN" } |
111 | }; | 111 | }; |
112 | for (i=0; humantypes[i].type; ++i) | 112 | for (i = 0; humantypes[i].type; ++i) |
113 | if (humantypes[i].type == f_type) | 113 | if (humantypes[i].type == f_type) |
114 | break; | 114 | break; |
115 | return humantypes[i].fs; | 115 | return humantypes[i].fs; |
116 | } | 116 | } |
117 | 117 | ||
118 | #ifdef CONFIG_FEATURE_STAT_FORMAT | 118 | #if ENABLE_FEATURE_STAT_FORMAT |
119 | /* print statfs info */ | 119 | /* print statfs info */ |
120 | static void print_statfs(char *pformat, const size_t buf_len, const char m, | 120 | static void print_statfs(char *pformat, const size_t buf_len, const char m, |
121 | const char * const filename, void const *data | 121 | const char * const filename, void const *data |
@@ -354,9 +354,9 @@ static bool do_statfs(char const *filename, char const *format) | |||
354 | return 0; | 354 | return 0; |
355 | } | 355 | } |
356 | 356 | ||
357 | #ifdef CONFIG_FEATURE_STAT_FORMAT | 357 | #if ENABLE_FEATURE_STAT_FORMAT |
358 | if (format == NULL) | 358 | if (format == NULL) |
359 | #ifndef ENABLE_SELINUX | 359 | #if !ENABLE_SELINUX |
360 | format = (option_mask32 & OPT_TERSE | 360 | format = (option_mask32 & OPT_TERSE |
361 | ? "%n %i %l %t %s %b %f %a %c %d\n" | 361 | ? "%n %i %l %t %s %b %f %a %c %d\n" |
362 | : " File: \"%n\"\n" | 362 | : " File: \"%n\"\n" |
@@ -460,9 +460,9 @@ static bool do_stat(char const *filename, char const *format) | |||
460 | return 0; | 460 | return 0; |
461 | } | 461 | } |
462 | 462 | ||
463 | #ifdef CONFIG_FEATURE_STAT_FORMAT | 463 | #if ENABLE_FEATURE_STAT_FORMAT |
464 | if (format == NULL) { | 464 | if (format == NULL) { |
465 | #ifndef ENABLE_SELINUX | 465 | #if !ENABLE_SELINUX |
466 | if (option_mask32 & OPT_TERSE) { | 466 | if (option_mask32 & OPT_TERSE) { |
467 | format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o"; | 467 | format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o"; |
468 | } else { | 468 | } else { |
diff --git a/coreutils/stty.c b/coreutils/stty.c index b13f1fb28..7493192e9 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -388,7 +388,7 @@ static const char *device_name = bb_msg_standard_input; | |||
388 | 388 | ||
389 | /* Return a string that is the printable representation of character CH */ | 389 | /* Return a string that is the printable representation of character CH */ |
390 | /* Adapted from 'cat' by Torbjorn Granlund */ | 390 | /* Adapted from 'cat' by Torbjorn Granlund */ |
391 | static const char *visible(unsigned int ch) | 391 | static const char *visible(unsigned ch) |
392 | { | 392 | { |
393 | char *bpout = G.buf; | 393 | char *bpout = G.buf; |
394 | 394 | ||
@@ -561,18 +561,18 @@ enum { | |||
561 | 561 | ||
562 | static int find_param(const char * const name) | 562 | static int find_param(const char * const name) |
563 | { | 563 | { |
564 | const char * const params[] = { | 564 | static const char * const params[] = { |
565 | "line", | 565 | "line", |
566 | "rows", | 566 | "rows", |
567 | "cols", | 567 | "cols", |
568 | "columns", | 568 | "columns", |
569 | "size", | 569 | "size", /* 4 */ |
570 | "speed", | 570 | "speed", /* 5 */ |
571 | "ispeed", | 571 | "ispeed", |
572 | "ospeed", | 572 | "ospeed", |
573 | NULL | 573 | NULL |
574 | }; | 574 | }; |
575 | smalluint i = index_in_str_array(params, name) + 1; | 575 | int i = index_in_str_array(params, name) + 1; |
576 | if (i == 0) | 576 | if (i == 0) |
577 | return 0; | 577 | return 0; |
578 | if (!(i == 4 || i == 5)) | 578 | if (!(i == 4 || i == 5)) |
@@ -584,7 +584,7 @@ static int find_param(const char * const name) | |||
584 | static int recover_mode(const char *arg, struct termios *mode) | 584 | static int recover_mode(const char *arg, struct termios *mode) |
585 | { | 585 | { |
586 | int i, n; | 586 | int i, n; |
587 | unsigned int chr; | 587 | unsigned chr; |
588 | unsigned long iflag, oflag, cflag, lflag; | 588 | unsigned long iflag, oflag, cflag, lflag; |
589 | 589 | ||
590 | /* Scan into temporaries since it is too much trouble to figure out | 590 | /* Scan into temporaries since it is too much trouble to figure out |
@@ -612,7 +612,7 @@ static int recover_mode(const char *arg, struct termios *mode) | |||
612 | } | 612 | } |
613 | 613 | ||
614 | static void display_recoverable(const struct termios *mode, | 614 | static void display_recoverable(const struct termios *mode, |
615 | const int ATTRIBUTE_UNUSED dummy) | 615 | int ATTRIBUTE_UNUSED dummy) |
616 | { | 616 | { |
617 | int i; | 617 | int i; |
618 | printf("%lx:%lx:%lx:%lx", | 618 | printf("%lx:%lx:%lx:%lx", |
@@ -975,7 +975,7 @@ int stty_main(int argc, char **argv) | |||
975 | goto invalid_argument; | 975 | goto invalid_argument; |
976 | } | 976 | } |
977 | } | 977 | } |
978 | end_option: | 978 | end_option: |
979 | continue; | 979 | continue; |
980 | } | 980 | } |
981 | 981 | ||
@@ -1031,7 +1031,7 @@ end_option: | |||
1031 | default: | 1031 | default: |
1032 | if (recover_mode(arg, &mode) == 1) break; | 1032 | if (recover_mode(arg, &mode) == 1) break; |
1033 | if (tty_value_to_baud(xatou(arg)) != (speed_t) -1) break; | 1033 | if (tty_value_to_baud(xatou(arg)) != (speed_t) -1) break; |
1034 | invalid_argument: | 1034 | invalid_argument: |
1035 | bb_error_msg_and_die("invalid argument '%s'", arg); | 1035 | bb_error_msg_and_die("invalid argument '%s'", arg); |
1036 | } | 1036 | } |
1037 | stty_state &= ~STTY_noargs; | 1037 | stty_state &= ~STTY_noargs; |
diff --git a/coreutils/tr.c b/coreutils/tr.c index f72d23c03..5d3dd4cd8 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -84,7 +84,7 @@ static unsigned int expand(const char *arg, char *buffer) | |||
84 | unsigned i; /* XXX: FIXME: use unsigned char? */ | 84 | unsigned i; /* XXX: FIXME: use unsigned char? */ |
85 | unsigned char ac; | 85 | unsigned char ac; |
86 | #define CLO ":]" | 86 | #define CLO ":]" |
87 | const char * const classes[] = { | 87 | static const char * const classes[] = { |
88 | "alpha"CLO, "alnum"CLO, "digit"CLO, "lower"CLO, "upper"CLO, "space"CLO, | 88 | "alpha"CLO, "alnum"CLO, "digit"CLO, "lower"CLO, "upper"CLO, "space"CLO, |
89 | "blank"CLO, "punct"CLO, "cntrl"CLO, NULL | 89 | "blank"CLO, "punct"CLO, "cntrl"CLO, NULL |
90 | }; | 90 | }; |
diff --git a/shell/ash.c b/shell/ash.c index a5ffaaf8e..950cdaa02 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -6967,6 +6967,11 @@ tokname(int tok) | |||
6967 | { | 6967 | { |
6968 | static char buf[16]; | 6968 | static char buf[16]; |
6969 | 6969 | ||
6970 | //try this: | ||
6971 | //if (tok < TSEMI) return tokname_array[tok] + 1; | ||
6972 | //sprintf(buf, "\"%s\"", tokname_array[tok] + 1); | ||
6973 | //return buf; | ||
6974 | |||
6970 | if (tok >= TSEMI) | 6975 | if (tok >= TSEMI) |
6971 | buf[0] = '"'; | 6976 | buf[0] = '"'; |
6972 | sprintf(buf + (tok >= TSEMI), "%s%c", | 6977 | sprintf(buf + (tok >= TSEMI), "%s%c", |
@@ -6978,15 +6983,15 @@ tokname(int tok) | |||
6978 | static int | 6983 | static int |
6979 | pstrcmp(const void *a, const void *b) | 6984 | pstrcmp(const void *a, const void *b) |
6980 | { | 6985 | { |
6981 | return strcmp((const char *) a, (*(const char *const *) b) + 1); | 6986 | return strcmp((char*) a, (*(char**) b) + 1); |
6982 | } | 6987 | } |
6983 | 6988 | ||
6984 | static const char *const * | 6989 | static const char *const * |
6985 | findkwd(const char *s) | 6990 | findkwd(const char *s) |
6986 | { | 6991 | { |
6987 | return bsearch(s, tokname_array + KWDOFFSET, | 6992 | return bsearch(s, tokname_array + KWDOFFSET, |
6988 | (sizeof(tokname_array) / sizeof(const char *)) - KWDOFFSET, | 6993 | (sizeof(tokname_array) / sizeof(char *)) - KWDOFFSET, |
6989 | sizeof(const char *), pstrcmp); | 6994 | sizeof(char *), pstrcmp); |
6990 | } | 6995 | } |
6991 | 6996 | ||
6992 | /* | 6997 | /* |
diff --git a/shell/lash.c b/shell/lash.c index 58d770fd8..192900bb6 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -716,11 +716,12 @@ static char * strsep_space(char *string, int * ix) | |||
716 | 716 | ||
717 | static int expand_arguments(char *command) | 717 | static int expand_arguments(char *command) |
718 | { | 718 | { |
719 | static const char out_of_space[] = "out of space during expansion"; | ||
720 | |||
719 | int total_length = 0, length, i, retval, ix = 0; | 721 | int total_length = 0, length, i, retval, ix = 0; |
720 | expand_t expand_result; | 722 | expand_t expand_result; |
721 | char *tmpcmd, *cmd, *cmd_copy; | 723 | char *tmpcmd, *cmd, *cmd_copy; |
722 | char *src, *dst, *var; | 724 | char *src, *dst, *var; |
723 | const char * const out_of_space = "out of space during expansion"; | ||
724 | int flags = GLOB_NOCHECK | 725 | int flags = GLOB_NOCHECK |
725 | #ifdef GLOB_BRACE | 726 | #ifdef GLOB_BRACE |
726 | | GLOB_BRACE | 727 | | GLOB_BRACE |
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index 9240e2c4b..d13fb83b1 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c | |||
@@ -154,7 +154,6 @@ int ipcrm_main(int argc, char **argv) | |||
154 | 154 | ||
155 | if (id < 0) { | 155 | if (id < 0) { |
156 | const char *errmsg; | 156 | const char *errmsg; |
157 | const char *const what = "key"; | ||
158 | 157 | ||
159 | error++; | 158 | error++; |
160 | switch (errno) { | 159 | switch (errno) { |
@@ -171,7 +170,7 @@ int ipcrm_main(int argc, char **argv) | |||
171 | errmsg = "unknown error in"; | 170 | errmsg = "unknown error in"; |
172 | break; | 171 | break; |
173 | } | 172 | } |
174 | bb_error_msg("%s %s (%s)", errmsg, what, optarg); | 173 | bb_error_msg("%s %s (%s)", errmsg, "key", optarg); |
175 | continue; | 174 | continue; |
176 | } | 175 | } |
177 | } else { | 176 | } else { |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 4a0237196..bc1c0d4a9 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -891,7 +891,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) | |||
891 | for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { | 891 | for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { |
892 | char *opteq = strchr(opt, '='); | 892 | char *opteq = strchr(opt, '='); |
893 | if (opteq) { | 893 | if (opteq) { |
894 | const char *const options[] = { | 894 | static const char *const options[] = { |
895 | /* 0 */ "rsize", | 895 | /* 0 */ "rsize", |
896 | /* 1 */ "wsize", | 896 | /* 1 */ "wsize", |
897 | /* 2 */ "timeo", | 897 | /* 2 */ "timeo", |
@@ -996,7 +996,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) | |||
996 | } | 996 | } |
997 | } | 997 | } |
998 | else { | 998 | else { |
999 | const char *const options[] = { | 999 | static const char *const options[] = { |
1000 | "bg", | 1000 | "bg", |
1001 | "fg", | 1001 | "fg", |
1002 | "soft", | 1002 | "soft", |