diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-19 17:50:44 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-19 17:50:44 +0200 |
commit | 020465218ccff1195a47a890037db37d0395c9d9 (patch) | |
tree | 491ffc11553f9de9b91c890f82dc0668c44660e8 /shell | |
parent | e329089c62ed813e97344f8c61d7dc34221fd5ee (diff) | |
parent | 8cd9f343e74ca65f36c42a44e845716ba5411663 (diff) | |
download | busybox-020465218ccff1195a47a890037db37d0395c9d9.tar.gz |
Merge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busybox
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 46 | ||||
-rw-r--r-- | shell/ash_test/ash-standalone/var_standalone1.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-standalone/var_standalone1.tests | 2 |
3 files changed, 16 insertions, 33 deletions
diff --git a/shell/ash.c b/shell/ash.c index 90680e849..f581b5bdf 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -36,16 +36,11 @@ #define JOBS ENABLE_ASH_JOB_CONTROL -#if DEBUG -# ifndef _GNU_SOURCE -# define _GNU_SOURCE -# endif -#endif - #include "busybox.h" /* for applet_names */ #include <paths.h> #include <setjmp.h> #include <fnmatch.h> +#include <sys/times.h> #include "shell_common.h" #include "math.h" @@ -7251,6 +7246,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char ** #if ENABLE_FEATURE_SH_STANDALONE if (applet_no >= 0) { if (APPLET_IS_NOEXEC(applet_no)) { + clearenv(); while (*envp) putenv(*envp++); run_applet_no_and_exit(applet_no, argv); @@ -7310,7 +7306,7 @@ shellexec(char **argv, const char *path, int idx) #endif clearredir(/*drop:*/ 1); - envp = listvars(VEXPORT, VUNSET, 0); + envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL); if (strchr(argv[0], '/') != NULL #if ENABLE_FEATURE_SH_STANDALONE || (applet_no = find_applet_by_name(argv[0])) >= 0 @@ -12468,7 +12464,7 @@ unsetfunc(const char *name) struct tblentry *cmdp; cmdp = cmdlookup(name, 0); - if (cmdp!= NULL && cmdp->cmdtype == CMDFUNCTION) + if (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION) delete_cmd_entry(); } @@ -12485,7 +12481,7 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) int flag = 0; int ret = 0; - while ((i = nextopt("vf")) != '\0') { + while ((i = nextopt("vf")) != 0) { flag = i; } @@ -12502,11 +12498,6 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) return ret & 1; } - -/* setmode.c */ - -#include <sys/times.h> - static const unsigned char timescmd_str[] ALIGN1 = { ' ', offsetof(struct tms, tms_utime), '\n', offsetof(struct tms, tms_stime), @@ -12514,11 +12505,10 @@ static const unsigned char timescmd_str[] ALIGN1 = { '\n', offsetof(struct tms, tms_cstime), 0 }; - static int FAST_FUNC timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) { - long clk_tck, s, t; + unsigned long clk_tck, s, t; const unsigned char *p; struct tms buf; @@ -12529,18 +12519,20 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) do { t = *(clock_t *)(((char *) &buf) + p[1]); s = t / clk_tck; - out1fmt("%ldm%ld.%.3lds%c", - s/60, s%60, - ((t - s * clk_tck) * 1000) / clk_tck, + t = t % clk_tck; + out1fmt("%lum%lu.%03lus%c", + s / 60, s % 60, + (t * 1000) / clk_tck, p[0]); - } while (*(p += 2)); + p += 2; + } while (*p); return 0; } #if ENABLE_SH_MATH_SUPPORT /* - * The let builtin. partial stolen from GNU Bash, the Bourne Again SHell. + * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell. * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. * * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru> @@ -12559,18 +12551,6 @@ letcmd(int argc UNUSED_PARAM, char **argv) return !i; } -#endif /* SH_MATH_SUPPORT */ - - -/* ============ miscbltin.c - * - * Miscellaneous builtins. - */ - -#undef rflag - -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 1 -typedef enum __rlimit_resource rlim_t; #endif /* diff --git a/shell/ash_test/ash-standalone/var_standalone1.right b/shell/ash_test/ash-standalone/var_standalone1.right new file mode 100644 index 000000000..37457fd74 --- /dev/null +++ b/shell/ash_test/ash-standalone/var_standalone1.right @@ -0,0 +1 @@ +Done: 1 diff --git a/shell/ash_test/ash-standalone/var_standalone1.tests b/shell/ash_test/ash-standalone/var_standalone1.tests new file mode 100755 index 000000000..1e905ba75 --- /dev/null +++ b/shell/ash_test/ash-standalone/var_standalone1.tests @@ -0,0 +1,2 @@ +VAR=42 $THIS_SH -c 'unset VAR; env | grep ^VAR' +echo Done: $? |