*/
-
#define IFS_BROKEN
#define PROFILE 0
+#include "busybox.h"
+
#ifdef DEBUG
#define _GNU_SOURCE
#endif
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/stat.h>
-#include <sys/time.h>
#include <sys/wait.h>
#include <stdio.h>
#include <paths.h>
#include <setjmp.h>
#include <signal.h>
-#include <stdint.h>
+/*#include <stdint.h>*/
#include <time.h>
#include <fnmatch.h>
-
-#include "busybox.h"
#include "pwd_.h"
#ifdef CONFIG_ASH_JOB_CONTROL
#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 **);
#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 + \
- 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"
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
{ 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 },
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) {
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 */
/*
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))