ref: 74f62ca21b03551824842bdd318f46940a78766d
parent: ed9fdc72f519553f9c8f1f221f97bd5919847caa
author: cinap_lenrek <[email protected]>
date: Tue Dec 27 21:08:45 EST 2016
fplot: parse negative numbers in argument to -r option (thanks qu7uux)
--- a/sys/src/cmd/fplot.c
+++ b/sys/src/cmd/fplot.c
@@ -466,16 +466,16 @@
void
parserange(char *s)
{
- while(*s && !isdigit(*s)) s++;
+ while(*s && !isdigit(*s) && *s != '-') s++;
if(*s == 0) return;
xmin = strtod(s, &s);
- while(*s && !isdigit(*s)) s++;
+ while(*s && !isdigit(*s) && *s != '-') s++;
if(*s == 0) return;
xmax = strtod(s, &s);
- while(*s && !isdigit(*s)) s++;
+ while(*s && !isdigit(*s) && *s != '-') s++;
if(*s == 0) return;
ymin = strtod(s, &s);
- while(*s && !isdigit(*s)) s++;
+ while(*s && !isdigit(*s) && *s != '-') s++;
if(*s == 0) return;
ymax = strtod(s, &s);
}