1
0
mirror of git://git.suckless.org/sbase synced 2024-12-23 23:43:33 +00:00
sbase/sleep.c

31 lines
416 B
C
Raw Normal View History

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