diff options
Diffstat (limited to 'editors/vi.c')
-rw-r--r-- | editors/vi.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/editors/vi.c b/editors/vi.c index e0047e49e..593dc8520 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -23,18 +23,6 @@ | |||
23 | 23 | ||
24 | 24 | ||
25 | #include "busybox.h" | 25 | #include "busybox.h" |
26 | #include <string.h> | ||
27 | #include <strings.h> | ||
28 | #include <unistd.h> | ||
29 | #include <sys/ioctl.h> | ||
30 | #include <time.h> | ||
31 | #include <fcntl.h> | ||
32 | #include <signal.h> | ||
33 | #include <setjmp.h> | ||
34 | #include <regex.h> | ||
35 | #include <ctype.h> | ||
36 | #include <errno.h> | ||
37 | #define vi_Version BB_VER " " BB_BT | ||
38 | 26 | ||
39 | #ifdef CONFIG_LOCALE_SUPPORT | 27 | #ifdef CONFIG_LOCALE_SUPPORT |
40 | #define Isprint(c) isprint((c)) | 28 | #define Isprint(c) isprint((c)) |
@@ -349,7 +337,7 @@ int vi_main(int argc, char **argv) | |||
349 | for (; optind < argc; optind++) { | 337 | for (; optind < argc; optind++) { |
350 | editing = 1; // 0=exit, 1=one file, 2+ =many files | 338 | editing = 1; // 0=exit, 1=one file, 2+ =many files |
351 | free(cfn); | 339 | free(cfn); |
352 | cfn = (Byte *) bb_xstrdup(argv[optind]); | 340 | cfn = (Byte *) xstrdup(argv[optind]); |
353 | edit_file(cfn); | 341 | edit_file(cfn); |
354 | } | 342 | } |
355 | } | 343 | } |
@@ -522,7 +510,7 @@ static Byte *get_one_address(Byte * p, int *addr) // get colon addr, if present | |||
522 | *q++ = *p; | 510 | *q++ = *p; |
523 | *q = '\0'; | 511 | *q = '\0'; |
524 | } | 512 | } |
525 | pat = (Byte *) bb_xstrdup((char *) buf); // save copy of pattern | 513 | pat = (Byte *) xstrdup((char *) buf); // save copy of pattern |
526 | if (*p == '/') | 514 | if (*p == '/') |
527 | p++; | 515 | p++; |
528 | q = char_search(dot, pat, FORWARD, FULL); | 516 | q = char_search(dot, pat, FORWARD, FULL); |
@@ -736,7 +724,7 @@ static void colon(Byte * buf) | |||
736 | 724 | ||
737 | // There is a read-able regular file | 725 | // There is a read-able regular file |
738 | // make this the current file | 726 | // make this the current file |
739 | q = (Byte *) bb_xstrdup((char *) fn); // save the cfn | 727 | q = (Byte *) xstrdup((char *) fn); // save the cfn |
740 | free(cfn); // free the old name | 728 | free(cfn); // free the old name |
741 | cfn = q; // remember new cfn | 729 | cfn = q; // remember new cfn |
742 | 730 | ||
@@ -788,7 +776,7 @@ static void colon(Byte * buf) | |||
788 | if (strlen((char *) args) > 0) { | 776 | if (strlen((char *) args) > 0) { |
789 | // user wants a new filename | 777 | // user wants a new filename |
790 | free(cfn); | 778 | free(cfn); |
791 | cfn = (Byte *) bb_xstrdup((char *) args); | 779 | cfn = (Byte *) xstrdup((char *) args); |
792 | } else { | 780 | } else { |
793 | // user wants file status info | 781 | // user wants file status info |
794 | last_status_cksum = 0; // force status update | 782 | last_status_cksum = 0; // force status update |
@@ -996,7 +984,7 @@ static void colon(Byte * buf) | |||
996 | } | 984 | } |
997 | #endif /* CONFIG_FEATURE_VI_SEARCH */ | 985 | #endif /* CONFIG_FEATURE_VI_SEARCH */ |
998 | } else if (strncasecmp((char *) cmd, "version", i) == 0) { // show software version | 986 | } else if (strncasecmp((char *) cmd, "version", i) == 0) { // show software version |
999 | psb("%s", vi_Version); | 987 | psb("%s", BB_VER " " BB_BT); |
1000 | } else if (strncasecmp((char *) cmd, "write", i) == 0 // write text to file | 988 | } else if (strncasecmp((char *) cmd, "write", i) == 0 // write text to file |
1001 | || strncasecmp((char *) cmd, "wq", i) == 0 | 989 | || strncasecmp((char *) cmd, "wq", i) == 0 |
1002 | || strncasecmp((char *) cmd, "wn", i) == 0 | 990 | || strncasecmp((char *) cmd, "wn", i) == 0 |
@@ -2313,7 +2301,7 @@ static Byte *get_input_line(Byte * prompt) // get input line- use "status line" | |||
2313 | } | 2301 | } |
2314 | refresh(FALSE); | 2302 | refresh(FALSE); |
2315 | free(obufp); | 2303 | free(obufp); |
2316 | obufp = (Byte *) bb_xstrdup((char *) buf); | 2304 | obufp = (Byte *) xstrdup((char *) buf); |
2317 | return (obufp); | 2305 | return (obufp); |
2318 | } | 2306 | } |
2319 | 2307 | ||
@@ -3199,7 +3187,7 @@ key_cmd_mode: | |||
3199 | // Stuff the last_modifying_cmd back into stdin | 3187 | // Stuff the last_modifying_cmd back into stdin |
3200 | // and let it be re-executed. | 3188 | // and let it be re-executed. |
3201 | if (last_modifying_cmd != 0) { | 3189 | if (last_modifying_cmd != 0) { |
3202 | ioq = ioq_start = (Byte *) bb_xstrdup((char *) last_modifying_cmd); | 3190 | ioq = ioq_start = (Byte *) xstrdup((char *) last_modifying_cmd); |
3203 | } | 3191 | } |
3204 | break; | 3192 | break; |
3205 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ | 3193 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ |
@@ -3214,7 +3202,7 @@ key_cmd_mode: | |||
3214 | if (strlen((char *) q) > 1) { // new pat- save it and find | 3202 | if (strlen((char *) q) > 1) { // new pat- save it and find |
3215 | // there is a new pat | 3203 | // there is a new pat |
3216 | free(last_search_pattern); | 3204 | free(last_search_pattern); |
3217 | last_search_pattern = (Byte *) bb_xstrdup((char *) q); | 3205 | last_search_pattern = (Byte *) xstrdup((char *) q); |
3218 | goto dc3; // now find the pattern | 3206 | goto dc3; // now find the pattern |
3219 | } | 3207 | } |
3220 | // user changed mind and erased the "/"- do nothing | 3208 | // user changed mind and erased the "/"- do nothing |