MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / PSGlobHasPattern

Function PSGlobHasPattern

misc/psglob.cpp:47–71  ·  view source on GitHub ↗

Returns 1 if string contains globbing characters in it

Source from the content-addressed store, hash-verified

45
46// Returns 1 if string contains globbing characters in it
47int PSGlobHasPattern(char *string) {
48 char *p = string;
49 char c;
50 int open = 0;
51
52 while ((c = *p++) != '\0') {
53 switch (c) {
54 case '?':
55 case '*':
56 return 1;
57 case '[': // Open brackets must have a matching close bracket in order to be a glob
58 open++;
59 continue;
60 case ']':
61 if (open)
62 return 1;
63 continue;
64 case '\\':
65 if (*p++ == '\0')
66 return 0;
67 }
68 }
69
70 return 0;
71}
72
73// PSGlobMatch
74// Matches the pattern passed in to the string in text. If the pattern matches

Callers 1

cf_LibraryFindFirstFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected