| 1180 | static int digit (int c) { return '0' <= c && c <= '9'; } |
| 1181 | |
| 1182 | static int getnum (const char **fmt, int df) { |
| 1183 | if (!digit(**fmt)) /* no number? */ |
| 1184 | return df; /* return default value */ |
| 1185 | else { |
| 1186 | int a = 0; |
| 1187 | do { |
| 1188 | a = a*10 + (*((*fmt)++) - '0'); |
| 1189 | } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); |
| 1190 | return a; |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | |
| 1195 | /* |
no test coverage detected