diff options
author | markm <markm@FreeBSD.org> | 2003-05-03 10:14:26 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2003-05-03 10:14:26 +0000 |
commit | aed36bd1256f3e55a874ab60a7399fd76221e83d (patch) | |
tree | 1d0e7a0f279d04eeb0fc60d0100fa43f6363cc78 /bin | |
parent | a3b8d0b40bc99c153b48135720fa8dca05aec176 (diff) | |
download | FreeBSD-src-aed36bd1256f3e55a874ab60a7399fd76221e83d.zip FreeBSD-src-aed36bd1256f3e55a874ab60a7399fd76221e83d.tar.gz |
Fix warnings. This is now WARNS=9, std=c99 clean in i386.
Use return(0) for main() instead of exit(0). Makes it a
wee bit smaller.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sleep/sleep.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/bin/sleep/sleep.c b/bin/sleep/sleep.c index 89e1436..739e4d4 100644 --- a/bin/sleep/sleep.c +++ b/bin/sleep/sleep.c @@ -47,10 +47,10 @@ __FBSDID("$FreeBSD$"); #include <ctype.h> #include <limits.h> +#include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> -#include <string.h> void usage(void); @@ -64,7 +64,7 @@ main(int argc, char *argv[]) if (argc != 2) { usage(); - /* NOTREACHED */ + return(1); } p = argv[1]; @@ -78,9 +78,10 @@ main(int argc, char *argv[]) if (*p == '-') { neg = 1; ++p; - if (!isdigit((unsigned char)*p) && *p != '.') + if (!isdigit((unsigned char)*p) && *p != '.') { usage(); - /* NOTREACHED */ + return(1); + } } else if (*p == '+') ++p; @@ -109,20 +110,20 @@ main(int argc, char *argv[]) time_to_sleep.tv_nsec += (*p - '0') * l; else break; - } while (l /= 10); + l /= 10; + } while (l); } if (!neg && (time_to_sleep.tv_sec > 0 || time_to_sleep.tv_nsec > 0)) (void)nanosleep(&time_to_sleep, (struct timespec *)NULL); - exit(0); + return(0); } void usage(void) { - const char *msg = "usage: sleep seconds\n"; + const char msg[] = "usage: sleep seconds\n"; - write(STDERR_FILENO, msg, strlen(msg)); - exit(1); + write(STDERR_FILENO, msg, sizeof(msg) - 1); } |