Commit | Line | Data |
---|---|---|
dde01d2a | 1 | /* |
eb80c550 KB |
2 | * Copyright (c) 1988, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
dde01d2a | 4 | * |
27c71911 | 5 | * %sccs.include.redist.c% |
dde01d2a KB |
6 | */ |
7 | ||
8 | #ifndef lint | |
eb80c550 KB |
9 | static char copyright[] = |
10 | "@(#) Copyright (c) 1988, 1993\n\ | |
11 | The Regents of the University of California. All rights reserved.\n"; | |
dde01d2a KB |
12 | #endif /* not lint */ |
13 | ||
14 | #ifndef lint | |
706c0358 | 15 | static char sccsid[] = "@(#)sleep.c 8.2 (Berkeley) %G%"; |
dde01d2a KB |
16 | #endif /* not lint */ |
17 | ||
18 | #include <stdio.h> | |
3600ab84 | 19 | #include <stdlib.h> |
706c0358 | 20 | #include <unistd.h> |
dde01d2a | 21 | |
029d5ba8 KB |
22 | void usage __P((void)); |
23 | ||
829d3aa9 | 24 | int |
e9f33521 | 25 | main(argc, argv) |
dde01d2a | 26 | int argc; |
029d5ba8 | 27 | char *argv[]; |
e9f33521 | 28 | { |
029d5ba8 KB |
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(); | |
e9f33521 | 42 | |
029d5ba8 | 43 | if ((secs = atoi(*argv)) > 0) |
dde01d2a KB |
44 | (void)sleep(secs); |
45 | exit(0); | |
e9f33521 | 46 | } |
029d5ba8 KB |
47 | |
48 | void | |
49 | usage() | |
50 | { | |
706c0358 | 51 | |
829d3aa9 | 52 | (void)fprintf(stderr, "usage: sleep seconds\n"); |
029d5ba8 KB |
53 | exit(1); |
54 | } |