summaryrefslogtreecommitdiff
path: root/braces.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1997-06-05 14:59:13 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:50 +0000
commitd166f048818e10cf3799aa24a174fb22835f1acc (patch)
tree1ca27f9243900f8b236d0cde6a3862002aea9e19 /braces.c
parentccc6cda312fea9f0468ee65b8f368e9653e1380b (diff)
downloadbash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.gz
Imported from ../bash-2.01.tar.gz.
Diffstat (limited to 'braces.c')
-rw-r--r--braces.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/braces.c b/braces.c
index 00952dbf..a7d9db19 100644
--- a/braces.c
+++ b/braces.c
@@ -28,11 +28,7 @@
# include <unistd.h>
#endif
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#else /* !HAVE_STRING_H */
-# include <strings.h>
-#endif /* !HAVE_STRING_H */
+#include "bashansi.h"
#if defined (SHELL)
# include "shell.h"
@@ -41,6 +37,10 @@
#include "general.h"
#define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
+#if defined (SHELL)
+extern char *extract_command_subst ();
+#endif
+
/* Basic idea:
Segregate the text into 3 sections: preamble (stuff before an open brace),
@@ -210,6 +210,10 @@ brace_gobbler (text, indx, satisfy)
int satisfy;
{
register int i, c, quoted, level, pass_next;
+#if defined (SHELL)
+ int si;
+ char *t;
+#endif
level = quoted = pass_next = 0;
@@ -242,6 +246,18 @@ brace_gobbler (text, indx, satisfy)
continue;
}
+#if defined (SHELL)
+ /* Pass new-style command substitutions through unchanged. */
+ if (c == '$' && text[i+1] == '(') /* ) */
+ {
+ si = i + 2;
+ t = extract_command_subst (text, &si);
+ i = si;
+ free (t);
+ continue;
+ }
+#endif
+
if (c == satisfy && level == 0 && quoted == 0)
{
/* We ignore an open brace surrounded by whitespace, and also