diff options
author | Bruno Haible <bruno@clisp.org> | 2006-06-22 11:27:01 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:13:26 +0200 |
commit | 744d757f4a49984579344441fd9e1a41f5b21095 (patch) | |
tree | c27cc1325371686adcfc7c5b61c7b692b961d9b5 | |
parent | b677d519ae61e248c0391a72ee76a0b2d8f4126a (diff) | |
download | external_gettext-744d757f4a49984579344441fd9e1a41f5b21095.zip external_gettext-744d757f4a49984579344441fd9e1a41f5b21095.tar.gz external_gettext-744d757f4a49984579344441fd9e1a41f5b21095.tar.bz2 |
Recognize also <(...) and >(...) syntax.
-rw-r--r-- | gettext-tools/src/ChangeLog | 4 | ||||
-rw-r--r-- | gettext-tools/src/x-sh.c | 49 |
2 files changed, 42 insertions, 11 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 7e6b2a2..2df2f26 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,5 +1,9 @@ 2006-06-21 Bruno Haible <bruno@clisp.org> + * x-sh.c (read_word): Recognize the Bash process substitution syntax. + +2006-06-21 Bruno Haible <bruno@clisp.org> + * x-sh.c (read_word): Recognize $(...) and $((...)) also inside double-quoted strings. Reported by Michelle Konzack <linux4michelle@freenet.de>. diff --git a/gettext-tools/src/x-sh.c b/gettext-tools/src/x-sh.c index 8b18d40..d8ba7d6 100644 --- a/gettext-tools/src/x-sh.c +++ b/gettext-tools/src/x-sh.c @@ -759,21 +759,27 @@ read_word (struct word *wp, int looking_for, flag_context_ty context) if (c == '<' || c == '>') { - /* Recognize the redirection operators < > >| << <<- >> <> <& >& */ + /* Recognize the redirection operators < > >| << <<- >> <> <& >& + But <( and >) are handled below, not here. */ int c2 = phase2_getc (); - if ((c == '<' ? c2 == '<' : c2 == '|') || c2 == '>' || c2 == '&') + if (c2 != '(') { - if (c == '<' && c2 == '<') + if ((c == '<' ? c2 == '<' : c2 == '|') || c2 == '>' || c2 == '&') { - int c3 = phase2_getc (); - if (c3 != '-') - phase2_ungetc (c3); + if (c == '<' && c2 == '<') + { + int c3 = phase2_getc (); + if (c3 != '-') + phase2_ungetc (c3); + } } + else + phase2_ungetc (c2); + wp->type = t_redirect; + return; } else phase2_ungetc (c2); - wp->type = t_redirect; - return; } if (looking_for == CLOSING_BACKQUOTE && c == CLOSING_BACKQUOTE) @@ -873,8 +879,8 @@ read_word (struct word *wp, int looking_for, flag_context_ty context) c3 = phase2_getc (); if (c3 == '(') { - /* Arithmetic expression. Skip until the matching closing - parenthesis. */ + /* Arithmetic expression (Bash syntax). Skip until the + matching closing parenthesis. */ unsigned int depth = 2; do @@ -890,7 +896,7 @@ read_word (struct word *wp, int looking_for, flag_context_ty context) } else { - /* Command substitution. */ + /* Command substitution (Bash syntax). */ phase2_ungetc (c3); read_command_list (')', context); } @@ -1127,6 +1133,27 @@ read_word (struct word *wp, int looking_for, flag_context_ty context) if (c == CLOSING_BACKQUOTE) break; + if (c == '<' || c == '>') + { + int c2; + + /* An unquoted c indicates we are not inside '...' nor "...". */ + if (open_singlequote || open_doublequote) + abort (); + + c2 = phase2_getc (); + if (c2 == '(') + { + /* Process substitution (Bash syntax). */ + read_command_list (')', context); + + wp->type = t_other; + continue; + } + else + phase2_ungetc (c2); + } + if (!open_singlequote && !open_doublequote && (is_whitespace (c) || is_operator_start (c))) break; |