sbase/sleep.c

30 lines
404 B
C
Raw Normal View History

2011-05-23 14:00:31 -04:00
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
#include <unistd.h>
#include "util.h"
2013-06-14 14:20:47 -04:00
static void
usage(void)
{
eprintf("usage: %s seconds\n", argv0);
}
2011-05-23 14:00:31 -04:00
int
main(int argc, char *argv[])
{
unsigned int seconds;
2013-06-14 14:20:47 -04:00
ARGBEGIN {
default:
usage();
} ARGEND;
2011-05-23 14:00:31 -04:00
2013-06-14 14:20:47 -04:00
if(argc < 1)
usage();
seconds = estrtol(argv[0], 0);
2011-05-23 14:00:31 -04:00
while((seconds = sleep(seconds)) > 0)
;
2014-10-02 18:46:04 -04:00
return 0;
2011-05-23 14:00:31 -04:00
}