Category : C Source Code
Archive   : JAZLIB.ZIP
Filename : JZWLDCRD.C

 
Output of file : JZWLDCRD.C contained in archive : JAZLIB.ZIP

/*
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³jzwldcrd ³
³Implement a dumb wildcard search for files ³
³Synopsis: ³
³ match = jzwldcrd("TEST.FIL","??ST.*"); ³
³ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
*/
#include
jzwldcrd(fstr,fcard)
char *fstr; /* string to search on */
char *fcard; /* wild cards */
{
int wmatch;
int w,wlen,x;
int wch1,wch2;

wmatch = 1;
wlen = strlen(fcard);

w = 0;
while (wmatch && (w < wlen) && *fstr)
switch(fcard[w]) {
case '?' : /* character substitution */
w ++;
fstr++; /* look at next character */
break;
case '*' :
x = index(fstr,'.'); /* look for dot */
if (x > 0) {
fstr += (int) x ; /* get past period */
w ++;
}
else {
w = wlen; /* exit loop */
wmatch = (fcard[wlen-1] == '*');
}
break;
default :
wch1 = *fstr++;
wch2 = fcard[w++];
wmatch = (toupper(wch1) == toupper(wch2));
break;
}

if (fcard[w] && (fcard[w] != '*'))
return(0);
else
return(wmatch);
}


  3 Responses to “Category : C Source Code
Archive   : JAZLIB.ZIP
Filename : JZWLDCRD.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/