Added usage message.
This commit is contained in:
parent
1f0bd271b9
commit
2076d5f6a5
2 changed files with 17 additions and 1 deletions
BIN
tprint/tprint
Executable file
BIN
tprint/tprint
Executable file
Binary file not shown.
|
@ -24,8 +24,24 @@ int main(int argc, char** argv) {
|
||||||
v = atoi(*argv);
|
v = atoi(*argv);
|
||||||
if(v == 0) v = 1000;
|
if(v == 0) v = 1000;
|
||||||
speed = 1.0/v;
|
speed = 1.0/v;
|
||||||
|
} else if(strcmp(*argv,"-h") == 0) {
|
||||||
|
printf("usage: tprint [-h] [-s speed] [filename]\n");
|
||||||
|
printf("\t-h: Print this help.\n");
|
||||||
|
printf("\t-s speed: speed in characters per second (default: 3)\n");
|
||||||
|
exit(0);
|
||||||
|
} else if(**argv == '-' && strlen(*argv) > 1) {
|
||||||
|
printf("Unkown option %s\n",*argv);
|
||||||
|
exit(1);
|
||||||
|
} else {
|
||||||
|
if(strcmp(*argv,"-")==0) {
|
||||||
|
fh = stdin;
|
||||||
} else {
|
} else {
|
||||||
fh = fopen(*argv,"r");
|
fh = fopen(*argv,"r");
|
||||||
|
if(fh == NULL) {
|
||||||
|
printf("Unable to open %s\n", *argv);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue