MCPcopy Create free account
hub / github.com/NetHack/NetHack / match_optname

Function match_optname

util/sfctool.c:1252–1263  ·  view source on GitHub ↗

check whether a user-supplied option string is a proper leading substring of a particular option name; option string might have a colon or equals sign and arbitrary value appended to it */

Source from the content-addressed store, hash-verified

1250 substring of a particular option name; option string might have
1251 a colon or equals sign and arbitrary value appended to it */
1252boolean
1253match_optname(const char *user_string, const char *optn_name, int min_length,
1254 boolean val_allowed)
1255{
1256 int len = (int) strlen(user_string);
1257
1258 if (val_allowed)
1259 len = length_without_val(user_string, len);
1260
1261 return (boolean) (len >= min_length
1262 && !strncmpi(optn_name, user_string, len));
1263}
1264
1265staticfn void
1266usage(int argc UNUSED, char **argv)

Callers

nothing calls this directly

Calls 2

length_without_valFunction · 0.70
strncmpiFunction · 0.70

Tested by

no test coverage detected