aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2017-06-30 17:40:22 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-07-02 18:44:24 +0200
commitef65274d43e7ab1d8a7f4fce353bb6a173bda987 (patch)
treeafe221073aed4d3ee719d22488ba7c75cb3ecc95
parentc1ddd4816fcf1bcc5e1e2549d9354bab7d02a344 (diff)
downloadmblaze-ef65274d43e7ab1d8a7f4fce353bb6a173bda987.tar.gz
seq: parse_relnum: fix for thread message syntax relative to . or $
With a message such as .^ specified, strtol() was used on the caret. On Linux this worked by accident because strtol() doesn't return an error but it fails on, e.g. FreeBSD. Furthermore, it was not possible to specify relative offsets after $.
-rw-r--r--seq.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/seq.c b/seq.c
index 95fca91..c1b51bd 100644
--- a/seq.c
+++ b/seq.c
@@ -185,10 +185,11 @@ parse_relnum(char *a, long cur, long last, long *out)
a = ".-1";
else if (strcmp(a, ".") == 0)
a = ".+0";
- else if (strcmp(a, "$") == 0)
- a = "-1";
- if (*a == '.') {
+ if (*a == '$') {
+ a++;
+ base = last;
+ } else if (*a == '.') {
a++;
base = cur;
} else if (*a == '-') {
@@ -198,7 +199,7 @@ parse_relnum(char *a, long cur, long last, long *out)
}
long d;
- if (*a == ':') {
+ if (strchr(":=_^", *a)) {
d = 0;
b = a;
} else {