From 3a9241add947cb6d24b5de7a8927517426a78795 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 25 Aug 2012 14:25:22 -0500 Subject: Move commands into "posix", "lsb", and "other" menus/directories. --- toys/sleep.c | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 toys/sleep.c (limited to 'toys/sleep.c') diff --git a/toys/sleep.c b/toys/sleep.c deleted file mode 100644 index ef6d827b..00000000 --- a/toys/sleep.c +++ /dev/null @@ -1,51 +0,0 @@ -/* vi: set sw=4 ts=4: - * - * sleep.c - Wait for a number of seconds. - * - * Copyright 2007 Rob Landley - * Copyright 2012 Georgi Chorbadzhiyski - * - * See http://www.opengroup.org/onlinepubs/009695399/utilities/sleep.html - -USE_SLEEP(NEWTOY(sleep, "<1", TOYFLAG_BIN)) - -config SLEEP - bool "sleep" - default y - help - usage: sleep SECONDS - - Wait before exiting. - -config SLEEP_FLOAT - bool - default y - depends on SLEEP && TOYBOX_FLOAT - help - The delay can be a decimal fraction. An optional suffix can be "m" - (minutes), "h" (hours), "d" (days), or "s" (seconds, the default). -*/ - -#include "toys.h" - -void sleep_main(void) -{ - - if (!CFG_TOYBOX_FLOAT) toys.exitval = sleep(atol(*toys.optargs)); - else { - char *arg; - double d = strtod(*toys.optargs, &arg); - struct timespec tv; - - // Parse suffix - if (*arg) { - int ismhd[]={1,60,3600,86400}; - char *smhd = "smhd", *c = strchr(smhd, *arg); - if (!c) error_exit("Unknown suffix '%c'", *arg); - d *= ismhd[c-smhd]; - } - - tv.tv_nsec=1000000000*(d-(tv.tv_sec = (unsigned long)d)); - toys.exitval = !!nanosleep(&tv, NULL); - } -} -- cgit v1.2.3