diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-01-22 10:13:52 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-01-22 10:13:52 +0100 |
commit | 778794d1dd99f29d099eb80ae2750381bc5e0059 (patch) | |
tree | 8c7b648fd7c5995afca509d0a23f7124d21c3daa | |
parent | 6aab061d2d6243505f7c21c7a92dcebc3922784c (diff) | |
download | busybox-w32-778794d1dd99f29d099eb80ae2750381bc5e0059.tar.gz busybox-w32-778794d1dd99f29d099eb80ae2750381bc5e0059.tar.bz2 busybox-w32-778794d1dd99f29d099eb80ae2750381bc5e0059.zip |
*: reuse more strings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/unzip.c | 4 | ||||
-rw-r--r-- | editors/vi.c | 28 | ||||
-rw-r--r-- | procps/top.c | 2 |
3 files changed, 17 insertions, 17 deletions
diff --git a/archival/unzip.c b/archival/unzip.c index 046027cc6..83bf8f6d6 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -626,7 +626,7 @@ int unzip_main(int argc, char **argv) | |||
626 | printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn); | 626 | printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn); |
627 | fflush_all(); | 627 | fflush_all(); |
628 | if (!fgets(key_buf, sizeof(key_buf), stdin)) { | 628 | if (!fgets(key_buf, sizeof(key_buf), stdin)) { |
629 | bb_perror_msg_and_die("can't read input"); | 629 | bb_perror_msg_and_die("can't read standard input"); |
630 | } | 630 | } |
631 | i = key_buf[0]; | 631 | i = key_buf[0]; |
632 | } | 632 | } |
@@ -669,7 +669,7 @@ int unzip_main(int argc, char **argv) | |||
669 | /* Prompt for new name */ | 669 | /* Prompt for new name */ |
670 | printf("new name: "); | 670 | printf("new name: "); |
671 | if (!fgets(key_buf, sizeof(key_buf), stdin)) { | 671 | if (!fgets(key_buf, sizeof(key_buf), stdin)) { |
672 | bb_perror_msg_and_die("can't read input"); | 672 | bb_perror_msg_and_die("can't read standard input"); |
673 | } | 673 | } |
674 | free(dst_fn); | 674 | free(dst_fn); |
675 | dst_fn = xstrdup(key_buf); | 675 | dst_fn = xstrdup(key_buf); |
diff --git a/editors/vi.c b/editors/vi.c index 5b5e2b0bf..7173415c8 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -1049,7 +1049,7 @@ static void colon(char *buf) | |||
1049 | #endif | 1049 | #endif |
1050 | // how many lines in text[]? | 1050 | // how many lines in text[]? |
1051 | li = count_lines(text, end - 1); | 1051 | li = count_lines(text, end - 1); |
1052 | status_line("\"%s\"%s" | 1052 | status_line("'%s'%s" |
1053 | IF_FEATURE_VI_READONLY("%s") | 1053 | IF_FEATURE_VI_READONLY("%s") |
1054 | " %dL, %dC", current_filename, | 1054 | " %dL, %dC", current_filename, |
1055 | (file_size(fn) < 0 ? " [New file]" : ""), | 1055 | (file_size(fn) < 0 ? " [New file]" : ""), |
@@ -1165,7 +1165,7 @@ static void colon(char *buf) | |||
1165 | goto ret; // nothing was inserted | 1165 | goto ret; // nothing was inserted |
1166 | // how many lines in text[]? | 1166 | // how many lines in text[]? |
1167 | li = count_lines(q, q + ch - 1); | 1167 | li = count_lines(q, q + ch - 1); |
1168 | status_line("\"%s\"" | 1168 | status_line("'%s'" |
1169 | IF_FEATURE_VI_READONLY("%s") | 1169 | IF_FEATURE_VI_READONLY("%s") |
1170 | " %dL, %dC", fn, | 1170 | " %dL, %dC", fn, |
1171 | IF_FEATURE_VI_READONLY((readonly_mode ? " [Readonly]" : ""),) | 1171 | IF_FEATURE_VI_READONLY((readonly_mode ? " [Readonly]" : ""),) |
@@ -1298,7 +1298,7 @@ static void colon(char *buf) | |||
1298 | } | 1298 | } |
1299 | #if ENABLE_FEATURE_VI_READONLY | 1299 | #if ENABLE_FEATURE_VI_READONLY |
1300 | if (readonly_mode && !useforce) { | 1300 | if (readonly_mode && !useforce) { |
1301 | status_line_bold("\"%s\" File is read only", fn); | 1301 | status_line_bold("'%s' is read only", fn); |
1302 | goto ret; | 1302 | goto ret; |
1303 | } | 1303 | } |
1304 | #endif | 1304 | #endif |
@@ -1321,9 +1321,9 @@ static void colon(char *buf) | |||
1321 | } | 1321 | } |
1322 | if (l < 0) { | 1322 | if (l < 0) { |
1323 | if (l == -1) | 1323 | if (l == -1) |
1324 | status_line_bold("\"%s\" %s", fn, strerror(errno)); | 1324 | status_line_bold("'%s' %s", fn, strerror(errno)); |
1325 | } else { | 1325 | } else { |
1326 | status_line("\"%s\" %dL, %dC", fn, li, l); | 1326 | status_line("'%s' %dL, %dC", fn, li, l); |
1327 | if (q == text && r == end - 1 && l == ch) { | 1327 | if (q == text && r == end - 1 && l == ch) { |
1328 | file_modified = 0; | 1328 | file_modified = 0; |
1329 | last_file_modified = -1; | 1329 | last_file_modified = -1; |
@@ -1735,7 +1735,7 @@ static char *char_search(char *p, const char *pat, int dir, int range) | |||
1735 | q = (char *)re_compile_pattern(pat, strlen(pat), (struct re_pattern_buffer *)&preg); | 1735 | q = (char *)re_compile_pattern(pat, strlen(pat), (struct re_pattern_buffer *)&preg); |
1736 | if (q != 0) { | 1736 | if (q != 0) { |
1737 | // The pattern was not compiled | 1737 | // The pattern was not compiled |
1738 | status_line_bold("bad search pattern: \"%s\": %s", pat, q); | 1738 | status_line_bold("bad search pattern: '%s': %s", pat, q); |
1739 | i = 0; // return p if pattern not compiled | 1739 | i = 0; // return p if pattern not compiled |
1740 | goto cs1; | 1740 | goto cs1; |
1741 | } | 1741 | } |
@@ -2503,12 +2503,12 @@ static int file_insert(const char *fn, char *p, int update_ro_status) | |||
2503 | 2503 | ||
2504 | /* Validate file */ | 2504 | /* Validate file */ |
2505 | if (stat(fn, &statbuf) < 0) { | 2505 | if (stat(fn, &statbuf) < 0) { |
2506 | status_line_bold("\"%s\" %s", fn, strerror(errno)); | 2506 | status_line_bold("'%s' %s", fn, strerror(errno)); |
2507 | goto fi0; | 2507 | goto fi0; |
2508 | } | 2508 | } |
2509 | if (!S_ISREG(statbuf.st_mode)) { | 2509 | if (!S_ISREG(statbuf.st_mode)) { |
2510 | // This is not a regular file | 2510 | // This is not a regular file |
2511 | status_line_bold("\"%s\" Not a regular file", fn); | 2511 | status_line_bold("'%s' is not a regular file", fn); |
2512 | goto fi0; | 2512 | goto fi0; |
2513 | } | 2513 | } |
2514 | if (p < text || p > end) { | 2514 | if (p < text || p > end) { |
@@ -2519,19 +2519,19 @@ static int file_insert(const char *fn, char *p, int update_ro_status) | |||
2519 | // read file to buffer | 2519 | // read file to buffer |
2520 | fd = open(fn, O_RDONLY); | 2520 | fd = open(fn, O_RDONLY); |
2521 | if (fd < 0) { | 2521 | if (fd < 0) { |
2522 | status_line_bold("\"%s\" %s", fn, strerror(errno)); | 2522 | status_line_bold("'%s' %s", fn, strerror(errno)); |
2523 | goto fi0; | 2523 | goto fi0; |
2524 | } | 2524 | } |
2525 | size = statbuf.st_size; | 2525 | size = (statbuf.st_size < INT_MAX ? (int)statbuf.st_size : INT_MAX); |
2526 | p += text_hole_make(p, size); | 2526 | p += text_hole_make(p, size); |
2527 | cnt = safe_read(fd, p, size); | 2527 | cnt = safe_read(fd, p, size); |
2528 | if (cnt < 0) { | 2528 | if (cnt < 0) { |
2529 | status_line_bold("\"%s\" %s", fn, strerror(errno)); | 2529 | status_line_bold("'%s' %s", fn, strerror(errno)); |
2530 | p = text_hole_delete(p, p + size - 1); // un-do buffer insert | 2530 | p = text_hole_delete(p, p + size - 1); // un-do buffer insert |
2531 | } else if (cnt < size) { | 2531 | } else if (cnt < size) { |
2532 | // There was a partial read, shrink unused space text[] | 2532 | // There was a partial read, shrink unused space text[] |
2533 | p = text_hole_delete(p + cnt, p + (size - cnt) - 1); // un-do buffer insert | 2533 | p = text_hole_delete(p + cnt, p + (size - cnt) - 1); // un-do buffer insert |
2534 | status_line_bold("can't read all of file \"%s\"", fn); | 2534 | status_line_bold("can't read '%s'", fn); |
2535 | } | 2535 | } |
2536 | if (cnt >= size) | 2536 | if (cnt >= size) |
2537 | file_modified++; | 2537 | file_modified++; |
@@ -3469,7 +3469,7 @@ static void do_cmd(int c) | |||
3469 | } else { | 3469 | } else { |
3470 | file_modified = 0; | 3470 | file_modified = 0; |
3471 | last_file_modified = -1; | 3471 | last_file_modified = -1; |
3472 | status_line("\"%s\" %dL, %dC", current_filename, count_lines(text, end - 1), cnt); | 3472 | status_line("'%s' %dL, %dC", current_filename, count_lines(text, end - 1), cnt); |
3473 | if (p[0] == 'x' || p[1] == 'q' || p[1] == 'n' | 3473 | if (p[0] == 'x' || p[1] == 'q' || p[1] == 'n' |
3474 | || p[0] == 'X' || p[1] == 'Q' || p[1] == 'N' | 3474 | || p[0] == 'X' || p[1] == 'Q' || p[1] == 'N' |
3475 | ) { | 3475 | ) { |
@@ -3667,7 +3667,7 @@ static void do_cmd(int c) | |||
3667 | } | 3667 | } |
3668 | if (file_modified) { | 3668 | if (file_modified) { |
3669 | if (ENABLE_FEATURE_VI_READONLY && readonly_mode) { | 3669 | if (ENABLE_FEATURE_VI_READONLY && readonly_mode) { |
3670 | status_line_bold("\"%s\" File is read only", current_filename); | 3670 | status_line_bold("'%s' is read only", current_filename); |
3671 | break; | 3671 | break; |
3672 | } | 3672 | } |
3673 | cnt = file_write(current_filename, text, end - 1); | 3673 | cnt = file_write(current_filename, text, end - 1); |
diff --git a/procps/top.c b/procps/top.c index 2908bd3e7..abee69806 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -294,7 +294,7 @@ static void get_jiffy_counts(void) | |||
294 | * they are used to calculate per process CPU% */ | 294 | * they are used to calculate per process CPU% */ |
295 | prev_jif = cur_jif; | 295 | prev_jif = cur_jif; |
296 | if (read_cpu_jiffy(fp, &cur_jif) < 4) | 296 | if (read_cpu_jiffy(fp, &cur_jif) < 4) |
297 | bb_error_msg_and_die("can't read /proc/stat"); | 297 | bb_error_msg_and_die("can't read '%s'", "/proc/stat"); |
298 | 298 | ||
299 | #if !ENABLE_FEATURE_TOP_SMP_CPU | 299 | #if !ENABLE_FEATURE_TOP_SMP_CPU |
300 | fclose(fp); | 300 | fclose(fp); |