don't allow users to specify more than one file, and update the usage
message to remove options that no longer exist.
if (!strcmp(argv[i], "-w"))
wait++;
else if (file)
- fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+ {
+ fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+ exit(1);
+ }
else
file = argv[i];
}
+ if (!file)
+ {
+ fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+ exit(1);
+ }
+
in = fopen(file, "r");
if (!in)
{
{
if (!strcmp(argv[i], "-w"))
wait++;
- else if (file)
- fprintf(stderr, "Usage: %s [-w] [-D] [-n] inputfile\n", whoami);
+ if (file)
+ {
+ fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+ exit(1);
+ }
else
file = argv[i];
}
+ if (!file)
+ {
+ fprintf(stderr, "Usage: %s [-w] inputfile\n", whoami);
+ exit(1);
+ }
+
in = fopen(file, "r");
if (!in)
{