| 1447 | static int digit (int c) { return '0' <= c && c <= '9'; } |
| 1448 | |
| 1449 | static int getnum (const char **fmt, int df) { |
| 1450 | if (!digit(**fmt)) /* no number? */ |
| 1451 | return df; /* return default value */ |
| 1452 | else { |
| 1453 | int a = 0; |
| 1454 | do { |
| 1455 | a = a*10 + (*((*fmt)++) - '0'); |
| 1456 | } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); |
| 1457 | return a; |
| 1458 | } |
| 1459 | } |
| 1460 | |
| 1461 | |
| 1462 | /* |
no test coverage detected