Commit Graph

617 Commits

Author SHA1 Message Date
christos
9fd1d5af01 PR/11317: Hubert Feyrer: Recognize mismatched parentheses inside old style
command substitution.
2008-11-05 22:04:43 +00:00
christos
bc4eb9bdd7 show better quoting output for sh -x, from Aleksey Cheusov 2008-10-31 14:38:42 +00:00
apb
89799ead73 Pass SED=${TOOL_SED:Q} in the environment to scripts run during the build. 2008-10-25 22:23:55 +00:00
apb
125b7c8cbb In shell scripts run during the build, add a SED variable, defaulting
to "sed".  SED=${TOOL_SED:Q} should be passed in the environment to
override this.
2008-10-25 22:18:15 +00:00
apb
9577284633 Don't try to remove trailing newlines from shell variables via
constructs like ${var%$nl}.  Apparently this allows the Ubuntu Linux
/bin/sh (dash) to be used as a host shell during the build.
Patch from PR 39786 by Andy Shevchenko.
2008-10-23 20:21:57 +00:00
apb
cd5c0f944d In shell scripts invoked during a build, and in crunchgen, use ${AWK}
instead of plain "awk".  The Makefiles that invoke these scripts
or programs will pass AWK=${HOST_AWK:Q}.
2008-10-19 22:10:04 +00:00
apb
96230fab84 Use ${TOOL_AWK} instead of ${AWK} or plain "awk" in make commands.
Pass AWK=${TOOL_AWK:Q} to shell scripts that use awk.
2008-10-19 22:05:19 +00:00
dholland
7fb5a8c68e The field width passed for a %.*s printf format is supposed to be int, not
ptrdiff_t; on 64-bit platforms the latter will be too wide.
Adjust accordingly.
2008-10-16 17:58:29 +00:00
dholland
72c2627f1f Wrap declaration of a STATIC function that's only conditionally defined
in a suitable ifdef, so things still compile if STATIC is defined as
"static", which is for some reason not the default.
2008-10-16 15:36:23 +00:00
dholland
744c8edc4b Wrap declaration of a STATIC function that's only conditionally defined
in a suitable ifdef, so things still compile if STATIC is defined as
"static", which is for some reason not the default.

(In the long run STATIC should go away - it might have once been a
portability hack but now definitely serves no purpose.)
2008-10-16 15:31:05 +00:00
dholland
e54c6daca4 Remove unused global variables 2008-10-16 14:55:28 +00:00
dholland
0faa1734e3 Use "extern" properly for referencing globals defined in other modules.
Now builds cleanly with -warn-common.
2008-10-16 14:36:40 +00:00
dholland
30a1416240 output.c output.h: expose OUTPUT_ERR (flag for an exposed flags variable)
bltin.h: support ferror()
echo.c: use ferror() to fail on output write errors

Another piece of PR bin/39574.
2008-10-12 01:40:37 +00:00
christos
8c54d84110 Fix here documents that end abruptly without NL before EOF.
(Andy Shevchenko)
2008-08-23 10:05:52 +00:00
lukem
2fe2731d3f Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-20 00:52:39 +00:00
tron
9cae530b67 Revert revisions 1.91 and 1.92. The POSIX spec about the correct behaviour
is contradictory at best. And these changes seem to cause more problems
that they are worth.
2008-05-26 14:55:17 +00:00
tron
4d6f948f7a Fix two more cases of bad handling of "set -e":
- false && false
- false || false
2008-05-24 22:24:32 +00:00
tron
c2987416cd Fix another problem with "set -e": "! true" should terminate the shell. 2008-05-24 19:06:43 +00:00
tron
35fbf8dd7f Port revision 1.44 of "src/bin/sh/eval.c" from FreeBSD to fix PR bin/38584.
Reviewed by Michael van Elst.
2008-05-24 17:12:53 +00:00
martin
3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
christos
76560beef5 Detect unmatched quotes inside old style command substitution.
echo `"`
2008-04-25 17:32:31 +00:00
apb
cd12700971 If SHELL_BUILTIN is defined (as will be the case when building external
builtins such as the printf command), then hide a few declarations.

This allows the shell to build again, fixing a problem with
"error" being declared as a function here, and as a variable in
.../usr.bin/printf/printf.c.
2008-03-29 09:58:00 +00:00
apb
d6d9ccc8ad * define SHELL_BUILTIN, which other headers may use to hide some of their
symbols if appropriate.  For example, error.h will use it to hide
  declarations that should not be seen by external builtins such as printf.
* The shell's outfmt() function returns void, but the standard fprintf()
  function returns int.  Similarly for several other functions that are
  redefined via macros in bltin.h.  Add a _RETURN_INT macro to do the
  necessary conversion.
