dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.9,1.10


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.9,1.10
Date: Mon, 16 Dec 2002 06:49:27 -0500

Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv8432/support

Modified Files:
        cmdline.c 
Log Message:


Map "*.*" to "match everything", even filenames that don't include
a ".", to be consistent with standard Windows practice.



Index: cmdline.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/cmdline.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** cmdline.c   16 Dec 2002 10:16:11 -0000      1.9
--- cmdline.c   16 Dec 2002 11:49:24 -0000      1.10
***************
*** 431,486 ****
                OutOfMemory();
        }
!       posn = 0;
!       regex[posn++] = '^';
!       first = 1;
!       while(*baseName != '\0')
        {
!               ch = *baseName++;
!               if(ch == '?')
                {
!                       if(first)
                        {
!                               /* Don't match '.' at the start of the name */
!                               regex[posn++] = '[';
!                               regex[posn++] = '^';
!                               regex[posn++] = '.';
!                               regex[posn++] = ']';
                        }
!                       else
                        {
!                               regex[posn++] = '.';
                        }
!               }
!               else if(ch == '*')
!               {
!                       if(first)
                        {
!                               /* Don't match '.' at the start of the name */
!                               regex[posn++] = '[';
!                               regex[posn++] = '^';
!                               regex[posn++] = '.';
!                               regex[posn++] = ']';
!                               regex[posn++] = '*';
                        }
                        else
                        {
!                               regex[posn++] = '.';
!                               regex[posn++] = '*';
                        }
                }
!               else if(ch == '.' || ch == '^' || ch == '$' || ch == '[' ||
!                               ch == ']' || ch == '\\' || ch == '(' || ch == 
')')
!               {
!                       regex[posn++] = '\\';
!                       regex[posn++] = (char)ch;
!               }
!               else
!               {
!                       regex[posn++] = (char)ch;
!               }
!               first = 0;
        }
-       regex[posn++] = '$';
-       regex[posn] = '\0';
        if(IL_regcomp(&state, regex, REG_EXTENDED | REG_NOSUB) != 0)
        {
--- 431,497 ----
                OutOfMemory();
        }
!       if(!strcmp(baseName, "*.*"))
        {
!               /* Special case: map "*.*" to "match everything", even
!                  those filenames that don't include a ".", to be
!                  consistent with standard Windows practice */
!               strcpy(regex, "^[^.].*$");
!       }
!       else
!       {
!               posn = 0;
!               regex[posn++] = '^';
!               first = 1;
!               while(*baseName != '\0')
                {
!                       ch = *baseName++;
!                       if(ch == '?')
                        {
!                               if(first)
!                               {
!                                       /* Don't match '.' at the start of the 
name */
!                                       regex[posn++] = '[';
!                                       regex[posn++] = '^';
!                                       regex[posn++] = '.';
!                                       regex[posn++] = ']';
!                               }
!                               else
!                               {
!                                       regex[posn++] = '.';
!                               }
                        }
!                       else if(ch == '*')
                        {
!                               if(first)
!                               {
!                                       /* Don't match '.' at the start of the 
name */
!                                       regex[posn++] = '[';
!                                       regex[posn++] = '^';
!                                       regex[posn++] = '.';
!                                       regex[posn++] = ']';
!                                       regex[posn++] = '.';
!                                       regex[posn++] = '*';
!                               }
!                               else
!                               {
!                                       regex[posn++] = '.';
!                                       regex[posn++] = '*';
!                               }
                        }
!                       else if(ch == '.' || ch == '^' || ch == '$' || ch == 
'[' ||
!                                       ch == ']' || ch == '\\' || ch == '(' || 
ch == ')')
                        {
!                               regex[posn++] = '\\';
!                               regex[posn++] = (char)ch;
                        }
                        else
                        {
!                               regex[posn++] = (char)ch;
                        }
+                       first = 0;
                }
!               regex[posn++] = '$';
!               regex[posn] = '\0';
        }
        if(IL_regcomp(&state, regex, REG_EXTENDED | REG_NOSUB) != 0)
        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]