aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Winston2024-05-15 20:06:16 -0400
committerBen Winston2024-05-15 20:06:16 -0400
commite93cab8a31ffd7b971e5e3a45ce8f889dd3da8dd (patch)
treea32e82dcdf4807b1684d79bf00da367159d28efc
parentf6c57a72dcdd3a5ad0f4ac9a2e73245dc00a3abd (diff)
expand validity of ints
-rw-r--r--booki.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/booki.c b/booki.c
index 4c71100..eeba4ba 100644
--- a/booki.c
+++ b/booki.c
@@ -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;