aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-28 19:51:11 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-28 20:41:31 +0200
commitf28e1c01581312f4f71abec0ad3c85d480922936 (patch)
tree0fd3cc93184f241e84634bc4a8f831fe30b4d3be
parenta3f4227c318f5df86b1450782c664d02a6ea7824 (diff)
downloadmblaze-f28e1c01581312f4f71abec0ad3c85d480922936.tar.gz
seq: parse .: correctly
-rw-r--r--seq.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/seq.c b/seq.c
index 7c9fc12..261c461 100644
--- a/seq.c
+++ b/seq.c
@@ -179,11 +179,18 @@ parse_relnum(char *a, long cur, long last, long *out)
} else {
base = 0;
}
- errno = 0;
- long d = strtol(a, &b, 10);
- if (errno != 0) {
- perror("strtol");
- exit(1);
+
+ long d;
+ if (*a == ':') {
+ d = 0;
+ b = a;
+ } else {
+ errno = 0;
+ d = strtol(a, &b, 10);
+ if (errno != 0) {
+ perror("strtol");
+ exit(1);
+ }
}
*out = base + d;