seb
cf788c3115
Add new builtin `wordexp' to support wordexp(3).
...
From FreeBSD.
Provided in PR lib/26123.
Approved by kleink@.
2004-07-13 15:05:59 +00:00
christos
5dd9099216
PR/25699: David Laight: sh(1) hangs opening a named pipe as stdin for
...
background process
This happens because we vfork, and then open a named pipe with O_RDONLY
and block in the child. We avoid this, by opening the file with O_NONBLOCK,
and then reset it if we are vforked. XXX: this is an ugly fix.
2004-07-08 03:57:33 +00:00
mycroft
1ccdf5daeb
Make "set -e" once again provide the behavior documented in the man page,
...
which was unnecessarily changed in revision 1.50 while fixing other bugs.
That is, exit the shell if the last command in a || or && compound statement
is not short-circuited, and exits with a false status. I.e., the following
will cause the shell to exit:
set -e
false || false
While this is not the prescribed behavior in SUSv3, it is what our man page
documents, and it is what all of the following implementations do:
NetBSD /bin/ksh (pdksh)
bash
zsh
Solaris 9 /bin/sh
Solaris 9 /usr/xpg4/bin/sh
Solaris 9 /usr/bin/ksh
Tru64 /bin/sh
HP/UX 11 /bin/sh
The "standard" seems to be wrong in this instance.
2004-06-30 09:32:38 +00:00
dsl
60bb0d96f3
Fix treatment of ' inside a 'here document' with a quoted EOF marker.
...
Fixes a breakage from the previous version.
2004-06-27 10:27:57 +00:00
dsl
c6cbc16d26
Correctly apply IFS to unquoted text in ${x-text}.
...
Fixes PR/26058 and the 'for i in ${x-a b c}; do ...' and ${x-'a b' c}.
I can't find a PR for the latter problem.
Regression test goind in shortly.
2004-06-26 22:09:49 +00:00
dsl
97e8f81436
Remove a broken optimistion that crept in earlier today.
2004-06-26 20:48:44 +00:00
dsl
8e940884ca
Kill a diagnostic I accidentally left in.
2004-06-26 14:21:29 +00:00
dsl
e4a2a056d2
No functional changes (intended).
...
Rename some variables, add some comments, and restructure a little.
In preparation for fixing "set ${x-a b c}" and friends.
2004-06-26 14:09:58 +00:00
dsl
39cf7788fc
Use shell variables to get '(' and '\' inside shell substitution patterns.
...
Solves problems with different shells having differntly buggy parsers
(and the standard probably allowing random behaviour).
Should fix bin/25938
2004-06-15 23:09:54 +00:00
dsl
c6e67e3bf2
Change '\0' to 0 so that the SVR4 'echo' doesn't convert it to a null byte.
...
Fixes bin/25938
2004-06-15 22:57:27 +00:00
christos
cf19966782
Undo previous fix, breaks:
...
#!/bin/sh
echo ${1+"$@"}
./sh.new foo.sh a b c
a b c b c
I'll revisit this when I have some more time.
2004-06-09 12:17:36 +00:00
christos
fc5d411571
"for i in ${x-a b c}; do echo $i; done" should print "a\nb\nc\n" not "a b c\n"
...
like other shells do. mark the expansion for ifs splitting. XXX: linux has a
very complicated fix for this. I wonder why.
2004-06-08 03:29:51 +00:00
christos
95a737969b
don't include the printf builtin if we are SMALL; saves 10K.
2004-06-06 07:03:11 +00:00
hubertf
c784286d1a
Fix typo: and the -> and then
2004-06-03 19:54:37 +00:00
dsl
00a6315e86
Ensure that fd 0, 1 and 2 are not used for the local end of pipelines.
...
Fixes PR bin/25395
2004-04-30 06:27:59 +00:00
wiz
d8dd84fc16
Fix typo noted by Patrick Welche.
2004-04-23 13:28:15 +00:00
lukem
778dabc229
Correct the description of sbsize; it is parsed in bytes not kbytes.
2004-04-19 01:36:32 +00:00
wiz
8e5ab2cd61
Bump date for previous.
2004-04-17 15:42:42 +00:00
christos
6acf809e53
understand rlimit sbsize
2004-04-17 15:40:12 +00:00
dsl
f0177aeba6
Put a syntax.c under CVS instead of building if with the mksyntax program.
...
Kill mksyntax.c - no longer possible to get the 'wrong sort of chars'.
/bin/sh now has no helper binaries.
syntax.c uses C99 initialisers, run time initialisation could be used
for systems where the compiler doesn't support them.
I've used some #defines to help make this possible - but writing the code
starts making it rather messy.
2004-01-17 17:38:12 +00:00
dsl
9cd22030d1
Put syntax.h under CVS instead of having it generated by mksyntax.
...
Use CHAR_MIN (from limits.h) to determine whether target char are signed
or unsigned - the syntax tables will not be indexed properly.
Rip out all the stuff from mksyntax.c that wrote syntax.h.
syntax.c can stiff be generated incorrectly...
2004-01-17 15:40:09 +00:00
dsl
1fe487ae6e
Replace mkinit.c with mkinit.sh
...
Build mksyntax directly from mksyntax.c so that the -DTARGET_CHAR=xxx
is applied when it is build.
OTOH mksyntax is broken as it tries to determine properties of the
target system by running code on the build system.
2004-01-17 11:47:30 +00:00
dsl
df348483d0
Replace the C program mknodes.c with a shell script mknodes.sh
...
(mkinit and mksyntax may also die soon...)
2004-01-16 23:24:38 +00:00
jmmv
b635f565e7
Homogenize usage messages: make the 'usage' word all lowercase, as this seems
...
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
wiz
4eb81d63b4
Fix example added in previous.
2003-12-21 11:16:23 +00:00
jdolecek
9927abce5e
add a note to Short-Circuit operators section about the somewhat
...
nonintuitive evaluation in case there is both || and && specified
pointed out in bin/23814 by VaX#n8
2003-12-21 08:40:29 +00:00
jdolecek
30651d6b04
minor optimization in evalvar()
...
change sent in bin/23813 by VaX#n8
2003-12-21 08:32:39 +00:00
heas
8e58476bbd
correct 2 typos
2003-12-18 15:52:31 +00:00
christos
08f1ceee65
PR/23786: Robert Nestor: wait command returns the wrong status code. This
...
seems to be an off-by-one error, since njobs is decremented before we use
it. I hope this does not break the vfork case!
2003-12-18 00:56:05 +00:00
dsl
7983f217c9
Generate command line when SMALL is defined and make buffer full sized.
...
All the code has been present for a while, and the memory cost is (about)
180 bytes per process.
Fixes PR bin/23545
2003-11-27 21:16:14 +00:00
lukem
e606e2dcb2
Improve how various "simple" host tools are built and invoked.
2003-11-16 14:14:18 +00:00
dsl
296844fe72
Posix requires that 'pwd -P' reset the shells saved cwd value - so a
...
subsequent 'pwd -L' will report the same value.
Update man page to be a closer match to reality.
2003-11-14 20:00:28 +00:00
dsl
c0cf1d6b30
This seems to need stdlib.h to get a prototype for abort().
2003-11-14 10:46:13 +00:00
dsl
edecd89511
Add '\n' to "fork failed" trace messages.
2003-11-14 10:27:10 +00:00
dsl
df5bd11fb9
Validate the arguments to 'pwd'. Treat -L and -P as per pwd(1).
...
Note that 'pwd -L' and 'pwd -P' almost always report the same answer as
the shell detects when 'cd' follows a symlink and discards its cached 'pwd'
2003-10-30 09:40:26 +00:00
wiz
6a22b79c1a
passwd(5), not passwd(4). From Igor Sobrado in PR 23278.
2003-10-27 08:23:40 +00:00
wiz
4580c6ac21
Do not xref alias(1) since that points to csh(1).
...
Noted by Igor Sobrado in PR 23278, fixed following a suggestion by Greg A. Woods.
2003-10-27 08:22:21 +00:00
lukem
7568eb663a
skip a leading `-' on the arg0 name when calling el_init()
2003-10-27 06:19:29 +00:00
lukem
130ab7336b
Rework how MAKEVERBOSE operates:
...
* Don't bother prefixing commands with a line of ${_MKCMD}\
and instead rely upon "make -s". This is less intrusive on
all the Makefiles than the former. Idea from David Laight.
* Rename the variables use to print messages. The scheme now is:
_MKMSG_FOO Run _MKMSG 'foo'
_MKTARGET_FOO Run _MKMSG_FOO ${.TARGET}
From discussion with Alistair Crooks.
2003-10-21 10:01:19 +00:00
christos
1bbc81a501
Let libedit handle signals so we resize properly. I might change my mind
...
later on that.
2003-10-19 19:13:21 +00:00
lukem
ddff99b7f4
rework to use the newer _MKMSGCREATE (et al) macros
2003-10-19 04:45:01 +00:00
lukem
1e840c4d40
Ensure that $TERM is set in the real environment before calling el_init(3)
...
when executing "set -o (emacs|vi)". Fixes [bin/23175] from me.
2003-10-19 01:55:05 +00:00
lukem
a9d371700c
improve MAKEVERBOSE message for HOST_LINKed tools
2003-10-19 00:43:02 +00:00
lukem
29e7d09b65
Support MAKEVERBOSE (XXX: mksyntax is noisy when MAKEVERBOSE=0).
...
Use DPSRCS appropriately.
2003-10-19 00:35:26 +00:00
lukem
51b9502fb1
Link the host tools against tools/compat -lnbcompat since someone decided to
...
use strlcpy() and snprintf() in the host tools...
Should fix part of [toolchain/22504], and build problems on other
platforms that don't have strlcpy() or snprintf()...
2003-10-18 07:58:35 +00:00
dsl
b17e1b5c12
Fix 'set "*" b; case "* b" in "$@") ...' and 'set "*"; case 1 in "${#1}") ...'
...
Which got broken by the previous fix.
2003-09-22 12:17:24 +00:00
jmmv
4c79e7620f
Drop equal signs from rule definitions; they cause problems with "bison -y".
2003-09-17 17:33:36 +00:00
christos
4dcb41ae2c
PR/22640: Paul Jarc: sh mishandles positional parameters in case. Fixed
...
from FreeBSD PR 56147.
2003-09-17 16:01:19 +00:00
jmmv
0ec085e737
Add 'trace' to CLEANFILES, generated when debug is enabled.
2003-09-14 12:11:10 +00:00
jmmv
af90286087
Fix crash when DEBUG=2, by opening the log file ASAP. Reviewed by simonb@.
2003-09-14 12:09:29 +00:00