diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-01-09 15:37:36 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-01-09 15:37:36 +0000 |
commit | d35c5df08c7ca8ad506a418555538a9270411c42 (patch) | |
tree | 6115bb768f9743cc5f0141ba21636fa59fd0f944 | |
parent | b75b6e2c35bc11274805f426ab626911df8f3892 (diff) | |
download | busybox-w32-d35c5df08c7ca8ad506a418555538a9270411c42.tar.gz busybox-w32-d35c5df08c7ca8ad506a418555538a9270411c42.tar.bz2 busybox-w32-d35c5df08c7ca8ad506a418555538a9270411c42.zip |
Make private ash config options be public
-rw-r--r-- | shell/ash.c | 210 | ||||
-rw-r--r-- | shell/config.in | 13 |
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 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | 35 | ||
36 | /* These defines allow you to adjust the feature set to be compiled | ||
37 | * into the ash shell. As a rule, enabling these options will make | ||
38 | * ash get bigger... With all of these options off, ash adds about | ||
39 | * 60k to busybox on an x86 system.*/ | ||
40 | |||
41 | |||
42 | /* Enable job control. This allows you to run jobs in the background, | ||
43 | * which is great when ash is being used as an interactive shell, but | ||
44 | * it completely useless for is all you are doing is running scripts. | ||
45 | * This adds about 2.5k on an x86 system. */ | ||
46 | #undef JOBS | ||
47 | |||
48 | /* This enables alias support in ash. If you want to support things | ||
49 | * like "alias ls='ls -l'" with ash, enable this. This is only useful | ||
50 | * when ash is used as an intractive shell. This adds about 1.5k */ | ||
51 | #define ASH_ALIAS | ||
52 | |||
53 | /* If you need ash to act as a full Posix shell, with full math | ||
54 | * support, enable this. This adds a bit over 2k an x86 system. */ | ||
55 | //#undef ASH_MATH_SUPPORT | ||
56 | #define ASH_MATH_SUPPORT | ||
57 | |||
58 | /* Getopts is used by shell procedures to parse positional parameters. | ||
59 | * You probably want to leave this disabled, and use the busybox getopt | ||
60 | * applet if you want to do this sort of thing. There are some scripts | ||
61 | * out there that use it, so it you need it, enable. Most people will | ||
62 | * leave this disabled. This adds 1k on an x86 system. */ | ||
63 | #undef ASH_GETOPTS | ||
64 | |||
65 | /* This allows you to override shell builtins and use whatever is on | ||
66 | * the filesystem. This is most useful when ash is acting as a | ||
67 | * standalone shell. Adds about 272 bytes. */ | ||
68 | #undef ASH_CMDCMD | ||
69 | |||
70 | /* Check for new mail on interactive shells? */ | ||
71 | #undef ASH_MAIL | ||
72 | |||
73 | /* Optimize size vs speed as size */ | ||
74 | #define ASH_OPTIMIZE_FOR_SIZE | ||
75 | |||
76 | /* Enable this to compile in extra debugging noise. When debugging is | 36 | /* Enable this to compile in extra debugging noise. When debugging is |
77 | * on, debugging info will be written to $HOME/trace and a quit signal | 37 | * on, debugging info will be written to $HOME/trace and a quit signal |
78 | * will generate a core dump. */ | 38 | * will generate a core dump. */ |
@@ -118,7 +78,7 @@ | |||
118 | #include <glob.h> | 78 | #include <glob.h> |
119 | #endif | 79 | #endif |
120 | 80 | ||
121 | #ifdef JOBS | 81 | #ifdef CONFIG_ASH_JOB_CONTROL |
122 | #include <termios.h> | 82 | #include <termios.h> |
123 | #endif | 83 | #endif |
124 | 84 | ||
@@ -281,7 +241,7 @@ static volatile int suppressint; | |||
281 | static volatile int intpending; | 241 | static volatile int intpending; |
282 | 242 | ||
283 | #define INTOFF suppressint++ | 243 | #define INTOFF suppressint++ |
284 | #ifndef ASH_OPTIMIZE_FOR_SIZE | 244 | #ifndef CONFIG_ASH_OPTIMIZE_FOR_SIZE |
285 | #define INTON { if (--suppressint == 0 && intpending) onint(); } | 245 | #define INTON { if (--suppressint == 0 && intpending) onint(); } |
286 | #define FORCEINTON {suppressint = 0; if (intpending) onint();} | 246 | #define FORCEINTON {suppressint = 0; if (intpending) onint();} |
287 | #else | 247 | #else |
@@ -608,7 +568,7 @@ struct strpush { | |||
608 | struct strpush *prev; /* preceding string on stack */ | 568 | struct strpush *prev; /* preceding string on stack */ |
609 | char *prevstring; | 569 | char *prevstring; |
610 | int prevnleft; | 570 | int prevnleft; |
611 | #ifdef ASH_ALIAS | 571 | #ifdef CONFIG_ASH_ALIAS |
612 | struct alias *ap; /* if push was associated with an alias */ | 572 | struct alias *ap; /* if push was associated with an alias */ |
613 | #endif | 573 | #endif |
614 | char *string; /* remember the string since it may change */ | 574 | 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); } | |||
685 | static void out1str(const char *p) { outstr(p, stdout); } | 645 | static void out1str(const char *p) { outstr(p, stdout); } |
686 | static void out2str(const char *p) { outstr(p, stderr); } | 646 | static void out2str(const char *p) { outstr(p, stderr); } |
687 | 647 | ||
688 | #ifndef ASH_OPTIMIZE_FOR_SIZE | 648 | #ifndef CONFIG_ASH_OPTIMIZE_FOR_SIZE |
689 | #define out2c(c) putc((c), stderr) | 649 | #define out2c(c) putc((c), stderr) |
690 | #else | 650 | #else |
691 | static void out2c(int c) { putc(c, stderr); } | 651 | static void out2c(int c) { putc(c, stderr); } |
692 | #endif | 652 | #endif |
693 | 653 | ||
694 | 654 | ||
695 | #ifdef ASH_OPTIMIZE_FOR_SIZE | 655 | #ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE |
696 | #define USE_SIT_FUNCTION | 656 | #define USE_SIT_FUNCTION |
697 | #endif | 657 | #endif |
698 | 658 | ||
@@ -1313,7 +1273,7 @@ static char *optptr; /* used by nextopt */ | |||
1313 | static char *minusc; /* argument to -c option */ | 1273 | static char *minusc; /* argument to -c option */ |
1314 | 1274 | ||
1315 | 1275 | ||
1316 | #ifdef ASH_ALIAS | 1276 | #ifdef CONFIG_ASH_ALIAS |
1317 | 1277 | ||
1318 | #define ALIASINUSE 1 | 1278 | #define ALIASINUSE 1 |
1319 | #define ALIASDEAD 2 | 1279 | #define ALIASDEAD 2 |
@@ -1507,7 +1467,7 @@ __lookupalias(const char *name) | |||
1507 | } | 1467 | } |
1508 | #endif | 1468 | #endif |
1509 | 1469 | ||
1510 | #ifdef ASH_MATH_SUPPORT | 1470 | #ifdef CONFIG_ASH_MATH_SUPPORT |
1511 | /* The generated file arith.c has been replaced with a custom hand | 1471 | /* The generated file arith.c has been replaced with a custom hand |
1512 | * written implementation written by Aaron Lehmann <aaronl@vitelus.com>. | 1472 | * written implementation written by Aaron Lehmann <aaronl@vitelus.com>. |
1513 | * This is now part of libbb, so that it can be used by all the shells | 1473 | * 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 */ | |||
1524 | * This file was generated by the mkbuiltins program. | 1484 | * This file was generated by the mkbuiltins program. |
1525 | */ | 1485 | */ |
1526 | 1486 | ||
1527 | #ifdef JOBS | 1487 | #ifdef CONFIG_ASH_JOB_CONTROL |
1528 | static int bgcmd (int, char **); | 1488 | static int bgcmd (int, char **); |
1529 | static int fgcmd (int, char **); | 1489 | static int fgcmd (int, char **); |
1530 | static int killcmd (int, char **); | 1490 | static int killcmd (int, char **); |
@@ -1532,7 +1492,7 @@ static int killcmd (int, char **); | |||
1532 | static int bltincmd (int, char **); | 1492 | static int bltincmd (int, char **); |
1533 | static int cdcmd (int, char **); | 1493 | static int cdcmd (int, char **); |
1534 | static int breakcmd (int, char **); | 1494 | static int breakcmd (int, char **); |
1535 | #ifdef ASH_CMDCMD | 1495 | #ifdef CONFIG_ASH_CMDCMD |
1536 | static int commandcmd (int, char **); | 1496 | static int commandcmd (int, char **); |
1537 | #endif | 1497 | #endif |
1538 | static int dotcmd (int, char **); | 1498 | static int dotcmd (int, char **); |
@@ -1553,7 +1513,7 @@ static int setvarcmd (int, char **); | |||
1553 | static int shiftcmd (int, char **); | 1513 | static int shiftcmd (int, char **); |
1554 | static int trapcmd (int, char **); | 1514 | static int trapcmd (int, char **); |
1555 | static int umaskcmd (int, char **); | 1515 | static int umaskcmd (int, char **); |
1556 | #ifdef ASH_ALIAS | 1516 | #ifdef CONFIG_ASH_ALIAS |
1557 | static int aliascmd (int, char **); | 1517 | static int aliascmd (int, char **); |
1558 | static int unaliascmd (int, char **); | 1518 | static int unaliascmd (int, char **); |
1559 | #endif | 1519 | #endif |
@@ -1561,11 +1521,11 @@ static int unsetcmd (int, char **); | |||
1561 | static int waitcmd (int, char **); | 1521 | static int waitcmd (int, char **); |
1562 | static int ulimitcmd (int, char **); | 1522 | static int ulimitcmd (int, char **); |
1563 | static int timescmd (int, char **); | 1523 | static int timescmd (int, char **); |
1564 | #ifdef ASH_MATH_SUPPORT | 1524 | #ifdef CONFIG_ASH_MATH_SUPPORT |
1565 | static int letcmd (int, char **); | 1525 | static int letcmd (int, char **); |
1566 | #endif | 1526 | #endif |
1567 | static int typecmd (int, char **); | 1527 | static int typecmd (int, char **); |
1568 | #ifdef ASH_GETOPTS | 1528 | #ifdef CONFIG_ASH_GETOPTS |
1569 | static int getoptscmd (int, char **); | 1529 | static int getoptscmd (int, char **); |
1570 | #endif | 1530 | #endif |
1571 | 1531 | ||
@@ -1606,17 +1566,17 @@ struct builtincmd { | |||
1606 | static const struct builtincmd builtincmds[] = { | 1566 | static const struct builtincmd builtincmds[] = { |
1607 | { BUILTIN_SPECIAL ".", dotcmd }, /* first, see declare DOTCMD */ | 1567 | { BUILTIN_SPECIAL ".", dotcmd }, /* first, see declare DOTCMD */ |
1608 | { BUILTIN_SPECIAL ":", true_main }, | 1568 | { BUILTIN_SPECIAL ":", true_main }, |
1609 | #ifdef ASH_ALIAS | 1569 | #ifdef CONFIG_ASH_ALIAS |
1610 | { BUILTIN_REG_ASSG "alias", aliascmd }, | 1570 | { BUILTIN_REG_ASSG "alias", aliascmd }, |
1611 | #endif | 1571 | #endif |
1612 | #ifdef JOBS | 1572 | #ifdef CONFIG_ASH_JOB_CONTROL |
1613 | { BUILTIN_REGULAR "bg", bgcmd }, | 1573 | { BUILTIN_REGULAR "bg", bgcmd }, |
1614 | #endif | 1574 | #endif |
1615 | { BUILTIN_SPECIAL "break", breakcmd }, | 1575 | { BUILTIN_SPECIAL "break", breakcmd }, |
1616 | { BUILTIN_SPECIAL "builtin", bltincmd }, | 1576 | { BUILTIN_SPECIAL "builtin", bltincmd }, |
1617 | { BUILTIN_REGULAR "cd", cdcmd }, | 1577 | { BUILTIN_REGULAR "cd", cdcmd }, |
1618 | { BUILTIN_NOSPEC "chdir", cdcmd }, | 1578 | { BUILTIN_NOSPEC "chdir", cdcmd }, |
1619 | #ifdef ASH_CMDCMD | 1579 | #ifdef CONFIG_ASH_CMDCMD |
1620 | { BUILTIN_REGULAR "command", commandcmd }, | 1580 | { BUILTIN_REGULAR "command", commandcmd }, |
1621 | #endif | 1581 | #endif |
1622 | { BUILTIN_SPECIAL "continue", breakcmd }, | 1582 | { BUILTIN_SPECIAL "continue", breakcmd }, |
@@ -1626,19 +1586,19 @@ static const struct builtincmd builtincmds[] = { | |||
1626 | { BUILTIN_SPEC_ASSG "export", exportcmd }, | 1586 | { BUILTIN_SPEC_ASSG "export", exportcmd }, |
1627 | { BUILTIN_REGULAR "false", false_main }, | 1587 | { BUILTIN_REGULAR "false", false_main }, |
1628 | { BUILTIN_REGULAR "fc", histcmd }, | 1588 | { BUILTIN_REGULAR "fc", histcmd }, |
1629 | #ifdef JOBS | 1589 | #ifdef CONFIG_ASH_JOB_CONTROL |
1630 | { BUILTIN_REGULAR "fg", fgcmd }, | 1590 | { BUILTIN_REGULAR "fg", fgcmd }, |
1631 | #endif | 1591 | #endif |
1632 | #ifdef ASH_GETOPTS | 1592 | #ifdef CONFIG_ASH_GETOPTS |
1633 | { BUILTIN_REGULAR "getopts", getoptscmd }, | 1593 | { BUILTIN_REGULAR "getopts", getoptscmd }, |
1634 | #endif | 1594 | #endif |
1635 | { BUILTIN_NOSPEC "hash", hashcmd }, | 1595 | { BUILTIN_NOSPEC "hash", hashcmd }, |
1636 | { BUILTIN_NOSPEC "help", helpcmd }, | 1596 | { BUILTIN_NOSPEC "help", helpcmd }, |
1637 | { BUILTIN_REGULAR "jobs", jobscmd }, | 1597 | { BUILTIN_REGULAR "jobs", jobscmd }, |
1638 | #ifdef JOBS | 1598 | #ifdef CONFIG_ASH_JOB_CONTROL |
1639 | { BUILTIN_REGULAR "kill", killcmd }, | 1599 | { BUILTIN_REGULAR "kill", killcmd }, |
1640 | #endif | 1600 | #endif |
1641 | #ifdef ASH_MATH_SUPPORT | 1601 | #ifdef CONFIG_ASH_MATH_SUPPORT |
1642 | { BUILTIN_REGULAR "let", letcmd }, | 1602 | { BUILTIN_REGULAR "let", letcmd }, |
1643 | #endif | 1603 | #endif |
1644 | { BUILTIN_ASSIGN "local", localcmd }, | 1604 | { BUILTIN_ASSIGN "local", localcmd }, |
@@ -1655,7 +1615,7 @@ static const struct builtincmd builtincmds[] = { | |||
1655 | { BUILTIN_NOSPEC "type", typecmd }, | 1615 | { BUILTIN_NOSPEC "type", typecmd }, |
1656 | { BUILTIN_NOSPEC "ulimit", ulimitcmd }, | 1616 | { BUILTIN_NOSPEC "ulimit", ulimitcmd }, |
1657 | { BUILTIN_REGULAR "umask", umaskcmd }, | 1617 | { BUILTIN_REGULAR "umask", umaskcmd }, |
1658 | #ifdef ASH_ALIAS | 1618 | #ifdef CONFIG_ASH_ALIAS |
1659 | { BUILTIN_REGULAR "unalias", unaliascmd }, | 1619 | { BUILTIN_REGULAR "unalias", unaliascmd }, |
1660 | #endif | 1620 | #endif |
1661 | { BUILTIN_SPECIAL "unset", unsetcmd }, | 1621 | { BUILTIN_SPECIAL "unset", unsetcmd }, |
@@ -1669,7 +1629,7 @@ static struct builtincmd *EXECCMD; | |||
1669 | static struct builtincmd *EVALCMD; | 1629 | static struct builtincmd *EVALCMD; |
1670 | 1630 | ||
1671 | /* states */ | 1631 | /* states */ |
1672 | #define JOBSTOPPED 1 /* all procs are stopped */ | 1632 | #define CONFIG_ASH_JOB_CONTROLTOPPED 1 /* all procs are stopped */ |
1673 | #define JOBDONE 2 /* all procs are completed */ | 1633 | #define JOBDONE 2 /* all procs are completed */ |
1674 | 1634 | ||
1675 | /* | 1635 | /* |
@@ -1688,7 +1648,7 @@ struct procstat { | |||
1688 | 1648 | ||
1689 | static int job_warning; /* user was warned about stopped jobs */ | 1649 | static int job_warning; /* user was warned about stopped jobs */ |
1690 | 1650 | ||
1691 | #ifdef JOBS | 1651 | #ifdef CONFIG_ASH_JOB_CONTROL |
1692 | static void setjobctl(int enable); | 1652 | static void setjobctl(int enable); |
1693 | #else | 1653 | #else |
1694 | #define setjobctl(on) /* do nothing */ | 1654 | #define setjobctl(on) /* do nothing */ |
@@ -1703,7 +1663,7 @@ struct job { | |||
1703 | char state; /* true if job is finished */ | 1663 | char state; /* true if job is finished */ |
1704 | char used; /* true if this entry is in used */ | 1664 | char used; /* true if this entry is in used */ |
1705 | char changed; /* true if status has changed */ | 1665 | char changed; /* true if status has changed */ |
1706 | #ifdef JOBS | 1666 | #ifdef CONFIG_ASH_JOB_CONTROL |
1707 | char jobctl; /* job running under job control */ | 1667 | char jobctl; /* job running under job control */ |
1708 | #endif | 1668 | #endif |
1709 | }; | 1669 | }; |
@@ -1711,7 +1671,7 @@ struct job { | |||
1711 | static struct job *jobtab; /* array of jobs */ | 1671 | static struct job *jobtab; /* array of jobs */ |
1712 | static int njobs; /* size of array */ | 1672 | static int njobs; /* size of array */ |
1713 | static int backgndpid = -1; /* pid of last background process */ | 1673 | static int backgndpid = -1; /* pid of last background process */ |
1714 | #ifdef JOBS | 1674 | #ifdef CONFIG_ASH_JOB_CONTROL |
1715 | static int initialpgrp; /* pgrp of shell on invocation */ | 1675 | static int initialpgrp; /* pgrp of shell on invocation */ |
1716 | static int curjob; /* current job */ | 1676 | static int curjob; /* current job */ |
1717 | static int jobctl; | 1677 | static int jobctl; |
@@ -2085,7 +2045,7 @@ errmsg(int e, int action) | |||
2085 | } | 2045 | } |
2086 | 2046 | ||
2087 | 2047 | ||
2088 | #ifdef ASH_OPTIMIZE_FOR_SIZE | 2048 | #ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE |
2089 | static void | 2049 | static void |
2090 | __inton() { | 2050 | __inton() { |
2091 | if (--suppressint == 0 && intpending) { | 2051 | if (--suppressint == 0 && intpending) { |
@@ -3053,7 +3013,7 @@ true_main(int argc, char **argv) | |||
3053 | 3013 | ||
3054 | static void setsignal(int signo); | 3014 | static void setsignal(int signo); |
3055 | 3015 | ||
3056 | #ifdef ASH_MAIL | 3016 | #ifdef CONFIG_ASH_MAIL |
3057 | static void chkmail(int silent); | 3017 | static void chkmail(int silent); |
3058 | #endif | 3018 | #endif |
3059 | 3019 | ||
@@ -3068,7 +3028,7 @@ setinteractive(int on) | |||
3068 | setsignal(SIGINT); | 3028 | setsignal(SIGINT); |
3069 | setsignal(SIGQUIT); | 3029 | setsignal(SIGQUIT); |
3070 | setsignal(SIGTERM); | 3030 | setsignal(SIGTERM); |
3071 | #ifdef ASH_MAIL | 3031 | #ifdef CONFIG_ASH_MAIL |
3072 | chkmail(1); | 3032 | chkmail(1); |
3073 | #endif | 3033 | #endif |
3074 | is_interactive = on; | 3034 | is_interactive = on; |
@@ -3183,7 +3143,7 @@ static void | |||
3183 | initshellproc(void) | 3143 | initshellproc(void) |
3184 | { | 3144 | { |
3185 | 3145 | ||
3186 | #ifdef ASH_ALIAS | 3146 | #ifdef CONFIG_ASH_ALIAS |
3187 | /* from alias.c: */ | 3147 | /* from alias.c: */ |
3188 | { | 3148 | { |
3189 | rmaliases(); | 3149 | rmaliases(); |
@@ -3202,7 +3162,7 @@ initshellproc(void) | |||
3202 | /* from jobs.c: */ | 3162 | /* from jobs.c: */ |
3203 | { | 3163 | { |
3204 | backgndpid = -1; | 3164 | backgndpid = -1; |
3205 | #ifdef JOBS | 3165 | #ifdef CONFIG_ASH_JOB_CONTROL |
3206 | jobctl = 0; | 3166 | jobctl = 0; |
3207 | #endif | 3167 | #endif |
3208 | } | 3168 | } |
@@ -3247,7 +3207,7 @@ static void pushfile (void); | |||
3247 | * Nul characters in the input are silently discarded. | 3207 | * Nul characters in the input are silently discarded. |
3248 | */ | 3208 | */ |
3249 | 3209 | ||
3250 | #ifndef ASH_OPTIMIZE_FOR_SIZE | 3210 | #ifndef CONFIG_ASH_OPTIMIZE_FOR_SIZE |
3251 | #define pgetc_macro() (--parsenleft >= 0? *parsenextc++ : preadbuffer()) | 3211 | #define pgetc_macro() (--parsenleft >= 0? *parsenextc++ : preadbuffer()) |
3252 | static int | 3212 | static int |
3253 | pgetc(void) | 3213 | pgetc(void) |
@@ -3497,7 +3457,7 @@ hashcmd(int argc, char **argv) | |||
3497 | int verbose; | 3457 | int verbose; |
3498 | struct cmdentry entry; | 3458 | struct cmdentry entry; |
3499 | char *name; | 3459 | char *name; |
3500 | #ifdef ASH_ALIAS | 3460 | #ifdef CONFIG_ASH_ALIAS |
3501 | const struct alias *ap; | 3461 | const struct alias *ap; |
3502 | #endif | 3462 | #endif |
3503 | 3463 | ||
@@ -3526,7 +3486,7 @@ hashcmd(int argc, char **argv) | |||
3526 | && (cmdp->cmdtype == CMDNORMAL | 3486 | && (cmdp->cmdtype == CMDNORMAL |
3527 | || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))) | 3487 | || (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))) |
3528 | delete_cmd_entry(); | 3488 | delete_cmd_entry(); |
3529 | #ifdef ASH_ALIAS | 3489 | #ifdef CONFIG_ASH_ALIAS |
3530 | /* Then look at the aliases */ | 3490 | /* Then look at the aliases */ |
3531 | if ((ap = *__lookupalias(name)) != NULL) { | 3491 | if ((ap = *__lookupalias(name)) != NULL) { |
3532 | if (verbose=='v') | 3492 | if (verbose=='v') |
@@ -4075,7 +4035,7 @@ typecmd(int argc, char **argv) | |||
4075 | return err; | 4035 | return err; |
4076 | } | 4036 | } |
4077 | 4037 | ||
4078 | #ifdef ASH_CMDCMD | 4038 | #ifdef CONFIG_ASH_CMDCMD |
4079 | static int | 4039 | static int |
4080 | commandcmd(int argc, char **argv) | 4040 | commandcmd(int argc, char **argv) |
4081 | { | 4041 | { |
@@ -4479,7 +4439,7 @@ argstr(char *p, int flag) | |||
4479 | expbackq(argbackq->n, c & CTLQUOTE, flag); | 4439 | expbackq(argbackq->n, c & CTLQUOTE, flag); |
4480 | argbackq = argbackq->next; | 4440 | argbackq = argbackq->next; |
4481 | break; | 4441 | break; |
4482 | #ifdef ASH_MATH_SUPPORT | 4442 | #ifdef CONFIG_ASH_MATH_SUPPORT |
4483 | case CTLENDARI: | 4443 | case CTLENDARI: |
4484 | expari(flag); | 4444 | expari(flag); |
4485 | break; | 4445 | break; |
@@ -4592,7 +4552,7 @@ removerecordregions(int endoff) | |||
4592 | } | 4552 | } |
4593 | 4553 | ||
4594 | 4554 | ||
4595 | #ifdef ASH_MATH_SUPPORT | 4555 | #ifdef CONFIG_ASH_MATH_SUPPORT |
4596 | /* | 4556 | /* |
4597 | * Expand arithmetic expression. Backup to start of expression, | 4557 | * Expand arithmetic expression. Backup to start of expression, |
4598 | * evaluate, place result in (backed up) result, adjust string position. | 4558 | * evaluate, place result in (backed up) result, adjust string position. |
@@ -5844,7 +5804,7 @@ static inline void putprompt(const char *s) { | |||
5844 | * Same as pgetc(), but ignores PEOA. | 5804 | * Same as pgetc(), but ignores PEOA. |
5845 | */ | 5805 | */ |
5846 | 5806 | ||
5847 | #ifdef ASH_ALIAS | 5807 | #ifdef CONFIG_ASH_ALIAS |
5848 | static int | 5808 | static int |
5849 | pgetc2(void) | 5809 | pgetc2(void) |
5850 | { | 5810 | { |
@@ -5855,7 +5815,7 @@ pgetc2(void) | |||
5855 | return c; | 5815 | return c; |
5856 | } | 5816 | } |
5857 | #else | 5817 | #else |
5858 | static inline int pgetc2() { return pgetc_macro(); } | 5818 | static inline int pgetc2(void) { return pgetc_macro(); } |
5859 | #endif | 5819 | #endif |
5860 | 5820 | ||
5861 | /* | 5821 | /* |
@@ -5925,7 +5885,7 @@ popstring(void) | |||
5925 | struct strpush *sp = parsefile->strpush; | 5885 | struct strpush *sp = parsefile->strpush; |
5926 | 5886 | ||
5927 | INTOFF; | 5887 | INTOFF; |
5928 | #ifdef ASH_ALIAS | 5888 | #ifdef CONFIG_ASH_ALIAS |
5929 | if (sp->ap) { | 5889 | if (sp->ap) { |
5930 | if (parsenextc[-1] == ' ' || parsenextc[-1] == '\t') { | 5890 | if (parsenextc[-1] == ' ' || parsenextc[-1] == '\t') { |
5931 | if (!checkalias) { | 5891 | if (!checkalias) { |
@@ -5970,7 +5930,7 @@ preadbuffer(void) | |||
5970 | char savec; | 5930 | char savec; |
5971 | 5931 | ||
5972 | while (parsefile->strpush) { | 5932 | while (parsefile->strpush) { |
5973 | #ifdef ASH_ALIAS | 5933 | #ifdef CONFIG_ASH_ALIAS |
5974 | if (parsenleft == -1 && parsefile->strpush->ap && | 5934 | if (parsenleft == -1 && parsefile->strpush->ap && |
5975 | parsenextc[-1] != ' ' && parsenextc[-1] != '\t') { | 5935 | parsenextc[-1] != ' ' && parsenextc[-1] != '\t') { |
5976 | return PEOA; | 5936 | return PEOA; |
@@ -6050,7 +6010,7 @@ pushstring(char *s, int len, void *ap) | |||
6050 | sp = parsefile->strpush = &(parsefile->basestrpush); | 6010 | sp = parsefile->strpush = &(parsefile->basestrpush); |
6051 | sp->prevstring = parsenextc; | 6011 | sp->prevstring = parsenextc; |
6052 | sp->prevnleft = parsenleft; | 6012 | sp->prevnleft = parsenleft; |
6053 | #ifdef ASH_ALIAS | 6013 | #ifdef CONFIG_ASH_ALIAS |
6054 | sp->ap = (struct alias *)ap; | 6014 | sp->ap = (struct alias *)ap; |
6055 | if (ap) { | 6015 | if (ap) { |
6056 | ((struct alias *)ap)->flag |= ALIASINUSE; | 6016 | ((struct alias *)ap)->flag |= ALIASINUSE; |
@@ -6103,7 +6063,7 @@ pushfile(void) | |||
6103 | parsefile = pf; | 6063 | parsefile = pf; |
6104 | } | 6064 | } |
6105 | 6065 | ||
6106 | #ifdef JOBS | 6066 | #ifdef CONFIG_ASH_JOB_CONTROL |
6107 | static void restartjob (struct job *); | 6067 | static void restartjob (struct job *); |
6108 | #endif | 6068 | #endif |
6109 | static void freejob (struct job *); | 6069 | static void freejob (struct job *); |
@@ -6128,7 +6088,7 @@ fd0_redirected_p (void) | |||
6128 | 6088 | ||
6129 | static void dupredirect (const union node *, int, int fd1dup); | 6089 | static void dupredirect (const union node *, int, int fd1dup); |
6130 | 6090 | ||
6131 | #ifdef JOBS | 6091 | #ifdef CONFIG_ASH_JOB_CONTROL |
6132 | /* | 6092 | /* |
6133 | * Turn job control on and off. | 6093 | * Turn job control on and off. |
6134 | * | 6094 | * |
@@ -6198,7 +6158,7 @@ static void setjobctl(int enable) | |||
6198 | #endif | 6158 | #endif |
6199 | 6159 | ||
6200 | 6160 | ||
6201 | #ifdef JOBS | 6161 | #ifdef CONFIG_ASH_JOB_CONTROL |
6202 | static int | 6162 | static int |
6203 | killcmd(int argc, char **argv) | 6163 | killcmd(int argc, char **argv) |
6204 | { | 6164 | { |
@@ -6405,7 +6365,7 @@ showjobs(int change) | |||
6405 | snprintf(s, 64, "Exit %d", | 6365 | snprintf(s, 64, "Exit %d", |
6406 | WEXITSTATUS(ps->status)); | 6366 | WEXITSTATUS(ps->status)); |
6407 | } else { | 6367 | } else { |
6408 | #ifdef JOBS | 6368 | #ifdef CONFIG_ASH_JOB_CONTROL |
6409 | if (WIFSTOPPED(ps->status)) | 6369 | if (WIFSTOPPED(ps->status)) |
6410 | i = WSTOPSIG(ps->status); | 6370 | i = WSTOPSIG(ps->status); |
6411 | else /* WIFSIGNALED(ps->status) */ | 6371 | else /* WIFSIGNALED(ps->status) */ |
@@ -6453,7 +6413,7 @@ freejob(struct job *jp) | |||
6453 | if (jp->ps != &jp->ps0) | 6413 | if (jp->ps != &jp->ps0) |
6454 | ckfree(jp->ps); | 6414 | ckfree(jp->ps); |
6455 | jp->used = 0; | 6415 | jp->used = 0; |
6456 | #ifdef JOBS | 6416 | #ifdef CONFIG_ASH_JOB_CONTROL |
6457 | if (curjob == jp - jobtab + 1) | 6417 | if (curjob == jp - jobtab + 1) |
6458 | curjob = 0; | 6418 | curjob = 0; |
6459 | #endif | 6419 | #endif |
@@ -6486,7 +6446,7 @@ start: | |||
6486 | } | 6446 | } |
6487 | if (WIFEXITED(status)) | 6447 | if (WIFEXITED(status)) |
6488 | retval = WEXITSTATUS(status); | 6448 | retval = WEXITSTATUS(status); |
6489 | #ifdef JOBS | 6449 | #ifdef CONFIG_ASH_JOB_CONTROL |
6490 | else if (WIFSTOPPED(status)) | 6450 | else if (WIFSTOPPED(status)) |
6491 | retval = WSTOPSIG(status) + 128; | 6451 | retval = WSTOPSIG(status) + 128; |
6492 | #endif | 6452 | #endif |
@@ -6526,7 +6486,7 @@ getjob(const char *name) | |||
6526 | int i; | 6486 | int i; |
6527 | 6487 | ||
6528 | if (name == NULL) { | 6488 | if (name == NULL) { |
6529 | #ifdef JOBS | 6489 | #ifdef CONFIG_ASH_JOB_CONTROL |
6530 | currentjob: | 6490 | currentjob: |
6531 | if ((jobno = curjob) == 0 || jobtab[jobno - 1].used == 0) | 6491 | if ((jobno = curjob) == 0 || jobtab[jobno - 1].used == 0) |
6532 | error("No current job"); | 6492 | error("No current job"); |
@@ -6540,7 +6500,7 @@ currentjob: | |||
6540 | if (jobno > 0 && jobno <= njobs | 6500 | if (jobno > 0 && jobno <= njobs |
6541 | && jobtab[jobno - 1].used != 0) | 6501 | && jobtab[jobno - 1].used != 0) |
6542 | return &jobtab[jobno - 1]; | 6502 | return &jobtab[jobno - 1]; |
6543 | #ifdef JOBS | 6503 | #ifdef CONFIG_ASH_JOB_CONTROL |
6544 | } else if (name[1] == '%' && name[2] == '\0') { | 6504 | } else if (name[1] == '%' && name[2] == '\0') { |
6545 | goto currentjob; | 6505 | goto currentjob; |
6546 | #endif | 6506 | #endif |
@@ -6608,7 +6568,7 @@ makejob(const union node *node, int nprocs) | |||
6608 | jp->used = 1; | 6568 | jp->used = 1; |
6609 | jp->changed = 0; | 6569 | jp->changed = 0; |
6610 | jp->nprocs = 0; | 6570 | jp->nprocs = 0; |
6611 | #ifdef JOBS | 6571 | #ifdef CONFIG_ASH_JOB_CONTROL |
6612 | jp->jobctl = jobctl; | 6572 | jp->jobctl = jobctl; |
6613 | #endif | 6573 | #endif |
6614 | if (nprocs > 1) { | 6574 | if (nprocs > 1) { |
@@ -6644,7 +6604,7 @@ static int | |||
6644 | forkshell(struct job *jp, const union node *n, int mode) | 6604 | forkshell(struct job *jp, const union node *n, int mode) |
6645 | { | 6605 | { |
6646 | int pid; | 6606 | int pid; |
6647 | #ifdef JOBS | 6607 | #ifdef CONFIG_ASH_JOB_CONTROL |
6648 | int pgrp; | 6608 | int pgrp; |
6649 | #endif | 6609 | #endif |
6650 | const char *devnull = _PATH_DEVNULL; | 6610 | const char *devnull = _PATH_DEVNULL; |
@@ -6674,7 +6634,7 @@ forkshell(struct job *jp, const union node *n, int mode) | |||
6674 | closescript(); | 6634 | closescript(); |
6675 | INTON; | 6635 | INTON; |
6676 | clear_traps(); | 6636 | clear_traps(); |
6677 | #ifdef JOBS | 6637 | #ifdef CONFIG_ASH_JOB_CONTROL |
6678 | jobctl = 0; /* do job control only in root shell */ | 6638 | jobctl = 0; /* do job control only in root shell */ |
6679 | if (wasroot && mode != FORK_NOJOB && mflag) { | 6639 | if (wasroot && mode != FORK_NOJOB && mflag) { |
6680 | if (jp == NULL || jp->nprocs == 0) | 6640 | if (jp == NULL || jp->nprocs == 0) |
@@ -6717,7 +6677,7 @@ forkshell(struct job *jp, const union node *n, int mode) | |||
6717 | } | 6677 | } |
6718 | return pid; | 6678 | return pid; |
6719 | } | 6679 | } |
6720 | #ifdef JOBS | 6680 | #ifdef CONFIG_ASH_JOB_CONTROL |
6721 | if (rootshell && mode != FORK_NOJOB && mflag) { | 6681 | if (rootshell && mode != FORK_NOJOB && mflag) { |
6722 | if (jp == NULL || jp->nprocs == 0) | 6682 | if (jp == NULL || jp->nprocs == 0) |
6723 | pgrp = pid; | 6683 | pgrp = pid; |
@@ -6765,7 +6725,7 @@ forkshell(struct job *jp, const union node *n, int mode) | |||
6765 | static int | 6725 | static int |
6766 | waitforjob(struct job *jp) | 6726 | waitforjob(struct job *jp) |
6767 | { | 6727 | { |
6768 | #ifdef JOBS | 6728 | #ifdef CONFIG_ASH_JOB_CONTROL |
6769 | int mypgrp = getpgrp(); | 6729 | int mypgrp = getpgrp(); |
6770 | #endif | 6730 | #endif |
6771 | int status; | 6731 | int status; |
@@ -6774,7 +6734,7 @@ waitforjob(struct job *jp) | |||
6774 | 6734 | ||
6775 | INTOFF; | 6735 | INTOFF; |
6776 | intreceived = 0; | 6736 | intreceived = 0; |
6777 | #ifdef JOBS | 6737 | #ifdef CONFIG_ASH_JOB_CONTROL |
6778 | if (!jobctl) { | 6738 | if (!jobctl) { |
6779 | #else | 6739 | #else |
6780 | if (!iflag) { | 6740 | if (!iflag) { |
@@ -6787,7 +6747,7 @@ waitforjob(struct job *jp) | |||
6787 | while (jp->state == 0) { | 6747 | while (jp->state == 0) { |
6788 | dowait(1, jp); | 6748 | dowait(1, jp); |
6789 | } | 6749 | } |
6790 | #ifdef JOBS | 6750 | #ifdef CONFIG_ASH_JOB_CONTROL |
6791 | if (!jobctl) { | 6751 | if (!jobctl) { |
6792 | #else | 6752 | #else |
6793 | if (!iflag) { | 6753 | if (!iflag) { |
@@ -6795,7 +6755,7 @@ waitforjob(struct job *jp) | |||
6795 | sigaction(SIGINT, &oact, 0); | 6755 | sigaction(SIGINT, &oact, 0); |
6796 | if (intreceived && trap[SIGINT]) kill(getpid(), SIGINT); | 6756 | if (intreceived && trap[SIGINT]) kill(getpid(), SIGINT); |
6797 | } | 6757 | } |
6798 | #ifdef JOBS | 6758 | #ifdef CONFIG_ASH_JOB_CONTROL |
6799 | if (jp->jobctl) { | 6759 | if (jp->jobctl) { |
6800 | #ifdef OLD_TTY_DRIVER | 6760 | #ifdef OLD_TTY_DRIVER |
6801 | if (ioctl(2, TIOCSPGRP, (char *)&mypgrp) < 0) | 6761 | if (ioctl(2, TIOCSPGRP, (char *)&mypgrp) < 0) |
@@ -6805,20 +6765,20 @@ waitforjob(struct job *jp) | |||
6805 | error("tcsetpgrp failed, errno=%d\n", errno); | 6765 | error("tcsetpgrp failed, errno=%d\n", errno); |
6806 | #endif | 6766 | #endif |
6807 | } | 6767 | } |
6808 | if (jp->state == JOBSTOPPED) | 6768 | if (jp->state == CONFIG_ASH_JOB_CONTROLTOPPED) |
6809 | curjob = jp - jobtab + 1; | 6769 | curjob = jp - jobtab + 1; |
6810 | #endif | 6770 | #endif |
6811 | status = jp->ps[jp->nprocs - 1].status; | 6771 | status = jp->ps[jp->nprocs - 1].status; |
6812 | /* convert to 8 bits */ | 6772 | /* convert to 8 bits */ |
6813 | if (WIFEXITED(status)) | 6773 | if (WIFEXITED(status)) |
6814 | st = WEXITSTATUS(status); | 6774 | st = WEXITSTATUS(status); |
6815 | #ifdef JOBS | 6775 | #ifdef CONFIG_ASH_JOB_CONTROL |
6816 | else if (WIFSTOPPED(status)) | 6776 | else if (WIFSTOPPED(status)) |
6817 | st = WSTOPSIG(status) + 128; | 6777 | st = WSTOPSIG(status) + 128; |
6818 | #endif | 6778 | #endif |
6819 | else | 6779 | else |
6820 | st = WTERMSIG(status) + 128; | 6780 | st = WTERMSIG(status) + 128; |
6821 | #ifdef JOBS | 6781 | #ifdef CONFIG_ASH_JOB_CONTROL |
6822 | if (jp->jobctl) { | 6782 | if (jp->jobctl) { |
6823 | /* | 6783 | /* |
6824 | * This is truly gross. | 6784 | * This is truly gross. |
@@ -6875,7 +6835,7 @@ waitproc(int block, int *status) | |||
6875 | int flags; | 6835 | int flags; |
6876 | 6836 | ||
6877 | flags = 0; | 6837 | flags = 0; |
6878 | #ifdef JOBS | 6838 | #ifdef CONFIG_ASH_JOB_CONTROL |
6879 | if (jobctl) | 6839 | if (jobctl) |
6880 | flags |= WUNTRACED; | 6840 | flags |= WUNTRACED; |
6881 | #endif | 6841 | #endif |
@@ -6924,11 +6884,11 @@ dowait(int block, struct job *job) | |||
6924 | done = 0; | 6884 | done = 0; |
6925 | } | 6885 | } |
6926 | if (stopped) { /* stopped or done */ | 6886 | if (stopped) { /* stopped or done */ |
6927 | int state = done? JOBDONE : JOBSTOPPED; | 6887 | int state = done? JOBDONE : CONFIG_ASH_JOB_CONTROLTOPPED; |
6928 | if (jp->state != state) { | 6888 | if (jp->state != state) { |
6929 | TRACE(("Job %d: changing state from %d to %d\n", jp - jobtab + 1, jp->state, state)); | 6889 | TRACE(("Job %d: changing state from %d to %d\n", jp - jobtab + 1, jp->state, state)); |
6930 | jp->state = state; | 6890 | jp->state = state; |
6931 | #ifdef JOBS | 6891 | #ifdef CONFIG_ASH_JOB_CONTROL |
6932 | if (done && curjob == jp - jobtab + 1) | 6892 | if (done && curjob == jp - jobtab + 1) |
6933 | curjob = 0; /* no current job */ | 6893 | curjob = 0; /* no current job */ |
6934 | #endif | 6894 | #endif |
@@ -6939,7 +6899,7 @@ dowait(int block, struct job *job) | |||
6939 | INTON; | 6899 | INTON; |
6940 | if (! rootshell || ! iflag || (job && thisjob == job)) { | 6900 | if (! rootshell || ! iflag || (job && thisjob == job)) { |
6941 | core = WCOREDUMP(status); | 6901 | core = WCOREDUMP(status); |
6942 | #ifdef JOBS | 6902 | #ifdef CONFIG_ASH_JOB_CONTROL |
6943 | if (WIFSTOPPED(status)) sig = WSTOPSIG(status); | 6903 | if (WIFSTOPPED(status)) sig = WSTOPSIG(status); |
6944 | else | 6904 | else |
6945 | #endif | 6905 | #endif |
@@ -6949,7 +6909,7 @@ dowait(int block, struct job *job) | |||
6949 | if (sig != 0 && sig != SIGINT && sig != SIGPIPE) { | 6909 | if (sig != 0 && sig != SIGINT && sig != SIGPIPE) { |
6950 | if (thisjob != job) | 6910 | if (thisjob != job) |
6951 | out2fmt("%d: ", pid); | 6911 | out2fmt("%d: ", pid); |
6952 | #ifdef JOBS | 6912 | #ifdef CONFIG_ASH_JOB_CONTROL |
6953 | if (sig == SIGTSTP && rootshell && iflag) | 6913 | if (sig == SIGTSTP && rootshell && iflag) |
6954 | out2fmt("%%%ld ", | 6914 | out2fmt("%%%ld ", |
6955 | (long)(job - jobtab + 1)); | 6915 | (long)(job - jobtab + 1)); |
@@ -6990,7 +6950,7 @@ stoppedjobs(void) | |||
6990 | for (jobno = 1, jp = jobtab; jobno <= njobs; jobno++, jp++) { | 6950 | for (jobno = 1, jp = jobtab; jobno <= njobs; jobno++, jp++) { |
6991 | if (jp->used == 0) | 6951 | if (jp->used == 0) |
6992 | continue; | 6952 | continue; |
6993 | if (jp->state == JOBSTOPPED) { | 6953 | if (jp->state == CONFIG_ASH_JOB_CONTROLTOPPED) { |
6994 | out2str("You have stopped jobs.\n"); | 6954 | out2str("You have stopped jobs.\n"); |
6995 | job_warning = 2; | 6955 | job_warning = 2; |
6996 | return (1); | 6956 | return (1); |
@@ -7408,7 +7368,7 @@ static void waitonint(int sig) { | |||
7408 | return; | 7368 | return; |
7409 | } | 7369 | } |
7410 | 7370 | ||
7411 | #ifdef ASH_MAIL | 7371 | #ifdef CONFIG_ASH_MAIL |
7412 | 7372 | ||
7413 | /* | 7373 | /* |
7414 | * Routines to check for mail. | 7374 | * Routines to check for mail. |
@@ -7469,7 +7429,7 @@ chkmail(int silent) | |||
7469 | popstackmark(&smark); | 7429 | popstackmark(&smark); |
7470 | } | 7430 | } |
7471 | 7431 | ||
7472 | #endif /* ASH_MAIL */ | 7432 | #endif /* CONFIG_ASH_MAIL */ |
7473 | 7433 | ||
7474 | #define PROFILE 0 | 7434 | #define PROFILE 0 |
7475 | 7435 | ||
@@ -7636,7 +7596,7 @@ cmdloop(int top) | |||
7636 | if (iflag && top) { | 7596 | if (iflag && top) { |
7637 | inter++; | 7597 | inter++; |
7638 | showjobs(1); | 7598 | showjobs(1); |
7639 | #ifdef ASH_MAIL | 7599 | #ifdef CONFIG_ASH_MAIL |
7640 | chkmail(0); | 7600 | chkmail(0); |
7641 | #endif | 7601 | #endif |
7642 | flushall(); | 7602 | flushall(); |
@@ -8861,7 +8821,7 @@ nodexstrdup(const char *s) | |||
8861 | return rtn; | 8821 | return rtn; |
8862 | } | 8822 | } |
8863 | 8823 | ||
8864 | #ifdef ASH_GETOPTS | 8824 | #ifdef CONFIG_ASH_GETOPTS |
8865 | static int getopts (char *, char *, char **, int *, int *); | 8825 | static int getopts (char *, char *, char **, int *, int *); |
8866 | #endif | 8826 | #endif |
8867 | 8827 | ||
@@ -9135,7 +9095,7 @@ static void change_lc_ctype(const char *value) | |||
9135 | 9095 | ||
9136 | #endif | 9096 | #endif |
9137 | 9097 | ||
9138 | #ifdef ASH_GETOPTS | 9098 | #ifdef CONFIG_ASH_GETOPTS |
9139 | /* | 9099 | /* |
9140 | * The getopts builtin. Shellparam.optnext points to the next argument | 9100 | * The getopts builtin. Shellparam.optnext points to the next argument |
9141 | * to be processed. Shellparam.optptr points to the next character to | 9101 | * to be processed. Shellparam.optptr points to the next character to |
@@ -9997,7 +9957,7 @@ static int | |||
9997 | readtoken() { | 9957 | readtoken() { |
9998 | int t; | 9958 | int t; |
9999 | 9959 | ||
10000 | #ifdef ASH_ALIAS | 9960 | #ifdef CONFIG_ASH_ALIAS |
10001 | int savecheckalias = checkalias; | 9961 | int savecheckalias = checkalias; |
10002 | int savecheckkwd = checkkwd; | 9962 | int savecheckkwd = checkkwd; |
10003 | struct alias *ap; | 9963 | struct alias *ap; |
@@ -10007,13 +9967,13 @@ readtoken() { | |||
10007 | int alreadyseen = tokpushback; | 9967 | int alreadyseen = tokpushback; |
10008 | #endif | 9968 | #endif |
10009 | 9969 | ||
10010 | #ifdef ASH_ALIAS | 9970 | #ifdef CONFIG_ASH_ALIAS |
10011 | top: | 9971 | top: |
10012 | #endif | 9972 | #endif |
10013 | 9973 | ||
10014 | t = xxreadtoken(); | 9974 | t = xxreadtoken(); |
10015 | 9975 | ||
10016 | #ifdef ASH_ALIAS | 9976 | #ifdef CONFIG_ASH_ALIAS |
10017 | checkalias = savecheckalias; | 9977 | checkalias = savecheckalias; |
10018 | #endif | 9978 | #endif |
10019 | 9979 | ||
@@ -10051,7 +10011,7 @@ top: | |||
10051 | } | 10011 | } |
10052 | } else if (checkalias == 2 && isassignment(wordtext)) { | 10012 | } else if (checkalias == 2 && isassignment(wordtext)) { |
10053 | lasttoken = t = TASSIGN; | 10013 | lasttoken = t = TASSIGN; |
10054 | #ifdef ASH_ALIAS | 10014 | #ifdef CONFIG_ASH_ALIAS |
10055 | } else if (checkalias) { | 10015 | } else if (checkalias) { |
10056 | if (!quoteflag && (ap = *__lookupalias(wordtext)) != NULL && !(ap->flag & ALIASINUSE)) { | 10016 | if (!quoteflag && (ap = *__lookupalias(wordtext)) != NULL && !(ap->flag & ALIASINUSE)) { |
10057 | if (*ap->val) { | 10017 | if (*ap->val) { |
@@ -10125,7 +10085,7 @@ xxreadtoken() { | |||
10125 | c = pgetc_macro(); | 10085 | c = pgetc_macro(); |
10126 | 10086 | ||
10127 | if ((c!=' ') && (c!='\t') | 10087 | if ((c!=' ') && (c!='\t') |
10128 | #ifdef ASH_ALIAS | 10088 | #ifdef CONFIG_ASH_ALIAS |
10129 | && (c!=PEOA) | 10089 | && (c!=PEOA) |
10130 | #endif | 10090 | #endif |
10131 | ) { | 10091 | ) { |
@@ -10191,7 +10151,7 @@ xxreadtoken() { | |||
10191 | c = pgetc_macro(); | 10151 | c = pgetc_macro(); |
10192 | switch (c) { | 10152 | switch (c) { |
10193 | case ' ': case '\t': | 10153 | case ' ': case '\t': |
10194 | #ifdef ASH_ALIAS | 10154 | #ifdef CONFIG_ASH_ALIAS |
10195 | case PEOA: | 10155 | case PEOA: |
10196 | #endif | 10156 | #endif |
10197 | continue; | 10157 | continue; |
@@ -10394,7 +10354,7 @@ readtoken1(int firstc, int syntax, const char *eofmark, int striptabs) | |||
10394 | USTPUTC(c, out); | 10354 | USTPUTC(c, out); |
10395 | } | 10355 | } |
10396 | break; | 10356 | break; |
10397 | #ifdef ASH_MATH_SUPPORT | 10357 | #ifdef CONFIG_ASH_MATH_SUPPORT |
10398 | case CLP: /* '(' in arithmetic */ | 10358 | case CLP: /* '(' in arithmetic */ |
10399 | parenlevel++; | 10359 | parenlevel++; |
10400 | USTPUTC(c, out); | 10360 | USTPUTC(c, out); |
@@ -10435,7 +10395,7 @@ readtoken1(int firstc, int syntax, const char *eofmark, int striptabs) | |||
10435 | default: | 10395 | default: |
10436 | if (varnest == 0) | 10396 | if (varnest == 0) |
10437 | goto endword; /* exit outer loop */ | 10397 | goto endword; /* exit outer loop */ |
10438 | #ifdef ASH_ALIAS | 10398 | #ifdef CONFIG_ASH_ALIAS |
10439 | if (c != PEOA) | 10399 | if (c != PEOA) |
10440 | #endif | 10400 | #endif |
10441 | USTPUTC(c, out); | 10401 | USTPUTC(c, out); |
@@ -10484,7 +10444,7 @@ endword: | |||
10484 | 10444 | ||
10485 | checkend: { | 10445 | checkend: { |
10486 | if (eofmark) { | 10446 | if (eofmark) { |
10487 | #ifdef ASH_ALIAS | 10447 | #ifdef CONFIG_ASH_ALIAS |
10488 | if (c == PEOA) { | 10448 | if (c == PEOA) { |
10489 | c = pgetc2(); | 10449 | c = pgetc2(); |
10490 | } | 10450 | } |
@@ -10765,7 +10725,7 @@ parsebackq: { | |||
10765 | /* fall through */ | 10725 | /* fall through */ |
10766 | 10726 | ||
10767 | case PEOF: | 10727 | case PEOF: |
10768 | #ifdef ASH_ALIAS | 10728 | #ifdef CONFIG_ASH_ALIAS |
10769 | case PEOA: | 10729 | case PEOA: |
10770 | #endif | 10730 | #endif |
10771 | startlinno = plinno; | 10731 | startlinno = plinno; |
@@ -11768,7 +11728,7 @@ setsignal(int signo) | |||
11768 | if (iflag) | 11728 | if (iflag) |
11769 | action = S_IGN; | 11729 | action = S_IGN; |
11770 | break; | 11730 | break; |
11771 | #ifdef JOBS | 11731 | #ifdef CONFIG_ASH_JOB_CONTROL |
11772 | case SIGTSTP: | 11732 | case SIGTSTP: |
11773 | case SIGTTOU: | 11733 | case SIGTTOU: |
11774 | if (mflag) | 11734 | if (mflag) |
@@ -11892,7 +11852,7 @@ exitshell(int status) | |||
11892 | } | 11852 | } |
11893 | l1: handler = &loc2; /* probably unnecessary */ | 11853 | l1: handler = &loc2; /* probably unnecessary */ |
11894 | flushall(); | 11854 | flushall(); |
11895 | #ifdef JOBS | 11855 | #ifdef CONFIG_ASH_JOB_CONTROL |
11896 | setjobctl(0); | 11856 | setjobctl(0); |
11897 | #endif | 11857 | #endif |
11898 | l2: _exit(status); | 11858 | l2: _exit(status); |
@@ -12031,7 +11991,7 @@ setvareq(char *s, int flags) | |||
12031 | vp->flags |= flags; | 11991 | vp->flags |= flags; |
12032 | vp->text = s; | 11992 | vp->text = s; |
12033 | 11993 | ||
12034 | #ifdef ASH_MAIL | 11994 | #ifdef CONFIG_ASH_MAIL |
12035 | /* | 11995 | /* |
12036 | * We could roll this to a function, to handle it as | 11996 | * We could roll this to a function, to handle it as |
12037 | * a regular variable function callback, but why bother? | 11997 | * a regular variable function callback, but why bother? |
@@ -12470,7 +12430,7 @@ findvar(struct var **vpp, const char *name) | |||
12470 | /* | 12430 | /* |
12471 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> | 12431 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> |
12472 | * This file contains code for the times builtin. | 12432 | * This file contains code for the times builtin. |
12473 | * $Id: ash.c,v 1.45 2001/12/31 06:16:54 aaronl Exp $ | 12433 | * $Id: ash.c,v 1.46 2002/01/09 15:37:36 andersen Exp $ |
12474 | */ | 12434 | */ |
12475 | static int timescmd (int argc, char **argv) | 12435 | static int timescmd (int argc, char **argv) |
12476 | { | 12436 | { |
@@ -12490,7 +12450,7 @@ static int timescmd (int argc, char **argv) | |||
12490 | return 0; | 12450 | return 0; |
12491 | } | 12451 | } |
12492 | 12452 | ||
12493 | #ifdef ASH_MATH_SUPPORT | 12453 | #ifdef CONFIG_ASH_MATH_SUPPORT |
12494 | /* The let builtin. */ | 12454 | /* The let builtin. */ |
12495 | int letcmd(int argc, char **argv) | 12455 | int letcmd(int argc, char **argv) |
12496 | { | 12456 | { |
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 | |||
30 | fi | 30 | fi |
31 | 31 | ||
32 | bool 'ash' CONFIG_ASH | 32 | bool 'ash' CONFIG_ASH |
33 | if [ "$CONFIG_ASH" = "y" ] ; then | ||
34 | comment 'Ash Shell Options' | ||
35 | bool 'Enable Job control' CONFIG_ASH_JOB_CONTROL | ||
36 | bool 'Enable alias support' CONFIG_ASH_ALIAS | ||
37 | bool 'Enable Posix math support' CONFIG_ASH_MATH_SUPPORT | ||
38 | bool 'Enable getopt builtin to parse positional parameters' CONFIG_ASH_GETOPTS | ||
39 | bool 'Enable cmdcmd to override shell builtins' CONFIG_ASH_CMDCMD | ||
40 | bool 'Check for new mail on interactive shells' CONFIG_ASH_MAIL | ||
41 | bool 'Optimize for size instead of speed' CONFIG_ASH_OPTIMIZE_FOR_SIZE | ||
42 | comment '' | ||
43 | fi | ||
44 | |||
33 | bool 'hush' CONFIG_HUSH | 45 | bool 'hush' CONFIG_HUSH |
34 | bool 'lash' CONFIG_LASH | 46 | bool 'lash' CONFIG_LASH |
35 | bool 'msh' CONFIG_MSH | 47 | bool 'msh' CONFIG_MSH |
36 | 48 | ||
49 | |||
37 | comment 'Bourne Shell Options' | 50 | comment 'Bourne Shell Options' |
38 | bool 'command line editing' CONFIG_FEATURE_COMMAND_EDITING | 51 | bool 'command line editing' CONFIG_FEATURE_COMMAND_EDITING |
39 | bool 'tab completion' CONFIG_FEATURE_COMMAND_TAB_COMPLETION | 52 | bool 'tab completion' CONFIG_FEATURE_COMMAND_TAB_COMPLETION |