1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

pipe: check if command line arguments are malformed

This commit is contained in:
Steffen Vogel 2017-07-01 20:46:47 +02:00
parent ce4fabb537
commit f7cf76d4d3

View file

@ -200,13 +200,19 @@ int main(int argc, char *argv[])
sendd.enabled = false; // receive only
break;
case 'd':
level = atoi(optarg);
break;
level = strtoul(optarg, &endptr, 10);
goto check;
case 'h':
case '?':
usage();
exit(c == '?' ? EXIT_FAILURE : EXIT_SUCCESS);
}
continue;
check: if (optarg == endptr)
error("Failed to parse parse option argument '-%c %s'", c, optarg);
}
if (argc != optind + 2) {