diff options
author | jilles <jilles@FreeBSD.org> | 2010-10-29 13:42:18 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-10-29 13:42:18 +0000 |
commit | 28ad180ab428c06679f4d2e8422bfb77ae2a926c (patch) | |
tree | a904801ee278e1d897c3118d8e675fd52f1a7856 /bin/sh/parser.h | |
parent | b6cd17990d125d91ed9a1a32e708c186c2fd3945 (diff) | |
download | FreeBSD-src-28ad180ab428c06679f4d2e8422bfb77ae2a926c.zip FreeBSD-src-28ad180ab428c06679f4d2e8422bfb77ae2a926c.tar.gz |
sh: Do IFS splitting on word in ${v+word} and ${v-word}.
The code is inspired by NetBSD sh somewhat, but different because we
preserve the old Almquist/Bourne/Korn ability to have an unquoted part in a
quoted ${v+word}. For example, "${v-"*"}" expands to $v as a single field if
v is set, but generates filenames otherwise.
Note that this is the only place where we split text literally from the
script (the similar ${v=word} assigns to v and then expands $v). The parser
must now add additional markers to allow the expansion code to know whether
arbitrary characters in substitutions are quoted.
Example:
for i in ${$+a b c}; do echo $i; done
Exp-run done by: pav (with some other sh(1) changes)
Diffstat (limited to 'bin/sh/parser.h')
-rw-r--r-- | bin/sh/parser.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/bin/sh/parser.h b/bin/sh/parser.h index 453711f..64ec97f 100644 --- a/bin/sh/parser.h +++ b/bin/sh/parser.h @@ -43,6 +43,7 @@ #define CTLARI '\206' #define CTLENDARI '\207' #define CTLQUOTEMARK '\210' +#define CTLQUOTEEND '\211' /* only for ${v+-...} */ /* variable substitution byte (follows CTLVAR) */ #define VSTYPE 0x0f /* type of variable substitution */ |