summaryrefslogtreecommitdiffstats
path: root/bin/sh/expand.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-02-03 15:54:57 +0000
committerjilles <jilles@FreeBSD.org>2013-02-03 15:54:57 +0000
commit6fa139d56eac8251b9a64c249c8e6fc8131f405c (patch)
tree798963ecfeaa133433ad99b27533d07fa1521c76 /bin/sh/expand.c
parentaa08976cf0559eb6c97a1886ea652e0f839759e5 (diff)
downloadFreeBSD-src-6fa139d56eac8251b9a64c249c8e6fc8131f405c.zip
FreeBSD-src-6fa139d56eac8251b9a64c249c8e6fc8131f405c.tar.gz
sh: Expand here documents in the current process.
Expand here documents at the same point other redirections are expanded but use a non-fork subshell environment (like simple command substitutions) for compatibility. Substitition errors result in an empty here document like before. As a result, a fork is avoided for short (<4K) expanded here documents. Unexpanded here documents (with quoted end marker after <<) are not affected by this change. They already only forked when >4K. Side effects: * Order of expansion is slightly different. * Slow expansions are not executed in parallel with the redirected command. * A non-fork subshell environment is subtly different from a forked process.
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r--bin/sh/expand.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index d43cc35..107f798 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -127,19 +127,6 @@ collate_range_cmp(wchar_t c1, wchar_t c2)
return (wcscoll(s1, s2));
}
-/*
- * Expand shell variables and backquotes inside a here document.
- * union node *arg the document
- * int fd; where to write the expanded version
- */
-
-void
-expandhere(union node *arg, int fd)
-{
- expandarg(arg, (struct arglist *)NULL, 0);
- xwrite(fd, stackblock(), expdest - stackblock());
-}
-
static char *
stputs_quotes(const char *data, const char *syntax, char *p)
{
OpenPOWER on IntegriCloud