aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:07:00 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:07:00 +1000
commita6a2325ecf402054132daae169f71edb0fb849e3 (patch)
tree97ede2815e2dd15a01515517c0495a64720414e3 /shell
parentc31744ca1a86b2276c37c6d9a884660185debed6 (diff)
parent020465218ccff1195a47a890037db37d0395c9d9 (diff)
downloadbusybox-w32-a6a2325ecf402054132daae169f71edb0fb849e3.tar.gz
busybox-w32-a6a2325ecf402054132daae169f71edb0fb849e3.tar.bz2
busybox-w32-a6a2325ecf402054132daae169f71edb0fb849e3.zip
Merge branch 'origin/master' (early part)
Conflicts: shell/ash.c
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c44
-rw-r--r--shell/ash_test/ash-standalone/var_standalone1.right1
-rwxr-xr-xshell/ash_test/ash-standalone/var_standalone1.tests2
3 files changed, 16 insertions, 31 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 89e70c1ee..5ac2a1922 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -48,18 +48,13 @@
48 48
49#define JOBS ENABLE_ASH_JOB_CONTROL 49#define JOBS ENABLE_ASH_JOB_CONTROL
50 50
51#if DEBUG
52# ifndef _GNU_SOURCE
53# define _GNU_SOURCE
54# endif
55#endif
56
57#include "busybox.h" /* for applet_names */ 51#include "busybox.h" /* for applet_names */
58#ifndef __MINGW32__ 52#ifndef __MINGW32__
59#include <paths.h> 53#include <paths.h>
60#endif 54#endif
61#include <setjmp.h> 55#include <setjmp.h>
62#include <fnmatch.h> 56#include <fnmatch.h>
57#include <sys/times.h>
63 58
64#include "shell_common.h" 59#include "shell_common.h"
65#include "math.h" 60#include "math.h"
@@ -7572,6 +7567,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **
7572#if ENABLE_FEATURE_SH_STANDALONE 7567#if ENABLE_FEATURE_SH_STANDALONE
7573 if (applet_no >= 0) { 7568 if (applet_no >= 0) {
7574 if (APPLET_IS_NOEXEC(applet_no)) { 7569 if (APPLET_IS_NOEXEC(applet_no)) {
7570 clearenv();
7575 while (*envp) 7571 while (*envp)
7576 putenv(*envp++); 7572 putenv(*envp++);
7577 run_applet_no_and_exit(applet_no, argv); 7573 run_applet_no_and_exit(applet_no, argv);
@@ -7631,7 +7627,7 @@ shellexec(char **argv, const char *path, int idx)
7631#endif 7627#endif
7632 7628
7633 clearredir(/*drop:*/ 1); 7629 clearredir(/*drop:*/ 1);
7634 envp = listvars(VEXPORT, VUNSET, 0); 7630 envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
7635 if ((strchr(argv[0], '/') || (ENABLE_PLATFORM_MINGW32 && strchr(argv[0], '\\'))) 7631 if ((strchr(argv[0], '/') || (ENABLE_PLATFORM_MINGW32 && strchr(argv[0], '\\')))
7636#if ENABLE_FEATURE_SH_STANDALONE 7632#if ENABLE_FEATURE_SH_STANDALONE
7637 || (applet_no = find_applet_by_name(argv[0])) >= 0 7633 || (applet_no = find_applet_by_name(argv[0])) >= 0
@@ -12962,7 +12958,7 @@ unsetfunc(const char *name)
12962 struct tblentry *cmdp; 12958 struct tblentry *cmdp;
12963 12959
12964 cmdp = cmdlookup(name, 0); 12960 cmdp = cmdlookup(name, 0);
12965 if (cmdp!= NULL && cmdp->cmdtype == CMDFUNCTION) 12961 if (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION)
12966 delete_cmd_entry(); 12962 delete_cmd_entry();
12967} 12963}
12968 12964
@@ -12979,7 +12975,7 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12979 int flag = 0; 12975 int flag = 0;
12980 int ret = 0; 12976 int ret = 0;
12981 12977
12982 while ((i = nextopt("vf")) != '\0') { 12978 while ((i = nextopt("vf")) != 0) {
12983 flag = i; 12979 flag = i;
12984 } 12980 }
12985 12981
@@ -12996,13 +12992,10 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12996 return ret & 1; 12992 return ret & 1;
12997} 12993}
12998 12994
12999
13000/* setmode.c */ 12995/* setmode.c */
13001 12996
13002#if !ENABLE_PLATFORM_MINGW32 12997#if !ENABLE_PLATFORM_MINGW32
13003 12998
13004#include <sys/times.h>
13005
13006static const unsigned char timescmd_str[] ALIGN1 = { 12999static const unsigned char timescmd_str[] ALIGN1 = {
13007 ' ', offsetof(struct tms, tms_utime), 13000 ' ', offsetof(struct tms, tms_utime),
13008 '\n', offsetof(struct tms, tms_stime), 13001 '\n', offsetof(struct tms, tms_stime),
@@ -13010,11 +13003,10 @@ static const unsigned char timescmd_str[] ALIGN1 = {
13010 '\n', offsetof(struct tms, tms_cstime), 13003 '\n', offsetof(struct tms, tms_cstime),
13011 0 13004 0
13012}; 13005};
13013
13014static int FAST_FUNC 13006static int FAST_FUNC
13015timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 13007timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
13016{ 13008{
13017 long clk_tck, s, t; 13009 unsigned long clk_tck, s, t;
13018 const unsigned char *p; 13010 const unsigned char *p;
13019 struct tms buf; 13011 struct tms buf;
13020 13012
@@ -13025,11 +13017,13 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
13025 do { 13017 do {
13026 t = *(clock_t *)(((char *) &buf) + p[1]); 13018 t = *(clock_t *)(((char *) &buf) + p[1]);
13027 s = t / clk_tck; 13019 s = t / clk_tck;
13028 out1fmt("%ldm%ld.%.3lds%c", 13020 t = t % clk_tck;
13029 s/60, s%60, 13021 out1fmt("%lum%lu.%03lus%c",
13030 ((t - s * clk_tck) * 1000) / clk_tck, 13022 s / 60, s % 60,
13023 (t * 1000) / clk_tck,
13031 p[0]); 13024 p[0]);
13032 } while (*(p += 2)); 13025 p += 2;
13026 } while (*p);
13033 13027
13034 return 0; 13028 return 0;
13035} 13029}
@@ -13043,7 +13037,7 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
13043 13037
13044#if ENABLE_SH_MATH_SUPPORT 13038#if ENABLE_SH_MATH_SUPPORT
13045/* 13039/*
13046 * The let builtin. partial stolen from GNU Bash, the Bourne Again SHell. 13040 * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell.
13047 * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. 13041 * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
13048 * 13042 *
13049 * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru> 13043 * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru>
@@ -13062,18 +13056,6 @@ letcmd(int argc UNUSED_PARAM, char **argv)
13062 13056
13063 return !i; 13057 return !i;
13064} 13058}
13065#endif /* SH_MATH_SUPPORT */
13066
13067
13068/* ============ miscbltin.c
13069 *
13070 * Miscellaneous builtins.
13071 */
13072
13073#undef rflag
13074
13075#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 1
13076typedef enum __rlimit_resource rlim_t;
13077#endif 13059#endif
13078 13060
13079/* 13061/*
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 @@
1VAR=42 $THIS_SH -c 'unset VAR; env | grep ^VAR'
2echo Done: $?