master xplshn/aruu / cmd / posix / sleep.c
 1/* See LICENSE file for copyright and license details. */
 2
 3
 4#include <unistd.h>
 5
 6#include "util.h"
 7
 8static void
 9usage(void)
10{
11	eprintf("usage: %s num\n", argv0);
12}
13
14// ?man sleep: delay for a duration
15// ?man arguments: num
16// ?man pause execution for a specified amount of time
17int
18main(int argc, char *argv[])
19{
20	unsigned seconds;
21
22	ARGBEGIN {
23	default:
24		usage();
25	} ARGEND
26
27	if (argc != 1)
28		usage();
29
30	seconds = estrtonum(argv[0], 0, UINT_MAX);
31	while ((seconds = sleep(seconds)) > 0)
32		;
33
34	return 0;
35}