sbase

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

sleep.c (403B)


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