sleep.c (407B)
1 /* See LICENSE file for copyright and license details. */ 2 #include <stdlib.h> 3 #include <unistd.h> 4 5 #include "util.h" 6 7 static void 8 usage(void) 9 { 10 eprintf("usage: %s seconds\n", argv0); 11 } 12 13 int 14 main(int argc, char *argv[]) 15 { 16 unsigned int seconds; 17 18 ARGBEGIN { 19 default: 20 usage(); 21 } ARGEND; 22 23 if (argc < 1) 24 usage(); 25 26 seconds = estrtol(argv[0], 0); 27 while ((seconds = sleep(seconds)) > 0) 28 ; 29 return 0; 30 }