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

Function length_without_val

util/sfctool.c:1232–1247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1230#endif
1231
1232static int
1233length_without_val(const char *user_string, int len)
1234{
1235 const char *p = strchr(user_string, ':'), *q = strchr(user_string, '=');
1236
1237 if (!p || (q && q < p))
1238 p = q;
1239 if (p) {
1240 /* 'user_string' hasn't necessarily been through mungspaces()
1241 so might have tabs or consecutive spaces */
1242 while (p > user_string && isspace((uchar) * (p - 1)))
1243 p--;
1244 len = (int) (p - user_string);
1245 }
1246 return len;
1247}
1248
1249/* check whether a user-supplied option string is a proper leading
1250 substring of a particular option name; option string might have

Callers 1

match_optnameFunction · 0.70

Calls 1

isspaceFunction · 0.85

Tested by

no test coverage detected