summary refs log tree commit diff
path: root/src/bltin (follow)
Commit message (Collapse)AuthorAge
* [BUILTIN] Made aexpr/oexpr non-recursiveHerbert Xu2008-07-13
| | | | | | | Making these functions non-recursive is straightforward since they carry no state. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Fixed 3,4-argument cases for test per POSIXHerbert Xu2008-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----- Forwarded message from Gerrit Pape <pape@smarden.org> ----- Subject: Bug#455828: dash: 4-argument test "test \( ! -e \)" yields an error Date: Fri, 28 Dec 2007 08:53:29 +0000 From: Gerrit Pape <pape@smarden.org> To: Vincent Lefevre <vincent@vinc17.org>, 455828@bugs.debian.org On Thu, Dec 27, 2007 at 06:23:20PM +0100, Vincent Lefevre wrote: > On 2007-12-27 16:00:06 +0000, Gerrit Pape wrote: > > On Wed, Dec 12, 2007 at 02:18:47AM +0100, Vincent Lefevre wrote: > > > According to POSIX[*], "test \( ! -e \)" is a 4-argument test and is > > > here equivalent to "test ! -e". But dash (like ksh93 and bash) yields > > > an error: > > > > > > $ test \( ! -e \) || echo $? > > > test: 1: closing paren expected > > > 2 > > > $ test ! -e || echo $? > > > 1 > > > > Hi Vincent, > > > > the -e switch to test takes an argument, a pathname. > > According to POSIX, in both above examples, "-e" is *not* a switch, > just a string. > > test \( ! -e \) > > means: return true if the string "-e" is empty, otherwhise return false. > The error in dash is that it incorrectly thinks that "-e" is a switch in > this context. I see, you're right. Thanks, Gerrit. ----- End forwarded message ----- This patch hard-codes the 3,4-argument cases in the way required by POSIX. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Use intmax_t arithmetic in testHerbert Xu2007-10-06
| | | | | This patch adds the function atomax10 and uses it in test(1) so that we support intmax_t comparisons.
* [BUILTIN] test: little size and speed optimizationsOleg Verych2007-09-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Speed up (libc=glibc): deen:debian/src/dash-0.5.3# echo $(((7853+8631+7529+9777+9161+7552)/6)) 8417,8250 # this patch deen:/mnt/work/debian/src/dash-0.5.3# echo $(((9553+7789+9450+9925+7595+9590)/6)) 8983 # short deen:debian/src/dash-0.5.3# echo $(( (9655+7853+9733+7826+9618+10053)/6 )) 9123 # '[' ']' deen:debian/src/dash-0.5.3# deen:debian/src/dash-0.5.3# echo $(((9231+9423+9365+9650+8883+8291)/6)) 9140 # unpatched deen:debian/src/dash-0.5.3# * Size down: olecom@deen:/mnt/debian/src/dash-0.5.3$ size src/test.o # this patchset text data bss dec hex filename 4142 0 16 4158 103e src/test.o olecom@deen:/mnt/debian/src/dash-0.5.3$ size src/test.o text data bss dec hex filename 4209 0 16 4225 1081 src/test.o olecom@deen:/mnt/debian/src/dash-0.5.3$
* [BUILTIN] test: White space fixesOleg Verych2007-09-22
| | | | Some trailing whitespace was killed or tabified.
* [SYSTEM] Check return code for getgroups and fwriteAlexey Gladkov2006-10-13
| | | | | Check getgroups() and fwrite() return code, required to build with -D_FORTIFY_SOURCE=2.
* [BUILTIN] Fix \c spillage across echo commandsHerbert Xu2005-11-14
| | | | | | | | | | | | | | | | | | | | | On Thu, Nov 03, 2005 at 07:16:53PM +0100, Mike Hommey wrote: > Here is a simple test case: > > #!/bin/dash > echo test\\ test > echo '\c' > echo test\\ test > > it outputs: > test\ test > test\ > > This is due to mis-usage of a global variable. See attached patch for a > fix. Instead of setting rval when \c is detected, this is now set in the return value of conv_escape_str. This prevents the spillage reported in http://bugs.debian.org/337294.
* [BUILTIN] Always call conv_escape_str in echocmdHerbert Xu2005-11-13
| | | | | Instead of calling conv_escape_str when we detect a backslash we will call it unconditionally. This helps get rid of some unnecessary code in echocmd.
* [SYSTEM] Added dummy sysconf implementationHerbert Xu2005-10-29
| | | | Add a dummy sysconf implementation that always fails for klibc.
* [BUILTIN] Removed standalone/csh support from testHerbert Xu2005-10-29
| | | | | Let's remove the support for standalone support from test for the same reason as printf.
* [BUILTIN] Removed standalone/csh support from printfHerbert Xu2005-10-29
| | | | | The support for standalone/csh printf only serves to complicate maintainence.
* Copyright/licence updates and remove all traces of sys/cdefs.hHerbert Xu2005-10-29
| | | | | | | | | | | This change updates the BSD licence to the three-clause version since NetBSD has already done so. This makes dash GPL-compatible. It also adds Christos Zoulas (NetBSD ash maintainer) to the COPYING file. I've added "copyright by Herbert Xu" to most files. Finally all CVS IDs and inclusion of sys/cdefs.h have been removed. The latter is needed for support of klibc.
* Invert return value of test_eaccess and rename it to test_st_mode.herbert2005-09-26
|
* Eliminate duplicate stat in test_eaccess.herbert2005-09-26
|
* Optimised FILGZ test.herbert2005-09-26
|
* Enclose abort insode ifdef DEBUG.herbert2005-09-26
|
* Renamed error to sh_error.herbert2005-09-26
|
* Initial import.Herbert Xu2005-09-26