sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

sleep.c (392B)


      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 	ARGBEGIN {
     18 	default:
     19 		usage();
     20 	} ARGEND
     21 
     22 	if (argc != 1)
     23 		usage();
     24 
     25 	seconds = estrtonum(argv[0], 0, UINT_MAX);
     26 	while ((seconds = sleep(seconds)) > 0)
     27 		;
     28 
     29 	return 0;
     30 }