MCPcopy Index your code
hub / github.com/NetHack/NetHack / strncmpi

Function strncmpi

src/hacklib.c:716–734  ·  view source on GitHub ↗

case-insensitive counted string comparison */ { aka strncasecmp }*/

Source from the content-addressed store, hash-verified

714/* case-insensitive counted string comparison */
715/*{ aka strncasecmp }*/
716int
717strncmpi(
718 const char *s1, const char *s2,
719 int n) /*(should probably be size_t, which is unsigned)*/
720{
721 char t1, t2;
722
723 while (n--) {
724 if (!*s2)
725 return (*s1 != 0); /* s1 >= s2 */
726 else if (!*s1)
727 return -1; /* s1 < s2 */
728 t1 = lowc(*s1++);
729 t2 = lowc(*s2++);
730 if (t1 != t2)
731 return (t1 > t2) ? 1 : -1;
732 }
733 return 0; /* s1 == s2 */
734}
735#endif /* STRNCMPI */
736
737#ifndef STRSTRI

Callers 15

parseoptionsFunction · 0.70
optfn_align_messageFunction · 0.70
optfn_align_statusFunction · 0.70
optfn_map_modeFunction · 0.70
optfn_menu_objsymsFunction · 0.70
optfn_perminv_modeFunction · 0.70
optfn_player_selectionFunction · 0.70
optfn_playmodeFunction · 0.70
optfn_scoresFunction · 0.70
optfn_booleanFunction · 0.70
match_optnameFunction · 0.70

Calls 1

lowcFunction · 0.70

Tested by

no test coverage detected