1 /*
2 * Copyright (c) 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 */
7
8 #ifndef lint
9 static char copyright[] =
10 "@(#) Copyright (c) 1988, 1993, 1994\n\
11 The Regents of the University of California. All rights reserved.\n";
12 #endif /* not lint */
13
14 #ifndef lint
15 static char sccsid[] = "@(#)sleep.c 8.3 (Berkeley) 04/02/94";
16 #endif /* not lint */
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <unistd.h>
21
22 void usage __P((void));
23
24 int
main(argc,argv)25 main(argc, argv)
26 int argc;
27 char *argv[];
28 {
29 int ch, secs;
30
31 while ((ch = getopt(argc, argv, "")) != EOF)
32 switch(ch) {
33 case '?':
34 default:
35 usage();
36 }
37 argc -= optind;
38 argv += optind;
39
40 if (argc != 1)
41 usage();
42
43 if ((secs = atoi(*argv)) > 0)
44 (void)sleep(secs);
45 exit(0);
46 }
47
48 void
usage()49 usage()
50 {
51
52 (void)fprintf(stderr, "usage: sleep seconds\n");
53 exit(1);
54 }
55