summaryrefslogtreecommitdiffstats
path: root/bin/sh/parser.c
Commit message (Collapse)AuthorAgeFilesLines
* When parsing an invalid parameter expansion (eg. ${} or ${foo@bar}) do notstefanf2006-11-051-9/+19
| | | | | | | | | | | issue a syntax error immediately but save the information that it is erroneous for later when the parameter expansion is actually done. This means eg. "false && ${}" will not generate an error which seems to be required by POSIX. Include the invalid parameter expansion in the error message (sometimes abbreviated with ... because recovering it would require a lot of code). PR: 105078 Submitted by: emaste
* Do not forget to increment the input line counteryar2006-07-311-0/+1
| | | | | | | when reading a word spanning multiple lines. PR: bin/101094 MFC after: 5 days
* Remove a hack for an ancient gdb.stefanf2005-08-151-13/+4
|
* Put the comparison with PEOF into a new macro is_eof(). Don't use it if thestefanf2005-08-131-3/+4
| | | | character comes from a string.
* Use assignment rather than comparison.stefanf2005-08-131-2/+2
|
* Include missing headers.stefanf2005-08-131-0/+1
|
* Support \H, \h, \w, \W, \$ string expansion in the prompt.obrien2005-03-011-4/+91
| | | | Submitted by: mini
* Remove clause 3 from the UCB licenses.markm2004-04-061-4/+0
| | | | OK'ed by: imp, core
* Replace home-grown dup2() implementation with actual dup2() calls. Thisdes2004-01-211-1/+0
| | | | | | | should slightly reduce the number of system calls in critical portions of the shell, and select a more efficient path through the fdalloc code. Reviewed by: bde
* Changes following CScout analysis:dds2003-07-051-11/+11
| | | | | | | | | | | - Removed dead declarations - Made objects that should have been declared as static, static. The changes use STATIC instead of static, following the existing convention in the rest of the code. Approved by: schweikh (mentor) MFC after: 2 weeks
* Disallow empty condition parts of "if", "while" and "until" compoundtjr2002-10-061-3/+6
| | | | | | commands. Commands like "if then ... fi" and "while do ... done" are no longer accepted. Bodies of compound commands are still allowed to be empty, because even though POSIX does not allow them, most shells do.
* Remove bits and pieces of support for atty, which was made obsolete bytjr2002-10-011-10/+0
| | | | | | adding history and vi/emacs-style line editing to the shell itself. Atty was a user-mode terminal emulator (like screen and window) that did line editing and history.
* Allow a left parenthesis before patterns in case blocks. POSIX requirestjr2002-09-301-0/+2
| | | | us to accept this, but I've never seen a script that uses it.
* Allow empty case/esac statements; POSIX requires this, and recent versionstjr2002-09-301-2/+2
| | | | | | | of autoconf are generating scripts that use this feature. PR: 43275 35879 Submitted by: Dan Nelson <dnelson@allantgroup.com>
* Replace various spellings with FALLTHROUGH which is lint()ablecharnier2002-08-251-1/+1
|
* Allow redirections by themselves between "&&" and "||" operators.tjr2002-08-111-3/+2
| | | | | | | For example, >/dev/null && echo foo Pointed out by: FUJISHIMA Satsuki MFC after: 1 week
* Don't allow "||" or "&&" to be the first tokens of a command.tjr2002-07-221-0/+1
| | | | | PR: 40386 MFC after: 2 weeks
* Consistently use FBSDIDobrien2002-06-301-2/+2
|
* Minor const cleanup.jmallett2002-06-201-2/+2
| | | | Don't discard qualifiers we don't need to discard.
* Implement the -C (-o noclobber) option, which prevents existing regulartjr2002-05-191-0/+2
| | | | files from being overwritten by shell redirection.
* o __P has been reovedimp2002-02-021-59/+52
| | | | | | | | | | | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. o Change int foo() { ... to int foo(void) { ...
* BASESYNTAX, DQSYNTAX, SQSYNTAX and ARISYNTAX handles negative indexes.tegge2001-09-191-2/+2
| | | | | Allow those to be used to properly quote characters in the shell control character range.
* ``|'' should be more binding than ``!'' so that this isn't broken:brian2001-04-091-2/+13
| | | | | | | | if ! echo bla | wc -c ; then echo broken fi Obtained from: NetBSD
* A much better (more correct) fix for handling ``!'' charactersbrian2001-04-041-23/+40
| | | | Obtained from: NetBSD
* Handle ``!'' characters when they appear as second and subsequentbrian2001-04-041-0/+3
| | | | | | | | parts of an && or || expression. This makes this expression work as expected: if true && ! false; then echo yes; fi
* Implement the <> redirection operator.brian2000-10-031-0/+2
|
* Disable part of my 8-bits fixes from December 1999.cracauer2000-08-161-4/+1
| | | | | | | | Serious fix still needed, see discussion on -current (Subject: /bin/sh dumps core with here-document of 8bit text) Problem in this code originally spotted by Jun Kuriyama <kuriyama@FreeBSD.org>
* Fix parsing of string for eval command.cracauer2000-05-151-0/+1
| | | | | PR: 18447 Submitted by: Koji Mori <mori@tri.asanuma.co.jp>
* Fix warnings, some of them serious because sh violated namecracauer2000-04-201-2/+1
| | | | | | | | spaces reserved by the header files it includes. mkinit.c still produces C code with redundant declarations, although they are more harmless since they automatically derived from the right places.
* Fix ${#varname} (getting length of string) when in double-quotes.cracauer2000-02-151-1/+1
| | | | | | | Approved-by: jkh PR: bin/12137 Submitted by: "Danny J. Zerkel" <dzerkel@columbus.rr.com>
* Second part of 8-bit fixes.cracauer1999-12-161-1/+9
|
* First round of 8-bit fixes.cracauer1999-12-151-4/+5
|
* Fix "subscript has type `char'" warnings by casting to int, ascracauer1999-12-041-1/+1
| | | | discussed on -arch.
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Be more consistent with handling of quote mark control character.tegge1998-09-131-9/+19
| | | | | | | Don't output double-quotes inside variable expansion/arithmetic expansion region in here-documents. When leaving the arithmetic expansion syntax mode, adjust the dblquote flag according to previous syntax, in order to avoid splitting of quoted variables.
* Better handling of word splitting. Don't record the same regiontegge1998-09-061-1/+10
| | | | | | multiple times when performing nested variable expansion, and preserve some quoting information in order to avoid removing apparently empty expansion result.
* Add rcsid. Spelling.charnier1998-05-181-3/+5
|
* Use the __unused attribute where warranted.steve1997-05-191-3/+3
|
* Revert changes from rev 1.16 to 1.17 for now. Closes PR 2879.steve1997-04-281-49/+29
|
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Merge in NetBSD mods and -Wall cleaning.steve1996-12-141-45/+121
| | | | Obtained from: NetBSD, me
* Ok, lets try this again, shall we? It was definatly my mistake, notpeter1996-09-101-1/+13
| | | | Steve's.. :-]
* ack! back these out so I can see what I did wrong. It looks like apeter1996-09-101-12/+0
| | | | patch-by-hand botch, but it sig-11's during make world.
* Fix for PR#1248, sh doesn't expand past ${9}peter1996-09-101-1/+13
| | | | Submitted by: Steve Price <sprice@hiwaay.net>
* Fix for PR#1287. This makes sh behave sensibly in case statements in thepeter1996-09-031-4/+9
| | | | | | | | | | | | | | face of aliases. Note, bash doesn't do aliases while running scripts, but "real" ksh does.. Also: Reduce redundant .Nm macros in (unused) bltin/echo.1 nuke error2, it's hardly used. More -Wall cleanups dont do certain history operations if NO_HISTORY defined handle quad_t's from resource limits Submitted by: Steve Price <sprice@hiwaay.net> (minor tweaks by me)
* Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is apeter1996-09-011-81/+166
| | | | | | | | | | | | | | merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
* Fix the borokeness that crept in with rev 1.10 of parser.c, the shjoerg1996-02-031-2/+2
| | | | | | | | didn't correctly start background jobs anymore. Strange that nobody was complaining... Add a dummy target for `builtins' in the Makefile, to prevent it from attempting to build this file by compiling builtins.c. :-/
* The shell incorrectly gave & precedence over ;. This breaks thejoerg1995-12-101-23/+19
| | | | | | | | | | | traditional behaviour, and it violates Posix.2. Fixes PR # bin/880: /bin/sh incorrectly parse... Fixes also an earlier problem report about the shell not evaluating loops correctly. (Not files via GNATS.) Submitted by: nnd@itfs.nsk.su (Nickolay N. Dudorov)
* Sigh. This will become a never ending story. :-(joerg1995-08-281-1/+4
| | | | | | When comparing my recent parser change against the ash in 1.1.5.1, i found that a couple of other problems in the same area has been fixed there, but not in 2.2. Semicolons and EOF do also delimit words...
OpenPOWER on IntegriCloud