Add usage() function.

Using arg.h, fallback to usage() if there is no value for time.
This commit is contained in:
Simon Lieb 2013-08-07 19:45:13 +02:00
parent e8e98a8c1f
commit 10619c50aa

10
slow.c
View file

@ -7,6 +7,11 @@
char *argv0; char *argv0;
void usage() {
printf("usage: %s [-t usec]\n", argv0);
exit(EXIT_FAILURE);
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
char buffer; char buffer;
size_t nread; size_t nread;
@ -14,7 +19,10 @@ int main(int argc, char *argv[]) {
ARGBEGIN { ARGBEGIN {
case 't': case 't':
useconds = atoi(ARGF()); useconds = atoi(EARGF(usage()));
break;
default:
usage();
} ARGEND; } ARGEND;
while((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) { while((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) {