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-w32-020465218ccff1195a47a890037db37d0395c9d9.tar.gz busybox-w32-020465218ccff1195a47a890037db37d0395c9d9.tar.bz2 busybox-w32-020465218ccff1195a47a890037db37d0395c9d9.zip |
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 @@ | |||
36 | 36 | ||
37 | #define JOBS ENABLE_ASH_JOB_CONTROL | 37 | #define JOBS ENABLE_ASH_JOB_CONTROL |
38 | 38 | ||
39 | #if DEBUG | ||
40 | # ifndef _GNU_SOURCE | ||
41 | # define _GNU_SOURCE | ||
42 | # endif | ||
43 | #endif | ||
44 | |||
45 | #include "busybox.h" /* for applet_names */ | 39 | #include "busybox.h" /* for applet_names */ |
46 | #include <paths.h> | 40 | #include <paths.h> |
47 | #include <setjmp.h> | 41 | #include <setjmp.h> |
48 | #include <fnmatch.h> | 42 | #include <fnmatch.h> |
43 | #include <sys/times.h> | ||
49 | 44 | ||
50 | #include "shell_common.h" | 45 | #include "shell_common.h" |
51 | #include "math.h" | 46 | #include "math.h" |
@@ -7251,6 +7246,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char ** | |||
7251 | #if ENABLE_FEATURE_SH_STANDALONE | 7246 | #if ENABLE_FEATURE_SH_STANDALONE |
7252 | if (applet_no >= 0) { | 7247 | if (applet_no >= 0) { |
7253 | if (APPLET_IS_NOEXEC(applet_no)) { | 7248 | if (APPLET_IS_NOEXEC(applet_no)) { |
7249 | clearenv(); | ||
7254 | while (*envp) | 7250 | while (*envp) |
7255 | putenv(*envp++); | 7251 | putenv(*envp++); |
7256 | run_applet_no_and_exit(applet_no, argv); | 7252 | run_applet_no_and_exit(applet_no, argv); |
@@ -7310,7 +7306,7 @@ shellexec(char **argv, const char *path, int idx) | |||
7310 | #endif | 7306 | #endif |
7311 | 7307 | ||
7312 | clearredir(/*drop:*/ 1); | 7308 | clearredir(/*drop:*/ 1); |
7313 | envp = listvars(VEXPORT, VUNSET, 0); | 7309 | envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL); |
7314 | if (strchr(argv[0], '/') != NULL | 7310 | if (strchr(argv[0], '/') != NULL |
7315 | #if ENABLE_FEATURE_SH_STANDALONE | 7311 | #if ENABLE_FEATURE_SH_STANDALONE |
7316 | || (applet_no = find_applet_by_name(argv[0])) >= 0 | 7312 | || (applet_no = find_applet_by_name(argv[0])) >= 0 |
@@ -12468,7 +12464,7 @@ unsetfunc(const char *name) | |||
12468 | struct tblentry *cmdp; | 12464 | struct tblentry *cmdp; |
12469 | 12465 | ||
12470 | cmdp = cmdlookup(name, 0); | 12466 | cmdp = cmdlookup(name, 0); |
12471 | if (cmdp!= NULL && cmdp->cmdtype == CMDFUNCTION) | 12467 | if (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION) |
12472 | delete_cmd_entry(); | 12468 | delete_cmd_entry(); |
12473 | } | 12469 | } |
12474 | 12470 | ||
@@ -12485,7 +12481,7 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
12485 | int flag = 0; | 12481 | int flag = 0; |
12486 | int ret = 0; | 12482 | int ret = 0; |
12487 | 12483 | ||
12488 | while ((i = nextopt("vf")) != '\0') { | 12484 | while ((i = nextopt("vf")) != 0) { |
12489 | flag = i; | 12485 | flag = i; |
12490 | } | 12486 | } |
12491 | 12487 | ||
@@ -12502,11 +12498,6 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
12502 | return ret & 1; | 12498 | return ret & 1; |
12503 | } | 12499 | } |
12504 | 12500 | ||
12505 | |||
12506 | /* setmode.c */ | ||
12507 | |||
12508 | #include <sys/times.h> | ||
12509 | |||
12510 | static const unsigned char timescmd_str[] ALIGN1 = { | 12501 | static const unsigned char timescmd_str[] ALIGN1 = { |
12511 | ' ', offsetof(struct tms, tms_utime), | 12502 | ' ', offsetof(struct tms, tms_utime), |
12512 | '\n', offsetof(struct tms, tms_stime), | 12503 | '\n', offsetof(struct tms, tms_stime), |
@@ -12514,11 +12505,10 @@ static const unsigned char timescmd_str[] ALIGN1 = { | |||
12514 | '\n', offsetof(struct tms, tms_cstime), | 12505 | '\n', offsetof(struct tms, tms_cstime), |
12515 | 0 | 12506 | 0 |
12516 | }; | 12507 | }; |
12517 | |||
12518 | static int FAST_FUNC | 12508 | static int FAST_FUNC |
12519 | timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | 12509 | timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
12520 | { | 12510 | { |
12521 | long clk_tck, s, t; | 12511 | unsigned long clk_tck, s, t; |
12522 | const unsigned char *p; | 12512 | const unsigned char *p; |
12523 | struct tms buf; | 12513 | struct tms buf; |
12524 | 12514 | ||
@@ -12529,18 +12519,20 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
12529 | do { | 12519 | do { |
12530 | t = *(clock_t *)(((char *) &buf) + p[1]); | 12520 | t = *(clock_t *)(((char *) &buf) + p[1]); |
12531 | s = t / clk_tck; | 12521 | s = t / clk_tck; |
12532 | out1fmt("%ldm%ld.%.3lds%c", | 12522 | t = t % clk_tck; |
12533 | s/60, s%60, | 12523 | out1fmt("%lum%lu.%03lus%c", |
12534 | ((t - s * clk_tck) * 1000) / clk_tck, | 12524 | s / 60, s % 60, |
12525 | (t * 1000) / clk_tck, | ||
12535 | p[0]); | 12526 | p[0]); |
12536 | } while (*(p += 2)); | 12527 | p += 2; |
12528 | } while (*p); | ||
12537 | 12529 | ||
12538 | return 0; | 12530 | return 0; |
12539 | } | 12531 | } |
12540 | 12532 | ||
12541 | #if ENABLE_SH_MATH_SUPPORT | 12533 | #if ENABLE_SH_MATH_SUPPORT |
12542 | /* | 12534 | /* |
12543 | * The let builtin. partial stolen from GNU Bash, the Bourne Again SHell. | 12535 | * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell. |
12544 | * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. | 12536 | * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. |
12545 | * | 12537 | * |
12546 | * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru> | 12538 | * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru> |
@@ -12559,18 +12551,6 @@ letcmd(int argc UNUSED_PARAM, char **argv) | |||
12559 | 12551 | ||
12560 | return !i; | 12552 | return !i; |
12561 | } | 12553 | } |
12562 | #endif /* SH_MATH_SUPPORT */ | ||
12563 | |||
12564 | |||
12565 | /* ============ miscbltin.c | ||
12566 | * | ||
12567 | * Miscellaneous builtins. | ||
12568 | */ | ||
12569 | |||
12570 | #undef rflag | ||
12571 | |||
12572 | #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 1 | ||
12573 | typedef enum __rlimit_resource rlim_t; | ||
12574 | #endif | 12554 | #endif |
12575 | 12555 | ||
12576 | /* | 12556 | /* |
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 @@ | |||
1 | VAR=42 $THIS_SH -c 'unset VAR; env | grep ^VAR' | ||
2 | echo Done: $? | ||