MCPcopy Create free account
hub / github.com/crownengine/crown / wildcmp

Function wildcmp

src/core/strings/string.cpp:31–61  ·  view source on GitHub ↗

Written by Jack Handy: jakkhandy@hotmail.com

Source from the content-addressed store, hash-verified

29
30// Written by Jack Handy: jakkhandy@hotmail.com
31int wildcmp(const char *wild, const char *str)
32{
33 const char *cp = NULL, *mp = NULL;
34
35 while (*str && *wild != '*') {
36 if (*wild != *str && *wild != '?')
37 return 0;
38 ++wild;
39 ++str;
40 }
41
42 while (*str) {
43 if (*wild == '*') {
44 if (!*++wild)
45 return 1;
46 mp = wild;
47 cp = str + 1;
48 } else if (*wild == *str || *wild == '?') {
49 ++wild;
50 ++str;
51 } else {
52 wild = mp;
53 str = cp++;
54 }
55 }
56
57 while (*wild == '*')
58 ++wild;
59
60 return !*wild;
61}
62
63int strncasecmp(const char *str1, const char *str2, u32 len)
64{

Callers 2

compile_internalMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected