diff options
author | Bernhard Reutner-Fischer | 2006-06-07 20:17:41 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer | 2006-06-07 20:17:41 +0000 |
commit | 19008b83735341c91fa8a09a072ffe9816c9e423 (patch) | |
tree | 6e35288c247102998a775cbc16f9ec014e00e7fd /coreutils/test.c | |
parent | 4c5ad2fc90389bf1239f17d84967d07b82f31dd7 (diff) | |
download | busybox-19008b83735341c91fa8a09a072ffe9816c9e423.zip busybox-19008b83735341c91fa8a09a072ffe9816c9e423.tar.gz |
- reuse strings and messages. Saves about 600B
Diffstat (limited to 'coreutils/test.c')
-rw-r--r-- | coreutils/test.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/coreutils/test.c b/coreutils/test.c index ecd1549..2b624e3 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -178,7 +178,6 @@ static arith_t getn(const char *s); 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 @@ int test_main(int argc, char **argv) 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 @@ static arith_t primary(enum token n) 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 @@ static int binop(void) 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: |