return 0;
}
+static void range_arguments(char *optarg)
+{
+ char *arg1;
+ char *arg2;
+
+ arg1 = xstrdup(optarg);
+ arg2 = strchr(arg1, ',');
+ if (arg2)
+ *arg2 = '\0';
+ if (arg2)
+ ++arg2;
+ else
+ arg2 = arg1;
+ if (arg1 && *arg1)
+ range_low = STRTOUKL(arg1, &arg1, 16);
+ if (*arg2)
+ range_high = STRTOUKL(arg2, &arg2, 16);
+ if (arg1 && (*arg1 || *arg2))
+ xerrx(EXIT_FAILURE, "%s: '%s'", _("failed to parse argument"),
+ optarg);
+}
+
int main(int argc, char **argv)
{
unsigned *pidlist;
q_option = 1;
break;
case 'A':
- {
- /* FIXME: this should be a function. */
- char *walk = optarg;
- char *arg1;
- char *arg2;
- if (walk[1]) {
- arg1 = walk + 1;
- walk += strlen(walk) - 1;
- } else {
- arg1 = *++argv;
- if (!arg1)
- usage(stderr);
- }
- arg2 = strchr(arg1, ',');
- if (arg2)
- *arg2 = '\0';
- if(arg2) ++arg2;
- else arg2 = arg1;
-
- if (arg1 && *arg1)
- range_low = STRTOUKL(arg1, &arg1, 16);
- if (*arg2)
- range_high = STRTOUKL(arg2, &arg2, 16);
- if (arg1 && (*arg1 || *arg2))
- usage(stderr);
- }
+ range_arguments(optarg);
break;
case 'h':
usage(stdout);