Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git] / lib / glob / sm_loop.c
index a8b70f7..6e8cf3a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2005 Free Software Foundation, Inc.
 
    This file is part of GNU Bash, the Bourne Again SHell.
    
@@ -358,7 +358,7 @@ BRACKMATCH (p, test, flags)
                {
                  bcopy (p + 1, ccname, (close - p - 1) * sizeof (CHAR));
                  *(ccname + (close - p - 1)) = L('\0');
-                 pc = IS_CCLASS (test, ccname);
+                 pc = IS_CCLASS (test, (XCHAR *)ccname);
                }
              if (pc == -1)
                pc = 0;
@@ -522,11 +522,11 @@ PATSCAN (string, end, delim)
      CHAR *string, *end;
      INT delim;
 {
-  int pnest, bnest;
+  int pnest, bnest, skip;
   INT cchar;
   CHAR *s, c, *bfirst;
 
-  pnest = bnest = 0;
+  pnest = bnest = skip = 0;
   cchar = 0;
   bfirst = NULL;
 
@@ -534,8 +534,17 @@ PATSCAN (string, end, delim)
     {
       if (s >= end)
        return (s);
+      if (skip)
+       {
+         skip = 0;
+         continue;
+       }
       switch (c)
        {
+       case L('\\'):
+         skip = 1;
+         break;
+
        case L('\0'):
          return ((CHAR *)NULL);