diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-25 21:28:25 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-25 21:28:25 +0100 |
commit | 3f8752c33f29d4cb4cc18fbff1f0da555f04c3ce (patch) | |
tree | 962f0bfc22bb3e19a5d4847456e35934d5a0e904 /miscutils/bc.c | |
parent | fa495ce4988f978dc2c716dba364e90e76cee844 (diff) | |
download | busybox-w32-3f8752c33f29d4cb4cc18fbff1f0da555f04c3ce.tar.gz busybox-w32-3f8752c33f29d4cb4cc18fbff1f0da555f04c3ce.tar.bz2 busybox-w32-3f8752c33f29d4cb4cc18fbff1f0da555f04c3ce.zip |
bc: shorten error messages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/bc.c')
-rw-r--r-- | miscutils/bc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 3e34d9e83..8fa312a2b 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -1029,12 +1029,12 @@ static BC_STATUS zbc_POSIX_does_not_allow(const char *msg) | |||
1029 | #define zbc_POSIX_does_not_allow(...) (zbc_POSIX_does_not_allow(__VA_ARGS__) COMMA_SUCCESS) | 1029 | #define zbc_POSIX_does_not_allow(...) (zbc_POSIX_does_not_allow(__VA_ARGS__) COMMA_SUCCESS) |
1030 | static BC_STATUS zbc_POSIX_does_not_allow_bool_ops_this_is_bad(const char *msg) | 1030 | static BC_STATUS zbc_POSIX_does_not_allow_bool_ops_this_is_bad(const char *msg) |
1031 | { | 1031 | { |
1032 | RETURN_STATUS(zbc_posix_error_fmt("%s%s %s", "POSIX does not allow ", "boolean operators; the following is bad:", msg)); | 1032 | RETURN_STATUS(zbc_posix_error_fmt("%s%s %s", "POSIX does not allow ", "boolean operators; this is bad:", msg)); |
1033 | } | 1033 | } |
1034 | #define zbc_POSIX_does_not_allow_bool_ops_this_is_bad(...) (zbc_POSIX_does_not_allow_bool_ops_this_is_bad(__VA_ARGS__) COMMA_SUCCESS) | 1034 | #define zbc_POSIX_does_not_allow_bool_ops_this_is_bad(...) (zbc_POSIX_does_not_allow_bool_ops_this_is_bad(__VA_ARGS__) COMMA_SUCCESS) |
1035 | static BC_STATUS zbc_POSIX_does_not_allow_empty_X_expression_in_for(const char *msg) | 1035 | static BC_STATUS zbc_POSIX_does_not_allow_empty_X_expression_in_for(const char *msg) |
1036 | { | 1036 | { |
1037 | RETURN_STATUS(zbc_posix_error_fmt("%san empty %s expression in a for loop", "POSIX does not allow ", msg)); | 1037 | RETURN_STATUS(zbc_posix_error_fmt("%san empty %s expression in 'for()'", "POSIX does not allow ", msg)); |
1038 | } | 1038 | } |
1039 | #define zbc_POSIX_does_not_allow_empty_X_expression_in_for(...) (zbc_POSIX_does_not_allow_empty_X_expression_in_for(__VA_ARGS__) COMMA_SUCCESS) | 1039 | #define zbc_POSIX_does_not_allow_empty_X_expression_in_for(...) (zbc_POSIX_does_not_allow_empty_X_expression_in_for(__VA_ARGS__) COMMA_SUCCESS) |
1040 | #endif | 1040 | #endif |
@@ -3084,10 +3084,10 @@ static BC_STATUS zbc_lex_identifier(void) | |||
3084 | if (l->lex_buf.len > 2) { | 3084 | if (l->lex_buf.len > 2) { |
3085 | // Prevent this: | 3085 | // Prevent this: |
3086 | // >>> qwe=1 | 3086 | // >>> qwe=1 |
3087 | // bc: POSIX only allows one character names; the following is bad: 'qwe=1 | 3087 | // bc: POSIX only allows one character names; this is bad: 'qwe=1 |
3088 | // ' | 3088 | // ' |
3089 | unsigned len = strchrnul(buf, '\n') - buf; | 3089 | unsigned len = strchrnul(buf, '\n') - buf; |
3090 | s = zbc_posix_error_fmt("POSIX only allows one character names; the following is bad: '%.*s'", len, buf); | 3090 | s = zbc_posix_error_fmt("POSIX only allows one character names; this is bad: '%.*s'", len, buf); |
3091 | } | 3091 | } |
3092 | 3092 | ||
3093 | RETURN_STATUS(s); | 3093 | RETURN_STATUS(s); |
@@ -3107,7 +3107,7 @@ static BC_STATUS zbc_lex_string(void) | |||
3107 | char c = l->buf[i]; | 3107 | char c = l->buf[i]; |
3108 | if (c == '\0') { | 3108 | if (c == '\0') { |
3109 | l->i = i; | 3109 | l->i = i; |
3110 | RETURN_STATUS(bc_error("string end could not be found")); | 3110 | RETURN_STATUS(bc_error("unterminated string")); |
3111 | } | 3111 | } |
3112 | if (c == '"') | 3112 | if (c == '"') |
3113 | break; | 3113 | break; |
@@ -3162,7 +3162,7 @@ static BC_STATUS zbc_lex_comment(void) | |||
3162 | } | 3162 | } |
3163 | if (c == '\0') { | 3163 | if (c == '\0') { |
3164 | l->i = i; | 3164 | l->i = i; |
3165 | RETURN_STATUS(bc_error("comment end could not be found")); | 3165 | RETURN_STATUS(bc_error("unterminated comment")); |
3166 | } | 3166 | } |
3167 | nls += (c == '\n'); | 3167 | nls += (c == '\n'); |
3168 | } | 3168 | } |
@@ -3261,7 +3261,7 @@ static BC_STATUS zbc_lex_token(void) | |||
3261 | s = zbc_lex_number(c); | 3261 | s = zbc_lex_number(c); |
3262 | else { | 3262 | else { |
3263 | l->lex = BC_LEX_KEY_LAST; | 3263 | l->lex = BC_LEX_KEY_LAST; |
3264 | s = zbc_POSIX_does_not_allow("a period ('.') as a shortcut for the last result"); | 3264 | s = zbc_POSIX_does_not_allow("'.' as 'last'"); |
3265 | } | 3265 | } |
3266 | break; | 3266 | break; |
3267 | case '/': | 3267 | case '/': |
@@ -4393,7 +4393,7 @@ static BC_STATUS zbc_func_insert(BcFunc *f, char *name, bool var) | |||
4393 | autoid = (void*)f->autos.v; | 4393 | autoid = (void*)f->autos.v; |
4394 | for (i = 0; i < f->autos.len; i++, autoid++) { | 4394 | for (i = 0; i < f->autos.len; i++, autoid++) { |
4395 | if (strcmp(name, autoid->name) == 0) | 4395 | if (strcmp(name, autoid->name) == 0) |
4396 | RETURN_STATUS(bc_error("function parameter or auto var has the same name as another")); | 4396 | RETURN_STATUS(bc_error("duplicate function parameter or auto name")); |
4397 | } | 4397 | } |
4398 | 4398 | ||
4399 | a.idx = var; | 4399 | a.idx = var; |