X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=shell%2Fmsh.c;h=dffacf02adac12befb6f19d093b60b185f532ce5;hb=e19e1935a33b117e2ee6daf9b2d79c00603333c7;hp=eb17eb6689e58de985fcecc988d65a1cc387182d;hpb=7ae1cc16b4ecec930cd776f9ed688b6d4d53a166;p=oweals%2Fbusybox.git diff --git a/shell/msh.c b/shell/msh.c index eb17eb668..dffacf02a 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -12,7 +12,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ - #include #include @@ -35,7 +34,6 @@ # include # define bb_dev_null "/dev/null" # define DEFAULT_SHELL "/proc/self/exe" -# define CONFIG_BUSYBOX_EXEC_PATH "/proc/self/exe" # define bb_banner "busybox standalone" # define ENABLE_FEATURE_SH_STANDALONE 0 # define bb_msg_memory_exhausted "memory exhausted" @@ -743,7 +741,7 @@ static void print_tree(struct op *head) static void prs(const char *s) { if (*s) - write(STDERR_FILENO, s, strlen(s)); + xwrite_str(STDERR_FILENO, s); } static void prn(unsigned u) @@ -1268,7 +1266,7 @@ static int newfile(char *s) f = open(s, O_RDONLY); if (f < 0) { prs(s); - err(": cannot open"); + err(": can't open"); return 1; } } @@ -2770,7 +2768,7 @@ static int forkexec(struct op *t, int *pin, int *pout, int no_fork, char **wp) DBGPRINTF3(("FORKEXEC: calling vfork()...\n")); newpid = vfork(); if (newpid == -1) { - DBGPRINTF(("FORKEXEC: ERROR, cannot vfork()!\n")); + DBGPRINTF(("FORKEXEC: ERROR, can't vfork()!\n")); return -1; } @@ -2820,7 +2818,7 @@ static int forkexec(struct op *t, int *pin, int *pout, int no_fork, char **wp) if (iopp) { if (bltin && bltin != doexec) { prs(bltin_name); - err(": cannot redirect shell command"); + err(": can't redirect shell command"); if (forked) _exit(-1); return -1; @@ -2840,7 +2838,7 @@ static int forkexec(struct op *t, int *pin, int *pout, int no_fork, char **wp) /* Builtin in pipe: disallowed */ /* TODO: allow "exec"? */ prs(bltin_name); - err(": cannot run builtin as part of pipe"); + err(": can't run builtin as part of pipe"); if (forked) _exit(-1); return -1; @@ -2955,7 +2953,7 @@ static int iosetup(struct ioword *iop, int pipein, int pipeout) if (u < 0) { prs(cp); - prs(": cannot "); + prs(": can't "); warn(msg); return 1; } @@ -3110,7 +3108,7 @@ static const char *rexecve(char *c, char **v, char **envp) return "not found"; } exstat = 126; /* mimic bash */ - return "cannot execute"; + return "can't execute"; } /* @@ -3176,8 +3174,9 @@ static int dohelp(struct op *t UNUSED_PARAM, char **args UNUSED_PARAM) int col; const struct builtincmd *x; - puts("\nBuilt-in commands:\n" - "-------------------"); + printf("\n" + "Built-in commands:\n" + "------------------\n"); col = 0; x = builtincmds; @@ -3600,7 +3599,7 @@ static int doset(struct op *t UNUSED_PARAM, char **args) cp = args[1]; if (cp == NULL) { for (vp = vlist; vp; vp = vp->next) - varput(vp->name, 1); + varput(vp->name, STDOUT_FILENO); return 0; } if (*cp == '-') { @@ -3639,8 +3638,8 @@ static int doset(struct op *t UNUSED_PARAM, char **args) static void varput(char *s, int out) { if (isalnum(*s) || *s == '_') { - write(out, s, strlen(s)); - write(out, "\n", 1); + xwrite_str(out, s); + xwrite(out, "\n", 1); } } @@ -3996,7 +3995,7 @@ static int dollar(int quoted) switch (c) { case '=': if (isdigit(*s)) { - err("cannot use ${...=...} with $n"); + err("can't use ${...=...} with $n"); gflg = 1; break; }