look up a numeric entry */
| 212 | |
| 213 | /* look up a numeric entry */ |
| 214 | int |
| 215 | tgetnum(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 */ |
| 232 | int |
no test coverage detected