aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c38
-rw-r--r--editors/patch.c12
-rw-r--r--editors/sed.c32
-rw-r--r--editors/vi.c28
4 files changed, 44 insertions, 66 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 16c871f8c..5d43e1d9e 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -7,19 +7,9 @@
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
8 */ 8 */
9 9
10#include <stdio.h>
11#include <stdlib.h>
12#include <unistd.h>
13#include <errno.h>
14#include <string.h>
15#include <strings.h>
16#include <time.h>
17#include <math.h>
18#include <ctype.h>
19#include <getopt.h>
20
21#include "xregex.h"
22#include "busybox.h" 10#include "busybox.h"
11#include "xregex.h"
12#include <math.h>
23 13
24 14
25#define MAXVARFMT 240 15#define MAXVARFMT 240
@@ -610,7 +600,7 @@ static inline int isalnum_(int c)
610 600
611static FILE *afopen(const char *path, const char *mode) 601static FILE *afopen(const char *path, const char *mode)
612{ 602{
613 return (*path == '-' && *(path+1) == '\0') ? stdin : bb_xfopen(path, mode); 603 return (*path == '-' && *(path+1) == '\0') ? stdin : xfopen(path, mode);
614} 604}
615 605
616/* -------- working with variables (set/get/copy/etc) -------- */ 606/* -------- working with variables (set/get/copy/etc) -------- */
@@ -672,7 +662,7 @@ static var *setvar_p(var *v, char *value)
672/* same as setvar_p but make a copy of string */ 662/* same as setvar_p but make a copy of string */
673static var *setvar_s(var *v, const char *value) 663static var *setvar_s(var *v, const char *value)
674{ 664{
675 return setvar_p(v, (value && *value) ? bb_xstrdup(value) : NULL); 665 return setvar_p(v, (value && *value) ? xstrdup(value) : NULL);
676} 666}
677 667
678/* same as setvar_s but set USER flag */ 668/* same as setvar_s but set USER flag */
@@ -709,7 +699,7 @@ static char *getvar_s(var *v)
709 /* if v is numeric and has no cached string, convert it to string */ 699 /* if v is numeric and has no cached string, convert it to string */
710 if ((v->type & (VF_NUMBER | VF_CACHED)) == VF_NUMBER) { 700 if ((v->type & (VF_NUMBER | VF_CACHED)) == VF_NUMBER) {
711 fmt_num(buf, MAXVARFMT, getvar_s(V[CONVFMT]), v->number, TRUE); 701 fmt_num(buf, MAXVARFMT, getvar_s(V[CONVFMT]), v->number, TRUE);
712 v->string = bb_xstrdup(buf); 702 v->string = xstrdup(buf);
713 v->type |= VF_CACHED; 703 v->type |= VF_CACHED;
714 } 704 }
715 return (v->string == NULL) ? "" : v->string; 705 return (v->string == NULL) ? "" : v->string;
@@ -744,7 +734,7 @@ static var *copyvar(var *dest, const var *src)
744 dest->type |= (src->type & ~VF_DONTTOUCH); 734 dest->type |= (src->type & ~VF_DONTTOUCH);
745 dest->number = src->number; 735 dest->number = src->number;
746 if (src->string) 736 if (src->string)
747 dest->string = bb_xstrdup(src->string); 737 dest->string = xstrdup(src->string);
748 } 738 }
749 handle_special(dest); 739 handle_special(dest);
750 return dest; 740 return dest;
@@ -1144,7 +1134,7 @@ static node *chain_node(uint32_t info)
1144 if (seq->programname != programname) { 1134 if (seq->programname != programname) {
1145 seq->programname = programname; 1135 seq->programname = programname;
1146 n = chain_node(OC_NEWSOURCE); 1136 n = chain_node(OC_NEWSOURCE);
1147 n->l.s = bb_xstrdup(programname); 1137 n->l.s = xstrdup(programname);
1148 } 1138 }
1149 1139
1150 n = seq->last; 1140 n = seq->last;
@@ -1433,7 +1423,7 @@ static int awk_split(char *s, node *spl, char **slist)
1433 regmatch_t pmatch[2]; 1423 regmatch_t pmatch[2];
1434 1424
1435 /* in worst case, each char would be a separate field */ 1425 /* in worst case, each char would be a separate field */
1436 *slist = s1 = bb_xstrndup(s, strlen(s) * 2 + 3); 1426 *slist = s1 = xstrndup(s, strlen(s) * 2 + 3);
1437 1427
1438 c[0] = c[1] = (char)spl->info; 1428 c[0] = c[1] = (char)spl->info;
1439 c[2] = c[3] = '\0'; 1429 c[2] = c[3] = '\0';
@@ -1747,7 +1737,7 @@ static char *awk_printf(node *n)
1747 var *v, *arg; 1737 var *v, *arg;
1748 1738
1749 v = nvalloc(1); 1739 v = nvalloc(1);
1750 fmt = f = bb_xstrdup(getvar_s(evaluate(nextarg(&n), v))); 1740 fmt = f = xstrdup(getvar_s(evaluate(nextarg(&n), v)));
1751 1741
1752 i = 0; 1742 i = 0;
1753 while (*f) { 1743 while (*f) {
@@ -1941,7 +1931,7 @@ static var *exec_builtin(node *op, var *res)
1941 case B_up: 1931 case B_up:
1942 to_xxx = toupper; 1932 to_xxx = toupper;
1943lo_cont: 1933lo_cont:
1944 s1 = s = bb_xstrdup(as[0]); 1934 s1 = s = xstrdup(as[0]);
1945 while (*s1) { 1935 while (*s1) {
1946 *s1 = (*to_xxx)(*s1); 1936 *s1 = (*to_xxx)(*s1);
1947 s1++; 1937 s1++;
@@ -2118,7 +2108,7 @@ static var *evaluate(node *op, var *res)
2118 bb_perror_msg_and_die("popen"); 2108 bb_perror_msg_and_die("popen");
2119 X.rsm->is_pipe = 1; 2109 X.rsm->is_pipe = 1;
2120 } else { 2110 } else {
2121 X.rsm->F = bb_xfopen(R.s, opn=='w' ? "w" : "a"); 2111 X.rsm->F = xfopen(R.s, opn=='w' ? "w" : "a");
2122 } 2112 }
2123 } 2113 }
2124 X.F = X.rsm->F; 2114 X.F = X.rsm->F;
@@ -2272,7 +2262,7 @@ re_cont:
2272 X.rsm->F = popen(L.s, "r"); 2262 X.rsm->F = popen(L.s, "r");
2273 X.rsm->is_pipe = TRUE; 2263 X.rsm->is_pipe = TRUE;
2274 } else { 2264 } else {
2275 X.rsm->F = fopen(L.s, "r"); /* not bb_xfopen! */ 2265 X.rsm->F = fopen(L.s, "r"); /* not xfopen! */
2276 } 2266 }
2277 } 2267 }
2278 } else { 2268 } else {
@@ -2564,7 +2554,7 @@ static int is_assignment(const char *expr)
2564{ 2554{
2565 char *exprc, *s, *s0, *s1; 2555 char *exprc, *s, *s0, *s1;
2566 2556
2567 exprc = bb_xstrdup(expr); 2557 exprc = xstrdup(expr);
2568 if (!isalnum_(*exprc) || (s = strchr(exprc, '=')) == NULL) { 2558 if (!isalnum_(*exprc) || (s = strchr(exprc, '=')) == NULL) {
2569 free(exprc); 2559 free(exprc);
2570 return FALSE; 2560 return FALSE;
@@ -2659,7 +2649,7 @@ int awk_main(int argc, char **argv)
2659 } 2649 }
2660 2650
2661 for (envp=environ; *envp; envp++) { 2651 for (envp=environ; *envp; envp++) {
2662 s = bb_xstrdup(*envp); 2652 s = xstrdup(*envp);
2663 s1 = strchr(s, '='); 2653 s1 = strchr(s, '=');
2664 if (!s1) { 2654 if (!s1) {
2665 goto keep_going; 2655 goto keep_going;
diff --git a/editors/patch.c b/editors/patch.c
index 337d1bbad..a710d8224 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -67,7 +67,7 @@ static char *extract_filename(char *line, int patch_level)
67 filename_start_ptr = temp + 1; 67 filename_start_ptr = temp + 1;
68 } 68 }
69 69
70 return(bb_xstrdup(filename_start_ptr)); 70 return(xstrdup(filename_start_ptr));
71} 71}
72 72
73static int file_doesnt_exist(const char *filename) 73static int file_doesnt_exist(const char *filename)
@@ -89,7 +89,7 @@ int patch_main(int argc, char **argv)
89 if (ret & 1) 89 if (ret & 1)
90 patch_level = bb_xgetlarg(p, 10, -1, USHRT_MAX); 90 patch_level = bb_xgetlarg(p, 10, -1, USHRT_MAX);
91 if (ret & 2) { 91 if (ret & 2) {
92 patch_file = bb_xfopen(i, "r"); 92 patch_file = xfopen(i, "r");
93 } else { 93 } else {
94 patch_file = stdin; 94 patch_file = stdin;
95 } 95 }
@@ -140,7 +140,7 @@ int patch_main(int argc, char **argv)
140 bb_make_directory(new_filename, -1, FILEUTILS_RECUR); 140 bb_make_directory(new_filename, -1, FILEUTILS_RECUR);
141 *line_ptr = '/'; 141 *line_ptr = '/';
142 } 142 }
143 dst_stream = bb_xfopen(new_filename, "w+"); 143 dst_stream = xfopen(new_filename, "w+");
144 backup_filename = NULL; 144 backup_filename = NULL;
145 } else { 145 } else {
146 backup_filename = xmalloc(strlen(new_filename) + 6); 146 backup_filename = xmalloc(strlen(new_filename) + 6);
@@ -150,16 +150,16 @@ int patch_main(int argc, char **argv)
150 bb_perror_msg_and_die("Couldnt create file %s", 150 bb_perror_msg_and_die("Couldnt create file %s",
151 backup_filename); 151 backup_filename);
152 } 152 }
153 dst_stream = bb_xfopen(new_filename, "w"); 153 dst_stream = xfopen(new_filename, "w");
154 } 154 }
155 155
156 if ((backup_filename == NULL) || file_doesnt_exist(original_filename)) { 156 if ((backup_filename == NULL) || file_doesnt_exist(original_filename)) {
157 src_stream = NULL; 157 src_stream = NULL;
158 } else { 158 } else {
159 if (strcmp(original_filename, new_filename) == 0) { 159 if (strcmp(original_filename, new_filename) == 0) {
160 src_stream = bb_xfopen(backup_filename, "r"); 160 src_stream = xfopen(backup_filename, "r");
161 } else { 161 } else {
162 src_stream = bb_xfopen(original_filename, "r"); 162 src_stream = xfopen(original_filename, "r");
163 } 163 }
164 } 164 }
165 165
diff --git a/editors/sed.c b/editors/sed.c
index 89b8dd72c..d5cf3f219 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -132,7 +132,7 @@ void sed_free_and_close_stuff(void)
132 sed_cmd_t *sed_cmd_next = sed_cmd->next; 132 sed_cmd_t *sed_cmd_next = sed_cmd->next;
133 133
134 if(sed_cmd->file) 134 if(sed_cmd->file)
135 bb_xprint_and_close_file(sed_cmd->file); 135 xprint_and_close_file(sed_cmd->file);
136 136
137 if (sed_cmd->beg_match) { 137 if (sed_cmd->beg_match) {
138 regfree(sed_cmd->beg_match); 138 regfree(sed_cmd->beg_match);
@@ -300,7 +300,7 @@ static int parse_file_cmd(sed_cmd_t *sed_cmd, char *filecmdstr, char **retval)
300 /* If lines glued together, put backslash back. */ 300 /* If lines glued together, put backslash back. */
301 if(filecmdstr[idx]=='\n') hack=1; 301 if(filecmdstr[idx]=='\n') hack=1;
302 if(idx==start) bb_error_msg_and_die("Empty filename"); 302 if(idx==start) bb_error_msg_and_die("Empty filename");
303 *retval = bb_xstrndup(filecmdstr+start, idx-start+hack+1); 303 *retval = xstrndup(filecmdstr+start, idx-start+hack+1);
304 if(hack) *(idx+*retval)='\\'; 304 if(hack) *(idx+*retval)='\\';
305 305
306 return idx; 306 return idx;
@@ -406,7 +406,7 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr)
406 } else if(isspace(*cmdstr)) cmdstr++; 406 } else if(isspace(*cmdstr)) cmdstr++;
407 else break; 407 else break;
408 } 408 }
409 sed_cmd->string = bb_xstrdup(cmdstr); 409 sed_cmd->string = xstrdup(cmdstr);
410 parse_escapes(sed_cmd->string,sed_cmd->string,strlen(cmdstr),0,0); 410 parse_escapes(sed_cmd->string,sed_cmd->string,strlen(cmdstr),0,0);
411 cmdstr += strlen(cmdstr); 411 cmdstr += strlen(cmdstr);
412 /* handle file cmds: (r)ead */ 412 /* handle file cmds: (r)ead */
@@ -415,7 +415,7 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr)
415 bb_error_msg_and_die("Command only uses one address"); 415 bb_error_msg_and_die("Command only uses one address");
416 cmdstr += parse_file_cmd(sed_cmd, cmdstr, &sed_cmd->string); 416 cmdstr += parse_file_cmd(sed_cmd, cmdstr, &sed_cmd->string);
417 if(sed_cmd->cmd=='w') 417 if(sed_cmd->cmd=='w')
418 sed_cmd->file=bb_xfopen(sed_cmd->string,"w"); 418 sed_cmd->file=xfopen(sed_cmd->string,"w");
419 /* handle branch commands */ 419 /* handle branch commands */
420 } else if (strchr(":btT", sed_cmd->cmd)) { 420 } else if (strchr(":btT", sed_cmd->cmd)) {
421 int length; 421 int length;
@@ -423,7 +423,7 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr)
423 while(isspace(*cmdstr)) cmdstr++; 423 while(isspace(*cmdstr)) cmdstr++;
424 length = strcspn(cmdstr, semicolon_whitespace); 424 length = strcspn(cmdstr, semicolon_whitespace);
425 if (length) { 425 if (length) {
426 sed_cmd->string = bb_xstrndup(cmdstr, length); 426 sed_cmd->string = xstrndup(cmdstr, length);
427 cmdstr += length; 427 cmdstr += length;
428 } 428 }
429 } 429 }
@@ -466,7 +466,7 @@ static void add_cmd(char *cmdstr)
466 466
467 /* Append this line to any unfinished line from last time. */ 467 /* Append this line to any unfinished line from last time. */
468 if (bbg.add_cmd_line) { 468 if (bbg.add_cmd_line) {
469 cmdstr = bb_xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr); 469 cmdstr = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr);
470 free(bbg.add_cmd_line); 470 free(bbg.add_cmd_line);
471 bbg.add_cmd_line = cmdstr; 471 bbg.add_cmd_line = cmdstr;
472 } 472 }
@@ -474,7 +474,7 @@ static void add_cmd(char *cmdstr)
474 /* If this line ends with backslash, request next line. */ 474 /* If this line ends with backslash, request next line. */
475 temp=strlen(cmdstr); 475 temp=strlen(cmdstr);
476 if(temp && cmdstr[temp-1]=='\\') { 476 if(temp && cmdstr[temp-1]=='\\') {
477 if (!bbg.add_cmd_line) bbg.add_cmd_line = bb_xstrdup(cmdstr); 477 if (!bbg.add_cmd_line) bbg.add_cmd_line = xstrdup(cmdstr);
478 bbg.add_cmd_line[temp-1] = 0; 478 bbg.add_cmd_line[temp-1] = 0;
479 return; 479 return;
480 } 480 }
@@ -671,7 +671,7 @@ static sed_cmd_t *branch_to(char *label)
671 671
672static void append(char *s) 672static void append(char *s)
673{ 673{
674 llist_add_to_end(&bbg.append_head, bb_xstrdup(s)); 674 llist_add_to_end(&bbg.append_head, xstrdup(s));
675} 675}
676 676
677static void flush_append(void) 677static void flush_append(void)
@@ -852,7 +852,7 @@ restart:
852 char *tmp = strchr(pattern_space,'\n'); 852 char *tmp = strchr(pattern_space,'\n');
853 853
854 if(tmp) { 854 if(tmp) {
855 tmp=bb_xstrdup(tmp+1); 855 tmp=xstrdup(tmp+1);
856 free(pattern_space); 856 free(pattern_space);
857 pattern_space=tmp; 857 pattern_space=tmp;
858 goto restart; 858 goto restart;
@@ -907,7 +907,7 @@ restart:
907 while ((line = bb_get_chomped_line_from_file(rfile)) 907 while ((line = bb_get_chomped_line_from_file(rfile))
908 != NULL) 908 != NULL)
909 append(line); 909 append(line);
910 bb_xprint_and_close_file(rfile); 910 xprint_and_close_file(rfile);
911 } 911 }
912 912
913 break; 913 break;
@@ -996,7 +996,7 @@ restart:
996 } 996 }
997 case 'g': /* Replace pattern space with hold space */ 997 case 'g': /* Replace pattern space with hold space */
998 free(pattern_space); 998 free(pattern_space);
999 pattern_space = bb_xstrdup(bbg.hold_space ? bbg.hold_space : ""); 999 pattern_space = xstrdup(bbg.hold_space ? bbg.hold_space : "");
1000 break; 1000 break;
1001 case 'G': /* Append newline and hold space to pattern space */ 1001 case 'G': /* Append newline and hold space to pattern space */
1002 { 1002 {
@@ -1019,7 +1019,7 @@ restart:
1019 } 1019 }
1020 case 'h': /* Replace hold space with pattern space */ 1020 case 'h': /* Replace hold space with pattern space */
1021 free(bbg.hold_space); 1021 free(bbg.hold_space);
1022 bbg.hold_space = bb_xstrdup(pattern_space); 1022 bbg.hold_space = xstrdup(pattern_space);
1023 break; 1023 break;
1024 case 'H': /* Append newline and pattern space to hold space */ 1024 case 'H': /* Append newline and pattern space to hold space */
1025 { 1025 {
@@ -1072,7 +1072,7 @@ discard_line:
1072static void add_cmd_block(char *cmdstr) 1072static void add_cmd_block(char *cmdstr)
1073{ 1073{
1074 int go=1; 1074 int go=1;
1075 char *temp=bb_xstrdup(cmdstr),*temp2=temp; 1075 char *temp=xstrdup(cmdstr),*temp2=temp;
1076 1076
1077 while(go) { 1077 while(go) {
1078 int len=strcspn(temp2,"\n"); 1078 int len=strcspn(temp2,"\n");
@@ -1121,14 +1121,14 @@ int sed_main(int argc, char **argv)
1121 FILE *cmdfile; 1121 FILE *cmdfile;
1122 char *line; 1122 char *line;
1123 1123
1124 cmdfile = bb_xfopen(optarg, "r"); 1124 cmdfile = xfopen(optarg, "r");
1125 1125
1126 while ((line = bb_get_chomped_line_from_file(cmdfile)) != NULL) { 1126 while ((line = bb_get_chomped_line_from_file(cmdfile)) != NULL) {
1127 add_cmd(line); 1127 add_cmd(line);
1128 getpat=0; 1128 getpat=0;
1129 free(line); 1129 free(line);
1130 } 1130 }
1131 bb_xprint_and_close_file(cmdfile); 1131 xprint_and_close_file(cmdfile);
1132 1132
1133 break; 1133 break;
1134 } 1134 }
@@ -1172,7 +1172,7 @@ int sed_main(int argc, char **argv)
1172 struct stat statbuf; 1172 struct stat statbuf;
1173 int nonstdoutfd; 1173 int nonstdoutfd;
1174 1174
1175 bbg.outname=bb_xstrndup(argv[i],strlen(argv[i])+6); 1175 bbg.outname=xstrndup(argv[i],strlen(argv[i])+6);
1176 strcat(bbg.outname,"XXXXXX"); 1176 strcat(bbg.outname,"XXXXXX");
1177 if(-1==(nonstdoutfd=mkstemp(bbg.outname))) 1177 if(-1==(nonstdoutfd=mkstemp(bbg.outname)))
1178 bb_error_msg_and_die("no temp file"); 1178 bb_error_msg_and_die("no temp file");
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