diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 32 | ||||
-rw-r--r-- | shell/cmdedit.c | 25 | ||||
-rw-r--r-- | shell/hush.c | 66 | ||||
-rw-r--r-- | shell/lash.c | 70 | ||||
-rw-r--r-- | shell/msh.c | 6 |
5 files changed, 99 insertions, 100 deletions
diff --git a/shell/ash.c b/shell/ash.c index 828a888..fb65c2d 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -1329,13 +1329,13 @@ static void setalias(char *name, char *val) if (!(ap->flag & ALIASINUSE)) { free(ap->val); } - ap->val = xstrdup(val); + ap->val = bb_xstrdup(val); ap->flag &= ~ALIASDEAD; } else { /* not found */ ap = xmalloc(sizeof(struct alias)); - ap->name = xstrdup(name); - ap->val = xstrdup(val); + ap->name = bb_xstrdup(name); + ap->val = bb_xstrdup(val); ap->flag = 0; ap->next = 0; *app = ap; @@ -1829,7 +1829,7 @@ static void setpwd(const char *val, int setold) if (!val) getpwd(); else - curdir = simplify_path(val); + curdir = bb_simplify_path(val); if (cated) free(cated); INTON; @@ -3285,7 +3285,7 @@ static void tryexec(char *cmd, char **argv, char **envp) char *name = cmd; #ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN - name = get_last_path_component(name); + name = bb_get_last_path_component(name); if(find_applet_by_name(name) != NULL) flg_bb = 1; #else @@ -7552,7 +7552,7 @@ static int dotcmd(int argc, char **argv) exitstatus = 0; for (sp = cmdenviron; sp; sp = sp->next) - setvareq(xstrdup(sp->text), VSTRFIXED | VTEXTFIXED); + setvareq(bb_xstrdup(sp->text), VSTRFIXED | VTEXTFIXED); if (argc >= 2) { /* That's what SVR2 does */ char *fullname; @@ -7950,7 +7950,7 @@ static int umaskcmd(int argc, char **argv) umask(mask); } else { mask = ~mask & 0777; - if (!parse_mode(ap, &mask)) { + if (!bb_parse_mode(ap, &mask)) { error("Illegal mode: %s", ap); } umask(~mask & 0777); @@ -8795,7 +8795,7 @@ static void setparam(char **argv) for (nparam = 0; argv[nparam]; nparam++); ap = newparam = xmalloc((nparam + 1) * sizeof *ap); while (*argv) { - *ap++ = xstrdup(*argv++); + *ap++ = bb_xstrdup(*argv++); } *ap = NULL; freeparam(&shellparam); @@ -11429,7 +11429,7 @@ static void opentrace() #else strcpy(s, "./trace"); #endif /* not_this_way */ - if ((tracefile = wfopen(s, "a")) == NULL) + if ((tracefile = bb_wfopen(s, "a")) == NULL) return; #ifdef O_APPEND if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0) @@ -11482,7 +11482,7 @@ static int trapcmd(int argc, char **argv) if (action[0] == '-' && action[1] == '\0') action = NULL; else - action = xstrdup(action); + action = bb_xstrdup(action); } free(trap[signo]); trap[signo] = action; @@ -11700,7 +11700,7 @@ static void initvar() vpp = hashvar(ip->text); vp->next = *vpp; *vpp = vp; - vp->text = xstrdup(ip->text); + vp->text = bb_xstrdup(ip->text); vp->flags = ip->flags; vp->func = ip->func; } @@ -11713,7 +11713,7 @@ static void initvar() vpp = hashvar("PS1=$ "); vps1.next = *vpp; *vpp = &vps1; - vps1.text = xstrdup(geteuid()? "PS1=$ " : "PS1=# "); + vps1.text = bb_xstrdup(geteuid()? "PS1=$ " : "PS1=# "); vps1.flags = VSTRFIXED | VTEXTFIXED; } #endif @@ -11833,7 +11833,7 @@ static void listsetvar(struct strlist *mylist) INTOFF; for (lp = mylist; lp; lp = lp->next) { - setvareq(xstrdup(lp->text), 0); + setvareq(bb_xstrdup(lp->text), 0); } INTON; } @@ -11996,7 +11996,7 @@ static void mklocal(char *name) vp = *findvar(vpp, name); if (vp == NULL) { if (strchr(name, '=')) - setvareq(xstrdup(name), VSTRFIXED); + setvareq(bb_xstrdup(name), VSTRFIXED); else setvar(name, NULL, VSTRFIXED); vp = *vpp; /* the new variable */ @@ -12007,7 +12007,7 @@ static void mklocal(char *name) lvp->flags = vp->flags; vp->flags |= VSTRFIXED | VTEXTFIXED; if (strchr(name, '=')) - setvareq(xstrdup(name), 0); + setvareq(bb_xstrdup(name), 0); } } lvp->vp = vp; @@ -12243,7 +12243,7 @@ int letcmd(int argc, char **argv) return 0; } snprintf(p, 12, "%ld", result); - setvar(argv[1], xstrdup(p), 0); + setvar(argv[1], bb_xstrdup(p), 0); } else if (argc >= 3) synerror("invalid operand"); return !result; diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 2ea6161..3cbdce0 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -330,7 +330,7 @@ static void parse_prompt(const char *prmt_ptr) char *pbuf; if (!pwd_buf) { - pwd_buf=(char *)unknown; + pwd_buf=(char *)bb_msg_unknown; } while (*prmt_ptr) { @@ -341,7 +341,7 @@ static void parse_prompt(const char *prmt_ptr) const char *cp = prmt_ptr; int l; - c = process_escape_sequence(&prmt_ptr); + c = bb_process_escape_sequence(&prmt_ptr); if(prmt_ptr==cp) { if (*cp == 0) break; @@ -430,7 +430,7 @@ static void parse_prompt(const char *prmt_ptr) if (flg_not_length == ']') sub_len++; } - if(pwd_buf!=(char *)unknown) + if(pwd_buf!=(char *)bb_msg_unknown) free(pwd_buf); cmdedit_prompt = prmt_mem_ptr; cmdedit_prmt_len = prmt_len - sub_len; @@ -520,8 +520,8 @@ static void cmdedit_init(void) my_euid = geteuid(); entry = getpwuid(my_euid); if (entry) { - user_buf = xstrdup(entry->pw_name); - home_pwd_buf = xstrdup(entry->pw_dir); + user_buf = bb_xstrdup(entry->pw_name); + home_pwd_buf = bb_xstrdup(entry->pw_dir); } #endif @@ -598,7 +598,7 @@ static char **username_tab_completion(char *ud, int *num_matches) /* Null usernames should result in all users as possible completions. */ if ( /*!userlen || */ !strncmp(ud, entry->pw_name, userlen)) { - bb_asprintf(&temp, "~%s/", entry->pw_name); + bb_xasprintf(&temp, "~%s/", entry->pw_name); matches = xrealloc(matches, (nm + 1) * sizeof(char *)); matches[nm++] = temp; @@ -647,7 +647,7 @@ static int path_parse(char ***p, int flags) *p = xmalloc(npth * sizeof(char *)); tmp = pth; - (*p)[0] = xstrdup(tmp); + (*p)[0] = bb_xstrdup(tmp); npth = 1; /* count words is + 1 count ':' */ for (;;) { @@ -1071,7 +1071,7 @@ static void input_tab(int *lastWasTab) qsort(matches, num_matches, sizeof(char *), match_compare); /* find minimal match */ - tmp = xstrdup(matches[0]); + tmp = bb_xstrdup(matches[0]); for (tmp1 = tmp; *tmp1; tmp1++) for (len_found = 1; len_found < num_matches; len_found++) if (matches[len_found][(tmp1 - tmp)] != *tmp1) { @@ -1132,7 +1132,7 @@ static void get_previous_history(void) { if(command_ps[0] != 0 || history[cur_history] == 0) { free(history[cur_history]); - history[cur_history] = xstrdup(command_ps); + history[cur_history] = bb_xstrdup(command_ps); } cur_history--; } @@ -1166,12 +1166,11 @@ extern void load_history ( const char *fromfile ) if (( fp = fopen ( fromfile, "r" ))) { for ( hi = 0; hi < MAX_HISTORY; ) { - char * hl = get_line_from_file(fp); + char * hl = bb_get_chomped_line_from_file(fp); int l; if(!hl) break; - chomp(hl); l = strlen(hl); if(l >= BUFSIZ) hl[BUFSIZ-1] = 0; @@ -1500,7 +1499,7 @@ rewrite_line: for(i = 0; i < (MAX_HISTORY-1); i++) history[i] = history[i+1]; } - history[i++] = xstrdup(command); + history[i++] = bb_xstrdup(command); cur_history = i; n_history = i; #if defined(CONFIG_FEATURE_SH_FANCY_PROMPT) @@ -1535,7 +1534,7 @@ rewrite_line: #ifdef TEST -const char *applet_name = "debug stuff usage"; +const char *bb_applet_name = "debug stuff usage"; const char *memory_exhausted = "Memory exhausted"; #ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT diff --git a/shell/hush.c b/shell/hush.c index e20bf7a..94b29c0 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -110,7 +110,7 @@ #include "busybox.h" #include "cmdedit.h" #else -#define applet_name "hush" +#define bb_applet_name "hush" #include "standalone.h" #define hush_main main #undef CONFIG_FEATURE_SH_FANCY_PROMPT @@ -320,7 +320,7 @@ static inline void debug_printf(const char *format, ...) { } #define final_printf debug_printf static void __syntax(char *file, int line) { - error_msg("syntax error %s:%d", file, line); + bb_error_msg("syntax error %s:%d", file, line); } #define syntax() __syntax(__FILE__, __LINE__) @@ -441,11 +441,11 @@ static struct built_in_command bltins[] = { static const char *set_cwd(void) { - if(cwd==unknown) + if(cwd==bb_msg_unknown) cwd = NULL; /* xgetcwd(arg) called free(arg) */ cwd = xgetcwd((char *)cwd); if (!cwd) - cwd = unknown; + cwd = bb_msg_unknown; return cwd; } @@ -548,7 +548,7 @@ static int builtin_export(struct child_prog *child) } } if (res<0) - perror_msg("export"); + bb_perror_msg("export"); else if(res==0) res = set_local_var(name, 1); else @@ -573,12 +573,12 @@ static int builtin_fg_bg(struct child_prog *child) } } if (!pi) { - error_msg("%s: no current job", child->argv[0]); + bb_error_msg("%s: no current job", child->argv[0]); return EXIT_FAILURE; } } else { if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) { - error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); + bb_error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); return EXIT_FAILURE; } for (pi = job_list; pi; pi = pi->next) { @@ -587,7 +587,7 @@ static int builtin_fg_bg(struct child_prog *child) } } if (!pi) { - error_msg("%s: %d: no such job", child->argv[0], jobnum); + bb_error_msg("%s: %d: no such job", child->argv[0], jobnum); return EXIT_FAILURE; } } @@ -605,7 +605,7 @@ static int builtin_fg_bg(struct child_prog *child) if (i == ESRCH) { remove_bg_job(pi); } else { - perror_msg("kill (SIGCONT)"); + bb_perror_msg("kill (SIGCONT)"); } } @@ -728,7 +728,7 @@ static int builtin_source(struct child_prog *child) /* XXX search through $PATH is missing */ input = fopen(child->argv[1], "r"); if (!input) { - error_msg("Couldn't open file '%s'", child->argv[1]); + bb_error_msg("Couldn't open file '%s'", child->argv[1]); return EXIT_FAILURE; } @@ -996,7 +996,7 @@ static void mark_closed(int fd) { struct close_me *tmp; if (close_me_head == NULL || close_me_head->fd != fd) - error_msg_and_die("corrupt close_me"); + bb_error_msg_and_die("corrupt close_me"); tmp = close_me_head; close_me_head = close_me_head->next; free(tmp); @@ -1029,7 +1029,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[]) if (openfd < 0) { /* this could get lost if stderr has been redirected, but bash and ash both lose it as well (though zsh doesn't!) */ - perror_msg("error opening %s", redir->word.gl_pathv[0]); + bb_perror_msg("error opening %s", redir->word.gl_pathv[0]); return 1; } } else { @@ -1125,14 +1125,14 @@ static void pseudo_exec(struct child_prog *child) #ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN /* Following discussions from November 2000 on the busybox mailing * list, the default configuration, (without - * get_last_path_component()) lets the user force use of an + * bb_get_last_path_component()) lets the user force use of an * external command by specifying the full (with slashes) filename. * If you enable CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN, then applets * _aways_ override external commands, so if you want to run * /bin/cat, it will use BusyBox cat even if /bin/cat exists on the * filesystem and is _not_ busybox. Some systems may want this, * most do not. */ - name = get_last_path_component(name); + name = bb_get_last_path_component(name); #endif /* Count argc for use in a second... */ for(argc_l=0;*argv_l!=NULL; argv_l++, argc_l++); @@ -1143,7 +1143,7 @@ static void pseudo_exec(struct child_prog *child) #endif debug_printf("exec of %s\n",child->argv[0]); execvp(child->argv[0],child->argv); - perror_msg("couldn't exec: %s",child->argv[0]); + bb_perror_msg("couldn't exec: %s",child->argv[0]); _exit(1); } else if (child->group) { debug_printf("runtime nesting to group\n"); @@ -1292,11 +1292,11 @@ static int checkjobs(struct pipe* fg_pipe) } if (childpid == -1 && errno != ECHILD) - perror_msg("waitpid"); + bb_perror_msg("waitpid"); /* move the shell to the foreground */ //if (interactive && tcsetpgrp(shell_terminal, getpgid(0))) - // perror_msg("tcsetpgrp-2"); + // bb_perror_msg("tcsetpgrp-2"); return -1; } @@ -1381,7 +1381,7 @@ static int run_pipe_real(struct pipe *pi) * variable. */ int export_me=0; char *name, *value; - name = xstrdup(child->argv[i]); + name = bb_xstrdup(child->argv[i]); debug_printf("Local environment set: %s\n", name); value = strchr(name, '='); if (value) @@ -1441,7 +1441,7 @@ static int run_pipe_real(struct pipe *pi) /* pipes are inserted between pairs of commands */ if ((i + 1) < pi->num_progs) { - if (pipe(pipefds)<0) perror_msg_and_die("pipe"); + if (pipe(pipefds)<0) bb_perror_msg_and_die("pipe"); nextout = pipefds[1]; } else { nextout=1; @@ -1626,11 +1626,11 @@ static int run_list_real(struct pipe *pi) if (interactive) { /* move the new process group into the foreground */ if (tcsetpgrp(shell_terminal, pi->pgrp) && errno != ENOTTY) - perror_msg("tcsetpgrp-3"); + bb_perror_msg("tcsetpgrp-3"); rcode = checkjobs(pi); /* move the shell to the foreground */ if (tcsetpgrp(shell_terminal, getpgid(0)) && errno != ENOTTY) - perror_msg("tcsetpgrp-4"); + bb_perror_msg("tcsetpgrp-4"); } else { rcode = checkjobs(pi); } @@ -1825,9 +1825,9 @@ static int xglob(o_string *dest, int flags, glob_t *pglob) debug_printf("globhack returned %d\n",gr); } if (gr == GLOB_NOSPACE) - error_msg_and_die("out of memory during glob"); + bb_error_msg_and_die("out of memory during glob"); if (gr != 0) { /* GLOB_ABORTED ? */ - error_msg("glob(3) error %d",gr); + bb_error_msg("glob(3) error %d",gr); } /* globprint(glob_target); */ return gr; @@ -1881,7 +1881,7 @@ static int set_local_var(const char *s, int flg_export) result++; } else { if(cur->flg_read_only) { - error_msg("%s: readonly variable", name); + bb_error_msg("%s: readonly variable", name); result = -1; } else { if(flg_export>0 || cur->flg_export>1) @@ -1935,7 +1935,7 @@ static void unset_local_var(const char *name) if(cur!=0) { struct variables *next = top_vars; if(cur->flg_read_only) { - error_msg("%s: readonly variable", name); + bb_error_msg("%s: readonly variable", name); return; } else { if(cur->flg_export) @@ -2139,7 +2139,7 @@ static int done_word(o_string *dest, struct p_context *ctx) if (ctx->pending_redirect) { ctx->pending_redirect=NULL; if (glob_target->gl_pathc != 1) { - error_msg("ambiguous redirect"); + bb_error_msg("ambiguous redirect"); return 1; } } else { @@ -2231,7 +2231,7 @@ static int redirect_dup_num(struct in_str *input) } if (ok) return d; - error_msg("ambiguous redirect"); + bb_error_msg("ambiguous redirect"); return -2; } @@ -2267,14 +2267,14 @@ FILE *generate_stream_from_list(struct pipe *head) FILE *pf; #if 1 int pid, channel[2]; - if (pipe(channel)<0) perror_msg_and_die("pipe"); + if (pipe(channel)<0) bb_perror_msg_and_die("pipe"); #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) pid=fork(); #else pid=vfork(); #endif if (pid<0) { - perror_msg_and_die("fork"); + bb_perror_msg_and_die("fork"); } else if (pid==0) { close(channel[0]); if (channel[1] != 1) { @@ -2450,7 +2450,7 @@ static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *i case '-': case '_': /* still unhandled, but should be eventually */ - error_msg("unhandled syntax: $%c",ch); + bb_error_msg("unhandled syntax: $%c",ch); return 1; break; default: @@ -2811,7 +2811,7 @@ int hush_main(int argc, char **argv) " or: sh -c command [args]...\n\n"); exit(EXIT_FAILURE); #else - show_usage(); + bb_show_usage(); #endif } } @@ -2845,12 +2845,12 @@ int hush_main(int argc, char **argv) debug_printf("\nrunning script '%s'\n", argv[optind]); global_argv = argv+optind; global_argc = argc-optind; - input = xfopen(argv[optind], "r"); + input = bb_xfopen(argv[optind], "r"); opt = parse_file_outer(input); #ifdef CONFIG_FEATURE_CLEAN_UP fclose(input); - if (cwd && cwd != unknown) + if (cwd && cwd != bb_msg_unknown) free((char*)cwd); { struct variables *cur, *tmp; diff --git a/shell/lash.c b/shell/lash.c index 3592989..8f864b3 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -246,7 +246,7 @@ static int builtin_cd(struct child_prog *child) } cwd = xgetcwd((char *)cwd); if (!cwd) - cwd = unknown; + cwd = bb_msg_unknown; return EXIT_SUCCESS; } @@ -284,12 +284,12 @@ static int builtin_fg_bg(struct child_prog *child) } } if (!job) { - error_msg("%s: no current job", child->argv[0]); + bb_error_msg("%s: no current job", child->argv[0]); return EXIT_FAILURE; } } else { if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) { - error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); + bb_error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); return EXIT_FAILURE; } for (job = child->family->job_list->head; job; job = job->next) { @@ -298,7 +298,7 @@ static int builtin_fg_bg(struct child_prog *child) } } if (!job) { - error_msg("%s: %d: no such job", child->argv[0], jobnum); + bb_error_msg("%s: %d: no such job", child->argv[0], jobnum); return EXIT_FAILURE; } } @@ -320,7 +320,7 @@ static int builtin_fg_bg(struct child_prog *child) if (i == ESRCH) { remove_job(&job_list, job); } else { - perror_msg("kill (SIGCONT)"); + bb_perror_msg("kill (SIGCONT)"); } } @@ -371,7 +371,7 @@ static int builtin_pwd(struct child_prog *dummy) { cwd = xgetcwd((char *)cwd); if (!cwd) - cwd = unknown; + cwd = bb_msg_unknown; puts(cwd); return EXIT_SUCCESS; } @@ -489,7 +489,7 @@ static void mark_closed(int fd) { struct close_me *tmp; if (close_me_head == NULL || close_me_head->fd != fd) - error_msg_and_die("corrupt close_me"); + bb_error_msg_and_die("corrupt close_me"); tmp = close_me_head; close_me_head = close_me_head->next; free(tmp); @@ -599,7 +599,7 @@ static void checkjobs(struct jobset *j_list) } if (childpid == -1 && errno != ECHILD) - perror_msg("waitpid"); + bb_perror_msg("waitpid"); } /* squirrel != NULL means we squirrel away copies of stdin, stdout, @@ -628,7 +628,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[]) if (openfd < 0) { /* this could get lost if stderr has been redirected, but bash and ash both lose it as well (though zsh doesn't!) */ - perror_msg("error opening %s", redir->filename); + bb_perror_msg("error opening %s", redir->filename); return 1; } @@ -803,7 +803,7 @@ static int expand_arguments(char *command) while( command && command[ix]) { if (command[ix] == '\\') { const char *tmp = command+ix+1; - command[ix] = process_escape_sequence( &tmp ); + command[ix] = bb_process_escape_sequence( &tmp ); memmove(command+ix + 1, tmp, strlen(tmp)+1); } ix++; @@ -816,7 +816,7 @@ static int expand_arguments(char *command) /* We need a clean copy, so strsep can mess up the copy while * we write stuff into the original (in a minute) */ - cmd = cmd_copy = xstrdup(command); + cmd = cmd_copy = bb_xstrdup(command); *command = '\0'; for (ix = 0, tmpcmd = cmd; (tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) { @@ -829,13 +829,13 @@ static int expand_arguments(char *command) if (retval == GLOB_NOSPACE) { /* Mem may have been allocated... */ globfree (&expand_result); - error_msg(out_of_space); + bb_error_msg(out_of_space); return FALSE; } else if (retval != 0) { /* Some other error. GLOB_NOMATCH shouldn't * happen because of the GLOB_NOCHECK flag in * the glob call. */ - error_msg("syntax error"); + bb_error_msg("syntax error"); return FALSE; } else { /* Convert from char** (one word per string) to a simple char*, @@ -843,7 +843,7 @@ static int expand_arguments(char *command) for (i=0; i < expand_result.gl_pathc; i++) { length=strlen(expand_result.gl_pathv[i]); if (total_length+length+1 >= BUFSIZ) { - error_msg(out_of_space); + bb_error_msg(out_of_space); return FALSE; } strcat(command+total_length, " "); @@ -930,7 +930,7 @@ static int expand_arguments(char *command) int subst_len = strlen(var); int trail_len = strlen(src); if (dst+subst_len+trail_len >= command+BUFSIZ) { - error_msg(out_of_space); + bb_error_msg(out_of_space); return FALSE; } /* Move stuff to the end of the string to accommodate @@ -1006,7 +1006,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*src == '\\') { src++; if (!*src) { - error_msg("character expected after \\"); + bb_error_msg("character expected after \\"); free_job(job); return 1; } @@ -1090,7 +1090,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) chptr++; if (!*chptr) { - error_msg("file name expected after %c", *(src-1)); + bb_error_msg("file name expected after %c", *(src-1)); free_job(job); job->num_progs=0; return 1; @@ -1109,7 +1109,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*prog->argv[argc_l] || saw_quote) argc_l++; if (!argc_l) { - error_msg("empty command in pipe"); + bb_error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1136,7 +1136,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) src++; if (!*src) { - error_msg("empty command in pipe"); + bb_error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1155,7 +1155,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) case '\\': src++; if (!*src) { - error_msg("character expected after \\"); + bb_error_msg("character expected after \\"); free_job(job); return 1; } @@ -1217,7 +1217,7 @@ static int pseudo_exec(struct child_prog *child) /* Check if the command matches any of the forking builtins. */ for (x = bltins_forking; x->cmd; x++) { if (strcmp(child->argv[0], x->cmd) == 0) { - applet_name=x->cmd; + bb_applet_name=x->cmd; _exit (x->function(child)); } } @@ -1225,7 +1225,7 @@ static int pseudo_exec(struct child_prog *child) /* Check if the command matches any busybox internal * commands ("applets") here. Following discussions from * November 2000 on busybox@busybox.net, don't use - * get_last_path_component(). This way explicit (with + * bb_get_last_path_component(). This way explicit (with * slashes) filenames will never be interpreted as an * applet, just like with builtins. This way the user can * override an applet with an explicit filename reference. @@ -1241,7 +1241,7 @@ static int pseudo_exec(struct child_prog *child) * /bin/cat exists on the filesystem and is _not_ busybox. * Some systems want this, others do not. Choose wisely. :-) */ - name = get_last_path_component(name); + name = bb_get_last_path_component(name); #endif { @@ -1255,7 +1255,7 @@ static int pseudo_exec(struct child_prog *child) execvp(child->argv[0], child->argv); - /* Do not use perror_msg_and_die() here, since we must not + /* Do not use bb_perror_msg_and_die() here, since we must not * call exit() but should call _exit() instead */ fprintf(stderr, "%s: %m\n", child->argv[0]); _exit(EXIT_FAILURE); @@ -1299,7 +1299,7 @@ static void insert_job(struct job *newjob, int inbg) /* move the new process group into the foreground */ /* suppress messages when run from /linuxrc mag@sysgo.de */ if (tcsetpgrp(shell_terminal, newjob->pgrp) && errno != ENOTTY) - perror_msg("tcsetpgrp"); + bb_perror_msg("tcsetpgrp"); } } @@ -1317,7 +1317,7 @@ static int run_command(struct job *newjob, int inbg, int outpipe[2]) child = & (newjob->progs[i]); if ((i + 1) < newjob->num_progs) { - if (pipe(pipefds)<0) perror_msg_and_die("pipe"); + if (pipe(pipefds)<0) bb_perror_msg_and_die("pipe"); nextout = pipefds[1]; } else { if (outpipe[1]!=-1) { @@ -1464,7 +1464,7 @@ static int busy_loop(FILE * input) if (waitpid(job_list.fg->progs[i].pid, &status, WUNTRACED)<0) { if (errno != ECHILD) { - perror_msg_and_die("waitpid(%d)",job_list.fg->progs[i].pid); + bb_perror_msg_and_die("waitpid(%d)",job_list.fg->progs[i].pid); } } @@ -1496,7 +1496,7 @@ static int busy_loop(FILE * input) /* move the shell to the foreground */ /* suppress messages when run from /linuxrc mag@sysgo.de */ if (tcsetpgrp(shell_terminal, getpgrp()) && errno != ENOTTY) - perror_msg("tcsetpgrp"); + bb_perror_msg("tcsetpgrp"); } } } @@ -1504,7 +1504,7 @@ static int busy_loop(FILE * input) /* return controlling TTY back to parent process group before exiting */ if (tcsetpgrp(shell_terminal, parent_pgrp) && errno != ENOTTY) - perror_msg("tcsetpgrp"); + bb_perror_msg("tcsetpgrp"); /* return exit status if called with "-c" */ if (input == NULL && WIFEXITED(status)) @@ -1517,7 +1517,7 @@ static int busy_loop(FILE * input) #ifdef CONFIG_FEATURE_CLEAN_UP void free_memory(void) { - if (cwd && cwd!=unknown) { + if (cwd && cwd!=bb_msg_unknown) { free((char*)cwd); } if (local_pending_command) @@ -1594,8 +1594,8 @@ int lash_main(int argc_l, char **argv_l) case 'c': input = NULL; if (local_pending_command != 0) - error_msg_and_die("multiple -c arguments"); - local_pending_command = xstrdup(argv[optind]); + bb_error_msg_and_die("multiple -c arguments"); + local_pending_command = bb_xstrdup(argv[optind]); optind++; argv = argv+optind; break; @@ -1603,7 +1603,7 @@ int lash_main(int argc_l, char **argv_l) interactive = TRUE; break; default: - show_usage(); + bb_show_usage(); } } /* A shell is interactive if the `-i' flag was given, or if all of @@ -1627,14 +1627,14 @@ int lash_main(int argc_l, char **argv_l) #endif } else if (local_pending_command==NULL) { //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); - input = xfopen(argv[optind], "r"); + input = bb_xfopen(argv[optind], "r"); mark_open(fileno(input)); /* be lazy, never mark this closed */ } /* initialize the cwd -- this is never freed...*/ cwd = xgetcwd(0); if (!cwd) - cwd = unknown; + cwd = bb_msg_unknown; #ifdef CONFIG_FEATURE_CLEAN_UP atexit(free_memory); diff --git a/shell/msh.c b/shell/msh.c index 53f643d..aad6bbf 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -2838,7 +2838,7 @@ char *c, **v, **envp; #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL char *name = c; #ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN - name = get_last_path_component(name); + name = bb_get_last_path_component(name); #endif optind = 1; if (find_applet_by_name(name)) { @@ -2876,7 +2876,7 @@ char *c, **v, **envp; return("no Shell"); case ENOMEM: - return((char*)memory_exhausted); + return((char*)bb_msg_memory_exhausted); case E2BIG: return("argument list too long"); @@ -3883,7 +3883,7 @@ int quoted; ; if (i < 0) { closepipe(pf); - err((char*)memory_exhausted); + err((char*)bb_msg_memory_exhausted); return(0); } if (i != 0) { |