aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonnie Barnes <djb@redhat.com>1999-07-22 02:28:16 +0000
committerDonnie Barnes <djb@redhat.com>1999-07-22 02:28:16 +0000
commit566f3cb6f39a8ff39275d5a4518f2c595ac31416 (patch)
tree70f611ba96e7385410c1c6cf3b1883d1f89b6213
parente98ed90b3dec44a680dba428ec1c3619ec6d00cb (diff)
downloadinitscripts-566f3cb6f39a8ff39275d5a4518f2c595ac31416.tar
initscripts-566f3cb6f39a8ff39275d5a4518f2c595ac31416.tar.gz
initscripts-566f3cb6f39a8ff39275d5a4518f2c595ac31416.tar.bz2
initscripts-566f3cb6f39a8ff39275d5a4518f2c595ac31416.tar.xz
initscripts-566f3cb6f39a8ff39275d5a4518f2c595ac31416.zip
fixed bug oot introduced into my code
-rw-r--r--src/usleep.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/usleep.c b/src/usleep.c
index 76fe3106..f814bb7d 100644
--- a/src/usleep.c
+++ b/src/usleep.c
@@ -1,7 +1,7 @@
/*
* usleep
*
- * Written by Donald Barnes <djb@redhat.com> for Red Hat Software.
+ * Written by Donald Barnes <djb@redhat.com> for Red Hat, Inc.
*
*/
@@ -38,18 +38,21 @@ int main(int argc, char **argv) {
}
if (showVersion) {
- printf("usleep version 1.1 by Donald Barnes <djb@redhat.com>\n usleep --help for more info\n");
+ printf("usleep version 1.2\n usleep --help for more info\n");
return 0;
}
countStr = poptGetArg(optCon);
- if (countStr && poptGetArg(optCon)) {
- fprintf(stderr, "usleep: exactly one argument (number of microseconds) "
- "must be used\n");
+
+ if (countStr == NULL) count = 1;
+
+ else if (countStr && poptGetArg(optCon)) {
+ fprintf(stderr, "%s: exactly one argument (number of microseconds) "
+ "must be used\n", argv[0]);
return 2;
}
- count = strtoul(countStr, NULL, 0);
+ else count = strtoul(countStr, NULL, 0);
usleep(count);
return 0;