aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c210
-rw-r--r--shell/config.in13
2 files changed, 98 insertions, 125 deletions
diff --git a/shell/ash.c b/shell/ash.c
index d1bef2a27..a4c415643 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -33,46 +33,6 @@
*/
-/* These defines allow you to adjust the feature set to be compiled
- * into the ash shell. As a rule, enabling these options will make
- * ash get bigger... With all of these options off, ash adds about
- * 60k to busybox on an x86 system.*/
-
-
-/* Enable job control. This allows you to run jobs in the background,
- * which is great when ash is being used as an interactive shell, but
- * it completely useless for is all you are doing is running scripts.
- * This adds about 2.5k on an x86 system. */
-#undef JOBS
-
-/* This enables alias support in ash. If you want to support things
- * like "alias ls='ls -l'" with ash, enable this. This is only useful
- * when ash is used as an intractive shell. This adds about 1.5k */
-#define ASH_ALIAS
-
-/* If you need ash to act as a full Posix shell, with full math
- * support, enable this. This adds a bit over 2k an x86 system. */
-//#undef ASH_MATH_SUPPORT
-#define ASH_MATH_SUPPORT
-
-/* Getopts is used by shell procedures to parse positional parameters.
- * You probably want to leave this disabled, and use the busybox getopt
- * applet if you want to do this sort of thing. There are some scripts
- * out there that use it, so it you need it, enable. Most people will
- * leave this disabled. This adds 1k on an x86 system. */
-#undef ASH_GETOPTS
-
-/* This allows you to override shell builtins and use whatever is on
- * the filesystem. This is most useful when ash is acting as a
- * standalone shell. Adds about 272 bytes. */
-#undef ASH_CMDCMD
-
-/* Check for new mail on interactive shells? */
-#undef ASH_MAIL
-
-/* Optimize size vs speed as size */
-#define ASH_OPTIMIZE_FOR_SIZE
-
/* Enable this to compile in extra debugging noise. When debugging is
* on, debugging info will be written to $HOME/trace and a quit signal
* will generate a core dump. */
@@ -118,7 +78,7 @@
#include <glob.h>
#endif
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
#include <termios.h>
#endif
@@ -281,7 +241,7 @@ static volatile int suppressint;
static volatile int intpending;
#define INTOFF suppressint++
-#ifndef ASH_OPTIMIZE_FOR_SIZE
+#ifndef CONFIG_ASH_OPTIMIZE_FOR_SIZE
#define INTON { if (--suppressint == 0 && intpending) onint(); }
#define FORCEINTON {suppressint = 0; if (intpending) onint();}
#else
@@ -608,7 +568,7 @@ struct strpush {
struct strpush *prev; /* preceding string on stack */
char *prevstring;
int prevnleft;
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
struct alias *ap; /* if push was associated with an alias */
#endif
char *string; /* remember the string since it may change */
@@ -685,14 +645,14 @@ static inline void outstr (const char *p, FILE *file) { fputs(p, file); }
static void out1str(const char *p) { outstr(p, stdout); }
static void out2str(const char *p) { outstr(p, stderr); }
-#ifndef ASH_OPTIMIZE_FOR_SIZE
+#ifndef CONFIG_ASH_OPTIMIZE_FOR_SIZE
#define out2c(c) putc((c), stderr)
#else
static void out2c(int c) { putc(c, stderr); }
#endif
-#ifdef ASH_OPTIMIZE_FOR_SIZE
+#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE
#define USE_SIT_FUNCTION
#endif
@@ -1313,7 +1273,7 @@ static char *optptr; /* used by nextopt */
static char *minusc; /* argument to -c option */
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
#define ALIASINUSE 1
#define ALIASDEAD 2
@@ -1507,7 +1467,7 @@ __lookupalias(const char *name)
}
#endif
-#ifdef ASH_MATH_SUPPORT
+#ifdef CONFIG_ASH_MATH_SUPPORT
/* The generated file arith.c has been replaced with a custom hand
* written implementation written by Aaron Lehmann <aaronl@vitelus.com>.
* This is now part of libbb, so that it can be used by all the shells
@@ -1524,7 +1484,7 @@ static int pendingsigs; /* indicates some signal received */
* This file was generated by the mkbuiltins program.
*/
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
static int bgcmd (int, char **);
static int fgcmd (int, char **);
static int killcmd (int, char **);
@@ -1532,7 +1492,7 @@ static int killcmd (int, char **);
static int bltincmd (int, char **);
static int cdcmd (int, char **);
static int breakcmd (int, char **);
-#ifdef ASH_CMDCMD
+#ifdef CONFIG_ASH_CMDCMD
static int commandcmd (int, char **);
#endif
static int dotcmd (int, char **);
@@ -1553,7 +1513,7 @@ static int setvarcmd (int, char **);
static int shiftcmd (int, char **);
static int trapcmd (int, char **);
static int umaskcmd (int, char **);
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
static int aliascmd (int, char **);
static int unaliascmd (int, char **);
#endif
@@ -1561,11 +1521,11 @@ static int unsetcmd (int, char **);
static int waitcmd (int, char **);
static int ulimitcmd (int, char **);
static int timescmd (int, char **);
-#ifdef ASH_MATH_SUPPORT
+#ifdef CONFIG_ASH_MATH_SUPPORT
static int letcmd (int, char **);
#endif
static int typecmd (int, char **);
-#ifdef ASH_GETOPTS
+#ifdef CONFIG_ASH_GETOPTS
static int getoptscmd (int, char **);
#endif
@@ -1606,17 +1566,17 @@ struct builtincmd {
static const struct builtincmd builtincmds[] = {
{ BUILTIN_SPECIAL ".", dotcmd }, /* first, see declare DOTCMD */
{ BUILTIN_SPECIAL ":", true_main },
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
{ BUILTIN_REG_ASSG "alias", aliascmd },
#endif
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
{ BUILTIN_REGULAR "bg", bgcmd },
#endif
{ BUILTIN_SPECIAL "break", breakcmd },
{ BUILTIN_SPECIAL "builtin", bltincmd },
{ BUILTIN_REGULAR "cd", cdcmd },
{ BUILTIN_NOSPEC "chdir", cdcmd },
-#ifdef ASH_CMDCMD
+#ifdef CONFIG_ASH_CMDCMD
{ BUILTIN_REGULAR "command", commandcmd },
#endif
{ BUILTIN_SPECIAL "continue", breakcmd },
@@ -1626,19 +1586,19 @@ static const struct builtincmd builtincmds[] = {
{ BUILTIN_SPEC_ASSG "export", exportcmd },
{ BUILTIN_REGULAR "false", false_main },
{ BUILTIN_REGULAR "fc", histcmd },
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
{ BUILTIN_REGULAR "fg", fgcmd },
#endif
-#ifdef ASH_GETOPTS
+#ifdef CONFIG_ASH_GETOPTS
{ BUILTIN_REGULAR "getopts", getoptscmd },
#endif
{ BUILTIN_NOSPEC "hash", hashcmd },
{ BUILTIN_NOSPEC "help", helpcmd },
{ BUILTIN_REGULAR "jobs", jobscmd },
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
{ BUILTIN_REGULAR "kill", killcmd },
#endif
-#ifdef ASH_MATH_SUPPORT
+#ifdef CONFIG_ASH_MATH_SUPPORT
{ BUILTIN_REGULAR "let", letcmd },
#endif
{ BUILTIN_ASSIGN "local", localcmd },
@@ -1655,7 +1615,7 @@ static const struct builtincmd builtincmds[] = {
{ BUILTIN_NOSPEC "type", typecmd },
{ BUILTIN_NOSPEC "ulimit", ulimitcmd },
{ BUILTIN_REGULAR "umask", umaskcmd },
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
{ BUILTIN_REGULAR "unalias", unaliascmd },
#endif
{ BUILTIN_SPECIAL "unset", unsetcmd },
@@ -1669,7 +1629,7 @@ static struct builtincmd *EXECCMD;
static struct builtincmd *EVALCMD;
/* states */
-#define JOBSTOPPED 1 /* all procs are stopped */
+#define CONFIG_ASH_JOB_CONTROLTOPPED 1 /* all procs are stopped */
#define JOBDONE 2 /* all procs are completed */
/*
@@ -1688,7 +1648,7 @@ struct procstat {
static int job_warning; /* user was warned about stopped jobs */
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
static void setjobctl(int enable);
#else
#define setjobctl(on) /* do nothing */
@@ -1703,7 +1663,7 @@ struct job {
char state; /* true if job is finished */
char used; /* true if this entry is in used */
char changed; /* true if status has changed */
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
char jobctl; /* job running under job control */
#endif
};
@@ -1711,7 +1671,7 @@ struct job {
static struct job *jobtab; /* array of jobs */
static int njobs; /* size of array */
static int backgndpid = -1; /* pid of last background process */
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
static int initialpgrp; /* pgrp of shell on invocation */
static int curjob; /* current job */
static int jobctl;
@@ -2085,7 +2045,7 @@ errmsg(int e, int action)
}
-#ifdef ASH_OPTIMIZE_FOR_SIZE
+#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE
static void
__inton() {
if (--suppressint == 0 && intpending) {
@@ -3053,7 +3013,7 @@ true_main(int argc, char **argv)
static void setsignal(int signo);
-#ifdef ASH_MAIL
+#ifdef CONFIG_ASH_MAIL
static void chkmail(int silent);
#endif
@@ -3068,7 +3028,7 @@ setinteractive(int on)
setsignal(SIGINT);
setsignal(SIGQUIT);
setsignal(SIGTERM);
-#ifdef ASH_MAIL
+#ifdef CONFIG_ASH_MAIL
chkmail(1);
#endif
is_interactive = on;
@@ -3183,7 +3143,7 @@ static void
initshellproc(void)
{
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
/* from alias.c: */
{
rmaliases();
@@ -3202,7 +3162,7 @@ initshellproc(void)
/* from jobs.c: */
{
backgndpid = -1;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
jobctl = 0;
#endif
}
@@ -3247,7 +3207,7 @@ static void pushfile (void);
* Nul characters in the input are silently discarded.
*/
-#ifndef ASH_OPTIMIZE_FOR_SIZE
+#ifndef CONFIG_ASH_OPTIMIZE_FOR_SIZE
#define pgetc_macro() (--parsenleft >= 0? *parsenextc++ : preadbuffer())
static int
pgetc(void)
@@ -3497,7 +3457,7 @@ hashcmd(int argc, char **argv)
int verbose;
struct cmdentry entry;
char *name;
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
const struct alias *ap;
#endif
@@ -3526,7 +3486,7 @@ hashcmd(int argc, char **argv)
&& (cmdp->cmdtype == CMDNORMAL
|| (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0)))
delete_cmd_entry();
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
/* Then look at the aliases */
if ((ap = *__lookupalias(name)) != NULL) {
if (verbose=='v')
@@ -4075,7 +4035,7 @@ typecmd(int argc, char **argv)
return err;
}
-#ifdef ASH_CMDCMD
+#ifdef CONFIG_ASH_CMDCMD
static int
commandcmd(int argc, char **argv)
{
@@ -4479,7 +4439,7 @@ argstr(char *p, int flag)
expbackq(argbackq->n, c & CTLQUOTE, flag);
argbackq = argbackq->next;
break;
-#ifdef ASH_MATH_SUPPORT
+#ifdef CONFIG_ASH_MATH_SUPPORT
case CTLENDARI:
expari(flag);
break;
@@ -4592,7 +4552,7 @@ removerecordregions(int endoff)
}
-#ifdef ASH_MATH_SUPPORT
+#ifdef CONFIG_ASH_MATH_SUPPORT
/*
* Expand arithmetic expression. Backup to start of expression,
* evaluate, place result in (backed up) result, adjust string position.
@@ -5844,7 +5804,7 @@ static inline void putprompt(const char *s) {
* Same as pgetc(), but ignores PEOA.
*/
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
static int
pgetc2(void)
{
@@ -5855,7 +5815,7 @@ pgetc2(void)
return c;
}
#else
-static inline int pgetc2() { return pgetc_macro(); }
+static inline int pgetc2(void) { return pgetc_macro(); }
#endif
/*
@@ -5925,7 +5885,7 @@ popstring(void)
struct strpush *sp = parsefile->strpush;
INTOFF;
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
if (sp->ap) {
if (parsenextc[-1] == ' ' || parsenextc[-1] == '\t') {
if (!checkalias) {
@@ -5970,7 +5930,7 @@ preadbuffer(void)
char savec;
while (parsefile->strpush) {
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
if (parsenleft == -1 && parsefile->strpush->ap &&
parsenextc[-1] != ' ' && parsenextc[-1] != '\t') {
return PEOA;
@@ -6050,7 +6010,7 @@ pushstring(char *s, int len, void *ap)
sp = parsefile->strpush = &(parsefile->basestrpush);
sp->prevstring = parsenextc;
sp->prevnleft = parsenleft;
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
sp->ap = (struct alias *)ap;
if (ap) {
((struct alias *)ap)->flag |= ALIASINUSE;
@@ -6103,7 +6063,7 @@ pushfile(void)
parsefile = pf;
}
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
static void restartjob (struct job *);
#endif
static void freejob (struct job *);
@@ -6128,7 +6088,7 @@ fd0_redirected_p (void)
static void dupredirect (const union node *, int, int fd1dup);
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
/*
* Turn job control on and off.
*
@@ -6198,7 +6158,7 @@ static void setjobctl(int enable)
#endif
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
static int
killcmd(int argc, char **argv)
{
@@ -6405,7 +6365,7 @@ showjobs(int change)
snprintf(s, 64, "Exit %d",
WEXITSTATUS(ps->status));
} else {
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (WIFSTOPPED(ps->status))
i = WSTOPSIG(ps->status);
else /* WIFSIGNALED(ps->status) */
@@ -6453,7 +6413,7 @@ freejob(struct job *jp)
if (jp->ps != &jp->ps0)
ckfree(jp->ps);
jp->used = 0;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (curjob == jp - jobtab + 1)
curjob = 0;
#endif
@@ -6486,7 +6446,7 @@ start:
}
if (WIFEXITED(status))
retval = WEXITSTATUS(status);
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
else if (WIFSTOPPED(status))
retval = WSTOPSIG(status) + 128;
#endif
@@ -6526,7 +6486,7 @@ getjob(const char *name)
int i;
if (name == NULL) {
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
currentjob:
if ((jobno = curjob) == 0 || jobtab[jobno - 1].used == 0)
error("No current job");
@@ -6540,7 +6500,7 @@ currentjob:
if (jobno > 0 && jobno <= njobs
&& jobtab[jobno - 1].used != 0)
return &jobtab[jobno - 1];
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
} else if (name[1] == '%' && name[2] == '\0') {
goto currentjob;
#endif
@@ -6608,7 +6568,7 @@ makejob(const union node *node, int nprocs)
jp->used = 1;
jp->changed = 0;
jp->nprocs = 0;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
jp->jobctl = jobctl;
#endif
if (nprocs > 1) {
@@ -6644,7 +6604,7 @@ static int
forkshell(struct job *jp, const union node *n, int mode)
{
int pid;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
int pgrp;
#endif
const char *devnull = _PATH_DEVNULL;
@@ -6674,7 +6634,7 @@ forkshell(struct job *jp, const union node *n, int mode)
closescript();
INTON;
clear_traps();
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
jobctl = 0; /* do job control only in root shell */
if (wasroot && mode != FORK_NOJOB && mflag) {
if (jp == NULL || jp->nprocs == 0)
@@ -6717,7 +6677,7 @@ forkshell(struct job *jp, const union node *n, int mode)
}
return pid;
}
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (rootshell && mode != FORK_NOJOB && mflag) {
if (jp == NULL || jp->nprocs == 0)
pgrp = pid;
@@ -6765,7 +6725,7 @@ forkshell(struct job *jp, const union node *n, int mode)
static int
waitforjob(struct job *jp)
{
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
int mypgrp = getpgrp();
#endif
int status;
@@ -6774,7 +6734,7 @@ waitforjob(struct job *jp)
INTOFF;
intreceived = 0;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (!jobctl) {
#else
if (!iflag) {
@@ -6787,7 +6747,7 @@ waitforjob(struct job *jp)
while (jp->state == 0) {
dowait(1, jp);
}
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (!jobctl) {
#else
if (!iflag) {
@@ -6795,7 +6755,7 @@ waitforjob(struct job *jp)
sigaction(SIGINT, &oact, 0);
if (intreceived && trap[SIGINT]) kill(getpid(), SIGINT);
}
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (jp->jobctl) {
#ifdef OLD_TTY_DRIVER
if (ioctl(2, TIOCSPGRP, (char *)&mypgrp) < 0)
@@ -6805,20 +6765,20 @@ waitforjob(struct job *jp)
error("tcsetpgrp failed, errno=%d\n", errno);
#endif
}
- if (jp->state == JOBSTOPPED)
+ if (jp->state == CONFIG_ASH_JOB_CONTROLTOPPED)
curjob = jp - jobtab + 1;
#endif
status = jp->ps[jp->nprocs - 1].status;
/* convert to 8 bits */
if (WIFEXITED(status))
st = WEXITSTATUS(status);
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
else if (WIFSTOPPED(status))
st = WSTOPSIG(status) + 128;
#endif
else
st = WTERMSIG(status) + 128;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (jp->jobctl) {
/*
* This is truly gross.
@@ -6875,7 +6835,7 @@ waitproc(int block, int *status)
int flags;
flags = 0;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (jobctl)
flags |= WUNTRACED;
#endif
@@ -6924,11 +6884,11 @@ dowait(int block, struct job *job)
done = 0;
}
if (stopped) { /* stopped or done */
- int state = done? JOBDONE : JOBSTOPPED;
+ int state = done? JOBDONE : CONFIG_ASH_JOB_CONTROLTOPPED;
if (jp->state != state) {
TRACE(("Job %d: changing state from %d to %d\n", jp - jobtab + 1, jp->state, state));
jp->state = state;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (done && curjob == jp - jobtab + 1)
curjob = 0; /* no current job */
#endif
@@ -6939,7 +6899,7 @@ dowait(int block, struct job *job)
INTON;
if (! rootshell || ! iflag || (job && thisjob == job)) {
core = WCOREDUMP(status);
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (WIFSTOPPED(status)) sig = WSTOPSIG(status);
else
#endif
@@ -6949,7 +6909,7 @@ dowait(int block, struct job *job)
if (sig != 0 && sig != SIGINT && sig != SIGPIPE) {
if (thisjob != job)
out2fmt("%d: ", pid);
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
if (sig == SIGTSTP && rootshell && iflag)
out2fmt("%%%ld ",
(long)(job - jobtab + 1));
@@ -6990,7 +6950,7 @@ stoppedjobs(void)
for (jobno = 1, jp = jobtab; jobno <= njobs; jobno++, jp++) {
if (jp->used == 0)
continue;
- if (jp->state == JOBSTOPPED) {
+ if (jp->state == CONFIG_ASH_JOB_CONTROLTOPPED) {
out2str("You have stopped jobs.\n");
job_warning = 2;
return (1);
@@ -7408,7 +7368,7 @@ static void waitonint(int sig) {
return;
}
-#ifdef ASH_MAIL
+#ifdef CONFIG_ASH_MAIL
/*
* Routines to check for mail.
@@ -7469,7 +7429,7 @@ chkmail(int silent)
popstackmark(&smark);
}
-#endif /* ASH_MAIL */
+#endif /* CONFIG_ASH_MAIL */
#define PROFILE 0
@@ -7636,7 +7596,7 @@ cmdloop(int top)
if (iflag && top) {
inter++;
showjobs(1);
-#ifdef ASH_MAIL
+#ifdef CONFIG_ASH_MAIL
chkmail(0);
#endif
flushall();
@@ -8861,7 +8821,7 @@ nodexstrdup(const char *s)
return rtn;
}
-#ifdef ASH_GETOPTS
+#ifdef CONFIG_ASH_GETOPTS
static int getopts (char *, char *, char **, int *, int *);
#endif
@@ -9135,7 +9095,7 @@ static void change_lc_ctype(const char *value)
#endif
-#ifdef ASH_GETOPTS
+#ifdef CONFIG_ASH_GETOPTS
/*
* The getopts builtin. Shellparam.optnext points to the next argument
* to be processed. Shellparam.optptr points to the next character to
@@ -9997,7 +9957,7 @@ static int
readtoken() {
int t;
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
int savecheckalias = checkalias;
int savecheckkwd = checkkwd;
struct alias *ap;
@@ -10007,13 +9967,13 @@ readtoken() {
int alreadyseen = tokpushback;
#endif
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
top:
#endif
t = xxreadtoken();
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
checkalias = savecheckalias;
#endif
@@ -10051,7 +10011,7 @@ top:
}
} else if (checkalias == 2 && isassignment(wordtext)) {
lasttoken = t = TASSIGN;
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
} else if (checkalias) {
if (!quoteflag && (ap = *__lookupalias(wordtext)) != NULL && !(ap->flag & ALIASINUSE)) {
if (*ap->val) {
@@ -10125,7 +10085,7 @@ xxreadtoken() {
c = pgetc_macro();
if ((c!=' ') && (c!='\t')
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
&& (c!=PEOA)
#endif
) {
@@ -10191,7 +10151,7 @@ xxreadtoken() {
c = pgetc_macro();
switch (c) {
case ' ': case '\t':
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
case PEOA:
#endif
continue;
@@ -10394,7 +10354,7 @@ readtoken1(int firstc, int syntax, const char *eofmark, int striptabs)
USTPUTC(c, out);
}
break;
-#ifdef ASH_MATH_SUPPORT
+#ifdef CONFIG_ASH_MATH_SUPPORT
case CLP: /* '(' in arithmetic */
parenlevel++;
USTPUTC(c, out);
@@ -10435,7 +10395,7 @@ readtoken1(int firstc, int syntax, const char *eofmark, int striptabs)
default:
if (varnest == 0)
goto endword; /* exit outer loop */
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
if (c != PEOA)
#endif
USTPUTC(c, out);
@@ -10484,7 +10444,7 @@ endword:
checkend: {
if (eofmark) {
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
if (c == PEOA) {
c = pgetc2();
}
@@ -10765,7 +10725,7 @@ parsebackq: {
/* fall through */
case PEOF:
-#ifdef ASH_ALIAS
+#ifdef CONFIG_ASH_ALIAS
case PEOA:
#endif
startlinno = plinno;
@@ -11768,7 +11728,7 @@ setsignal(int signo)
if (iflag)
action = S_IGN;
break;
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
case SIGTSTP:
case SIGTTOU:
if (mflag)
@@ -11892,7 +11852,7 @@ exitshell(int status)
}
l1: handler = &loc2; /* probably unnecessary */
flushall();
-#ifdef JOBS
+#ifdef CONFIG_ASH_JOB_CONTROL
setjobctl(0);
#endif
l2: _exit(status);
@@ -12031,7 +11991,7 @@ setvareq(char *s, int flags)
vp->flags |= flags;
vp->text = s;
-#ifdef ASH_MAIL
+#ifdef CONFIG_ASH_MAIL
/*
* We could roll this to a function, to handle it as
* a regular variable function callback, but why bother?
@@ -12470,7 +12430,7 @@ findvar(struct var **vpp, const char *name)
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
- * $Id: ash.c,v 1.45 2001/12/31 06:16:54 aaronl Exp $
+ * $Id: ash.c,v 1.46 2002/01/09 15:37:36 andersen Exp $
*/
static int timescmd (int argc, char **argv)
{
@@ -12490,7 +12450,7 @@ static int timescmd (int argc, char **argv)
return 0;
}
-#ifdef ASH_MATH_SUPPORT
+#ifdef CONFIG_ASH_MATH_SUPPORT
/* The let builtin. */
int letcmd(int argc, char **argv)
{
diff --git a/shell/config.in b/shell/config.in
index 2efec9765..d6a7f1686 100644
--- a/shell/config.in
+++ b/shell/config.in
@@ -30,10 +30,23 @@ if [ "$CONFIG_FEATURE_SH_IS_MSH" = "y" ] ; then
fi
bool 'ash' CONFIG_ASH
+if [ "$CONFIG_ASH" = "y" ] ; then
+ comment 'Ash Shell Options'
+ bool 'Enable Job control' CONFIG_ASH_JOB_CONTROL
+ bool 'Enable alias support' CONFIG_ASH_ALIAS
+ bool 'Enable Posix math support' CONFIG_ASH_MATH_SUPPORT
+ bool 'Enable getopt builtin to parse positional parameters' CONFIG_ASH_GETOPTS
+ bool 'Enable cmdcmd to override shell builtins' CONFIG_ASH_CMDCMD
+ bool 'Check for new mail on interactive shells' CONFIG_ASH_MAIL
+ bool 'Optimize for size instead of speed' CONFIG_ASH_OPTIMIZE_FOR_SIZE
+ comment ''
+fi
+
bool 'hush' CONFIG_HUSH
bool 'lash' CONFIG_LASH
bool 'msh' CONFIG_MSH
+
comment 'Bourne Shell Options'
bool 'command line editing' CONFIG_FEATURE_COMMAND_EDITING
bool 'tab completion' CONFIG_FEATURE_COMMAND_TAB_COMPLETION