source: trunk/minix/commands/simple/sleep.c@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 569 bytes
Line 
1/* sleep - suspend a process for x sec Author: Andy Tanenbaum */
2
3#include <sys/types.h>
4#include <stdlib.h>
5#include <unistd.h>
6#include <minix/minlib.h>
7
8_PROTOTYPE(int main, (int argc, char **argv));
9
10int main(argc, argv)
11int argc;
12char *argv[];
13{
14 register seconds;
15 register char c;
16
17 seconds = 0;
18
19 if (argc != 2) {
20 std_err("Usage: sleep time\n");
21 exit(1);
22 }
23 while (c = *(argv[1])++) {
24 if (c < '0' || c > '9') {
25 std_err("sleep: bad arg\n");
26 exit(1);
27 }
28 seconds = 10 * seconds + (c - '0');
29 }
30
31 /* Now sleep. */
32 sleep(seconds);
33 return(0);
34}
Note: See TracBrowser for help on using the repository browser.