[patch] save ~600B
Bernhard Fischer
rep.nop at aon.at
Sun Jun 4 20:14:53 UTC 2006
On Sun, Jun 04, 2006 at 08:49:16PM +0200, Bernhard Fischer wrote:
>Hi,
>
>- use bb_msg_... in more places.
>
>While i think that this patch should be ok, i'd be glad if someone could
>look over it (been staring at it for too long).
>
>TIA,
>Bernhard
updated version 02e
-------------- next part --------------
Index: networking/ip.c
===================================================================
--- networking/ip.c (revision 15268)
+++ networking/ip.c (working copy)
@@ -59,7 +59,7 @@
else if (strcmp(argv[1], "link") == 0)
preferred_family = AF_PACKET;
else
- invarg(argv[1], "invalid protocol family");
+ invarg(bb_msg_invalid_arg, argv[1], "-family");
} else if (strcmp(opt, "-4") == 0) {
preferred_family = AF_INET;
} else if (strcmp(opt, "-6") == 0) {
Index: networking/libiproute/iptunnel.c
===================================================================
--- networking/libiproute/iptunnel.c (revision 15268)
+++ networking/libiproute/iptunnel.c (working copy)
@@ -259,9 +259,9 @@
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (get_unsigned(&uval, *argv, 0))
- invarg("invalid TTL\n", *argv);
+ invarg(*argv, "TTL");
if (uval > 255)
- invarg("TTL must be <=255\n", *argv);
+ invarg(*argv, "TTL must be <=255");
p->iph.ttl = uval;
}
} else if (strcmp(*argv, "tos") == 0 ||
@@ -270,7 +270,7 @@
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (rtnl_dsfield_a2n(&uval, *argv))
- invarg("bad TOS value", *argv);
+ invarg(*argv, "TOS");
p->iph.tos = uval;
} else
p->iph.tos = 1;
Index: networking/libiproute/utils.c
===================================================================
--- networking/libiproute/utils.c (revision 15268)
+++ networking/libiproute/utils.c (working copy)
@@ -240,9 +240,9 @@
exit(-1);
}
-void invarg(char *msg, char *arg)
+void invarg(const char const *arg, const char const *opt)
{
- bb_error_msg("argument \"%s\" is wrong: %s", arg, msg);
+ bb_error_msg(bb_msg_invalid_arg, arg, opt);
exit(-1);
}
Index: networking/libiproute/utils.h
===================================================================
--- networking/libiproute/utils.h (revision 15268)
+++ networking/libiproute/utils.h (working copy)
@@ -1,13 +1,13 @@
#ifndef __UTILS_H__
#define __UTILS_H__ 1
+#include "libbb.h"
#include <asm/types.h>
#include <resolv.h>
#include "libnetlink.h"
#include "ll_map.h"
#include "rtm_map.h"
-#include "libbb.h"
extern int preferred_family;
extern int show_stats;
@@ -77,7 +77,7 @@
extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
-void invarg(char *, char *) ATTRIBUTE_NORETURN;
+void invarg(const char const*, const char const*) ATTRIBUTE_NORETURN;
void duparg(char *, char *) ATTRIBUTE_NORETURN;
void duparg2(char *, char *) ATTRIBUTE_NORETURN;
int matches(char *arg, char *pattern);
Index: networking/libiproute/ipaddress.c
===================================================================
--- networking/libiproute/ipaddress.c (revision 15268)
+++ networking/libiproute/ipaddress.c (working copy)
@@ -430,11 +430,11 @@
if (flush) {
if (argc <= 0) {
- fprintf(stderr, "Flush requires arguments.\n");
+ bb_error_msg(bb_msg_requires_arg, "flush");
return -1;
}
if (filter.family == AF_PACKET) {
- fprintf(stderr, "Cannot flush link addresses.\n");
+ bb_error_msg("Cannot flush link addresses.");
return -1;
}
}
@@ -456,7 +456,7 @@
filter.scopemask = -1;
if (rtnl_rtscope_a2n(&scope, *argv)) {
if (strcmp(*argv, "all") != 0) {
- invarg("invalid \"scope\"\n", *argv);
+ invarg(*argv, "scope");
}
scope = RT_SCOPE_NOWHERE;
filter.scopemask = 0;
@@ -711,7 +711,7 @@
uint32_t scope = 0;
NEXT_ARG();
if (rtnl_rtscope_a2n(&scope, *argv)) {
- invarg(*argv, "invalid scope value");
+ invarg(*argv, "scope");
}
req.ifa.ifa_scope = scope;
scoped = 1;
@@ -744,7 +744,7 @@
}
if (d == NULL) {
- bb_error_msg("Not enough information: \"dev\" argument is required");
+ bb_error_msg(bb_msg_requires_arg,"\"dev\"");
return -1;
}
if (l && matches(d, l) != 0) {
Index: networking/libiproute/iplink.c
===================================================================
--- networking/libiproute/iplink.c (revision 15268)
+++ networking/libiproute/iplink.c (working copy)
@@ -252,7 +252,7 @@
if (mtu != -1)
duparg("mtu", *argv);
if (get_integer(&mtu, *argv, 0))
- invarg("Invalid \"mtu\" value\n", *argv);
+ invarg(*argv, "mtu");
} else if (strcmp(*argv, "multicast") == 0) {
NEXT_ARG();
mask |= IFF_MULTICAST;
@@ -286,7 +286,7 @@
}
if (!dev) {
- bb_error_msg("Not enough of information: \"dev\" argument is required.");
+ bb_error_msg(bb_msg_requires_arg, "\"dev\"");
exit(-1);
}
Index: networking/libiproute/ip_parse_common_args.c
===================================================================
--- networking/libiproute/ip_parse_common_args.c (revision 15268)
+++ networking/libiproute/ip_parse_common_args.c (working copy)
@@ -56,7 +56,7 @@
else if (strcmp(argv[1], "link") == 0)
preferred_family = AF_PACKET;
else
- invarg(argv[1], "invalid protocol family");
+ invarg(argv[1], "protocol family");
} else if (strcmp(opt, "-4") == 0) {
preferred_family = AF_INET;
} else if (strcmp(opt, "-6") == 0) {
Index: networking/libiproute/iproute.c
===================================================================
--- networking/libiproute/iproute.c (revision 15268)
+++ networking/libiproute/iproute.c (working copy)
@@ -343,14 +343,14 @@
NEXT_ARG();
}
if (get_unsigned(&mtu, *argv, 0)) {
- invarg("\"mtu\" value is invalid\n", *argv);
+ invarg(*argv, "mtu");
}
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
} else if (matches(*argv, "protocol") == 0) {
uint32_t prot;
NEXT_ARG();
if (rtnl_rtprot_a2n(&prot, *argv))
- invarg("\"protocol\" value is invalid\n", *argv);
+ invarg(*argv, "protocol");
req.r.rtm_protocol = prot;
proto_ok =1;
} else if (strcmp(*argv, "dev") == 0 ||
@@ -487,7 +487,7 @@
filter.tb = RT_TABLE_MAIN;
if (flush && argc <= 0) {
- fprintf(stderr, "\"ip route flush\" requires arguments.\n");
+ bb_error_msg(bb_msg_requires_arg, "\"ip route flush\"");
return -1;
}
@@ -498,7 +498,7 @@
filter.protocolmask = -1;
if (rtnl_rtprot_a2n(&prot, *argv)) {
if (strcmp(*argv, "all") != 0) {
- invarg("invalid \"protocol\"\n", *argv);
+ invarg(*argv, "protocol");
}
prot = 0;
filter.protocolmask = 0;
@@ -541,7 +541,7 @@
if (matches(*argv, "cache") == 0) {
filter.tb = -1;
} else if (matches(*argv, "main") != 0) {
- invarg("invalid \"table\"", *argv);
+ invarg(*argv, "table");
}
} else if (matches(*argv, "cache") == 0) {
filter.tb = -1;
Index: networking/udhcp/dhcpc.c
===================================================================
--- networking/udhcp/dhcpc.c (revision 15268)
+++ networking/udhcp/dhcpc.c (working copy)
@@ -206,7 +206,7 @@
{"script", required_argument, 0, 's'},
{"timeout", required_argument, 0, 'T'},
{"version", no_argument, 0, 'v'},
- {"retries", required_argument, 0, 't'},
+ {"retries", required_argument, 0, 't'},
{0, 0, 0, 0}
};
Index: archival/unzip.c
===================================================================
--- archival/unzip.c (revision 15268)
+++ archival/unzip.c (working copy)
@@ -86,7 +86,7 @@
static void unzip_read(int fd, void *buf, size_t count)
{
if (bb_xread(fd, buf, count) != count) {
- bb_error_msg_and_die("Read failure");
+ bb_error_msg_and_die(bb_msg_read_error);
}
}
@@ -95,7 +95,7 @@
/* Create all leading directories */
char *name = bb_xstrdup(fn);
if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
- bb_error_msg_and_die("Failed to create directory");
+ bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */
}
free(name);
}
@@ -282,8 +282,8 @@
unzip_skip(src_fd, zip_header.formated.extra_len);
if ((verbosity == v_list) && !list_header_done){
- printf(" Length Date Time Name\n");
- printf(" -------- ---- ---- ----\n");
+ printf(" Length Date Time Name\n"
+ " -------- ---- ---- ----\n");
list_header_done = 1;
}
Index: shell/lash.c
===================================================================
--- shell/lash.c (revision 15270)
+++ shell/lash.c (working copy)
@@ -284,7 +284,7 @@
}
} else {
if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) {
- bb_error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]);
+ bb_error_msg(bb_msg_invalid_arg, child->argv[1], child->argv[0]);
return EXIT_FAILURE;
}
for (job = child->family->job_list->head; job; job = job->next) {
@@ -465,7 +465,7 @@
static int builtin_unset(struct child_prog *child)
{
if (child->argv[1] == NULL) {
- printf( "unset: parameter required.\n");
+ printf(bb_msg_requires_arg, "unset");
return EXIT_FAILURE;
}
unsetenv(child->argv[1]);
Index: shell/ash.c
===================================================================
--- shell/ash.c (revision 15268)
+++ shell/ash.c (working copy)
@@ -8762,7 +8762,7 @@
xminusc = minusc;
if (*xargv == NULL) {
if (xminusc)
- sh_error("-c requires an argument");
+ sh_error(bb_msg_requires_arg, "-c");
sflag = 1;
}
if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1))
Index: coreutils/dd.c
===================================================================
--- coreutils/dd.c (revision 15268)
+++ coreutils/dd.c (working copy)
@@ -96,7 +96,7 @@
noerror = TRUE;
ibuf += 7;
} else {
- bb_error_msg_and_die("invalid conversion `%s'", argv[i]+5);
+ bb_error_msg_and_die(bb_msg_invalid_arg, argv[i]+5, "conv");
}
if (ibuf[0] == '\0') break;
if (ibuf[0] == ',') ibuf++;
Index: coreutils/diff.c
===================================================================
--- coreutils/diff.c (revision 15268)
+++ coreutils/diff.c (working copy)
@@ -1158,7 +1158,7 @@
while (*dirlist2 != NULL && strcmp(*dirlist2, start) < 0)
dirlist2++;
if ((*dirlist1 == NULL) || (*dirlist2 == NULL))
- bb_error_msg("Invalid argument to -S");
+ bb_error_msg(bb_msg_invalid_arg, "NULL", "-S");
}
/* Now that both dirlist1 and dirlist2 contain sorted directory
@@ -1194,7 +1194,6 @@
int diff_main(int argc, char **argv)
{
- char *ep;
int gotstdin = 0;
char *U_opt;
@@ -1229,11 +1228,7 @@
context = 3; /* This is the default number of lines of context. */
if (cmd_flags & FLAG_U) {
- context = strtol(U_opt, &ep, 10);
- if (context == 0) {
- bb_error_msg("Invalid context length");
- bb_show_usage();
- }
+ context = bb_xgetlarg(U_opt, 10, 1, INT_MAX);
}
argc -= optind;
argv += optind;
Index: coreutils/test.c
===================================================================
--- coreutils/test.c (revision 15268)
+++ coreutils/test.c (working copy)
@@ -178,7 +178,6 @@
static int newerf(const char *f1, const char *f2);
static int olderf(const char *f1, const char *f2);
static int equalf(const char *f1, const char *f2);
-static void syntax(const char *op, const char *msg);
static int test_eaccess(char *path, int mode);
static int is_a_group_member(gid_t gid);
static void initialize_group_array(void);
@@ -230,20 +229,11 @@
res = !oexpr(t_lex(*t_wp));
if (*t_wp != NULL && *++t_wp != NULL)
- syntax(*t_wp, "unknown operand");
+ bb_error_msg_and_die("%s: unknown operand", *t_wp);
return (res);
}
-static void syntax(const char *op, const char *msg)
-{
- if (op && *op) {
- bb_error_msg_and_die("%s: %s", op, msg);
- } else {
- bb_error_msg_and_die("%s", msg);
- }
-}
-
static arith_t oexpr(enum token n)
{
arith_t res;
@@ -279,18 +269,18 @@
arith_t res;
if (n == EOI) {
- syntax(NULL, "argument expected");
+ bb_error_msg_and_die("argument expected");
}
if (n == LPAREN) {
res = oexpr(t_lex(*++t_wp));
if (t_lex(*++t_wp) != RPAREN)
- syntax(NULL, "closing paren expected");
+ bb_error_msg_and_die("closing paren expected");
return res;
}
if (t_wp_op && t_wp_op->op_type == UNOP) {
/* unary expression */
if (*++t_wp == NULL)
- syntax(t_wp_op->op_text, "argument expected");
+ bb_error_msg_and_die(bb_msg_requires_arg, t_wp_op->op_text);
switch (n) {
case STREZ:
return strlen(*t_wp) == 0;
@@ -320,7 +310,7 @@
op = t_wp_op;
if ((opnd2 = *++t_wp) == (char *) 0)
- syntax(op->op_text, "argument expected");
+ bb_error_msg_and_die(bb_msg_requires_arg, op->op_text);
switch (op->op_num) {
case STREQ:
Index: coreutils/stty.c
===================================================================
--- coreutils/stty.c (revision 15268)
+++ coreutils/stty.c (working copy)
@@ -23,6 +23,7 @@
//#define TEST
+#include "busybox.h"
#include <stddef.h>
#include <termios.h>
#include <sys/ioctl.h>
@@ -45,7 +46,6 @@
#include <errno.h>
#include <limits.h>
#include <fcntl.h>
-#include "busybox.h"
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
@@ -608,7 +608,7 @@
for (i = 0; i < NUM_control_info; ++i)
if (STREQ(argv[k], control_info[i].name)) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
match_found = 1;
++k;
set_control_char(&control_info[i], argv[k], &mode);
@@ -619,14 +619,14 @@
if (match_found == 0) {
if (STREQ(argv[k], "ispeed")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_speed(input_speed, argv[k], &mode);
speed_was_set = 1;
require_set_attr = 1;
} else if (STREQ(argv[k], "ospeed")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_speed(output_speed, argv[k], &mode);
speed_was_set = 1;
@@ -635,13 +635,13 @@
#ifdef TIOCGWINSZ
else if (STREQ(argv[k], "rows")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_window_size((int) bb_xparse_number(argv[k], stty_suffixes),
-1);
} else if (STREQ(argv[k], "cols") || STREQ(argv[k], "columns")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_window_size(-1,
(int) bb_xparse_number(argv[k], stty_suffixes));
@@ -654,7 +654,7 @@
#ifdef HAVE_C_LINE
else if (STREQ(argv[k], "line")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
mode.c_line = bb_xparse_number(argv[k], stty_suffixes);
require_set_attr = 1;
Index: libbb/messages.c
===================================================================
--- libbb/messages.c (revision 15268)
+++ libbb/messages.c (working copy)
@@ -38,11 +38,17 @@
const char * const bb_msg_unknown = "(unknown)";
#endif
#ifdef L_can_not_create_raw_socket
- const char * const bb_msg_can_not_create_raw_socket = "can`t create raw socket";
+ const char * const bb_msg_can_not_create_raw_socket = "can't create raw socket";
#endif
#ifdef L_perm_denied_are_you_root
const char * const bb_msg_perm_denied_are_you_root = "permission denied. (are you root?)";
#endif
+#ifdef L_msg_requires_arg
+ const char * const bb_msg_requires_arg = "%s requires an argument";
+#endif
+#ifdef L_msg_invalid_arg
+ const char * const bb_msg_invalid_arg = "invalid argument `%s' to `%s'";
+#endif
#ifdef L_msg_standard_input
const char * const bb_msg_standard_input = "standard input";
#endif
Index: include/libbb.h
===================================================================
--- include/libbb.h (revision 15268)
+++ include/libbb.h (working copy)
@@ -341,6 +341,8 @@
extern const char * const bb_msg_unknown;
extern const char * const bb_msg_can_not_create_raw_socket;
extern const char * const bb_msg_perm_denied_are_you_root;
+extern const char * const bb_msg_requires_arg;
+extern const char * const bb_msg_invalid_arg;
extern const char * const bb_msg_standard_input;
extern const char * const bb_msg_standard_output;
Index: findutils/find.c
===================================================================
--- findutils/find.c (revision 15268)
+++ findutils/find.c (working copy)
@@ -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 @@
}
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 @@
#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 @@
} 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 @@
} 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 @@
} 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 @@
} 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 @@
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 *));
Index: findutils/grep.c
===================================================================
--- findutils/grep.c (revision 15268)
+++ findutils/grep.c (working copy)
@@ -313,12 +313,12 @@
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))) {
Index: editors/sed.c
===================================================================
--- editors/sed.c (revision 15278)
+++ editors/sed.c (working copy)
@@ -1166,7 +1166,7 @@
* files were specified or '-' was specified, take input from stdin.
* Otherwise, we process all the files specified. */
if (argv[optind] == NULL) {
- if(bbg.in_place) bb_error_msg_and_die("Filename required for -i");
+ if(bbg.in_place) bb_error_msg_and_die(bb_msg_requires_arg, "-i <file>");
add_input_file(stdin);
process_files();
} else {
Index: util-linux/fsck_minix.c
===================================================================
--- util-linux/fsck_minix.c (revision 15268)
+++ util-linux/fsck_minix.c (working copy)
@@ -456,12 +456,13 @@
return;
}
if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) {
- printf("Read error: unable to seek to block in file '%s'\n",
- current_name);
+ printf("%s: unable to seek to block in file '%s'\n",
+ bb_msg_read_error, current_name);
errors_uncorrected = 1;
memset(addr, 0, BLOCK_SIZE);
} else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) {
- printf("Read error: bad block in file '%s'\n", current_name);
+ printf("%s: bad block in file '%s'\n",
+ bb_msg_read_error, current_name);
errors_uncorrected = 1;
memset(addr, 0, BLOCK_SIZE);
}
@@ -483,7 +484,8 @@
if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET))
die("seek failed in write_block");
if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) {
- printf("Write error: bad block in file '%s'\n", current_name);
+ printf("%s: bad block in file '%s'\n",
+ bb_msg_write_error, current_name);
errors_uncorrected = 1;
}
}
More information about the busybox
mailing list