projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make lash smaller. (Use llist_t for file closing, and different allocation
[oweals/busybox.git]
/
shell
/
ash.c
diff --git
a/shell/ash.c
b/shell/ash.c
index 708ab21fbd2a309f1792566733967d3eaa9352e3..713898a9f598459fc59f37168df9f522dd0e1c63 100644
(file)
--- a/
shell/ash.c
+++ b/
shell/ash.c
@@
-44,11
+44,12
@@
*/
*/
-
#define IFS_BROKEN
#define PROFILE 0
#define IFS_BROKEN
#define PROFILE 0
+#include "busybox.h"
+
#ifdef DEBUG
#define _GNU_SOURCE
#endif
#ifdef DEBUG
#define _GNU_SOURCE
#endif
@@
-58,7
+59,6
@@
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/stat.h>
-#include <sys/time.h>
#include <sys/wait.h>
#include <stdio.h>
#include <sys/wait.h>
#include <stdio.h>
@@
-77,12
+77,10
@@
#include <paths.h>
#include <setjmp.h>
#include <signal.h>
#include <paths.h>
#include <setjmp.h>
#include <signal.h>
-#include <stdint.h>
+/*#include <stdint.h>*/
#include <time.h>
#include <fnmatch.h>
#include <time.h>
#include <fnmatch.h>
-
-#include "busybox.h"
#include "pwd_.h"
#ifdef CONFIG_ASH_JOB_CONTROL
#include "pwd_.h"
#ifdef CONFIG_ASH_JOB_CONTROL
@@
-1227,6
+1225,9
@@
static int evalcmd(int, char **);
#ifdef CONFIG_ASH_BUILTIN_ECHO
static int echocmd(int, char **);
#endif
#ifdef CONFIG_ASH_BUILTIN_ECHO
static int echocmd(int, char **);
#endif
+#ifdef CONFIG_ASH_BUILTIN_TEST
+static int testcmd(int, char **);
+#endif
static int execcmd(int, char **);
static int exitcmd(int, char **);
static int exportcmd(int, char **);
static int execcmd(int, char **);
static int exitcmd(int, char **);
static int exportcmd(int, char **);
@@
-1288,10
+1289,15
@@
struct builtincmd {
#define COMMANDCMD (builtincmd + 5 + \
#define COMMANDCMD (builtincmd + 5 + \
- ENABLE_ASH_ALIAS + ENABLE_ASH_JOB_CONTROL)
+ 2 * ENABLE_ASH_BUILTIN_TEST + \
+ ENABLE_ASH_ALIAS + \
+ ENABLE_ASH_JOB_CONTROL)
#define EXECCMD (builtincmd + 7 + \
#define EXECCMD (builtincmd + 7 + \
- ENABLE_ASH_CMDCMD + ENABLE_ASH_ALIAS + \
- ENABLE_ASH_BUILTIN_ECHO + ENABLE_ASH_JOB_CONTROL)
+ 2 * ENABLE_ASH_BUILTIN_TEST + \
+ ENABLE_ASH_ALIAS + \
+ ENABLE_ASH_JOB_CONTROL + \
+ ENABLE_ASH_CMDCMD + \
+ ENABLE_ASH_BUILTIN_ECHO)
#define BUILTIN_NOSPEC "0"
#define BUILTIN_SPECIAL "1"
#define BUILTIN_NOSPEC "0"
#define BUILTIN_SPECIAL "1"
@@
-1309,6
+1315,10
@@
struct builtincmd {
static const struct builtincmd builtincmd[] = {
{ BUILTIN_SPEC_REG ".", dotcmd },
{ BUILTIN_SPEC_REG ":", truecmd },
static const struct builtincmd builtincmd[] = {
{ BUILTIN_SPEC_REG ".", dotcmd },
{ BUILTIN_SPEC_REG ":", truecmd },
+#ifdef CONFIG_ASH_BUILTIN_TEST
+ { BUILTIN_REGULAR "[", testcmd },
+ { BUILTIN_REGULAR "[[", testcmd },
+#endif
#ifdef CONFIG_ASH_ALIAS
{ BUILTIN_REG_ASSG "alias", aliascmd },
#endif
#ifdef CONFIG_ASH_ALIAS
{ BUILTIN_REG_ASSG "alias", aliascmd },
#endif
@@
-1355,6
+1365,9
@@
static const struct builtincmd builtincmd[] = {
{ BUILTIN_SPEC_REG "set", setcmd },
{ BUILTIN_SPEC_REG "source", dotcmd },
{ BUILTIN_SPEC_REG "shift", shiftcmd },
{ BUILTIN_SPEC_REG "set", setcmd },
{ BUILTIN_SPEC_REG "source", dotcmd },
{ BUILTIN_SPEC_REG "shift", shiftcmd },
+#ifdef CONFIG_ASH_BUILTIN_TEST
+ { BUILTIN_REGULAR "test", testcmd },
+#endif
{ BUILTIN_SPEC_REG "times", timescmd },
{ BUILTIN_SPEC_REG "trap", trapcmd },
{ BUILTIN_REGULAR "true", truecmd },
{ BUILTIN_SPEC_REG "times", timescmd },
{ BUILTIN_SPEC_REG "trap", trapcmd },
{ BUILTIN_REGULAR "true", truecmd },
@@
-7147,8
+7160,8
@@
forkchild(struct job *jp, union node *n, int mode)
ignoresig(SIGQUIT);
if (jp->nprocs == 0) {
close(0);
ignoresig(SIGQUIT);
if (jp->nprocs == 0) {
close(0);
- if (open(
_PATH_DEVNULL
, O_RDONLY) != 0)
- sh_error("Can't open %s",
_PATH_DEVNULL
);
+ if (open(
bb_dev_null
, O_RDONLY) != 0)
+ sh_error("Can't open %s",
bb_dev_null
);
}
}
if (!oldlvl && iflag) {
}
}
if (!oldlvl && iflag) {
@@
-8145,6
+8158,15
@@
echocmd(int argc, char **argv)
return bb_echo(argc, argv);
}
#endif
return bb_echo(argc, argv);
}
#endif
+
+#ifdef CONFIG_ASH_BUILTIN_TEST
+static int
+testcmd(int argc, char **argv)
+{
+ return bb_test(argc, argv);
+}
+#endif
+
/* memalloc.c */
/*
/* memalloc.c */
/*
@@
-8764,7
+8786,7
@@
procargs(int argc, char **argv)
xminusc = minusc;
if (*xargv == NULL) {
if (xminusc)
xminusc = minusc;
if (*xargv == NULL) {
if (xminusc)
- sh_error(
"-c requires an argument
");
+ sh_error(
bb_msg_requires_arg, "-c
");
sflag = 1;
}
if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1))
sflag = 1;
}
if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1))