* Delete some declarations that appear in error.h.
* Add comments on some #else/#endif lines.
2008-03-29 09:55:40 +00:00
apb
074a931bf5 Remove trailing ';' in definitions of out1c and out2c macros. 2008-03-29 09:49:52 +00:00
dsl
01709217fc Generate ANSI functions.
Just indent the code by a single tab - no need to compare against the
C program generated version any more.
2008-02-27 21:56:14 +00:00
dsl
b63023e666 Change spaces to tabs for consistency with adjacent lines. 2008-02-27 21:55:07 +00:00
matt
4498b1fe25 Fix inconsistent definitions 2008-02-15 17:26:06 +00:00
joerg
f04ccd71b4 Set unique mode for the history, so that repeating a command doesn't
spam the history.
2008-02-13 12:57:16 +00:00
msaitoh
899c734b12 Conform to XCU Section 2.8.2 (Exit Status for Commands) 2008-01-21 06:43:03 +00:00
dogcow
90ee124aaf This should have been all on one line anyway - and hey, it fixes my build
issue.
2007-12-18 07:25:00 +00:00
perry
8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
lukem
bcf893f432 use __RCSID() 2007-12-12 22:55:42 +00:00
christos
2554aff24b PR/36531: Greg A. Woods: another very helpful DEBUG TRACE() call for execve()
failures in /bin/sh
2007-06-24 18:36:23 +00:00
christos
546dff6580 PR/36533: Greg A. Woods: minor doc fixes for sh(1) 2007-06-24 17:57:56 +00:00
dsl
8da3353686 Fix sh -c 'true && ! true | false; echo $?'
Add some more TRACE((...)) calls to aid such debugging.
Fixes PR bin/36435
Clearly no one tried this test when the changes of rev 1.31 and 1.44 were done!
2007-06-07 20:57:59 +00:00
apb
faafdc7e21 Document that shell arithmetic now uses intmax_t. Document that
variables in shell arithmetic don't need "$" signs.
2007-03-25 06:56:43 +00:00
apb
1a20cbd95e WARNS=4 2007-03-25 06:30:37 +00:00
apb
91ce988bec Make /bin/sh use intmax_t (instead of int) for arithmetic in $((...)). 2007-03-25 06:29:26 +00:00
rillig
9da5e43f4d Since interpreting ELF binaries as shell scripts is not very useful, and
since the current error message is less than helpful, improve it.
2007-02-15 12:02:59 +00:00
christos
30760cbdc7 PR/35410: Valeriy E. Ushakov: /bin/sh mishandles shell function definitions
with function names that are not plain words
1. remove the escape annotations from the function name.
2. check if the function has a valid name before storing it.
2007-01-13 18:58:26 +00:00
christos
a54fe38a0d fix a volatile variable; from Anon Ymous 2006-12-18 00:37:33 +00:00
wiz
5c056f6785 s/apparant/apparent/, from Zafer. 2006-11-24 22:54:47 +00:00
christos
272937609b sprinkle volatile. 2006-10-16 00:36:19 +00:00
christos
ab28bede4c Prefix "Syntax Error" with the program name, if the command name is not
available. At least this way we get an idea of what program gives us the
message.
2006-10-04 15:00:38 +00:00
dsl
1719403bf2 Fix typo, update date.
Fixes PR/34472
2006-09-04 20:30:36 +00:00
dsl
c58b829dda Set the 'not a parameter' flag when we skip initial whitespace.
Otherwise:
    ./sh -c 'x=" "; for a in $x; do echo a${a}a; done'
is processed as a single empty parameter (instead of no parameters).
Should fix the breakage I introdiced in rev 1.75 and PR/34256 and PR/34254
2006-08-22 18:11:42 +00:00
dsl
413b7762c2 Rework the code changes from revisions 1.69, 1.70 and 1.74 so that the code
behaves correctly.
As far as I can tell, "x$@y" now expands correctly, as does IFS=:; set -$IFS.
Fixes PR/33472 (again) and PR/33956
2006-08-21 21:30:14 +00:00
christos
a8b3562160 PR/33775: YAMAMOTO Takashi: /bin/sh doesn't accept "(" before case patterns 2006-06-20 15:57:44 +00:00
dsl
0e765f005a When expanding "$@" add a \0 byte after the last argument (as well as all
the earlier ones) so that a separator is added before it when it is empty.
This wasn't needed before a recent change that chenged the behaviour of
trailing whitespace IFS characters.
Fixed PR/33472
2006-05-20 13:57:27 +00:00
christos
e80f354dab Coverity CID 3384: Don't close -1. 2006-05-13 19:47:22 +00:00