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

Function map_subkeyvalue

sys/windows/consoletty.c:1998–2029  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1996#endif
1997
1998void
1999map_subkeyvalue(char *op)
2000{
2001 char digits[] = "0123456789";
2002 int length, i, idx, val;
2003 char *kp;
2004
2005 idx = -1;
2006 val = -1;
2007 kp = strchr(op, '/');
2008 if (kp) {
2009 *kp = '\0';
2010 kp++;
2011 length = strlen(kp);
2012 if (length < 1 || length > 3)
2013 return;
2014 for (i = 0; i < length; i++)
2015 if (!strchr(digits, kp[i]))
2016 return;
2017 val = atoi(kp);
2018 length = strlen(op);
2019 if (length < 1 || length > 3)
2020 return;
2021 for (i = 0; i < length; i++)
2022 if (!strchr(digits, op[i]))
2023 return;
2024 idx = atoi(op);
2025 }
2026 if (idx >= MAX_OVERRIDES || idx < 0 || val >= MAX_OVERRIDES || val < 1)
2027 return;
2028 key_overrides[idx] = val;
2029}
2030
2031#if 0
2032/* fatal error */

Callers 1

optfn_subkeyvalueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected