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

Function tgetnum

sys/share/tclib.c:214–229  ·  view source on GitHub ↗

look up a numeric entry */

Source from the content-addressed store, hash-verified

212
213/* look up a numeric entry */
214int
215tgetnum(const char *which)
216{
217 const char *q, *p = tc_field(which, &q);
218 char numbuf[32];
219 size_t n;
220
221 if (!p || p[2] != '#')
222 return -1;
223 p += 3;
224 if ((n = (size_t)(q - p)) >= sizeof numbuf)
225 return -1;
226 (void) strncpy(numbuf, p, n);
227 numbuf[n] = '\0';
228 return atoi(numbuf);
229}
230
231/* look up a boolean entry */
232int

Callers 4

term_startupFunction · 0.85
init_hiliteFunction · 0.85
kill_hiliteFunction · 0.85
tc_storeFunction · 0.85

Calls 1

tc_fieldFunction · 0.85

Tested by

no test coverage detected