diff options
Diffstat (limited to 'src/usleep.c')
-rw-r--r-- | src/usleep.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/usleep.c b/src/usleep.c new file mode 100644 index 00000000..dbffc850 --- /dev/null +++ b/src/usleep.c @@ -0,0 +1,37 @@ +/* + * usleep + * + * Written by Donald Barnes <djb@redhat.com> for Red Hat Software. + * + */ + + +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +void main(int argc, char **argv) +{ + + double count; + + if (argc == 1) count=1; + else if (!strcmp(argv[1], "--help")) + { + printf("usleep [number]\n sleep [number] of microseconds\n the default number to sleep is 1 microsecond\n"); + exit(0); + } + else if (!strcmp(argv[1], "-v")) + { + printf("usleep version 1.0 by Donald Barnes <djb@redhat.com>\n usleep --help for more info\n"); + exit(0); + } + else + count = strtod(argv[1], NULL); + + usleep(count); + exit(0); + + +} |