B: val = pnmatch( name, pattern );
C: int pnmatch(const char *name, const char *pattern);
PNMATCH determines whether or not the pattern in the ASCII string "pattern" matches the ASCII string in "name". The pattern is constructed as follows.
Any character not mentioned above matches only itself. PNMATCH distinguishes between letters in upper and lower case, so if an application does not distinguish between cases, the user must change both "name" and "pattern" to the same case.
The application for which PNMATCH was written was the matching of file (path) names with a pattern. For example, the pattern "pas*.b" would match all strings beginning with "pas" and ending with ".b". It might very well be useful for a wider range of applications.
To implement "*", the routine recurses. You should be sure to have either short strings (12 characters) or enough stack space to allow for a large number of function calls.
Copyright © 1996, Thinkage Ltd.