diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-20 19:14:19 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-20 19:14:19 +0100 |
commit | c270454f8f1f33e5438e46cb13bebd8fb190a40a (patch) | |
tree | 88b30e299e775cbac784eaf71c1e3c103a43a180 | |
parent | ad7d94bdc7d6a8ffe798a54f09e1e51dd949c9b7 (diff) | |
download | busybox-w32-c270454f8f1f33e5438e46cb13bebd8fb190a40a.tar.gz busybox-w32-c270454f8f1f33e5438e46cb13bebd8fb190a40a.tar.bz2 busybox-w32-c270454f8f1f33e5438e46cb13bebd8fb190a40a.zip |
fix fallout from isprint() changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/wc.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 49 | ||||
-rw-r--r-- | shell/hush.c | 4 |
3 files changed, 30 insertions, 25 deletions
diff --git a/coreutils/wc.c b/coreutils/wc.c index 43e8ed492..08f3c2dc4 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -129,7 +129,7 @@ int wc_main(int argc UNUSED_PARAM, char **argv) | |||
129 | --counts[WC_CHARS]; | 129 | --counts[WC_CHARS]; |
130 | goto DO_EOF; /* Treat an EOF as '\r'. */ | 130 | goto DO_EOF; /* Treat an EOF as '\r'. */ |
131 | } | 131 | } |
132 | if (isprint(c)) { | 132 | if (isprint_asciionly(c)) { |
133 | ++linepos; | 133 | ++linepos; |
134 | if (!isspace(c)) { | 134 | if (!isspace(c)) { |
135 | in_word = 1; | 135 | in_word = 1; |
diff --git a/editors/vi.c b/editors/vi.c index 7d83db642..58c6f5a05 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -30,9 +30,10 @@ | |||
30 | #if ENABLE_LOCALE_SUPPORT | 30 | #if ENABLE_LOCALE_SUPPORT |
31 | 31 | ||
32 | #if ENABLE_FEATURE_VI_8BIT | 32 | #if ENABLE_FEATURE_VI_8BIT |
33 | # define Isprint(c) isprint(c) | 33 | //FIXME: this does not work properly for Unicode anyway |
34 | # define Isprint(c) (isprint)(c) | ||
34 | #else | 35 | #else |
35 | # define Isprint(c) (isprint(c) && (unsigned char)(c) < 0x7f) | 36 | # define Isprint(c) isprint_asciionly(c) |
36 | #endif | 37 | #endif |
37 | 38 | ||
38 | #else | 39 | #else |
@@ -891,7 +892,7 @@ static void colon(char *buf) | |||
891 | li, ch); | 892 | li, ch); |
892 | } else if (strncmp(cmd, "file", i) == 0) { // what File is this | 893 | } else if (strncmp(cmd, "file", i) == 0) { // what File is this |
893 | if (b != -1 || e != -1) { | 894 | if (b != -1 || e != -1) { |
894 | not_implemented("No address allowed on this command"); | 895 | status_line_bold("No address allowed on this command"); |
895 | goto vc1; | 896 | goto vc1; |
896 | } | 897 | } |
897 | if (args[0]) { | 898 | if (args[0]) { |
@@ -2588,36 +2589,41 @@ static void status_line(const char *format, ...) | |||
2588 | // copy s to buf, convert unprintable | 2589 | // copy s to buf, convert unprintable |
2589 | static void print_literal(char *buf, const char *s) | 2590 | static void print_literal(char *buf, const char *s) |
2590 | { | 2591 | { |
2592 | char *d; | ||
2591 | unsigned char c; | 2593 | unsigned char c; |
2592 | char b[2]; | ||
2593 | 2594 | ||
2594 | b[1] = '\0'; | ||
2595 | buf[0] = '\0'; | 2595 | buf[0] = '\0'; |
2596 | if (!s[0]) | 2596 | if (!s[0]) |
2597 | s = "(NULL)"; | 2597 | s = "(NULL)"; |
2598 | |||
2599 | d = buf; | ||
2598 | for (; *s; s++) { | 2600 | for (; *s; s++) { |
2599 | int c_is_no_print; | 2601 | int c_is_no_print; |
2600 | 2602 | ||
2601 | c = *s; | 2603 | c = *s; |
2602 | c_is_no_print = (c & 0x80) && !Isprint(c); | 2604 | c_is_no_print = (c & 0x80) && !Isprint(c); |
2603 | if (c_is_no_print) { | 2605 | if (c_is_no_print) { |
2604 | strcat(buf, SOn); | 2606 | strcpy(d, SOn); |
2607 | d += sizeof(SOn)-1; | ||
2605 | c = '.'; | 2608 | c = '.'; |
2606 | } | 2609 | } |
2607 | if (c < ' ' || c == 127) { | 2610 | if (c < ' ' || c == 0x7f) { |
2608 | strcat(buf, "^"); | 2611 | *d++ = '^'; |
2609 | if (c == 127) | 2612 | c |= '@'; /* 0x40 */ |
2613 | if (c == 0x7f) | ||
2610 | c = '?'; | 2614 | c = '?'; |
2611 | else | 2615 | } |
2612 | c += '@'; | 2616 | *d++ = c; |
2613 | } | 2617 | *d = '\0'; |
2614 | b[0] = c; | 2618 | if (c_is_no_print) { |
2615 | strcat(buf, b); | 2619 | strcpy(d, SOs); |
2616 | if (c_is_no_print) | 2620 | d += sizeof(SOs)-1; |
2617 | strcat(buf, SOs); | 2621 | } |
2618 | if (*s == '\n') | 2622 | if (*s == '\n') { |
2619 | strcat(buf, "$"); | 2623 | *d++ = '$'; |
2620 | if (strlen(buf) > MAX_INPUT_LEN - 10) // paranoia | 2624 | *d = '\0'; |
2625 | } | ||
2626 | if (d - buf > MAX_INPUT_LEN - 10) // paranoia | ||
2621 | break; | 2627 | break; |
2622 | } | 2628 | } |
2623 | } | 2629 | } |
@@ -2982,11 +2988,6 @@ static void do_cmd(int c) | |||
2982 | default: // unrecognized command | 2988 | default: // unrecognized command |
2983 | buf[0] = c; | 2989 | buf[0] = c; |
2984 | buf[1] = '\0'; | 2990 | buf[1] = '\0'; |
2985 | if (c < ' ') { | ||
2986 | buf[0] = '^'; | ||
2987 | buf[1] = c + '@'; | ||
2988 | buf[2] = '\0'; | ||
2989 | } | ||
2990 | not_implemented(buf); | 2991 | not_implemented(buf); |
2991 | end_cmd_q(); // stop adding to q | 2992 | end_cmd_q(); // stop adding to q |
2992 | case 0x00: // nul- ignore | 2993 | case 0x00: // nul- ignore |
diff --git a/shell/hush.c b/shell/hush.c index 2d6f55bc7..3044024a0 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -5572,6 +5572,10 @@ static int process_command_subs(o_string *dest, const char *s) | |||
5572 | } | 5572 | } |
5573 | #endif /* ENABLE_HUSH_TICK */ | 5573 | #endif /* ENABLE_HUSH_TICK */ |
5574 | 5574 | ||
5575 | #if !ENABLE_HUSH_FUNCTIONS | ||
5576 | #define parse_group(dest, ctx, input, ch) \ | ||
5577 | parse_group(ctx, input, ch) | ||
5578 | #endif | ||
5575 | static int parse_group(o_string *dest, struct parse_context *ctx, | 5579 | static int parse_group(o_string *dest, struct parse_context *ctx, |
5576 | struct in_str *input, int ch) | 5580 | struct in_str *input, int ch) |
5577 | { | 5581 | { |