Update of /cvsroot/radmind/radmind
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv31458
Modified Files:
wildcard.c
Log Message:
Committing [ 1488099 ] Additional wildcard patterns
Index: wildcard.c
===================================================================
RCS file: /cvsroot/radmind/radmind/wildcard.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** wildcard.c 19 Jul 2004 18:53:06 -0000 1.10
--- wildcard.c 4 Aug 2006 15:21:11 -0000 1.11
***************
*** 15,19 ****
{
int min, max;
! int i;
for (;;) {
--- 15,20 ----
{
int min, max;
! int i, match;
! char *tmp;
for (;;) {
***************
*** 66,69 ****
--- 67,172 ----
break;
+ case '?' :
+ wild++;
+ p++;
+ break;
+
+ case '[' :
+ wild++;
+ match = 0;
+
+ while ( isalnum((int)*wild )) {
+ if ( *wild == *p ) {
+ match = 1;
+ break;
+ }
+ wild++;
+ }
+ if ( *wild != ']' ) {
+ while ( *wild ) {
+ if ( *wild == ']' ) {
+ break;
+ }
+ wild++;
+ }
+ if ( *wild == '\0' ) {
+ return( 0 );
+ }
+ }
+ p++;
+ wild++;
+
+ if ( match == 0 ) {
+ return( 0 );
+ }
+ break;
+
+ case '{' :
+ wild++;
+ tmp = p;
+ match = 1;
+
+ while ( *wild == ',' ) wild++;
+ while ( isprint((int)*wild )) {
+ if ( *wild == ',' ) {
+ if ( match ) {
+ break;
+ }
+
+ match = 1;
+ wild++;
+ p = tmp;
+ }
+ while ( *wild == ',' ) wild++;
+
+ if ( *wild == '}' ) {
+ break;
+ }
+
+ if ( sensitive ) {
+ if ( *wild != *p ) {
+ match = 0;
+ }
+ } else {
+ if ( tolower( *wild ) != tolower( *p )) {
+ match = 0;
+ }
+ }
+
+ if ( !match ) {
+ /* find next , or } or NUL */
+ while ( *wild ) {
+ wild++;
+ if ( *wild == ',' || *wild == '}' ) {
+ break;
+ }
+ }
+ } else {
+ wild++, p++;
+ }
+ }
+
+ if ( !match ) {
+ return( 0 );
+ }
+
+ /* verify remaining format */
+ if ( *wild != '}' ) {
+ while ( *wild ) {
+ if ( *wild == '}' ) {
+ break;
+ }
+ wild++;
+ }
+ if ( *wild == '\0' ) {
+ return( 0 );
+ }
+ }
+ if ( *wild++ != '}' ) {
+ return( 0 );
+ }
+
+ break;
+
case '\\' :
wild++;
|