From aed36bd1256f3e55a874ab60a7399fd76221e83d Mon Sep 17 00:00:00 2001 From: markm Date: Sat, 3 May 2003 10:14:26 +0000 Subject: [PATCH] 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. --- bin/sleep/sleep.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/sleep/sleep.c b/bin/sleep/sleep.c index 89e143611ea0..739e4d4266b3 100644 --- a/bin/sleep/sleep.c +++ b/bin/sleep/sleep.c @@ -47,10 +47,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include -#include 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); }