aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c4
-rw-r--r--shell/cmdedit.c16
-rw-r--r--shell/hush.c4
-rw-r--r--shell/lash.c12
4 files changed, 18 insertions, 18 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 5031ae153..c1b2b0ed6 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -6011,7 +6011,7 @@ static inline void putprompt(const char *s)
6011{ 6011{
6012#ifdef CONFIG_ASH_EXPAND_PRMT 6012#ifdef CONFIG_ASH_EXPAND_PRMT
6013 free(cmdedit_prompt); 6013 free(cmdedit_prompt);
6014 cmdedit_prompt = bb_xstrdup(s); 6014 cmdedit_prompt = xstrdup(s);
6015#else 6015#else
6016 cmdedit_prompt = s; 6016 cmdedit_prompt = s;
6017#endif 6017#endif
@@ -8105,7 +8105,7 @@ static int dotcmd(int argc, char **argv)
8105 int status = 0; 8105 int status = 0;
8106 8106
8107 for (sp = cmdenviron; sp; sp = sp->next) 8107 for (sp = cmdenviron; sp; sp = sp->next)
8108 setvareq(bb_xstrdup(sp->text), VSTRFIXED | VTEXTFIXED); 8108 setvareq(xstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
8109 8109
8110 if (argc >= 2) { /* That's what SVR2 does */ 8110 if (argc >= 2) { /* That's what SVR2 does */
8111 char *fullname; 8111 char *fullname;
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 59226aff5..0af1a2ad0 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -216,7 +216,7 @@ static void cmdedit_set_out_char(int next_char)
216 printf("\033[7m%c\033[0m", c); 216 printf("\033[7m%c\033[0m", c);
217 } else 217 } else
218#endif 218#endif
219 putchar(c); 219 if (initial_settings.c_lflag & ECHO) putchar(c);
220 if (++cmdedit_x >= cmdedit_termw) { 220 if (++cmdedit_x >= cmdedit_termw) {
221 /* terminal is scrolled down */ 221 /* terminal is scrolled down */
222 cmdedit_y++; 222 cmdedit_y++;
@@ -546,8 +546,8 @@ static void cmdedit_init(void)
546 my_euid = geteuid(); 546 my_euid = geteuid();
547 entry = getpwuid(my_euid); 547 entry = getpwuid(my_euid);
548 if (entry) { 548 if (entry) {
549 user_buf = bb_xstrdup(entry->pw_name); 549 user_buf = xstrdup(entry->pw_name);
550 home_pwd_buf = bb_xstrdup(entry->pw_dir); 550 home_pwd_buf = xstrdup(entry->pw_dir);
551 } 551 }
552#endif 552#endif
553 553
@@ -634,7 +634,7 @@ static void username_tab_completion(char *ud, char *with_shash_flg)
634 while ((entry = getpwent()) != NULL) { 634 while ((entry = getpwent()) != NULL) {
635 /* Null usernames should result in all users as possible completions. */ 635 /* Null usernames should result in all users as possible completions. */
636 if ( /*!userlen || */ !strncmp(ud, entry->pw_name, userlen)) { 636 if ( /*!userlen || */ !strncmp(ud, entry->pw_name, userlen)) {
637 add_match(bb_xasprintf("~%s", entry->pw_name), '/'); 637 add_match(xasprintf("~%s", entry->pw_name), '/');
638 } 638 }
639 } 639 }
640 640
@@ -684,7 +684,7 @@ static int path_parse(char ***p, int flags)
684 *p = xmalloc(npth * sizeof(char *)); 684 *p = xmalloc(npth * sizeof(char *));
685 685
686 tmp = pth; 686 tmp = pth;
687 (*p)[0] = bb_xstrdup(tmp); 687 (*p)[0] = xstrdup(tmp);
688 npth = 1; /* count words is + 1 count ':' */ 688 npth = 1; /* count words is + 1 count ':' */
689 689
690 for (;;) { 690 for (;;) {
@@ -1114,7 +1114,7 @@ static void input_tab(int *lastWasTab)
1114 if (!matches) 1114 if (!matches)
1115 return; /* not found */ 1115 return; /* not found */
1116 /* find minimal match */ 1116 /* find minimal match */
1117 tmp1 = bb_xstrdup(matches[0]); 1117 tmp1 = xstrdup(matches[0]);
1118 for (tmp = tmp1; *tmp; tmp++) 1118 for (tmp = tmp1; *tmp; tmp++)
1119 for (len_found = 1; len_found < num_matches; len_found++) 1119 for (len_found = 1; len_found < num_matches; len_found++)
1120 if (matches[len_found][(tmp - tmp1)] != *tmp) { 1120 if (matches[len_found][(tmp - tmp1)] != *tmp) {
@@ -1175,7 +1175,7 @@ static void get_previous_history(void)
1175{ 1175{
1176 if(command_ps[0] != 0 || history[cur_history] == 0) { 1176 if(command_ps[0] != 0 || history[cur_history] == 0) {
1177 free(history[cur_history]); 1177 free(history[cur_history]);
1178 history[cur_history] = bb_xstrdup(command_ps); 1178 history[cur_history] = xstrdup(command_ps);
1179 } 1179 }
1180 cur_history--; 1180 cur_history--;
1181} 1181}
@@ -1856,7 +1856,7 @@ rewrite_line:
1856 for(i = 0; i < (MAX_HISTORY-1); i++) 1856 for(i = 0; i < (MAX_HISTORY-1); i++)
1857 history[i] = history[i+1]; 1857 history[i] = history[i+1];
1858 } 1858 }
1859 history[i++] = bb_xstrdup(command); 1859 history[i++] = xstrdup(command);
1860 cur_history = i; 1860 cur_history = i;
1861 n_history = i; 1861 n_history = i;
1862#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT) 1862#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
diff --git a/shell/hush.c b/shell/hush.c
index 8c432942e..8df91a1e8 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1320,7 +1320,7 @@ static int run_pipe_real(struct pipe *pi)
1320 * variable. */ 1320 * variable. */
1321 int export_me=0; 1321 int export_me=0;
1322 char *name, *value; 1322 char *name, *value;
1323 name = bb_xstrdup(child->argv[i]); 1323 name = xstrdup(child->argv[i]);
1324 debug_printf("Local environment set: %s\n", name); 1324 debug_printf("Local environment set: %s\n", name);
1325 value = strchr(name, '='); 1325 value = strchr(name, '=');
1326 if (value) 1326 if (value)
@@ -2753,7 +2753,7 @@ int hush_main(int argc, char **argv)
2753 debug_printf("\nrunning script '%s'\n", argv[optind]); 2753 debug_printf("\nrunning script '%s'\n", argv[optind]);
2754 global_argv = argv+optind; 2754 global_argv = argv+optind;
2755 global_argc = argc-optind; 2755 global_argc = argc-optind;
2756 input = bb_xfopen(argv[optind], "r"); 2756 input = xfopen(argv[optind], "r");
2757 opt = parse_file_outer(input); 2757 opt = parse_file_outer(input);
2758 2758
2759#ifdef CONFIG_FEATURE_CLEAN_UP 2759#ifdef CONFIG_FEATURE_CLEAN_UP
diff --git a/shell/lash.c b/shell/lash.c
index 92c24d1c2..eae949e18 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -710,7 +710,7 @@ static char * strsep_space( char *string, int * ix)
710 return NULL; 710 return NULL;
711 } 711 }
712 712
713 token = bb_xstrndup(string, *ix); 713 token = xstrndup(string, *ix);
714 714
715 return token; 715 return token;
716} 716}
@@ -751,7 +751,7 @@ static int expand_arguments(char *command)
751 751
752 /* We need a clean copy, so strsep can mess up the copy while 752 /* We need a clean copy, so strsep can mess up the copy while
753 * we write stuff into the original (in a minute) */ 753 * we write stuff into the original (in a minute) */
754 cmd = cmd_copy = bb_xstrdup(command); 754 cmd = cmd_copy = xstrdup(command);
755 *command = '\0'; 755 *command = '\0';
756 for (ix = 0, tmpcmd = cmd; 756 for (ix = 0, tmpcmd = cmd;
757 (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) { 757 (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) {
@@ -1123,10 +1123,10 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
1123 prog->argv[argc_l] = NULL; 1123 prog->argv[argc_l] = NULL;
1124 1124
1125 if (!return_command) { 1125 if (!return_command) {
1126 job->text = bb_xstrdup(*command_ptr); 1126 job->text = xstrdup(*command_ptr);
1127 } else { 1127 } else {
1128 /* This leaves any trailing spaces, which is a bit sloppy */ 1128 /* This leaves any trailing spaces, which is a bit sloppy */
1129 job->text = bb_xstrndup(*command_ptr, return_command - *command_ptr); 1129 job->text = xstrndup(*command_ptr, return_command - *command_ptr);
1130 } 1130 }
1131 1131
1132 *command_ptr = return_command; 1132 *command_ptr = return_command;
@@ -1543,7 +1543,7 @@ int lash_main(int argc_l, char **argv_l)
1543 input = NULL; 1543 input = NULL;
1544 if (local_pending_command != 0) 1544 if (local_pending_command != 0)
1545 bb_error_msg_and_die("multiple -c arguments"); 1545 bb_error_msg_and_die("multiple -c arguments");
1546 local_pending_command = bb_xstrdup(argv[optind]); 1546 local_pending_command = xstrdup(argv[optind]);
1547 optind++; 1547 optind++;
1548 argv = argv+optind; 1548 argv = argv+optind;
1549 break; 1549 break;
@@ -1575,7 +1575,7 @@ int lash_main(int argc_l, char **argv_l)
1575 } 1575 }
1576 } else if (!local_pending_command && argv[optind]) { 1576 } else if (!local_pending_command && argv[optind]) {
1577 //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); 1577 //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]);
1578 input = bb_xfopen(argv[optind], "r"); 1578 input = xfopen(argv[optind], "r");
1579 /* be lazy, never mark this closed */ 1579 /* be lazy, never mark this closed */
1580 llist_add_to(&close_me_list, (void *)(long)fileno(input)); 1580 llist_add_to(&close_me_list, (void *)(long)fileno(input));
1581 } 1581 }