1 #include <u.h> 2 #include <libc.h> 3 4 void 5 main(int argc, char *argv[]) 6 { 7 char *p; 8 long secs; 9 10 if(argc>1){ 11 for(secs = atol(argv[1]); secs > 0; secs--) 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 = strchr(argv[1], '.')){ 19 p++; 20 switch(strlen(p)){ 21 case 0: 22 break; 23 case 1: 24 sleep(atoi(p)*100); 25 break; 26 case 2: 27 sleep(atoi(p)*10); 28 break; 29 default: 30 p[3] = 0; 31 sleep(atoi(p)); 32 break; 33 } 34 } 35 } 36 exits(0); 37 } 38