projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
prettyness police
[unix-history]
/
usr
/
src
/
bin
/
sleep
/
sleep.c
diff --git
a/usr/src/bin/sleep/sleep.c
b/usr/src/bin/sleep/sleep.c
index
cba8f20
..
714468b
100644
(file)
--- a/
usr/src/bin/sleep/sleep.c
+++ b/
usr/src/bin/sleep/sleep.c
@@
-1,35
+1,54
@@
/*
/*
- * Copyright (c) 1988
Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988
, 1993
+ *
The Regents of the University of California.
All rights reserved.
*
* %sccs.include.redist.c%
*/
#ifndef lint
*
* %sccs.include.redist.c%
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1988
Regents of the University of California.
\n\
- All rights reserved.\n";
+
static
char copyright[] =
+"@(#) Copyright (c) 1988
, 1993
\n\
+
The Regents of the University of California.
All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)sleep.c
5.5
(Berkeley) %G%";
+static char sccsid[] = "@(#)sleep.c
8.2
(Berkeley) %G%";
#endif /* not lint */
#endif /* not lint */
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
+void usage __P((void));
+int
main(argc, argv)
int argc;
main(argc, argv)
int argc;
- char *
*argv
;
+ char *
argv[]
;
{
{
- int secs;
+ int ch, secs;
+
+ while ((ch = getopt(argc, argv, "")) != EOF)
+ switch(ch) {
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 1)
+ usage();
- if (argc != 2) {
- (void)fprintf(stderr, "usage: sleep time\n");
- exit(1);
- }
- if ((secs = atoi(argv[1])) > 0)
+ if ((secs = atoi(*argv)) > 0)
(void)sleep(secs);
exit(0);
}
(void)sleep(secs);
exit(0);
}
+
+void
+usage()
+{
+
+ (void)fprintf(stderr, "usage: sleep seconds\n");
+ exit(1);
+}