diff options
author | Mike Frysinger | 2006-08-24 03:06:55 +0000 |
---|---|---|
committer | Mike Frysinger | 2006-08-24 03:06:55 +0000 |
commit | f23b96cebfe169eee7131efd8b879748587d1845 (patch) | |
tree | a4a0caf443011bdfed1e103871066ea8fb90faf3 /shell | |
parent | f86a5ba510ef62ab46d14bd0761a1d88289a398d (diff) | |
download | busybox-1_2_1.zip busybox-1_2_1.tar.gz |
tag busybox-1.2.11_2_1
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 44 | ||||
-rw-r--r-- | shell/lash.c | 41 |
2 files changed, 71 insertions, 14 deletions
diff --git a/shell/ash.c b/shell/ash.c index 5031ae1..6011448 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2035,6 +2035,7 @@ static void onsig(int); static int dotrap(void); static void setinteractive(int); static void exitshell(void) ATTRIBUTE_NORETURN; +static int decode_signal(const char *, int); /* * This routine is called when an error or an interrupt occurs in an @@ -2546,6 +2547,11 @@ onint(void) { int i; intpending = 0; +#if 0 + /* comment by vodz: its strange for me, this programm don`t use other + signal block */ + sigsetmask(0); +#endif i = EXSIG; if (gotsig[SIGINT - 1] && !trap[SIGINT]) { if (!(rootshell && iflag)) { @@ -3322,7 +3328,7 @@ evalcommand(union node *cmd, int flags) } sp = arglist.list; } - full_write(preverrout_fd, "\n", 1); + bb_full_write(preverrout_fd, "\n", 1); } cmd_is_exec = 0; @@ -4559,7 +4565,7 @@ expandhere(union node *arg, int fd) { herefd = fd; expandarg(arg, (struct arglist *)NULL, 0); - full_write(fd, stackblock(), expdest - (char *)stackblock()); + bb_full_write(fd, stackblock(), expdest - (char *)stackblock()); } @@ -6547,7 +6553,7 @@ usage: } if (**++argv == '-') { - signo = get_signum(*argv + 1); + signo = decode_signal(*argv + 1, 1); if (signo < 0) { int c; @@ -6561,7 +6567,7 @@ usage: list = 1; break; case 's': - signo = get_signum(optionarg); + signo = decode_signal(optionarg, 1); if (signo < 0) { sh_error( "invalid signal number or name: %s", @@ -6587,14 +6593,14 @@ usage: if (!*argv) { for (i = 1; i < NSIG; i++) { - name = get_signame(i); - if (isdigit(*name)) + name = u_signal_names(0, &i, 1); + if (name) out1fmt(snlfmt, name); } return 0; } - name = get_signame(signo); - if (isdigit(*name)) + name = u_signal_names(*argptr, &signo, -1); + if (name) out1fmt(snlfmt, name); else sh_error("invalid signal number or exit status: %s", *argptr); @@ -8378,7 +8384,7 @@ growstackstr(void) { size_t len = stackblocksize(); if (herefd >= 0 && len >= 1024) { - full_write(herefd, stackblock(), len); + bb_full_write(herefd, stackblock(), len); return stackblock(); } growstackblock(); @@ -10973,7 +10979,7 @@ openhere(union node *redir) if (redir->type == NHERE) { len = strlen(redir->nhere.doc->narg.text); if (len <= PIPESIZE) { - full_write(pip[1], redir->nhere.doc->narg.text, len); + bb_full_write(pip[1], redir->nhere.doc->narg.text, len); goto out; } } @@ -10987,7 +10993,7 @@ openhere(union node *redir) #endif signal(SIGPIPE, SIG_DFL); if (redir->type == NHERE) - full_write(pip[1], redir->nhere.doc->narg.text, len); + bb_full_write(pip[1], redir->nhere.doc->narg.text, len); else expandhere(redir->nhere.doc, pip[1]); _exit(0); @@ -11616,7 +11622,9 @@ trapcmd(int argc, char **argv) if (trap[signo] != NULL) { const char *sn; - sn = get_signame(signo); + sn = u_signal_names(0, &signo, 0); + if (sn == NULL) + sn = "???"; out1fmt("trap -- %s %s\n", single_quote(trap[signo]), sn); } @@ -11628,7 +11636,7 @@ trapcmd(int argc, char **argv) else action = *ap++; while (*ap) { - if ((signo = get_signum(*ap)) < 0) + if ((signo = decode_signal(*ap, 0)) < 0) sh_error("%s: bad trap", *ap); INTOFF; if (action) { @@ -11931,6 +11939,14 @@ out: /* NOTREACHED */ } +static int decode_signal(const char *string, int minsig) +{ + int signo; + const char *name = u_signal_names(string, &signo, minsig); + + return name ? signo : -1; +} + /* var.c */ static struct var *vartab[VTABSIZE]; @@ -13457,7 +13473,7 @@ static const char op_tokens[] = { static arith_t arith (const char *expr, int *perrcode) { - char arithval; /* Current character under analysis */ + register char arithval; /* Current character under analysis */ operator lasttok, op; operator prec; diff --git a/shell/lash.c b/shell/lash.c index 92c24d1..be2f364 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -22,7 +22,18 @@ #include "busybox.h" +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <signal.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/wait.h> +#include <unistd.h> #include <getopt.h> +#include <termios.h> #include "cmdedit.h" #ifdef CONFIG_LOCALE_SUPPORT @@ -532,6 +543,16 @@ static void checkjobs(struct jobset *j_list) /* child stopped */ job->stopped_progs++; job->progs[prognum].is_stopped = 1; + +#if 0 + /* Printing this stuff is a pain, since it tends to + * overwrite the prompt an inconveinient moments. So + * don't do that. */ + if (job->stopped_progs == job->num_progs) { + printf(JOB_STATUS_FORMAT, job->jobid, "Stopped", + job->text); + } +#endif } } @@ -686,6 +707,26 @@ static int get_command(FILE * source, char *command) return 0; } +static char* itoa(register int i) +{ + static char a[7]; /* Max 7 ints */ + register char *b = a + sizeof(a) - 1; + int sign = (i < 0); + + if (sign) + i = -i; + *b = 0; + do + { + *--b = '0' + (i % 10); + i /= 10; + } + while (i); + if (sign) + *--b = '-'; + return b; +} + static char * strsep_space( char *string, int * ix) { char *token; |