diff options
| author | Ben Winston | 2024-05-15 20:06:16 -0400 |
|---|---|---|
| committer | Ben Winston | 2024-05-15 20:06:16 -0400 |
| commit | e93cab8a31ffd7b971e5e3a45ce8f889dd3da8dd (patch) | |
| tree | a32e82dcdf4807b1684d79bf00da367159d28efc | |
| parent | f6c57a72dcdd3a5ad0f4ac9a2e73245dc00a3abd (diff) | |
expand validity of ints
| -rw-r--r-- | booki.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -70,7 +70,20 @@ long parse_int(char* current_pos, char** new_pos) { // will put the first non-digit into endptr char* endptr; long ret = strtol(current_pos, &endptr, 10); - bool valid = *endptr == ' ' || *endptr == '\n'; + bool valid; + switch(*endptr) { + case ' ': + case '\n': + case ']': + case ',': + valid = true; + break; + + default: + valid = false; + break; + } + *new_pos = endptr; |
