diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-07 20:17:41 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-07 20:17:41 +0000 |
commit | 19008b83735341c91fa8a09a072ffe9816c9e423 (patch) | |
tree | 6e35288c247102998a775cbc16f9ec014e00e7fd | |
parent | 4c5ad2fc90389bf1239f17d84967d07b82f31dd7 (diff) | |
download | busybox-w32-19008b83735341c91fa8a09a072ffe9816c9e423.tar.gz busybox-w32-19008b83735341c91fa8a09a072ffe9816c9e423.tar.bz2 busybox-w32-19008b83735341c91fa8a09a072ffe9816c9e423.zip |
- reuse strings and messages. Saves about 600B
-rw-r--r-- | archival/unzip.c | 10 | ||||
-rw-r--r-- | coreutils/dd.c | 2 | ||||
-rw-r--r-- | coreutils/diff.c | 9 | ||||
-rw-r--r-- | coreutils/stty.c | 14 | ||||
-rw-r--r-- | coreutils/test.c | 20 | ||||
-rw-r--r-- | editors/sed.c | 2 | ||||
-rw-r--r-- | findutils/find.c | 32 | ||||
-rw-r--r-- | findutils/grep.c | 4 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/messages.c | 8 | ||||
-rw-r--r-- | networking/ip.c | 2 | ||||
-rw-r--r-- | networking/libiproute/ip_parse_common_args.c | 2 | ||||
-rw-r--r-- | networking/libiproute/ipaddress.c | 10 | ||||
-rw-r--r-- | networking/libiproute/iplink.c | 4 | ||||
-rw-r--r-- | networking/libiproute/iproute.c | 10 | ||||
-rw-r--r-- | networking/libiproute/iptunnel.c | 6 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 4 | ||||
-rw-r--r-- | networking/libiproute/utils.h | 4 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 2 | ||||
-rw-r--r-- | shell/ash.c | 2 | ||||
-rw-r--r-- | shell/lash.c | 4 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 10 |
22 files changed, 77 insertions, 86 deletions
diff --git a/archival/unzip.c b/archival/unzip.c index c6ef9a183..8ba39e9af 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -86,7 +86,7 @@ static void unzip_skip(int fd, off_t skip) | |||
86 | static void unzip_read(int fd, void *buf, size_t count) | 86 | static void unzip_read(int fd, void *buf, size_t count) |
87 | { | 87 | { |
88 | if (bb_xread(fd, buf, count) != count) { | 88 | if (bb_xread(fd, buf, count) != count) { |
89 | bb_error_msg_and_die("Read failure"); | 89 | bb_error_msg_and_die(bb_msg_read_error); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
@@ -95,7 +95,7 @@ static void unzip_create_leading_dirs(char *fn) | |||
95 | /* Create all leading directories */ | 95 | /* Create all leading directories */ |
96 | char *name = bb_xstrdup(fn); | 96 | char *name = bb_xstrdup(fn); |
97 | if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) { | 97 | if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) { |
98 | bb_error_msg_and_die("Failed to create directory"); | 98 | bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */ |
99 | } | 99 | } |
100 | free(name); | 100 | free(name); |
101 | } | 101 | } |
@@ -282,8 +282,8 @@ int unzip_main(int argc, char **argv) | |||
282 | unzip_skip(src_fd, zip_header.formated.extra_len); | 282 | unzip_skip(src_fd, zip_header.formated.extra_len); |
283 | 283 | ||
284 | if ((verbosity == v_list) && !list_header_done){ | 284 | if ((verbosity == v_list) && !list_header_done){ |
285 | printf(" Length Date Time Name\n"); | 285 | printf(" Length Date Time Name\n" |
286 | printf(" -------- ---- ---- ----\n"); | 286 | " -------- ---- ---- ----\n"); |
287 | list_header_done = 1; | 287 | list_header_done = 1; |
288 | } | 288 | } |
289 | 289 | ||
@@ -321,7 +321,7 @@ int unzip_main(int argc, char **argv) | |||
321 | } | 321 | } |
322 | unzip_create_leading_dirs(dst_fn); | 322 | unzip_create_leading_dirs(dst_fn); |
323 | if (bb_make_directory(dst_fn, 0777, 0)) { | 323 | if (bb_make_directory(dst_fn, 0777, 0)) { |
324 | bb_error_msg_and_die("Failed to create directory"); | 324 | bb_error_msg_and_die("Exiting"); |
325 | } | 325 | } |
326 | } else { | 326 | } else { |
327 | if (!S_ISDIR(stat_buf.st_mode)) { | 327 | if (!S_ISDIR(stat_buf.st_mode)) { |
diff --git a/coreutils/dd.c b/coreutils/dd.c index 53aa085ed..33e789311 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -96,7 +96,7 @@ int dd_main(int argc, char **argv) | |||
96 | noerror = TRUE; | 96 | noerror = TRUE; |
97 | ibuf += 7; | 97 | ibuf += 7; |
98 | } else { | 98 | } else { |
99 | bb_error_msg_and_die("invalid conversion `%s'", argv[i]+5); | 99 | bb_error_msg_and_die(bb_msg_invalid_arg, argv[i]+5, "conv"); |
100 | } | 100 | } |
101 | if (ibuf[0] == '\0') break; | 101 | if (ibuf[0] == '\0') break; |
102 | if (ibuf[0] == ',') ibuf++; | 102 | if (ibuf[0] == ',') ibuf++; |
diff --git a/coreutils/diff.c b/coreutils/diff.c index 57b32eb78..786e2a8ab 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c | |||
@@ -1158,7 +1158,7 @@ static void diffdir(char *p1, char *p2) | |||
1158 | while (*dirlist2 != NULL && strcmp(*dirlist2, start) < 0) | 1158 | while (*dirlist2 != NULL && strcmp(*dirlist2, start) < 0) |
1159 | dirlist2++; | 1159 | dirlist2++; |
1160 | if ((*dirlist1 == NULL) || (*dirlist2 == NULL)) | 1160 | if ((*dirlist1 == NULL) || (*dirlist2 == NULL)) |
1161 | bb_error_msg("Invalid argument to -S"); | 1161 | bb_error_msg(bb_msg_invalid_arg, "NULL", "-S"); |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | /* Now that both dirlist1 and dirlist2 contain sorted directory | 1164 | /* Now that both dirlist1 and dirlist2 contain sorted directory |
@@ -1194,7 +1194,6 @@ static void diffdir(char *p1, char *p2) | |||
1194 | 1194 | ||
1195 | int diff_main(int argc, char **argv) | 1195 | int diff_main(int argc, char **argv) |
1196 | { | 1196 | { |
1197 | char *ep; | ||
1198 | int gotstdin = 0; | 1197 | int gotstdin = 0; |
1199 | 1198 | ||
1200 | char *U_opt; | 1199 | char *U_opt; |
@@ -1229,11 +1228,7 @@ int diff_main(int argc, char **argv) | |||
1229 | 1228 | ||
1230 | context = 3; /* This is the default number of lines of context. */ | 1229 | context = 3; /* This is the default number of lines of context. */ |
1231 | if (cmd_flags & FLAG_U) { | 1230 | if (cmd_flags & FLAG_U) { |
1232 | context = strtol(U_opt, &ep, 10); | 1231 | context = bb_xgetlarg(U_opt, 10, 1, INT_MAX); |
1233 | if (context == 0) { | ||
1234 | bb_error_msg("Invalid context length"); | ||
1235 | bb_show_usage(); | ||
1236 | } | ||
1237 | } | 1232 | } |
1238 | argc -= optind; | 1233 | argc -= optind; |
1239 | argv += optind; | 1234 | argv += optind; |
diff --git a/coreutils/stty.c b/coreutils/stty.c index 8b70af65e..cfb7f7f39 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | //#define TEST | 24 | //#define TEST |
25 | 25 | ||
26 | #include "busybox.h" | ||
26 | #include <stddef.h> | 27 | #include <stddef.h> |
27 | #include <termios.h> | 28 | #include <termios.h> |
28 | #include <sys/ioctl.h> | 29 | #include <sys/ioctl.h> |
@@ -45,7 +46,6 @@ | |||
45 | #include <errno.h> | 46 | #include <errno.h> |
46 | #include <limits.h> | 47 | #include <limits.h> |
47 | #include <fcntl.h> | 48 | #include <fcntl.h> |
48 | #include "busybox.h" | ||
49 | 49 | ||
50 | #define STREQ(a, b) (strcmp ((a), (b)) == 0) | 50 | #define STREQ(a, b) (strcmp ((a), (b)) == 0) |
51 | 51 | ||
@@ -608,7 +608,7 @@ int main(int argc, char **argv) | |||
608 | for (i = 0; i < NUM_control_info; ++i) | 608 | for (i = 0; i < NUM_control_info; ++i) |
609 | if (STREQ(argv[k], control_info[i].name)) { | 609 | if (STREQ(argv[k], control_info[i].name)) { |
610 | if (k == argc - 1) | 610 | if (k == argc - 1) |
611 | bb_error_msg_and_die("missing argument to `%s'", argv[k]); | 611 | bb_error_msg_and_die(bb_msg_requires_arg, argv[k]); |
612 | match_found = 1; | 612 | match_found = 1; |
613 | ++k; | 613 | ++k; |
614 | set_control_char(&control_info[i], argv[k], &mode); | 614 | set_control_char(&control_info[i], argv[k], &mode); |
@@ -619,14 +619,14 @@ int main(int argc, char **argv) | |||
619 | if (match_found == 0) { | 619 | if (match_found == 0) { |
620 | if (STREQ(argv[k], "ispeed")) { | 620 | if (STREQ(argv[k], "ispeed")) { |
621 | if (k == argc - 1) | 621 | if (k == argc - 1) |
622 | bb_error_msg_and_die("missing argument to `%s'", argv[k]); | 622 | bb_error_msg_and_die(bb_msg_requires_arg, argv[k]); |
623 | ++k; | 623 | ++k; |
624 | set_speed(input_speed, argv[k], &mode); | 624 | set_speed(input_speed, argv[k], &mode); |
625 | speed_was_set = 1; | 625 | speed_was_set = 1; |
626 | require_set_attr = 1; | 626 | require_set_attr = 1; |
627 | } else if (STREQ(argv[k], "ospeed")) { | 627 | } else if (STREQ(argv[k], "ospeed")) { |
628 | if (k == argc - 1) | 628 | if (k == argc - 1) |
629 | bb_error_msg_and_die("missing argument to `%s'", argv[k]); | 629 | bb_error_msg_and_die(bb_msg_requires_arg, argv[k]); |
630 | ++k; | 630 | ++k; |
631 | set_speed(output_speed, argv[k], &mode); | 631 | set_speed(output_speed, argv[k], &mode); |
632 | speed_was_set = 1; | 632 | speed_was_set = 1; |
@@ -635,13 +635,13 @@ int main(int argc, char **argv) | |||
635 | #ifdef TIOCGWINSZ | 635 | #ifdef TIOCGWINSZ |
636 | else if (STREQ(argv[k], "rows")) { | 636 | else if (STREQ(argv[k], "rows")) { |
637 | if (k == argc - 1) | 637 | if (k == argc - 1) |
638 | bb_error_msg_and_die("missing argument to `%s'", argv[k]); | 638 | bb_error_msg_and_die(bb_msg_requires_arg, argv[k]); |
639 | ++k; | 639 | ++k; |
640 | set_window_size((int) bb_xparse_number(argv[k], stty_suffixes), | 640 | set_window_size((int) bb_xparse_number(argv[k], stty_suffixes), |
641 | -1); | 641 | -1); |
642 | } else if (STREQ(argv[k], "cols") || STREQ(argv[k], "columns")) { | 642 | } else if (STREQ(argv[k], "cols") || STREQ(argv[k], "columns")) { |
643 | if (k == argc - 1) | 643 | if (k == argc - 1) |
644 | bb_error_msg_and_die("missing argument to `%s'", argv[k]); | 644 | bb_error_msg_and_die(bb_msg_requires_arg, argv[k]); |
645 | ++k; | 645 | ++k; |
646 | set_window_size(-1, | 646 | set_window_size(-1, |
647 | (int) bb_xparse_number(argv[k], stty_suffixes)); | 647 | (int) bb_xparse_number(argv[k], stty_suffixes)); |
@@ -654,7 +654,7 @@ int main(int argc, char **argv) | |||
654 | #ifdef HAVE_C_LINE | 654 | #ifdef HAVE_C_LINE |
655 | else if (STREQ(argv[k], "line")) { | 655 | else if (STREQ(argv[k], "line")) { |
656 | if (k == argc - 1) | 656 | if (k == argc - 1) |
657 | bb_error_msg_and_die("missing argument to `%s'", argv[k]); | 657 | bb_error_msg_and_die(bb_msg_requires_arg, argv[k]); |
658 | ++k; | 658 | ++k; |
659 | mode.c_line = bb_xparse_number(argv[k], stty_suffixes); | 659 | mode.c_line = bb_xparse_number(argv[k], stty_suffixes); |
660 | require_set_attr = 1; | 660 | require_set_attr = 1; |
diff --git a/coreutils/test.c b/coreutils/test.c index ecd154907..2b624e308 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -178,7 +178,6 @@ static arith_t getn(const char *s); | |||
178 | static int newerf(const char *f1, const char *f2); | 178 | static int newerf(const char *f1, const char *f2); |
179 | static int olderf(const char *f1, const char *f2); | 179 | static int olderf(const char *f1, const char *f2); |
180 | static int equalf(const char *f1, const char *f2); | 180 | static int equalf(const char *f1, const char *f2); |
181 | static void syntax(const char *op, const char *msg); | ||
182 | static int test_eaccess(char *path, int mode); | 181 | static int test_eaccess(char *path, int mode); |
183 | static int is_a_group_member(gid_t gid); | 182 | static int is_a_group_member(gid_t gid); |
184 | static void initialize_group_array(void); | 183 | static void initialize_group_array(void); |
@@ -230,20 +229,11 @@ int test_main(int argc, char **argv) | |||
230 | res = !oexpr(t_lex(*t_wp)); | 229 | res = !oexpr(t_lex(*t_wp)); |
231 | 230 | ||
232 | if (*t_wp != NULL && *++t_wp != NULL) | 231 | if (*t_wp != NULL && *++t_wp != NULL) |
233 | syntax(*t_wp, "unknown operand"); | 232 | bb_error_msg_and_die("%s: unknown operand", *t_wp); |
234 | 233 | ||
235 | return (res); | 234 | return (res); |
236 | } | 235 | } |
237 | 236 | ||
238 | static void syntax(const char *op, const char *msg) | ||
239 | { | ||
240 | if (op && *op) { | ||
241 | bb_error_msg_and_die("%s: %s", op, msg); | ||
242 | } else { | ||
243 | bb_error_msg_and_die("%s", msg); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | static arith_t oexpr(enum token n) | 237 | static arith_t oexpr(enum token n) |
248 | { | 238 | { |
249 | arith_t res; | 239 | arith_t res; |
@@ -279,18 +269,18 @@ static arith_t primary(enum token n) | |||
279 | arith_t res; | 269 | arith_t res; |
280 | 270 | ||
281 | if (n == EOI) { | 271 | if (n == EOI) { |
282 | syntax(NULL, "argument expected"); | 272 | bb_error_msg_and_die("argument expected"); |
283 | } | 273 | } |
284 | if (n == LPAREN) { | 274 | if (n == LPAREN) { |
285 | res = oexpr(t_lex(*++t_wp)); | 275 | res = oexpr(t_lex(*++t_wp)); |
286 | if (t_lex(*++t_wp) != RPAREN) | 276 | if (t_lex(*++t_wp) != RPAREN) |
287 | syntax(NULL, "closing paren expected"); | 277 | bb_error_msg_and_die("closing paren expected"); |
288 | return res; | 278 | return res; |
289 | } | 279 | } |
290 | if (t_wp_op && t_wp_op->op_type == UNOP) { | 280 | if (t_wp_op && t_wp_op->op_type == UNOP) { |
291 | /* unary expression */ | 281 | /* unary expression */ |
292 | if (*++t_wp == NULL) | 282 | if (*++t_wp == NULL) |
293 | syntax(t_wp_op->op_text, "argument expected"); | 283 | bb_error_msg_and_die(bb_msg_requires_arg, t_wp_op->op_text); |
294 | switch (n) { | 284 | switch (n) { |
295 | case STREZ: | 285 | case STREZ: |
296 | return strlen(*t_wp) == 0; | 286 | return strlen(*t_wp) == 0; |
@@ -320,7 +310,7 @@ static int binop(void) | |||
320 | op = t_wp_op; | 310 | op = t_wp_op; |
321 | 311 | ||
322 | if ((opnd2 = *++t_wp) == (char *) 0) | 312 | if ((opnd2 = *++t_wp) == (char *) 0) |
323 | syntax(op->op_text, "argument expected"); | 313 | bb_error_msg_and_die(bb_msg_requires_arg, op->op_text); |
324 | 314 | ||
325 | switch (op->op_num) { | 315 | switch (op->op_num) { |
326 | case STREQ: | 316 | case STREQ: |
diff --git a/editors/sed.c b/editors/sed.c index 71542d2ac..219a44008 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1166,7 +1166,7 @@ int sed_main(int argc, char **argv) | |||
1166 | * files were specified or '-' was specified, take input from stdin. | 1166 | * files were specified or '-' was specified, take input from stdin. |
1167 | * Otherwise, we process all the files specified. */ | 1167 | * Otherwise, we process all the files specified. */ |
1168 | if (argv[optind] == NULL) { | 1168 | if (argv[optind] == NULL) { |
1169 | if(bbg.in_place) bb_error_msg_and_die("Filename required for -i"); | 1169 | if(bbg.in_place) bb_error_msg_and_die(bb_msg_requires_arg, "-i"); |
1170 | add_input_file(stdin); | 1170 | add_input_file(stdin); |
1171 | process_files(); | 1171 | process_files(); |
1172 | } else { | 1172 | } else { |
diff --git a/findutils/find.c b/findutils/find.c index f8bcccaf5..1e15e8899 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -20,10 +20,6 @@ | |||
20 | #include <time.h> | 20 | #include <time.h> |
21 | #include <ctype.h> | 21 | #include <ctype.h> |
22 | 22 | ||
23 | //XXX just found out about libbb/messages.c . maybe move stuff there ? - ghoz | ||
24 | static const char msg_req_arg[] = "option `%s' requires an argument"; | ||
25 | static const char msg_invalid_arg[] = "invalid argument `%s' to `%s'"; | ||
26 | |||
27 | static char *pattern; | 23 | static char *pattern; |
28 | #ifdef CONFIG_FEATURE_FIND_PRINT0 | 24 | #ifdef CONFIG_FEATURE_FIND_PRINT0 |
29 | static char printsep = '\n'; | 25 | static char printsep = '\n'; |
@@ -188,7 +184,7 @@ static int find_type(char *type) | |||
188 | } | 184 | } |
189 | 185 | ||
190 | if (mask == 0 || type[1] != '\0') | 186 | if (mask == 0 || type[1] != '\0') |
191 | bb_error_msg_and_die(msg_invalid_arg, type, "-type"); | 187 | bb_error_msg_and_die(bb_msg_invalid_arg, type, "-type"); |
192 | 188 | ||
193 | return mask; | 189 | return mask; |
194 | } | 190 | } |
@@ -217,22 +213,22 @@ int find_main(int argc, char **argv) | |||
217 | #endif | 213 | #endif |
218 | else if (strcmp(argv[i], "-name") == 0) { | 214 | else if (strcmp(argv[i], "-name") == 0) { |
219 | if (++i == argc) | 215 | if (++i == argc) |
220 | bb_error_msg_and_die(msg_req_arg, "-name"); | 216 | bb_error_msg_and_die(bb_msg_requires_arg, "-name"); |
221 | pattern = argv[i]; | 217 | pattern = argv[i]; |
222 | #ifdef CONFIG_FEATURE_FIND_TYPE | 218 | #ifdef CONFIG_FEATURE_FIND_TYPE |
223 | } else if (strcmp(argv[i], "-type") == 0) { | 219 | } else if (strcmp(argv[i], "-type") == 0) { |
224 | if (++i == argc) | 220 | if (++i == argc) |
225 | bb_error_msg_and_die(msg_req_arg, "-type"); | 221 | bb_error_msg_and_die(bb_msg_requires_arg, "-type"); |
226 | type_mask = find_type(argv[i]); | 222 | type_mask = find_type(argv[i]); |
227 | #endif | 223 | #endif |
228 | #ifdef CONFIG_FEATURE_FIND_PERM | 224 | #ifdef CONFIG_FEATURE_FIND_PERM |
229 | } else if (strcmp(argv[i], "-perm") == 0) { | 225 | } else if (strcmp(argv[i], "-perm") == 0) { |
230 | char *end; | 226 | char *end; |
231 | if (++i == argc) | 227 | if (++i == argc) |
232 | bb_error_msg_and_die(msg_req_arg, "-perm"); | 228 | bb_error_msg_and_die(bb_msg_requires_arg, "-perm"); |
233 | perm_mask = strtol(argv[i], &end, 8); | 229 | perm_mask = strtol(argv[i], &end, 8); |
234 | if ((end[0] != '\0') || (perm_mask > 07777)) | 230 | if ((end[0] != '\0') || (perm_mask > 07777)) |
235 | bb_error_msg_and_die(msg_invalid_arg, argv[i], "-perm"); | 231 | bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-perm"); |
236 | if ((perm_char = argv[i][0]) == '-') | 232 | if ((perm_char = argv[i][0]) == '-') |
237 | perm_mask = -perm_mask; | 233 | perm_mask = -perm_mask; |
238 | #endif | 234 | #endif |
@@ -240,10 +236,10 @@ int find_main(int argc, char **argv) | |||
240 | } else if (strcmp(argv[i], "-mtime") == 0) { | 236 | } else if (strcmp(argv[i], "-mtime") == 0) { |
241 | char *end; | 237 | char *end; |
242 | if (++i == argc) | 238 | if (++i == argc) |
243 | bb_error_msg_and_die(msg_req_arg, "-mtime"); | 239 | bb_error_msg_and_die(bb_msg_requires_arg, "-mtime"); |
244 | mtime_days = strtol(argv[i], &end, 10); | 240 | mtime_days = strtol(argv[i], &end, 10); |
245 | if (end[0] != '\0') | 241 | if (end[0] != '\0') |
246 | bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mtime"); | 242 | bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-mtime"); |
247 | if ((mtime_char = argv[i][0]) == '-') | 243 | if ((mtime_char = argv[i][0]) == '-') |
248 | mtime_days = -mtime_days; | 244 | mtime_days = -mtime_days; |
249 | #endif | 245 | #endif |
@@ -251,10 +247,10 @@ int find_main(int argc, char **argv) | |||
251 | } else if (strcmp(argv[i], "-mmin") == 0) { | 247 | } else if (strcmp(argv[i], "-mmin") == 0) { |
252 | char *end; | 248 | char *end; |
253 | if (++i == argc) | 249 | if (++i == argc) |
254 | bb_error_msg_and_die(msg_req_arg, "-mmin"); | 250 | bb_error_msg_and_die(bb_msg_requires_arg, "-mmin"); |
255 | mmin_mins = strtol(argv[i], &end, 10); | 251 | mmin_mins = strtol(argv[i], &end, 10); |
256 | if (end[0] != '\0') | 252 | if (end[0] != '\0') |
257 | bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mmin"); | 253 | bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-mmin"); |
258 | if ((mmin_char = argv[i][0]) == '-') | 254 | if ((mmin_char = argv[i][0]) == '-') |
259 | mmin_mins = -mmin_mins; | 255 | mmin_mins = -mmin_mins; |
260 | #endif | 256 | #endif |
@@ -281,7 +277,7 @@ int find_main(int argc, char **argv) | |||
281 | } else if (strcmp(argv[i], "-newer") == 0) { | 277 | } else if (strcmp(argv[i], "-newer") == 0) { |
282 | struct stat stat_newer; | 278 | struct stat stat_newer; |
283 | if (++i == argc) | 279 | if (++i == argc) |
284 | bb_error_msg_and_die(msg_req_arg, "-newer"); | 280 | bb_error_msg_and_die(bb_msg_requires_arg, "-newer"); |
285 | xstat (argv[i], &stat_newer); | 281 | xstat (argv[i], &stat_newer); |
286 | newer_mtime = stat_newer.st_mtime; | 282 | newer_mtime = stat_newer.st_mtime; |
287 | #endif | 283 | #endif |
@@ -289,10 +285,10 @@ int find_main(int argc, char **argv) | |||
289 | } else if (strcmp(argv[i], "-inum") == 0) { | 285 | } else if (strcmp(argv[i], "-inum") == 0) { |
290 | char *end; | 286 | char *end; |
291 | if (++i == argc) | 287 | if (++i == argc) |
292 | bb_error_msg_and_die(msg_req_arg, "-inum"); | 288 | bb_error_msg_and_die(bb_msg_requires_arg, "-inum"); |
293 | inode_num = strtol(argv[i], &end, 10); | 289 | inode_num = strtol(argv[i], &end, 10); |
294 | if (end[0] != '\0') | 290 | if (end[0] != '\0') |
295 | bb_error_msg_and_die(msg_invalid_arg, argv[i], "-inum"); | 291 | bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-inum"); |
296 | #endif | 292 | #endif |
297 | #ifdef CONFIG_FEATURE_FIND_EXEC | 293 | #ifdef CONFIG_FEATURE_FIND_EXEC |
298 | } else if (strcmp(argv[i], "-exec") == 0) { | 294 | } else if (strcmp(argv[i], "-exec") == 0) { |
@@ -301,14 +297,14 @@ int find_main(int argc, char **argv) | |||
301 | 297 | ||
302 | while (i++) { | 298 | while (i++) { |
303 | if (i == argc) | 299 | if (i == argc) |
304 | bb_error_msg_and_die(msg_req_arg, "-exec"); | 300 | bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); |
305 | if (*argv[i] == ';') | 301 | if (*argv[i] == ';') |
306 | break; | 302 | break; |
307 | cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); | 303 | cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); |
308 | } | 304 | } |
309 | 305 | ||
310 | if (*cmd_string == 0) | 306 | if (*cmd_string == 0) |
311 | bb_error_msg_and_die(msg_req_arg, "-exec"); | 307 | bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); |
312 | cmd_string++; | 308 | cmd_string++; |
313 | exec_str = xmalloc(sizeof(char *)); | 309 | exec_str = xmalloc(sizeof(char *)); |
314 | 310 | ||
diff --git a/findutils/grep.c b/findutils/grep.c index a24be248b..ecb1d0457 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -313,12 +313,12 @@ int grep_main(int argc, char **argv) | |||
313 | if(opt & GREP_OPT_A) { | 313 | if(opt & GREP_OPT_A) { |
314 | lines_after = strtoul(slines_after, &junk, 10); | 314 | lines_after = strtoul(slines_after, &junk, 10); |
315 | if(*junk != '\0') | 315 | if(*junk != '\0') |
316 | bb_error_msg_and_die("invalid context length argument"); | 316 | bb_error_msg_and_die(bb_msg_invalid_arg, slines_after, "-A"); |
317 | } | 317 | } |
318 | if(opt & GREP_OPT_B) { | 318 | if(opt & GREP_OPT_B) { |
319 | lines_before = strtoul(slines_before, &junk, 10); | 319 | lines_before = strtoul(slines_before, &junk, 10); |
320 | if(*junk != '\0') | 320 | if(*junk != '\0') |
321 | bb_error_msg_and_die("invalid context length argument"); | 321 | bb_error_msg_and_die(bb_msg_invalid_arg, slines_before, "-B"); |
322 | } | 322 | } |
323 | /* sanity checks after parse may be invalid numbers ;-) */ | 323 | /* sanity checks after parse may be invalid numbers ;-) */ |
324 | if ((opt & (GREP_OPT_c|GREP_OPT_q|GREP_OPT_l|GREP_OPT_L))) { | 324 | if ((opt & (GREP_OPT_c|GREP_OPT_q|GREP_OPT_l|GREP_OPT_L))) { |
diff --git a/include/libbb.h b/include/libbb.h index 18ad8419f..9529b56e0 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -350,6 +350,8 @@ extern const char * const bb_msg_name_longer_than_foo; | |||
350 | extern const char * const bb_msg_unknown; | 350 | extern const char * const bb_msg_unknown; |
351 | extern const char * const bb_msg_can_not_create_raw_socket; | 351 | extern const char * const bb_msg_can_not_create_raw_socket; |
352 | extern const char * const bb_msg_perm_denied_are_you_root; | 352 | extern const char * const bb_msg_perm_denied_are_you_root; |
353 | extern const char * const bb_msg_requires_arg; | ||
354 | extern const char * const bb_msg_invalid_arg; | ||
353 | extern const char * const bb_msg_standard_input; | 355 | extern const char * const bb_msg_standard_input; |
354 | extern const char * const bb_msg_standard_output; | 356 | extern const char * const bb_msg_standard_output; |
355 | 357 | ||
diff --git a/libbb/messages.c b/libbb/messages.c index 89ac94e13..f21579861 100644 --- a/libbb/messages.c +++ b/libbb/messages.c | |||
@@ -38,11 +38,17 @@ | |||
38 | const char * const bb_msg_unknown = "(unknown)"; | 38 | const char * const bb_msg_unknown = "(unknown)"; |
39 | #endif | 39 | #endif |
40 | #ifdef L_can_not_create_raw_socket | 40 | #ifdef L_can_not_create_raw_socket |
41 | const char * const bb_msg_can_not_create_raw_socket = "can`t create raw socket"; | 41 | const char * const bb_msg_can_not_create_raw_socket = "can't create raw socket"; |
42 | #endif | 42 | #endif |
43 | #ifdef L_perm_denied_are_you_root | 43 | #ifdef L_perm_denied_are_you_root |
44 | const char * const bb_msg_perm_denied_are_you_root = "permission denied. (are you root?)"; | 44 | const char * const bb_msg_perm_denied_are_you_root = "permission denied. (are you root?)"; |
45 | #endif | 45 | #endif |
46 | #ifdef L_msg_requires_arg | ||
47 | const char * const bb_msg_requires_arg = "%s requires an argument"; | ||
48 | #endif | ||
49 | #ifdef L_msg_invalid_arg | ||
50 | const char * const bb_msg_invalid_arg = "invalid argument `%s' to `%s'"; | ||
51 | #endif | ||
46 | #ifdef L_msg_standard_input | 52 | #ifdef L_msg_standard_input |
47 | const char * const bb_msg_standard_input = "standard input"; | 53 | const char * const bb_msg_standard_input = "standard input"; |
48 | #endif | 54 | #endif |
diff --git a/networking/ip.c b/networking/ip.c index 9250484aa..bba70890d 100644 --- a/networking/ip.c +++ b/networking/ip.c | |||
@@ -59,7 +59,7 @@ void ip_parse_common_args(int *argcp, char ***argvp) | |||
59 | else if (strcmp(argv[1], "link") == 0) | 59 | else if (strcmp(argv[1], "link") == 0) |
60 | preferred_family = AF_PACKET; | 60 | preferred_family = AF_PACKET; |
61 | else | 61 | else |
62 | invarg(argv[1], "invalid protocol family"); | 62 | invarg(bb_msg_invalid_arg, argv[1], "-family"); |
63 | } else if (strcmp(opt, "-4") == 0) { | 63 | } else if (strcmp(opt, "-4") == 0) { |
64 | preferred_family = AF_INET; | 64 | preferred_family = AF_INET; |
65 | } else if (strcmp(opt, "-6") == 0) { | 65 | } else if (strcmp(opt, "-6") == 0) { |
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c index 52e549ea2..6d4915775 100644 --- a/networking/libiproute/ip_parse_common_args.c +++ b/networking/libiproute/ip_parse_common_args.c | |||
@@ -56,7 +56,7 @@ void ip_parse_common_args(int *argcp, char ***argvp) | |||
56 | else if (strcmp(argv[1], "link") == 0) | 56 | else if (strcmp(argv[1], "link") == 0) |
57 | preferred_family = AF_PACKET; | 57 | preferred_family = AF_PACKET; |
58 | else | 58 | else |
59 | invarg(argv[1], "invalid protocol family"); | 59 | invarg(argv[1], "protocol family"); |
60 | } else if (strcmp(opt, "-4") == 0) { | 60 | } else if (strcmp(opt, "-4") == 0) { |
61 | preferred_family = AF_INET; | 61 | preferred_family = AF_INET; |
62 | } else if (strcmp(opt, "-6") == 0) { | 62 | } else if (strcmp(opt, "-6") == 0) { |
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index a048cff99..ee9825ba2 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -430,11 +430,11 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush) | |||
430 | 430 | ||
431 | if (flush) { | 431 | if (flush) { |
432 | if (argc <= 0) { | 432 | if (argc <= 0) { |
433 | fprintf(stderr, "Flush requires arguments.\n"); | 433 | bb_error_msg(bb_msg_requires_arg, "flush"); |
434 | return -1; | 434 | return -1; |
435 | } | 435 | } |
436 | if (filter.family == AF_PACKET) { | 436 | if (filter.family == AF_PACKET) { |
437 | fprintf(stderr, "Cannot flush link addresses.\n"); | 437 | bb_error_msg("Cannot flush link addresses."); |
438 | return -1; | 438 | return -1; |
439 | } | 439 | } |
440 | } | 440 | } |
@@ -456,7 +456,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush) | |||
456 | filter.scopemask = -1; | 456 | filter.scopemask = -1; |
457 | if (rtnl_rtscope_a2n(&scope, *argv)) { | 457 | if (rtnl_rtscope_a2n(&scope, *argv)) { |
458 | if (strcmp(*argv, "all") != 0) { | 458 | if (strcmp(*argv, "all") != 0) { |
459 | invarg("invalid \"scope\"\n", *argv); | 459 | invarg(*argv, "scope"); |
460 | } | 460 | } |
461 | scope = RT_SCOPE_NOWHERE; | 461 | scope = RT_SCOPE_NOWHERE; |
462 | filter.scopemask = 0; | 462 | filter.scopemask = 0; |
@@ -711,7 +711,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
711 | uint32_t scope = 0; | 711 | uint32_t scope = 0; |
712 | NEXT_ARG(); | 712 | NEXT_ARG(); |
713 | if (rtnl_rtscope_a2n(&scope, *argv)) { | 713 | if (rtnl_rtscope_a2n(&scope, *argv)) { |
714 | invarg(*argv, "invalid scope value"); | 714 | invarg(*argv, "scope"); |
715 | } | 715 | } |
716 | req.ifa.ifa_scope = scope; | 716 | req.ifa.ifa_scope = scope; |
717 | scoped = 1; | 717 | scoped = 1; |
@@ -744,7 +744,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
744 | } | 744 | } |
745 | 745 | ||
746 | if (d == NULL) { | 746 | if (d == NULL) { |
747 | bb_error_msg("Not enough information: \"dev\" argument is required"); | 747 | bb_error_msg(bb_msg_requires_arg,"\"dev\""); |
748 | return -1; | 748 | return -1; |
749 | } | 749 | } |
750 | if (l && matches(d, l) != 0) { | 750 | if (l && matches(d, l) != 0) { |
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 2797f0250..9e30122c3 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c | |||
@@ -252,7 +252,7 @@ static int do_set(int argc, char **argv) | |||
252 | if (mtu != -1) | 252 | if (mtu != -1) |
253 | duparg("mtu", *argv); | 253 | duparg("mtu", *argv); |
254 | if (get_integer(&mtu, *argv, 0)) | 254 | if (get_integer(&mtu, *argv, 0)) |
255 | invarg("Invalid \"mtu\" value\n", *argv); | 255 | invarg(*argv, "mtu"); |
256 | } else if (strcmp(*argv, "multicast") == 0) { | 256 | } else if (strcmp(*argv, "multicast") == 0) { |
257 | NEXT_ARG(); | 257 | NEXT_ARG(); |
258 | mask |= IFF_MULTICAST; | 258 | mask |= IFF_MULTICAST; |
@@ -286,7 +286,7 @@ static int do_set(int argc, char **argv) | |||
286 | } | 286 | } |
287 | 287 | ||
288 | if (!dev) { | 288 | if (!dev) { |
289 | bb_error_msg("Not enough of information: \"dev\" argument is required."); | 289 | bb_error_msg(bb_msg_requires_arg, "\"dev\""); |
290 | exit(-1); | 290 | exit(-1); |
291 | } | 291 | } |
292 | 292 | ||
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 6052a3023..511e89107 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -343,14 +343,14 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) | |||
343 | NEXT_ARG(); | 343 | NEXT_ARG(); |
344 | } | 344 | } |
345 | if (get_unsigned(&mtu, *argv, 0)) { | 345 | if (get_unsigned(&mtu, *argv, 0)) { |
346 | invarg("\"mtu\" value is invalid\n", *argv); | 346 | invarg(*argv, "mtu"); |
347 | } | 347 | } |
348 | rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); | 348 | rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); |
349 | } else if (matches(*argv, "protocol") == 0) { | 349 | } else if (matches(*argv, "protocol") == 0) { |
350 | uint32_t prot; | 350 | uint32_t prot; |
351 | NEXT_ARG(); | 351 | NEXT_ARG(); |
352 | if (rtnl_rtprot_a2n(&prot, *argv)) | 352 | if (rtnl_rtprot_a2n(&prot, *argv)) |
353 | invarg("\"protocol\" value is invalid\n", *argv); | 353 | invarg(*argv, "protocol"); |
354 | req.r.rtm_protocol = prot; | 354 | req.r.rtm_protocol = prot; |
355 | proto_ok =1; | 355 | proto_ok =1; |
356 | } else if (strcmp(*argv, "dev") == 0 || | 356 | } else if (strcmp(*argv, "dev") == 0 || |
@@ -487,7 +487,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) | |||
487 | filter.tb = RT_TABLE_MAIN; | 487 | filter.tb = RT_TABLE_MAIN; |
488 | 488 | ||
489 | if (flush && argc <= 0) { | 489 | if (flush && argc <= 0) { |
490 | fprintf(stderr, "\"ip route flush\" requires arguments.\n"); | 490 | bb_error_msg(bb_msg_requires_arg, "\"ip route flush\""); |
491 | return -1; | 491 | return -1; |
492 | } | 492 | } |
493 | 493 | ||
@@ -498,7 +498,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) | |||
498 | filter.protocolmask = -1; | 498 | filter.protocolmask = -1; |
499 | if (rtnl_rtprot_a2n(&prot, *argv)) { | 499 | if (rtnl_rtprot_a2n(&prot, *argv)) { |
500 | if (strcmp(*argv, "all") != 0) { | 500 | if (strcmp(*argv, "all") != 0) { |
501 | invarg("invalid \"protocol\"\n", *argv); | 501 | invarg(*argv, "protocol"); |
502 | } | 502 | } |
503 | prot = 0; | 503 | prot = 0; |
504 | filter.protocolmask = 0; | 504 | filter.protocolmask = 0; |
@@ -541,7 +541,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) | |||
541 | if (matches(*argv, "cache") == 0) { | 541 | if (matches(*argv, "cache") == 0) { |
542 | filter.tb = -1; | 542 | filter.tb = -1; |
543 | } else if (matches(*argv, "main") != 0) { | 543 | } else if (matches(*argv, "main") != 0) { |
544 | invarg("invalid \"table\"", *argv); | 544 | invarg(*argv, "table"); |
545 | } | 545 | } |
546 | } else if (matches(*argv, "cache") == 0) { | 546 | } else if (matches(*argv, "cache") == 0) { |
547 | filter.tb = -1; | 547 | filter.tb = -1; |
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index 1b1458e1e..9b96920dc 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c | |||
@@ -259,9 +259,9 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
259 | NEXT_ARG(); | 259 | NEXT_ARG(); |
260 | if (strcmp(*argv, "inherit") != 0) { | 260 | if (strcmp(*argv, "inherit") != 0) { |
261 | if (get_unsigned(&uval, *argv, 0)) | 261 | if (get_unsigned(&uval, *argv, 0)) |
262 | invarg("invalid TTL\n", *argv); | 262 | invarg(*argv, "TTL"); |
263 | if (uval > 255) | 263 | if (uval > 255) |
264 | invarg("TTL must be <=255\n", *argv); | 264 | invarg(*argv, "TTL must be <=255"); |
265 | p->iph.ttl = uval; | 265 | p->iph.ttl = uval; |
266 | } | 266 | } |
267 | } else if (strcmp(*argv, "tos") == 0 || | 267 | } else if (strcmp(*argv, "tos") == 0 || |
@@ -270,7 +270,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
270 | NEXT_ARG(); | 270 | NEXT_ARG(); |
271 | if (strcmp(*argv, "inherit") != 0) { | 271 | if (strcmp(*argv, "inherit") != 0) { |
272 | if (rtnl_dsfield_a2n(&uval, *argv)) | 272 | if (rtnl_dsfield_a2n(&uval, *argv)) |
273 | invarg("bad TOS value", *argv); | 273 | invarg(*argv, "TOS"); |
274 | p->iph.tos = uval; | 274 | p->iph.tos = uval; |
275 | } else | 275 | } else |
276 | p->iph.tos = 1; | 276 | p->iph.tos = 1; |
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index 3a161ead0..2e2aa90f8 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c | |||
@@ -240,9 +240,9 @@ void incomplete_command(void) | |||
240 | exit(-1); | 240 | exit(-1); |
241 | } | 241 | } |
242 | 242 | ||
243 | void invarg(char *msg, char *arg) | 243 | void invarg(const char const *arg, const char const *opt) |
244 | { | 244 | { |
245 | bb_error_msg("argument \"%s\" is wrong: %s", arg, msg); | 245 | bb_error_msg(bb_msg_invalid_arg, arg, opt); |
246 | exit(-1); | 246 | exit(-1); |
247 | } | 247 | } |
248 | 248 | ||
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h index 0a3a06c15..af286c8f5 100644 --- a/networking/libiproute/utils.h +++ b/networking/libiproute/utils.h | |||
@@ -1,13 +1,13 @@ | |||
1 | #ifndef __UTILS_H__ | 1 | #ifndef __UTILS_H__ |
2 | #define __UTILS_H__ 1 | 2 | #define __UTILS_H__ 1 |
3 | 3 | ||
4 | #include "libbb.h" | ||
4 | #include <asm/types.h> | 5 | #include <asm/types.h> |
5 | #include <resolv.h> | 6 | #include <resolv.h> |
6 | 7 | ||
7 | #include "libnetlink.h" | 8 | #include "libnetlink.h" |
8 | #include "ll_map.h" | 9 | #include "ll_map.h" |
9 | #include "rtm_map.h" | 10 | #include "rtm_map.h" |
10 | #include "libbb.h" | ||
11 | 11 | ||
12 | extern int preferred_family; | 12 | extern int preferred_family; |
13 | extern int show_stats; | 13 | extern int show_stats; |
@@ -77,7 +77,7 @@ extern int get_s8(__s8 *val, char *arg, int base); | |||
77 | extern const char *format_host(int af, int len, void *addr, char *buf, int buflen); | 77 | extern const char *format_host(int af, int len, void *addr, char *buf, int buflen); |
78 | extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen); | 78 | extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen); |
79 | 79 | ||
80 | void invarg(char *, char *) ATTRIBUTE_NORETURN; | 80 | void invarg(const char const*, const char const*) ATTRIBUTE_NORETURN; |
81 | void duparg(char *, char *) ATTRIBUTE_NORETURN; | 81 | void duparg(char *, char *) ATTRIBUTE_NORETURN; |
82 | void duparg2(char *, char *) ATTRIBUTE_NORETURN; | 82 | void duparg2(char *, char *) ATTRIBUTE_NORETURN; |
83 | int matches(char *arg, char *pattern); | 83 | int matches(char *arg, char *pattern); |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index c36c87602..a1b6d4626 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -206,7 +206,7 @@ int main(int argc, char *argv[]) | |||
206 | {"script", required_argument, 0, 's'}, | 206 | {"script", required_argument, 0, 's'}, |
207 | {"timeout", required_argument, 0, 'T'}, | 207 | {"timeout", required_argument, 0, 'T'}, |
208 | {"version", no_argument, 0, 'v'}, | 208 | {"version", no_argument, 0, 'v'}, |
209 | {"retries", required_argument, 0, 't'}, | 209 | {"retries", required_argument, 0, 't'}, |
210 | {0, 0, 0, 0} | 210 | {0, 0, 0, 0} |
211 | }; | 211 | }; |
212 | 212 | ||
diff --git a/shell/ash.c b/shell/ash.c index 5cdd7f006..962813dbd 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -8762,7 +8762,7 @@ procargs(int argc, char **argv) | |||
8762 | xminusc = minusc; | 8762 | xminusc = minusc; |
8763 | if (*xargv == NULL) { | 8763 | if (*xargv == NULL) { |
8764 | if (xminusc) | 8764 | if (xminusc) |
8765 | sh_error("-c requires an argument"); | 8765 | sh_error(bb_msg_requires_arg, "-c"); |
8766 | sflag = 1; | 8766 | sflag = 1; |
8767 | } | 8767 | } |
8768 | if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1)) | 8768 | if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1)) |
diff --git a/shell/lash.c b/shell/lash.c index b8ec8c66b..733b80cf5 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -284,7 +284,7 @@ static int builtin_fg_bg(struct child_prog *child) | |||
284 | } | 284 | } |
285 | } else { | 285 | } else { |
286 | if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) { | 286 | if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) { |
287 | bb_error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); | 287 | bb_error_msg(bb_msg_invalid_arg, child->argv[1], child->argv[0]); |
288 | return EXIT_FAILURE; | 288 | return EXIT_FAILURE; |
289 | } | 289 | } |
290 | for (job = child->family->job_list->head; job; job = job->next) { | 290 | for (job = child->family->job_list->head; job; job = job->next) { |
@@ -465,7 +465,7 @@ static int builtin_source(struct child_prog *child) | |||
465 | static int builtin_unset(struct child_prog *child) | 465 | static int builtin_unset(struct child_prog *child) |
466 | { | 466 | { |
467 | if (child->argv[1] == NULL) { | 467 | if (child->argv[1] == NULL) { |
468 | printf( "unset: parameter required.\n"); | 468 | printf(bb_msg_requires_arg, "unset"); |
469 | return EXIT_FAILURE; | 469 | return EXIT_FAILURE; |
470 | } | 470 | } |
471 | unsetenv(child->argv[1]); | 471 | unsetenv(child->argv[1]); |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index db44848b8..422cae3de 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -456,12 +456,13 @@ static void read_block(unsigned int nr, char *addr) | |||
456 | return; | 456 | return; |
457 | } | 457 | } |
458 | if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) { | 458 | if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) { |
459 | printf("Read error: unable to seek to block in file '%s'\n", | 459 | printf("%s: unable to seek to block in file '%s'\n", |
460 | current_name); | 460 | bb_msg_read_error, current_name); |
461 | errors_uncorrected = 1; | 461 | errors_uncorrected = 1; |
462 | memset(addr, 0, BLOCK_SIZE); | 462 | memset(addr, 0, BLOCK_SIZE); |
463 | } else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) { | 463 | } else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) { |
464 | printf("Read error: bad block in file '%s'\n", current_name); | 464 | printf("%s: bad block in file '%s'\n", |
465 | bb_msg_read_error, current_name); | ||
465 | errors_uncorrected = 1; | 466 | errors_uncorrected = 1; |
466 | memset(addr, 0, BLOCK_SIZE); | 467 | memset(addr, 0, BLOCK_SIZE); |
467 | } | 468 | } |
@@ -483,7 +484,8 @@ static void write_block(unsigned int nr, char *addr) | |||
483 | if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) | 484 | if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) |
484 | die("seek failed in write_block"); | 485 | die("seek failed in write_block"); |
485 | if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) { | 486 | if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) { |
486 | printf("Write error: bad block in file '%s'\n", current_name); | 487 | printf("%s: bad block in file '%s'\n", |
488 | bb_msg_write_error, current_name); | ||
487 | errors_uncorrected = 1; | 489 | errors_uncorrected = 1; |
488 | } | 490 | } |
489 | } | 491 | } |