aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;