]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/sleep.c
rsa: rename getkey() to getrsakey(), document rsa2csr in rsa(8)
[plan9front.git] / sys / src / cmd / sleep.c
1 #include <u.h>
2 #include <libc.h>
3
4 void
5 main(int argc, char *argv[])
6 {
7         long n;
8         char *p, *q;
9
10         if(argc>1){
11                 for(n = strtol(argv[1], &p, 0); n > 0; n--)
12                         sleep(1000);
13                 /*
14                  * no floating point because it is useful to
15                  * be able to run sleep when bootstrapping
16                  * a machine.
17                  */
18                 if(*p++ == '.' && (n = strtol(p, &q, 10)) > 0){
19                         switch(q - p){
20                         case 0:
21                                 break;
22                         case 1:
23                                 n *= 100;
24                                 break;
25                         case 2:
26                                 n *= 10;
27                                 break;
28                         default:
29                                 p[3] = 0;
30                                 n = strtol(p, 0, 10);
31                                 break;
32                         }
33                         sleep(n);
34                 }
35         }
36         exits(0);
37 }