#include "common.h"Include dependency graph for wildcmp.c:

Go to the source code of this file.
Functions | |
| static int | subMatch (char *str, char *wild) |
| boolean | wildMatch (char *wildCard, char *string) |
Variables | |
| static char const | rcsid [] = "$Id: wildcmp.c,v 1.5 2003/05/06 07:33:44 kate Exp $" |
| static int subMatch | ( | char * | str, | |
| char * | wild | |||
| ) | [static] |
Definition at line 10 of file wildcmp.c.
Referenced by wildMatch().
00013 { 00014 int len = 0; 00015 00016 for(;;) 00017 { 00018 if(toupper(*str++) != toupper(*wild++) ) 00019 return(0); 00020 ++len; 00021 switch(*wild) 00022 { 00023 case 0: 00024 case '?': 00025 case '*': 00026 return(len); 00027 } 00028 } 00029 }
Here is the caller graph for this function:

| boolean wildMatch | ( | char * | wildCard, | |
| char * | string | |||
| ) |
Definition at line 31 of file wildcmp.c.
References FALSE, subMatch(), and TRUE.
Referenced by blastFileOpenVerify(), listDir(), listDirX(), and rkeyEval().
00036 { 00037 boolean matchStar = 0; 00038 int starMatchSize; 00039 00040 for(;;) 00041 { 00042 NEXT_WILD: 00043 switch(*wildCard) 00044 { 00045 case 0: /* end of wildcard */ 00046 { 00047 if(matchStar) 00048 { 00049 while(*string++) 00050 ; 00051 return TRUE; 00052 } 00053 else if(*string) 00054 return FALSE; 00055 else 00056 return TRUE; 00057 } 00058 case '*': 00059 matchStar = TRUE; 00060 break; 00061 case '?': /* anything will do */ 00062 { 00063 if(*string == 0) 00064 return FALSE; /* out of string, no match for ? */ 00065 ++string; 00066 break; 00067 } 00068 default: 00069 { 00070 if(matchStar) 00071 { 00072 for(;;) 00073 { 00074 if(*string == 0) /* if out of string no match */ 00075 return FALSE; 00076 00077 /* note matchStar is re-used here for substring 00078 * after star match length */ 00079 if((starMatchSize = subMatch(string,wildCard)) != 0) 00080 { 00081 string += starMatchSize; 00082 wildCard += starMatchSize; 00083 matchStar = FALSE; 00084 goto NEXT_WILD; 00085 } 00086 ++string; 00087 } 00088 } 00089 00090 /* default: they must be equal or no match */ 00091 if(toupper(*string) != toupper(*wildCard)) 00092 return FALSE; 00093 ++string; 00094 break; 00095 } 00096 } 00097 ++wildCard; 00098 } 00099 }
Here is the call graph for this function:

Here is the caller graph for this function:

char const rcsid[] = "$Id: wildcmp.c,v 1.5 2003/05/06 07:33:44 kate Exp $" [static] |
1.5.2