diff options
Diffstat (limited to 'findutils')
-rw-r--r-- | findutils/find.c | 32 | ||||
-rw-r--r-- | findutils/grep.c | 4 |
2 files changed, 16 insertions, 20 deletions
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 @@ #include <time.h> #include <ctype.h> -//XXX just found out about libbb/messages.c . maybe move stuff there ? - ghoz -static const char msg_req_arg[] = "option `%s' requires an argument"; -static const char msg_invalid_arg[] = "invalid argument `%s' to `%s'"; - static char *pattern; #ifdef CONFIG_FEATURE_FIND_PRINT0 static char printsep = '\n'; @@ -188,7 +184,7 @@ static int find_type(char *type) } if (mask == 0 || type[1] != '\0') - bb_error_msg_and_die(msg_invalid_arg, type, "-type"); + bb_error_msg_and_die(bb_msg_invalid_arg, type, "-type"); return mask; } @@ -217,22 +213,22 @@ int find_main(int argc, char **argv) #endif else if (strcmp(argv[i], "-name") == 0) { if (++i == argc) - bb_error_msg_and_die(msg_req_arg, "-name"); + bb_error_msg_and_die(bb_msg_requires_arg, "-name"); pattern = argv[i]; #ifdef CONFIG_FEATURE_FIND_TYPE } else if (strcmp(argv[i], "-type") == 0) { if (++i == argc) - bb_error_msg_and_die(msg_req_arg, "-type"); + bb_error_msg_and_die(bb_msg_requires_arg, "-type"); type_mask = find_type(argv[i]); #endif #ifdef CONFIG_FEATURE_FIND_PERM } else if (strcmp(argv[i], "-perm") == 0) { char *end; if (++i == argc) - bb_error_msg_and_die(msg_req_arg, "-perm"); + bb_error_msg_and_die(bb_msg_requires_arg, "-perm"); perm_mask = strtol(argv[i], &end, 8); if ((end[0] != '\0') || (perm_mask > 07777)) - bb_error_msg_and_die(msg_invalid_arg, argv[i], "-perm"); + bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-perm"); if ((perm_char = argv[i][0]) == '-') perm_mask = -perm_mask; #endif @@ -240,10 +236,10 @@ int find_main(int argc, char **argv) } else if (strcmp(argv[i], "-mtime") == 0) { char *end; if (++i == argc) - bb_error_msg_and_die(msg_req_arg, "-mtime"); + bb_error_msg_and_die(bb_msg_requires_arg, "-mtime"); mtime_days = strtol(argv[i], &end, 10); if (end[0] != '\0') - bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mtime"); + bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-mtime"); if ((mtime_char = argv[i][0]) == '-') mtime_days = -mtime_days; #endif @@ -251,10 +247,10 @@ int find_main(int argc, char **argv) } else if (strcmp(argv[i], "-mmin") == 0) { char *end; if (++i == argc) - bb_error_msg_and_die(msg_req_arg, "-mmin"); + bb_error_msg_and_die(bb_msg_requires_arg, "-mmin"); mmin_mins = strtol(argv[i], &end, 10); if (end[0] != '\0') - bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mmin"); + bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-mmin"); if ((mmin_char = argv[i][0]) == '-') mmin_mins = -mmin_mins; #endif @@ -281,7 +277,7 @@ int find_main(int argc, char **argv) } else if (strcmp(argv[i], "-newer") == 0) { struct stat stat_newer; if (++i == argc) - bb_error_msg_and_die(msg_req_arg, "-newer"); + bb_error_msg_and_die(bb_msg_requires_arg, "-newer"); xstat (argv[i], &stat_newer); newer_mtime = stat_newer.st_mtime; #endif @@ -289,10 +285,10 @@ int find_main(int argc, char **argv) } else if (strcmp(argv[i], "-inum") == 0) { char *end; if (++i == argc) - bb_error_msg_and_die(msg_req_arg, "-inum"); + bb_error_msg_and_die(bb_msg_requires_arg, "-inum"); inode_num = strtol(argv[i], &end, 10); if (end[0] != '\0') - bb_error_msg_and_die(msg_invalid_arg, argv[i], "-inum"); + bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-inum"); #endif #ifdef CONFIG_FEATURE_FIND_EXEC } else if (strcmp(argv[i], "-exec") == 0) { @@ -301,14 +297,14 @@ int find_main(int argc, char **argv) while (i++) { if (i == argc) - bb_error_msg_and_die(msg_req_arg, "-exec"); + bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); if (*argv[i] == ';') break; cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); } if (*cmd_string == 0) - bb_error_msg_and_die(msg_req_arg, "-exec"); + bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); cmd_string++; exec_str = xmalloc(sizeof(char *)); 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) if(opt & GREP_OPT_A) { lines_after = strtoul(slines_after, &junk, 10); if(*junk != '\0') - bb_error_msg_and_die("invalid context length argument"); + bb_error_msg_and_die(bb_msg_invalid_arg, slines_after, "-A"); } if(opt & GREP_OPT_B) { lines_before = strtoul(slines_before, &junk, 10); if(*junk != '\0') - bb_error_msg_and_die("invalid context length argument"); + bb_error_msg_and_die(bb_msg_invalid_arg, slines_before, "-B"); } /* sanity checks after parse may be invalid numbers ;-) */ if ((opt & (GREP_OPT_c|GREP_OPT_q|GREP_OPT_l|GREP_OPT_L))) { |