Use getopt to parse command line arguments.
Standard:
while ((ch = getopt(argc, argv, "mo:ps:tx")) != -1)
switch(ch) {
[...]
case 'x':
if (!domd5)
requiremd5("-x");
MDTestSuite();
nomd5stdin = 1;
break;
case '?':
default:
usage();
}
argc -= optind;
argv += optind;
Deviation:
while (argc > 1 && argv[1][0] == '-') {
switch(argv[1][1]) {
[...]
case 's':
sflag = 1;
break;
default:
usage();
}
argc--; argv++;
}
nfiles = argc - 1;