ash: convert #ifdef CONFIG_ to #if ENABLE_
diff --git a/shell/ash.c b/shell/ash.c
index a4ce3ff..9815321 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -82,13 +82,13 @@
#include <time.h>
#include <fnmatch.h>
-#ifdef CONFIG_ASH_JOB_CONTROL
+#if ENABLE_ASH_JOB_CONTROL
#define JOBS 1
#else
#define JOBS 0
#endif
-#if JOBS || defined(CONFIG_ASH_READ_NCHARS)
+#if JOBS || ENABLE_ASH_READ_NCHARS
#include <termios.h>
#endif
@@ -111,7 +111,7 @@
#endif
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
/* alias.h */
#define ALIASINUSE 1
@@ -225,7 +225,7 @@
static void sh_warnx(const char *, ...);
-#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE
+#if ENABLE_ASH_OPTIMIZE_FOR_SIZE
static void
inton(void) {
if (--suppressint == 0 && intpending) {
@@ -254,7 +254,7 @@
if (intpending) onint(); \
0; \
})
-#endif /* CONFIG_ASH_OPTIMIZE_FOR_SIZE */
+#endif /* ASH_OPTIMIZE_FOR_SIZE */
/* expand.h */
@@ -289,7 +289,7 @@
static char *_rmescapes(char *, int);
static int casematch(union node *, char *);
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
static void expari(int);
#endif
@@ -340,7 +340,6 @@
#define NNOT 25
-
struct ncmd {
int type;
union node *assign;
@@ -348,28 +347,24 @@
union node *redirect;
};
-
struct npipe {
int type;
int backgnd;
struct nodelist *cmdlist;
};
-
struct nredir {
int type;
union node *n;
union node *redirect;
};
-
struct nbinary {
int type;
union node *ch1;
union node *ch2;
};
-
struct nif {
int type;
union node *test;
@@ -377,7 +372,6 @@
union node *elsepart;
};
-
struct nfor {
int type;
union node *args;
@@ -385,14 +379,12 @@
char *var;
};
-
struct ncase {
int type;
union node *expr;
union node *cases;
};
-
struct nclist {
int type;
union node *next;
@@ -400,7 +392,6 @@
union node *body;
};
-
struct narg {
int type;
union node *next;
@@ -408,7 +399,6 @@
struct nodelist *backquote;
};
-
struct nfile {
int type;
union node *next;
@@ -417,7 +407,6 @@
char *expfname;
};
-
struct ndup {
int type;
union node *next;
@@ -426,7 +415,6 @@
union node *vname;
};
-
struct nhere {
int type;
union node *next;
@@ -434,13 +422,11 @@
union node *doc;
};
-
struct nnot {
int type;
union node *com;
};
-
union node {
int type;
struct ncmd ncmd;
@@ -458,13 +444,11 @@
struct nnot nnot;
};
-
struct nodelist {
struct nodelist *next;
union node *n;
};
-
struct funcnode {
int count;
union node n;
@@ -529,7 +513,7 @@
struct strpush *prev; /* preceding string on stack */
char *prevstring;
int prevnleft;
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
struct alias *ap; /* if push was associated with an alias */
#endif
char *string; /* remember the string since it may change */
@@ -709,7 +693,7 @@
#define CSPCL 13 /* these terminate a word */
#define CIGN 14 /* character should be ignored */
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
#define SYNBASE 130
#define PEOF -130
#define PEOA -129
@@ -741,7 +725,7 @@
* This file was generated by the mksyntax program.
*/
-#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE
+#if ENABLE_ASH_OPTIMIZE_FOR_SIZE
#define USE_SIT_FUNCTION
#endif
@@ -751,9 +735,9 @@
#define SQSYNTAX 2 /* in single quotes */
#define ARISYNTAX 3 /* in arithmetic */
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
static const char S_I_T[][4] = {
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
{CSPCL, CIGN, CIGN, CIGN}, /* 0, PEOA */
#endif
{CSPCL, CWORD, CWORD, CWORD}, /* 1, ' ' */
@@ -775,7 +759,7 @@
};
#else
static const char S_I_T[][3] = {
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
{CSPCL, CIGN, CIGN}, /* 0, PEOA */
#endif
{CSPCL, CWORD, CWORD}, /* 1, ' ' */
@@ -795,7 +779,7 @@
{CCTL, CCTL, CCTL} /* 14, CTLESC ... */
#endif
};
-#endif /* CONFIG_ASH_MATH_SUPPORT */
+#endif /* ASH_MATH_SUPPORT */
#ifdef USE_SIT_FUNCTION
@@ -804,7 +788,7 @@
static int SIT(int c, int syntax)
{
static const char spec_symbls[] = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~";
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
static const char syntax_index_table[] = {
1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */
7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */
@@ -824,7 +808,7 @@
if (c == PEOF) /* 2^8+2 */
return CENDFILE;
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
if (c == PEOA) /* 2^8+1 */
indx = 0;
else
@@ -844,7 +828,7 @@
#define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax]
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
#define CSPCL_CIGN_CIGN_CIGN 0
#define CSPCL_CWORD_CWORD_CWORD 1
#define CNL_CNL_CNL_CNL 2
@@ -880,7 +864,7 @@
static const char syntax_index_table[258] = {
/* BASESYNTAX_DQSYNTAX_SQSYNTAX_ARISYNTAX */
/* 0 PEOF */ CENDFILE_CENDFILE_CENDFILE_CENDFILE,
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
/* 1 PEOA */ CSPCL_CIGN_CIGN_CIGN,
#endif
/* 2 -128 0x80 */ CWORD_CWORD_CWORD_CWORD,
@@ -1215,15 +1199,15 @@
#endif
static int breakcmd(int, char **);
static int cdcmd(int, char **);
-#ifdef CONFIG_ASH_CMDCMD
+#if ENABLE_ASH_CMDCMD
static int commandcmd(int, char **);
#endif
static int dotcmd(int, char **);
static int evalcmd(int, char **);
-#ifdef CONFIG_ASH_BUILTIN_ECHO
+#if ENABLE_ASH_BUILTIN_ECHO
static int echocmd(int, char **);
#endif
-#ifdef CONFIG_ASH_BUILTIN_TEST
+#if ENABLE_ASH_BUILTIN_TEST
static int testcmd(int, char **);
#endif
static int execcmd(int, char **);
@@ -1233,7 +1217,7 @@
#if JOBS
static int fgcmd(int, char **);
#endif
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
static int getoptscmd(int, char **);
#endif
static int hashcmd(int, char **);
@@ -1243,7 +1227,7 @@
#if JOBS
static int jobscmd(int, char **);
#endif
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
static int letcmd(int, char **);
#endif
static int localcmd(int, char **);
@@ -1266,7 +1250,7 @@
/* mail.h */
-#ifdef CONFIG_ASH_MAIL
+#if ENABLE_ASH_MAIL
static void chkmail(void);
static void changemail(const char *);
#endif
@@ -1314,11 +1298,11 @@
static const struct builtincmd builtincmd[] = {
{ BUILTIN_SPEC_REG ".", dotcmd },
{ BUILTIN_SPEC_REG ":", truecmd },
-#ifdef CONFIG_ASH_BUILTIN_TEST
+#if ENABLE_ASH_BUILTIN_TEST
{ BUILTIN_REGULAR "[", testcmd },
{ BUILTIN_REGULAR "[[", testcmd },
#endif
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
{ BUILTIN_REG_ASSG "alias", aliascmd },
#endif
#if JOBS
@@ -1327,11 +1311,11 @@
{ BUILTIN_SPEC_REG "break", breakcmd },
{ BUILTIN_REGULAR "cd", cdcmd },
{ BUILTIN_NOSPEC "chdir", cdcmd },
-#ifdef CONFIG_ASH_CMDCMD
+#if ENABLE_ASH_CMDCMD
{ BUILTIN_REGULAR "command", commandcmd },
#endif
{ BUILTIN_SPEC_REG "continue", breakcmd },
-#ifdef CONFIG_ASH_BUILTIN_ECHO
+#if ENABLE_ASH_BUILTIN_ECHO
{ BUILTIN_REGULAR "echo", echocmd },
#endif
{ BUILTIN_SPEC_REG "eval", evalcmd },
@@ -1342,7 +1326,7 @@
#if JOBS
{ BUILTIN_REGULAR "fg", fgcmd },
#endif
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
{ BUILTIN_REGULAR "getopts", getoptscmd },
#endif
{ BUILTIN_NOSPEC "hash", hashcmd },
@@ -1353,7 +1337,7 @@
{ BUILTIN_REGULAR "jobs", jobscmd },
{ BUILTIN_REGULAR "kill", killcmd },
#endif
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
{ BUILTIN_NOSPEC "let", letcmd },
#endif
{ BUILTIN_ASSIGN "local", localcmd },
@@ -1364,7 +1348,7 @@
{ BUILTIN_SPEC_REG "set", setcmd },
{ BUILTIN_SPEC_REG "shift", shiftcmd },
{ BUILTIN_SPEC_REG "source", dotcmd },
-#ifdef CONFIG_ASH_BUILTIN_TEST
+#if ENABLE_ASH_BUILTIN_TEST
{ BUILTIN_REGULAR "test", testcmd },
#endif
{ BUILTIN_SPEC_REG "times", timescmd },
@@ -1373,7 +1357,7 @@
{ BUILTIN_NOSPEC "type", typecmd },
{ BUILTIN_NOSPEC "ulimit", ulimitcmd },
{ BUILTIN_REGULAR "umask", umaskcmd },
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
{ BUILTIN_REGULAR "unalias", unaliascmd },
#endif
{ BUILTIN_SPEC_REG "unset", unsetcmd },
@@ -1411,7 +1395,7 @@
static void defun(char *, union node *);
static void unsetfunc(const char *);
-#ifdef CONFIG_ASH_MATH_SUPPORT_64
+#if ENABLE_ASH_MATH_SUPPORT_64
typedef int64_t arith_t;
#define arith_t_type (long long)
#else
@@ -1419,12 +1403,12 @@
#define arith_t_type (long)
#endif
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
static arith_t dash_arith(const char *);
static arith_t arith(const char *expr, int *perrcode);
#endif
-#ifdef CONFIG_ASH_RANDOM_SUPPORT
+#if ENABLE_ASH_RANDOM_SUPPORT
static unsigned long rseed;
static void change_random(const char *);
# ifndef DYNAMIC_VAR
@@ -1480,11 +1464,11 @@
* Shell variables.
*/
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
static void getoptsreset(const char *);
#endif
-#ifdef CONFIG_LOCALE_SUPPORT
+#if ENABLE_LOCALE_SUPPORT
static void change_lc_all(const char *value);
static void change_lc_ctype(const char *value);
#endif
@@ -1508,7 +1492,7 @@
{ 0, VSTRFIXED|VTEXTFIXED|VUNSET, "IFS\0", 0 },
#endif
-#ifdef CONFIG_ASH_MAIL
+#if ENABLE_ASH_MAIL
{ 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL\0", changemail },
{ 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH\0", changemail },
#endif
@@ -1517,13 +1501,13 @@
{ 0, VSTRFIXED|VTEXTFIXED, "PS1=$ ", 0 },
{ 0, VSTRFIXED|VTEXTFIXED, "PS2=> ", 0 },
{ 0, VSTRFIXED|VTEXTFIXED, "PS4=+ ", 0 },
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
{ 0, VSTRFIXED|VTEXTFIXED, "OPTIND=1", getoptsreset },
#endif
-#ifdef CONFIG_ASH_RANDOM_SUPPORT
+#if ENABLE_ASH_RANDOM_SUPPORT
{0, VSTRFIXED|VTEXTFIXED|VUNSET|VDYNAMIC, "RANDOM\0", change_random },
#endif
-#ifdef CONFIG_LOCALE_SUPPORT
+#if ENABLE_LOCALE_SUPPORT
{0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_ALL\0", change_lc_all },
{0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_CTYPE\0", change_lc_ctype },
#endif
@@ -1533,7 +1517,7 @@
};
#define vifs varinit[0]
-#ifdef CONFIG_ASH_MAIL
+#if ENABLE_ASH_MAIL
#define vmail (&vifs)[1]
#define vmpath (&vmail)[1]
#else
@@ -1544,7 +1528,7 @@
#define vps2 (&vps1)[1]
#define vps4 (&vps2)[1]
#define voptind (&vps4)[1]
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
#define vrandom (&voptind)[1]
#else
#define vrandom (&vps4)[1]
@@ -1579,7 +1563,7 @@
static int showvars(const char *, int, int);
static void poplocalvars(void);
static int unsetvar(const char *);
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
static int setvarsafe(const char *, const char *, int);
#endif
static int varcmp(const char *, const char *);
@@ -1905,7 +1889,7 @@
int nparam; /* # of positional parameters (without $0) */
unsigned char malloc; /* if parameter list dynamically allocated */
char **p; /* parameter list */
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
int optind; /* next parameter to be processed by getopts */
int optoff; /* used by getopts */
#endif
@@ -2093,7 +2077,7 @@
}
}
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
static struct alias *atab[ATABSIZE];
static void setalias(const char *, const char *);
@@ -2274,7 +2258,7 @@
return app;
}
-#endif /* CONFIG_ASH_ALIAS */
+#endif /* ASH_ALIAS */
/* cd.c */
@@ -2531,7 +2515,6 @@
*/
-
static void exverror(int, const char *, va_list) ATTRIBUTE_NORETURN;
/*
@@ -2668,7 +2651,6 @@
errmsg(int e, const char *em)
{
if (e == ENOENT || e == ENOTDIR) {
-
return em;
}
return strerror(e);
@@ -2771,7 +2753,6 @@
}
-
/*
* Evaluate a parse tree. The value is left in the global variable
* exitstatus.
@@ -2933,7 +2914,6 @@
}
-
static void
evalfor(union node *n, int flags)
{
@@ -3002,7 +2982,6 @@
}
-
/*
* Kick off a subshell to evaluate a tree.
*/
@@ -3037,7 +3016,6 @@
}
-
/*
* Compute the names of the files in a redirection list.
*/
@@ -3075,7 +3053,6 @@
}
-
/*
* Evaluate a pipeline. All the processes in the pipeline are children
* of the process creating the pipeline. (This differs from some versions
@@ -3138,7 +3115,6 @@
}
-
/*
* Execute a command inside back quotes. If it's a builtin command, we
* want to save its output in a block obtained from malloc. Otherwise
@@ -3191,7 +3167,7 @@
result->fd, result->buf, result->nleft, result->jp));
}
-#ifdef CONFIG_ASH_CMDCMD
+#if ENABLE_ASH_CMDCMD
static char ** parse_command_args(char **argv, const char **path)
{
char *cp, c;
@@ -3231,7 +3207,7 @@
return *q == '=';
}
-#ifdef CONFIG_ASH_EXPAND_PRMT
+#if ENABLE_ASH_EXPAND_PRMT
static const char *expandstr(const char *ps);
#else
#define expandstr(s) s
@@ -3373,7 +3349,7 @@
spclbltin = IS_BUILTIN_SPECIAL(cmdentry.u.cmd);
if (cmdentry.u.cmd == EXECCMD)
cmd_is_exec++;
-#ifdef CONFIG_ASH_CMDCMD
+#if ENABLE_ASH_CMDCMD
if (cmdentry.u.cmd == COMMANDCMD) {
path = oldpath;
@@ -3523,7 +3499,7 @@
INTON;
shellparam.nparam = argc - 1;
shellparam.p = argv + 1;
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
shellparam.optind = 1;
shellparam.optoff = -1;
#endif
@@ -3768,7 +3744,7 @@
#if ENABLE_FEATURE_SH_STANDALONE_SHELL
if (find_applet_by_name(cmd) != NULL) {
/* re-exec ourselves with the new arguments */
- execve(CONFIG_BUSYBOX_EXEC_PATH,argv,envp);
+ execve(CONFIG_BUSYBOX_EXEC_PATH, argv, envp);
/* If they called chroot or otherwise made the binary no longer
* executable, fall through */
}
@@ -4115,7 +4091,6 @@
}
-
/*
* Called when a cd is done. Marks all commands so the next time they
* are executed they will be rehashed.
@@ -4140,7 +4115,6 @@
}
-
/*
* Fix command hash table when PATH changed.
* Called before PATH is changed. The argument is the new value of PATH;
@@ -4357,7 +4331,7 @@
*/
-#ifdef CONFIG_ASH_CMDCMD
+#if ENABLE_ASH_CMDCMD
static int
describe_command(char *command, int describe_command_verbose)
#else
@@ -4368,7 +4342,7 @@
{
struct cmdentry entry;
struct tblentry *cmdp;
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
const struct alias *ap;
#endif
const char *path = pathval();
@@ -4383,7 +4357,7 @@
goto out;
}
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
/* Then look at the aliases */
if ((ap = lookupalias(command, 0)) != NULL) {
if (describe_command_verbose) {
@@ -4465,7 +4439,7 @@
int err = 0;
for (i = 1; i < argc; i++) {
-#ifdef CONFIG_ASH_CMDCMD
+#if ENABLE_ASH_CMDCMD
err |= describe_command(argv[i], 1);
#else
err |= describe_command(argv[i]);
@@ -4474,7 +4448,7 @@
return err;
}
-#ifdef CONFIG_ASH_CMDCMD
+#if ENABLE_ASH_CMDCMD
static int
commandcmd(int argc, char **argv)
{
@@ -4670,7 +4644,7 @@
CTLVAR,
CTLBACKQ,
CTLBACKQ | CTLQUOTE,
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
CTLENDARI,
#endif
0
@@ -4707,7 +4681,7 @@
length += strcspn(p + length, reject);
c = p[length];
if (c && (!(c & 0x80)
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
|| c == CTLENDARI
#endif
)) {
@@ -4785,7 +4759,7 @@
expbackq(argbackq->n, c, quotes);
argbackq = argbackq->next;
goto start;
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
case CTLENDARI:
p--;
expari(quotes);
@@ -4886,7 +4860,7 @@
}
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
/*
* Expand arithmetic expression. Backup to start of expression,
* evaluate, place result in (backed up) result, adjust string position.
@@ -5474,7 +5448,6 @@
int ifsspc;
int nulonly;
-
start = string;
if (ifslastp != NULL) {
ifsspc = 0;
@@ -5790,7 +5763,7 @@
p = msort(p, len - half); /* sort second half */
lpp = &list;
for (;;) {
-#ifdef CONFIG_LOCALE_SUPPORT
+#if ENABLE_LOCALE_SUPPORT
if (strcoll(p->text, q->text) < 0)
#else
if (strcmp(p->text, q->text) < 0)
@@ -5925,7 +5898,7 @@
int len;
expdest = makestrspace(32, expdest);
-#ifdef CONFIG_ASH_MATH_SUPPORT_64
+#if ENABLE_ASH_MATH_SUPPORT_64
len = fmtstr(expdest, 32, "%lld", (long long) num);
#else
len = fmtstr(expdest, 32, "%ld", num);
@@ -5971,7 +5944,7 @@
#define pgetc_as_macro() (--parsenleft >= 0? SC2INT(*parsenextc++) : preadbuffer())
-#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE
+#if ENABLE_ASH_OPTIMIZE_FOR_SIZE
#define pgetc_macro() pgetc()
static int
pgetc(void)
@@ -5991,7 +5964,7 @@
/*
* Same as pgetc(), but ignores PEOA.
*/
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
static int pgetc2(void)
{
int c;
@@ -6131,7 +6104,7 @@
char savec;
while (parsefile->strpush) {
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
if (parsenleft == -1 && parsefile->strpush->ap &&
parsenextc[-1] != ' ' && parsenextc[-1] != '\t') {
return PEOA;
@@ -6227,7 +6200,7 @@
sp = parsefile->strpush = &(parsefile->basestrpush);
sp->prevstring = parsenextc;
sp->prevnleft = parsenleft;
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
sp->ap = (struct alias *)ap;
if (ap) {
((struct alias *)ap)->flag |= ALIASINUSE;
@@ -6245,7 +6218,7 @@
struct strpush *sp = parsefile->strpush;
INTOFF;
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
if (sp->ap) {
if (parsenextc[-1] == ' ' || parsenextc[-1] == '\t') {
checkkwd |= CHKALIAS;
@@ -7705,7 +7678,7 @@
case CTLBACKQ+CTLQUOTE:
str = "\"$(...)\"";
goto dostr;
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
case CTLARI:
str = "$((";
goto dostr;
@@ -7805,7 +7778,7 @@
return retval;
}
-#ifdef CONFIG_ASH_MAIL
+#if ENABLE_ASH_MAIL
/* mail.c */
/*
@@ -7875,7 +7848,7 @@
mail_var_path_changed++;
}
-#endif /* CONFIG_ASH_MAIL */
+#endif /* ASH_MAIL */
/* main.c */
@@ -7951,7 +7924,7 @@
#endif
rootpid = getpid();
-#ifdef CONFIG_ASH_RANDOM_SUPPORT
+#if ENABLE_ASH_RANDOM_SUPPORT
rseed = rootpid + ((time_t)time((time_t *)0));
#endif
init();
@@ -8048,7 +8021,7 @@
inter = 0;
if (iflag && top) {
inter++;
-#ifdef CONFIG_ASH_MAIL
+#if ENABLE_ASH_MAIL
chkmail();
#endif
}
@@ -8192,7 +8165,7 @@
/* NOTREACHED */
}
-#ifdef CONFIG_ASH_BUILTIN_ECHO
+#if ENABLE_ASH_BUILTIN_ECHO
static int
echocmd(int argc, char **argv)
{
@@ -8200,7 +8173,7 @@
}
#endif
-#ifdef CONFIG_ASH_BUILTIN_TEST
+#if ENABLE_ASH_BUILTIN_TEST
static int
testcmd(int argc, char **argv)
{
@@ -8853,7 +8826,7 @@
}
shellparam.p = xargv;
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
shellparam.optind = 1;
shellparam.optoff = -1;
#endif
@@ -8965,7 +8938,6 @@
}
-
/*
* Set the shell parameters.
*/
@@ -8987,7 +8959,7 @@
shellparam.malloc = 1;
shellparam.nparam = nparam;
shellparam.p = newparam;
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
shellparam.optind = 1;
shellparam.optoff = -1;
#endif
@@ -9011,7 +8983,6 @@
}
-
/*
* The shift builtin command.
*/
@@ -9035,7 +9006,7 @@
}
ap2 = shellparam.p;
while ((*ap2++ = *ap1++) != NULL);
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
shellparam.optind = 1;
shellparam.optoff = -1;
#endif
@@ -9044,7 +9015,6 @@
}
-
/*
* The set command builtin.
*/
@@ -9065,7 +9035,7 @@
}
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
static void
getoptsreset(const char *value)
{
@@ -9074,7 +9044,7 @@
}
#endif
-#ifdef CONFIG_LOCALE_SUPPORT
+#if ENABLE_LOCALE_SUPPORT
static void change_lc_all(const char *value)
{
if (value != 0 && *value != 0)
@@ -9089,7 +9059,7 @@
#endif
-#ifdef CONFIG_ASH_RANDOM_SUPPORT
+#if ENABLE_ASH_RANDOM_SUPPORT
/* Roughly copied from bash.. */
static void change_random(const char *value)
{
@@ -9110,7 +9080,7 @@
#endif
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
static int
getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *optoff)
{
@@ -9232,7 +9202,7 @@
return getopts(argv[1], argv[2], optbase, &shellparam.optind,
&shellparam.optoff);
}
-#endif /* CONFIG_ASH_GETOPTS */
+#endif /* ASH_GETOPTS */
/*
* XXX - should get rid of. have all builtins use getopt(3). the
@@ -9345,7 +9315,6 @@
}
-
/* parser.c */
@@ -9386,8 +9355,6 @@
static void setprompt(int);
-
-
/*
* Read and parse a command. Returns NEOF on end of file. (NULL is a
* valid parse tree indicating a blank line.)
@@ -9482,7 +9449,6 @@
}
-
static union node *
andor(void)
{
@@ -9510,7 +9476,6 @@
}
-
static union node *
pipeline(void)
{
@@ -9554,7 +9519,6 @@
}
-
static union node *
command(void)
{
@@ -9604,7 +9568,8 @@
n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL;
n1->nbinary.ch1 = list(0);
if ((got=readtoken()) != TDO) {
-TRACE(("expecting DO got %s %s\n", tokname(got), got == TWORD ? wordtext : ""));
+ TRACE(("expecting DO got %s %s\n", tokname(got),
+ got == TWORD ? wordtext : ""));
synexpect(TDO);
}
n1->nbinary.ch2 = list(0);
@@ -9942,7 +9907,7 @@
int alreadyseen = tokpushback;
#endif
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
top:
#endif
@@ -9976,7 +9941,7 @@
}
if (checkkwd & CHKALIAS) {
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
struct alias *ap;
if ((ap = lookupalias(wordtext, 1)) != NULL) {
if (*ap->val) {
@@ -10050,7 +10015,7 @@
c = pgetc_macro();
if ((c != ' ') && (c != '\t')
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
&& (c != PEOA)
#endif
) {
@@ -10117,7 +10082,7 @@
c = pgetc_macro();
switch (c) {
case ' ': case '\t':
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
case PEOA:
#endif
continue;
@@ -10317,7 +10282,7 @@
USTPUTC(c, out);
}
break;
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
case CLP: /* '(' in arithmetic */
parenlevel++;
USTPUTC(c, out);
@@ -10358,7 +10323,7 @@
default:
if (varnest == 0)
goto endword; /* exit outer loop */
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
if (c != PEOA)
#endif
USTPUTC(c, out);
@@ -10368,7 +10333,7 @@
}
}
endword:
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
if (syntax == ARISYNTAX)
synerror("Missing '))'");
#endif
@@ -10402,7 +10367,6 @@
/* end of readtoken routine */
-
/*
* Check to see whether we are at the end of the here document. When this
* is called, c is set to the first character of the next input line. If
@@ -10411,7 +10375,7 @@
checkend: {
if (eofmark) {
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
if (c == PEOA) {
c = pgetc2();
}
@@ -10526,7 +10490,7 @@
pungetc();
} else if (c == '(') { /* $(command) or $((arith)) */
if (pgetc() == '(') {
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
PARSEARITH();
#else
synerror("We unsupport $((arith))");
@@ -10691,7 +10655,7 @@
/* fall through */
case PEOF:
-#ifdef CONFIG_ASH_ALIAS
+#if ENABLE_ASH_ALIAS
case PEOA:
#endif
startlinno = plinno;
@@ -10768,7 +10732,7 @@
goto parsebackq_newreturn;
}
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
/*
* Parse an arithmetic expansion (indicate start of one and set state)
*/
@@ -10795,7 +10759,6 @@
} /* end of readtoken */
-
/*
* Returns true if the text contains nothing to expand (no dollar signs
* or backquotes).
@@ -10872,7 +10835,7 @@
* should be added here.
*/
-#ifdef CONFIG_ASH_EXPAND_PRMT
+#if ENABLE_ASH_EXPAND_PRMT
static const char *
expandstr(const char *ps)
{
@@ -10896,7 +10859,7 @@
static void setprompt(int whichprompt)
{
const char *prompt;
-#ifdef CONFIG_ASH_EXPAND_PRMT
+#if ENABLE_ASH_EXPAND_PRMT
struct stackmark smark;
#endif
@@ -10912,12 +10875,12 @@
default: /* 0 */
prompt = nullstr;
}
-#ifdef CONFIG_ASH_EXPAND_PRMT
+#if ENABLE_ASH_EXPAND_PRMT
setstackmark(&smark);
stalloc(stackblocksize());
#endif
putprompt(expandstr(prompt));
-#ifdef CONFIG_ASH_EXPAND_PRMT
+#if ENABLE_ASH_EXPAND_PRMT
popstackmark(&smark);
#endif
}
@@ -11113,7 +11076,6 @@
copyfd(f, fd);
close(f);
}
- return;
}
/*
@@ -11386,7 +11348,6 @@
}
-
static void
sharg(union node *arg, FILE *fp)
{
@@ -11484,7 +11445,6 @@
}
-
/*
* Debugging stuff.
*/
@@ -11639,7 +11599,6 @@
#define S_RESET 5 /* temporary - to reset a hard ignored sig */
-
/*
* The trap builtin.
*/
@@ -11928,7 +11887,7 @@
out1fmt("\n\n");
return EXIT_SUCCESS;
}
-#endif /* CONFIG_FEATURE_SH_EXTRA_QUIET */
+#endif /* FEATURE_SH_EXTRA_QUIET */
/*
* Called to exit the shell.
@@ -11976,7 +11935,7 @@
*/
-#ifdef CONFIG_ASH_GETOPTS
+#if ENABLE_ASH_GETOPTS
/*
* Safe version of setvar, returns 1 on success 0 on failure.
*/
@@ -12223,7 +12182,6 @@
}
-
/*
* The export and readonly commands.
*/
@@ -12433,7 +12391,6 @@
}
-
/*
* Find the appropriate entry in the hash table from the name.
*/
@@ -12450,7 +12407,6 @@
}
-
/*
* Compares two strings up to the first = or '\0'. The first
* string must be terminated by '='; the second may be terminated by
@@ -12526,7 +12482,7 @@
return 0;
}
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
static arith_t
dash_arith(const char *s)
{
@@ -12573,7 +12529,7 @@
return !i;
}
-#endif /* CONFIG_ASH_MATH_SUPPORT */
+#endif /* ASH_MATH_SUPPORT */
/* miscbltin.c */
@@ -12608,13 +12564,13 @@
int startword;
int status;
int i;
-#if defined(CONFIG_ASH_READ_NCHARS)
+#if ENABLE_ASH_READ_NCHARS
int nch_flag = 0;
int nchars = 0;
int silent = 0;
struct termios tty, old_tty;
#endif
-#if defined(CONFIG_ASH_READ_TIMEOUT)
+#if ENABLE_ASH_READ_TIMEOUT
fd_set set;
struct timeval ts;
@@ -12623,11 +12579,11 @@
rflag = 0;
prompt = NULL;
-#if defined(CONFIG_ASH_READ_NCHARS) && defined(CONFIG_ASH_READ_TIMEOUT)
+#if ENABLE_ASH_READ_NCHARS && ENABLE_ASH_READ_TIMEOUT
while ((i = nextopt("p:rt:n:s")) != '\0')
-#elif defined(CONFIG_ASH_READ_NCHARS)
+#elif ENABLE_ASH_READ_NCHARS
while ((i = nextopt("p:rn:s")) != '\0')
-#elif defined(CONFIG_ASH_READ_TIMEOUT)
+#elif ENABLE_ASH_READ_TIMEOUT
while ((i = nextopt("p:rt:")) != '\0')
#else
while ((i = nextopt("p:r")) != '\0')
@@ -12637,7 +12593,7 @@
case 'p':
prompt = optionarg;
break;
-#if defined(CONFIG_ASH_READ_NCHARS)
+#if ENABLE_ASH_READ_NCHARS
case 'n':
nchars = strtol(optionarg, &p, 10);
if (*p)
@@ -12648,7 +12604,7 @@
silent = 1;
break;
#endif
-#if defined(CONFIG_ASH_READ_TIMEOUT)
+#if ENABLE_ASH_READ_TIMEOUT
case 't':
ts.tv_sec = strtol(optionarg, &p, 10);
ts.tv_usec = 0;
@@ -12687,7 +12643,7 @@
sh_error("arg count");
if ((ifs = bltinlookup("IFS")) == NULL)
ifs = defifs;
-#if defined(CONFIG_ASH_READ_NCHARS)
+#if ENABLE_ASH_READ_NCHARS
if (nch_flag || silent) {
tcgetattr(0, &tty);
old_tty = tty;
@@ -12702,14 +12658,14 @@
tcsetattr(0, TCSANOW, &tty);
}
#endif
-#if defined(CONFIG_ASH_READ_TIMEOUT)
+#if ENABLE_ASH_READ_TIMEOUT
if (ts.tv_sec || ts.tv_usec) {
FD_ZERO (&set);
FD_SET (0, &set);
i = select(FD_SETSIZE, &set, NULL, NULL, &ts);
if (!i) {
-#if defined(CONFIG_ASH_READ_NCHARS)
+#if ENABLE_ASH_READ_NCHARS
if (nch_flag)
tcsetattr(0, TCSANOW, &old_tty);
#endif
@@ -12721,7 +12677,7 @@
startword = 1;
backslash = 0;
STARTSTACKSTR(p);
-#if defined(CONFIG_ASH_READ_NCHARS)
+#if ENABLE_ASH_READ_NCHARS
while (!nch_flag || nchars--)
#else
for (;;)
@@ -12760,7 +12716,7 @@
STPUTC(c, p);
}
}
-#if defined(CONFIG_ASH_READ_NCHARS)
+#if ENABLE_ASH_READ_NCHARS
if (nch_flag || silent)
tcsetattr(0, TCSANOW, &old_tty);
#endif
@@ -13024,7 +12980,7 @@
}
-#ifdef CONFIG_ASH_MATH_SUPPORT
+#if ENABLE_ASH_MATH_SUPPORT
/* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com>
@@ -13416,7 +13372,7 @@
goto err;
}
/* save to shell variable */
-#ifdef CONFIG_ASH_MATH_SUPPORT_64
+#if ENABLE_ASH_MATH_SUPPORT_64
snprintf(buf, sizeof(buf), "%lld", arith_t_type rez);
#else
snprintf(buf, sizeof(buf), "%ld", arith_t_type rez);
@@ -13560,7 +13516,7 @@
continue;
} else if (is_digit(arithval)) {
numstackptr->var = NULL;
-#ifdef CONFIG_ASH_MATH_SUPPORT_64
+#if ENABLE_ASH_MATH_SUPPORT_64
numstackptr->val = strtoll(expr, (char **) &expr, 0);
#else
numstackptr->val = strtol(expr, (char **) &expr, 0);
@@ -13668,7 +13624,7 @@
++expr;
} /* while */
}
-#endif /* CONFIG_ASH_MATH_SUPPORT */
+#endif /* ASH_MATH_SUPPORT */
#if DEBUG