git: 9front

Download patch

ref: 223b49e60e7aa97dded85bc3bd808e2bfcbd8122
parent: 1f230d3bb9b56a601250a9836f33d5edfcb79d1d
author: cinap_lenrek <cinap_lenrek@felloff.net>
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);
 }
--