From: Andrew M. <fit...@us...> - 2006-05-26 19:15:57
|
Update of /cvsroot/radmind/radmind-assistant/rte In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18425 Modified Files: UMWildcard.m Log Message: Additional wildcard patterns (from wildcard.c patch 1488099) Index: UMWildcard.m =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rte/UMWildcard.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UMWildcard.m 25 Apr 2006 20:24:08 -0000 1.2 --- UMWildcard.m 26 May 2006 19:15:54 -0000 1.3 *************** *** 19,24 **** wildcard( unsigned char *wild, unsigned char *p, int sensitive ) { ! int min, max; ! int i; for (;;) { --- 19,25 ---- wildcard( unsigned char *wild, unsigned char *p, int sensitive ) { ! int min, max; ! int i, match; ! unsigned char *tmp; for (;;) { *************** *** 71,74 **** --- 72,177 ---- 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++; |