aboutsummaryrefslogtreecommitdiff
path: root/shell/cmdedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/cmdedit.c')
-rw-r--r--shell/cmdedit.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 2ea61614d..3cbdce0ef 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -330,7 +330,7 @@ static void parse_prompt(const char *prmt_ptr)
330 char *pbuf; 330 char *pbuf;
331 331
332 if (!pwd_buf) { 332 if (!pwd_buf) {
333 pwd_buf=(char *)unknown; 333 pwd_buf=(char *)bb_msg_unknown;
334 } 334 }
335 335
336 while (*prmt_ptr) { 336 while (*prmt_ptr) {
@@ -341,7 +341,7 @@ static void parse_prompt(const char *prmt_ptr)
341 const char *cp = prmt_ptr; 341 const char *cp = prmt_ptr;
342 int l; 342 int l;
343 343
344 c = process_escape_sequence(&prmt_ptr); 344 c = bb_process_escape_sequence(&prmt_ptr);
345 if(prmt_ptr==cp) { 345 if(prmt_ptr==cp) {
346 if (*cp == 0) 346 if (*cp == 0)
347 break; 347 break;
@@ -430,7 +430,7 @@ static void parse_prompt(const char *prmt_ptr)
430 if (flg_not_length == ']') 430 if (flg_not_length == ']')
431 sub_len++; 431 sub_len++;
432 } 432 }
433 if(pwd_buf!=(char *)unknown) 433 if(pwd_buf!=(char *)bb_msg_unknown)
434 free(pwd_buf); 434 free(pwd_buf);
435 cmdedit_prompt = prmt_mem_ptr; 435 cmdedit_prompt = prmt_mem_ptr;
436 cmdedit_prmt_len = prmt_len - sub_len; 436 cmdedit_prmt_len = prmt_len - sub_len;
@@ -520,8 +520,8 @@ static void cmdedit_init(void)
520 my_euid = geteuid(); 520 my_euid = geteuid();
521 entry = getpwuid(my_euid); 521 entry = getpwuid(my_euid);
522 if (entry) { 522 if (entry) {
523 user_buf = xstrdup(entry->pw_name); 523 user_buf = bb_xstrdup(entry->pw_name);
524 home_pwd_buf = xstrdup(entry->pw_dir); 524 home_pwd_buf = bb_xstrdup(entry->pw_dir);
525 } 525 }
526#endif 526#endif
527 527
@@ -598,7 +598,7 @@ static char **username_tab_completion(char *ud, int *num_matches)
598 /* Null usernames should result in all users as possible completions. */ 598 /* Null usernames should result in all users as possible completions. */
599 if ( /*!userlen || */ !strncmp(ud, entry->pw_name, userlen)) { 599 if ( /*!userlen || */ !strncmp(ud, entry->pw_name, userlen)) {
600 600
601 bb_asprintf(&temp, "~%s/", entry->pw_name); 601 bb_xasprintf(&temp, "~%s/", entry->pw_name);
602 matches = xrealloc(matches, (nm + 1) * sizeof(char *)); 602 matches = xrealloc(matches, (nm + 1) * sizeof(char *));
603 603
604 matches[nm++] = temp; 604 matches[nm++] = temp;
@@ -647,7 +647,7 @@ static int path_parse(char ***p, int flags)
647 *p = xmalloc(npth * sizeof(char *)); 647 *p = xmalloc(npth * sizeof(char *));
648 648
649 tmp = pth; 649 tmp = pth;
650 (*p)[0] = xstrdup(tmp); 650 (*p)[0] = bb_xstrdup(tmp);
651 npth = 1; /* count words is + 1 count ':' */ 651 npth = 1; /* count words is + 1 count ':' */
652 652
653 for (;;) { 653 for (;;) {
@@ -1071,7 +1071,7 @@ static void input_tab(int *lastWasTab)
1071 qsort(matches, num_matches, sizeof(char *), match_compare); 1071 qsort(matches, num_matches, sizeof(char *), match_compare);
1072 1072
1073 /* find minimal match */ 1073 /* find minimal match */
1074 tmp = xstrdup(matches[0]); 1074 tmp = bb_xstrdup(matches[0]);
1075 for (tmp1 = tmp; *tmp1; tmp1++) 1075 for (tmp1 = tmp; *tmp1; tmp1++)
1076 for (len_found = 1; len_found < num_matches; len_found++) 1076 for (len_found = 1; len_found < num_matches; len_found++)
1077 if (matches[len_found][(tmp1 - tmp)] != *tmp1) { 1077 if (matches[len_found][(tmp1 - tmp)] != *tmp1) {
@@ -1132,7 +1132,7 @@ static void get_previous_history(void)
1132{ 1132{
1133 if(command_ps[0] != 0 || history[cur_history] == 0) { 1133 if(command_ps[0] != 0 || history[cur_history] == 0) {
1134 free(history[cur_history]); 1134 free(history[cur_history]);
1135 history[cur_history] = xstrdup(command_ps); 1135 history[cur_history] = bb_xstrdup(command_ps);
1136 } 1136 }
1137 cur_history--; 1137 cur_history--;
1138} 1138}
@@ -1166,12 +1166,11 @@ extern void load_history ( const char *fromfile )
1166 if (( fp = fopen ( fromfile, "r" ))) { 1166 if (( fp = fopen ( fromfile, "r" ))) {
1167 1167
1168 for ( hi = 0; hi < MAX_HISTORY; ) { 1168 for ( hi = 0; hi < MAX_HISTORY; ) {
1169 char * hl = get_line_from_file(fp); 1169 char * hl = bb_get_chomped_line_from_file(fp);
1170 int l; 1170 int l;
1171 1171
1172 if(!hl) 1172 if(!hl)
1173 break; 1173 break;
1174 chomp(hl);
1175 l = strlen(hl); 1174 l = strlen(hl);
1176 if(l >= BUFSIZ) 1175 if(l >= BUFSIZ)
1177 hl[BUFSIZ-1] = 0; 1176 hl[BUFSIZ-1] = 0;
@@ -1500,7 +1499,7 @@ rewrite_line:
1500 for(i = 0; i < (MAX_HISTORY-1); i++) 1499 for(i = 0; i < (MAX_HISTORY-1); i++)
1501 history[i] = history[i+1]; 1500 history[i] = history[i+1];
1502 } 1501 }
1503 history[i++] = xstrdup(command); 1502 history[i++] = bb_xstrdup(command);
1504 cur_history = i; 1503 cur_history = i;
1505 n_history = i; 1504 n_history = i;
1506#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT) 1505#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
@@ -1535,7 +1534,7 @@ rewrite_line:
1535 1534
1536#ifdef TEST 1535#ifdef TEST
1537 1536
1538const char *applet_name = "debug stuff usage"; 1537const char *bb_applet_name = "debug stuff usage";
1539const char *memory_exhausted = "Memory exhausted"; 1538const char *memory_exhausted = "Memory exhausted";
1540 1539
1541#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT 1540#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT