aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:57:26 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:57:26 +1000
commit0c9d2455301ed633826e222aacd930126990913e (patch)
tree2353a480f55dfa41d9e6d2fa328af1b60dd3653e /shell
parente8db4fe96b3a68b6f971d88084ef2fd2c8513e78 (diff)
parent9dc04124d5a3f0c9be249287817a964691e187b0 (diff)
downloadbusybox-w32-0c9d2455301ed633826e222aacd930126990913e.tar.gz
busybox-w32-0c9d2455301ed633826e222aacd930126990913e.tar.bz2
busybox-w32-0c9d2455301ed633826e222aacd930126990913e.zip
Merge branch 'origin/master' (early part)
Diffstat (limited to 'shell')
-rw-r--r--shell/Kbuild.src2
-rw-r--r--shell/ash.c25
-rw-r--r--shell/ash_ptr_hack.c2
-rw-r--r--shell/ash_test/ash-vars/var_bash5.right4
-rwxr-xr-xshell/ash_test/ash-vars/var_bash5.tests11
-rw-r--r--shell/bbsh.c2
-rw-r--r--shell/cttyhack.c4
-rw-r--r--shell/hush.c2
-rw-r--r--shell/match.c2
-rw-r--r--shell/math.c2
-rw-r--r--shell/random.c2
-rw-r--r--shell/random.h2
-rw-r--r--shell/shell_common.c4
-rw-r--r--shell/shell_common.h2
14 files changed, 41 insertions, 25 deletions
diff --git a/shell/Kbuild.src b/shell/Kbuild.src
index a669bdfb0..c00aec92a 100644
--- a/shell/Kbuild.src
+++ b/shell/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/shell/ash.c b/shell/ash.c
index f7fad88cd..6d67a1f8a 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13,7 +13,7 @@
13 * Copyright (c) 1997-2005 Herbert Xu <herbert@gondor.apana.org.au> 13 * Copyright (c) 1997-2005 Herbert Xu <herbert@gondor.apana.org.au>
14 * was re-ported from NetBSD and debianized. 14 * was re-ported from NetBSD and debianized.
15 * 15 *
16 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 16 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
17 */ 17 */
18 18
19/* 19/*
@@ -5204,9 +5204,13 @@ noclobberopen(const char *fname)
5204 * revealed that it was a regular file, and the file has not been 5204 * revealed that it was a regular file, and the file has not been
5205 * replaced, return the file descriptor. 5205 * replaced, return the file descriptor.
5206 */ 5206 */
5207 if (fstat(fd, &finfo2) == 0 && !S_ISREG(finfo2.st_mode) 5207 if (fstat(fd, &finfo2) == 0
5208 && finfo.st_dev == finfo2.st_dev && finfo.st_ino == finfo2.st_ino) 5208 && !S_ISREG(finfo2.st_mode)
5209 && finfo.st_dev == finfo2.st_dev
5210 && finfo.st_ino == finfo2.st_ino
5211 ) {
5209 return fd; 5212 return fd;
5213 }
5210 5214
5211 /* The file has been replaced. badness. */ 5215 /* The file has been replaced. badness. */
5212 close(fd); 5216 close(fd);
@@ -11611,10 +11615,9 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11611 if (dqvarnest > 0) { 11615 if (dqvarnest > 0) {
11612 dqvarnest--; 11616 dqvarnest--;
11613 } 11617 }
11614 USTPUTC(CTLENDVAR, out); 11618 c = CTLENDVAR;
11615 } else {
11616 USTPUTC(c, out);
11617 } 11619 }
11620 USTPUTC(c, out);
11618 break; 11621 break;
11619#if ENABLE_SH_MATH_SUPPORT 11622#if ENABLE_SH_MATH_SUPPORT
11620 case CLP: /* '(' in arithmetic */ 11623 case CLP: /* '(' in arithmetic */
@@ -11623,25 +11626,23 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11623 break; 11626 break;
11624 case CRP: /* ')' in arithmetic */ 11627 case CRP: /* ')' in arithmetic */
11625 if (parenlevel > 0) { 11628 if (parenlevel > 0) {
11626 USTPUTC(c, out); 11629 parenlevel--;
11627 --parenlevel;
11628 } else { 11630 } else {
11629 if (pgetc() == ')') { 11631 if (pgetc() == ')') {
11630 if (--arinest == 0) { 11632 if (--arinest == 0) {
11631 USTPUTC(CTLENDARI, out);
11632 syntax = prevsyntax; 11633 syntax = prevsyntax;
11633 dblquote = (syntax == DQSYNTAX); 11634 dblquote = (syntax == DQSYNTAX);
11634 } else 11635 c = CTLENDARI;
11635 USTPUTC(')', out); 11636 }
11636 } else { 11637 } else {
11637 /* 11638 /*
11638 * unbalanced parens 11639 * unbalanced parens
11639 * (don't 2nd guess - no error) 11640 * (don't 2nd guess - no error)
11640 */ 11641 */
11641 pungetc(); 11642 pungetc();
11642 USTPUTC(')', out);
11643 } 11643 }
11644 } 11644 }
11645 USTPUTC(c, out);
11645 break; 11646 break;
11646#endif 11647#endif
11647 case CBQUOTE: /* '`' */ 11648 case CBQUOTE: /* '`' */
diff --git a/shell/ash_ptr_hack.c b/shell/ash_ptr_hack.c
index 68d907292..f69840825 100644
--- a/shell/ash_ptr_hack.c
+++ b/shell/ash_ptr_hack.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> 3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8struct globals_misc; 8struct globals_misc;
diff --git a/shell/ash_test/ash-vars/var_bash5.right b/shell/ash_test/ash-vars/var_bash5.right
new file mode 100644
index 000000000..278ed3228
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash5.right
@@ -0,0 +1,4 @@
1a/
2a/d
3a/e/f
4Done: 0
diff --git a/shell/ash_test/ash-vars/var_bash5.tests b/shell/ash_test/ash-vars/var_bash5.tests
new file mode 100755
index 000000000..3f49321e1
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash5.tests
@@ -0,0 +1,11 @@
1# This testcase checks whether slashes in ${v/a/b} are parsed before or after expansions
2# in a part
3
4v='a/b/c'
5s='b/c'
6r='e/f'
7echo "${v/$s}"
8echo "${v/$s/d}"
9echo "${v/$s/$r}"
10
11echo Done: $?
diff --git a/shell/bbsh.c b/shell/bbsh.c
index 83132f928..8e25db458 100644
--- a/shell/bbsh.c
+++ b/shell/bbsh.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2006 Rob Landley <rob@landley.net> 5 * Copyright 2006 Rob Landley <rob@landley.net>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10// A section of code that gets repeatedly or conditionally executed is stored 10// A section of code that gets repeatedly or conditionally executed is stored
diff --git a/shell/cttyhack.c b/shell/cttyhack.c
index 7a5e1ffd2..d1cb7fcc3 100644
--- a/shell/cttyhack.c
+++ b/shell/cttyhack.c
@@ -1,8 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2
4 *
5 * Copyright (c) 2007 Denys Vlasenko <vda.linux@googlemail.com> 3 * Copyright (c) 2007 Denys Vlasenko <vda.linux@googlemail.com>
4 *
5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7#include "libbb.h" 7#include "libbb.h"
8 8
diff --git a/shell/hush.c b/shell/hush.c
index df4058998..e8dfb2499 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -79,7 +79,7 @@
79 * $ "export" i=`echo 'aaa bbb'`; echo "$i" 79 * $ "export" i=`echo 'aaa bbb'`; echo "$i"
80 * aaa 80 * aaa
81 * 81 *
82 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 82 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
83 */ 83 */
84#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */ 84#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */
85#include <malloc.h> /* for malloc_trim */ 85#include <malloc.h> /* for malloc_trim */
diff --git a/shell/match.c b/shell/match.c
index fb6a38ef1..8b1ddacd5 100644
--- a/shell/match.c
+++ b/shell/match.c
@@ -4,7 +4,7 @@
4 * This code is derived from software contributed to Berkeley by 4 * This code is derived from software contributed to Berkeley by
5 * Kenneth Almquist. 5 * Kenneth Almquist.
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 * Copyright (c) 1989, 1991, 1993, 1994 9 * Copyright (c) 1989, 1991, 1993, 1994
10 * The Regents of the University of California. All rights reserved. 10 * The Regents of the University of California. All rights reserved.
diff --git a/shell/math.c b/shell/math.c
index 91fb28f05..f0cc2e35d 100644
--- a/shell/math.c
+++ b/shell/math.c
@@ -23,7 +23,7 @@
23 * rewrote arith (see notes to this), added locale support, 23 * rewrote arith (see notes to this), added locale support,
24 * rewrote dynamic variables. 24 * rewrote dynamic variables.
25 * 25 *
26 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 26 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
27 */ 27 */
28/* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com> 28/* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com>
29 29
diff --git a/shell/random.c b/shell/random.c
index 7f5821cbc..853ab085a 100644
--- a/shell/random.c
+++ b/shell/random.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Denys Vlasenko 5 * Copyright (C) 2009 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "random.h" 10#include "random.h"
diff --git a/shell/random.h b/shell/random.h
index 08563402c..180c48abb 100644
--- a/shell/random.h
+++ b/shell/random.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Denys Vlasenko 5 * Copyright (C) 2009 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#ifndef SHELL_RANDOM_H 9#ifndef SHELL_RANDOM_H
10#define SHELL_RANDOM_H 1 10#define SHELL_RANDOM_H 1
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 957d71928..0b9d4ebe6 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -14,7 +14,7 @@
14 * Copyright (c) 2010 Denys Vlasenko 14 * Copyright (c) 2010 Denys Vlasenko
15 * Split from ash.c 15 * Split from ash.c
16 * 16 *
17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19#include "libbb.h" 19#include "libbb.h"
20#include "shell_common.h" 20#include "shell_common.h"
@@ -429,7 +429,7 @@ shell_builtin_ulimit(char **argv)
429 else 429 else
430 val = bb_strtoull(val_str, NULL, 10); 430 val = bb_strtoull(val_str, NULL, 10);
431 if (errno) { 431 if (errno) {
432 bb_error_msg("bad number"); 432 bb_error_msg("invalid number '%s'", val_str);
433 return EXIT_FAILURE; 433 return EXIT_FAILURE;
434 } 434 }
435 val <<= l->factor_shift; 435 val <<= l->factor_shift;
diff --git a/shell/shell_common.h b/shell/shell_common.h
index 1e9f6a691..f06bc4120 100644
--- a/shell/shell_common.h
+++ b/shell/shell_common.h
@@ -14,7 +14,7 @@
14 * Copyright (c) 2010 Denys Vlasenko 14 * Copyright (c) 2010 Denys Vlasenko
15 * Split from ash.c 15 * Split from ash.c
16 * 16 *
17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19#ifndef SHELL_COMMON_H 19#ifndef SHELL_COMMON_H
20#define SHELL_COMMON_H 1 20#define SHELL_COMMON_H 1