if (1 < begin && (spec[0] == '+' || spec[0] == '-')) {
num = strtol(spec + 1, &term, 10);
if (term != spec + 1) {
+ if (!ret)
+ return term;
if (spec[0] == '-')
num = 0 - num;
if (0 < num)
}
num = strtol(spec, &term, 10);
if (term != spec) {
- *ret = num;
+ if (ret)
+ *ret = num;
return term;
}
if (spec[0] != '/')
if (*term != '/')
return spec;
+ /* in the scan-only case we are not interested in the regex */
+ if (!ret)
+ return term+1;
+
/* try [spec+1 .. term-1] as regexp */
*term = 0;
begin--; /* input is in human terms */
return 0;
}
+
+const char *skip_range_arg(const char *arg)
+{
+ arg = parse_loc(arg, NULL, NULL, 0, -1, NULL);
+
+ if (*arg == ',')
+ arg = parse_loc(arg+1, NULL, NULL, 0, 0, NULL);
+
+ return arg;
+}