]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Recognize also <(...) and >(...) syntax.
authorBruno Haible <bruno@clisp.org>
Thu, 22 Jun 2006 11:27:01 +0000 (11:27 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:26 +0000 (12:13 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/x-sh.c

index 7e6b2a2090cab5512b5cac9b9d2699560bd00232..2df2f26825be01a6439882479686497899d181e3 100644 (file)
@@ -1,3 +1,7 @@
+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
index 8b18d40bc07144646bf0f43b1df2aca26784f520..d8ba7d635301a9f5f12aec80fe371e8119f55f4b 100644 (file)
@@ -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;