Problem: given any input string that does not contain null bytes, determine whether or not the input string matches glob as defined below:
null is disallowed in both string in glob * matches zero or more characters ** is disallowed in glob ? matches exactly 1 character [ch] matches a character class of the specified characters to include ] in a class, it must be the first character [^ch] matches a character class of all but specified characters to include ] in a class, it must be the first character after ^ The empty glob only matches the empty string.
The system glob() on the target platform implements glob where * doesn't match a /, so you can't use it. This has infested all shells. You could try converting to a regex; however this won't be as easy it it looks.
You must specify an encoding for your program. Your program must be valid in that encoding. All bytes including null are allowed in cp437. Your score is the number of characters in your encoding.
Bonus: If your program is expressed in a well-known encoding that uses 6 or fewer bits, your score is multiplied by the number of bits used in the encoding and divided by 7. Your program will be passed its arguments in ASCII in that case.
Your program will receive the string to match or not as the first argument and the glob pattern as the second argument. Your return code must be 0 on match and nonzero on nonmatch.
You may leave it undefined what happens if you get passed a disallowed glob.
Standard loopholes are disallowed; however the following are allowed:
You may compress your program but it must work if executed directly. Binaries are allowed. Submit a disassembly with it so I can read it. Using two different chars which look the same is allowed. You may use trigraphs (but I can't see how it helps).
"w*c*d" matches "wildcard" but doesn't match "wildcards" "ww*w*d" matches "wwwdwd" but doesn't match "wwd" "ww*[w-c]?*" matches "www-" and "wwcc" but doesn't match "wwc" "[a-c]" matches "-" but doesn't match "b" "^[*][^]]" matches "^*[" but doesn't match "^?[" or "^*]" or "**]"