summaryrefslogtreecommitdiffstats
path: root/bin/sh/expand.h
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-10-29 13:42:18 +0000
committerjilles <jilles@FreeBSD.org>2010-10-29 13:42:18 +0000
commit28ad180ab428c06679f4d2e8422bfb77ae2a926c (patch)
treea904801ee278e1d897c3118d8e675fd52f1a7856 /bin/sh/expand.h
parentb6cd17990d125d91ed9a1a32e708c186c2fd3945 (diff)
downloadFreeBSD-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/expand.h')
-rw-r--r--bin/sh/expand.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/expand.h b/bin/sh/expand.h
index a3e079a..a4bb198 100644
--- a/bin/sh/expand.h
+++ b/bin/sh/expand.h
@@ -52,6 +52,8 @@ struct arglist {
#define EXP_VARTILDE 0x4 /* expand tildes in an assignment */
#define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */
#define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */
+#define EXP_SPLIT_LIT 0x20 /* IFS split literal text ${v+-a b c} */
+#define EXP_LIT_QUOTED 0x40 /* for EXP_SPLIT_LIT, start off quoted */
union node;
OpenPOWER on IntegriCloud