diff options
author | Rob Landley <rob@landley.net> | 2007-05-17 02:38:27 -0400 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2007-05-17 02:38:27 -0400 |
commit | f2f98fa34e9c00c2b5366fb6a9a912cf94f9a157 (patch) | |
tree | c6c558c472f3be6c7f907f45e1f7c1530b132fa9 /toys | |
parent | 8e0520c3ac41b37ccd8937ce3a81f9ab04e2a189 (diff) | |
download | toybox-f2f98fa34e9c00c2b5366fb6a9a912cf94f9a157.tar.gz |
Add sleep.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/Config.in | 8 | ||||
-rw-r--r-- | toys/sleep.c | 11 | ||||
-rw-r--r-- | toys/toylist.h | 5 |
3 files changed, 24 insertions, 0 deletions
diff --git a/toys/Config.in b/toys/Config.in index ff4c68a3..fcec743e 100644 --- a/toys/Config.in +++ b/toys/Config.in @@ -217,6 +217,14 @@ config READLINK_FINAL -f Show final location, including normal files and multiple symlinks. +config SLEEP + bool "sleep" + default n + help + usage: sleep SECONDS + + Wait a decimal integer number of seconds. + config SYNC bool "sync" default n diff --git a/toys/sleep.c b/toys/sleep.c new file mode 100644 index 00000000..06c4565d --- /dev/null +++ b/toys/sleep.c @@ -0,0 +1,11 @@ +/* vi: set sw=4 ts=4: */ +/* + * sleep.c - Wait for a number of seconds. + */ + +#include "toys.h" + +int sleep_main(void) +{ + return sleep(atol(*toys.optargs)); +} diff --git a/toys/toylist.h b/toys/toylist.h index 41b76698..0b3845d9 100644 --- a/toys/toylist.h +++ b/toys/toylist.h @@ -45,6 +45,10 @@ struct mke2fs_data { struct ext2_superblock sb; }; +struct sleep_data { + long seconds; +}; + struct touch_data { char *ref_file; char *time; @@ -97,6 +101,7 @@ USE_ONEIT(NEWTOY(oneit, "+<1p", TOYFLAG_SBIN)) USE_PWD(NEWTOY(pwd, NULL, TOYFLAG_BIN)) USE_READLINK(NEWTOY(readlink, "<1f", TOYFLAG_BIN)) USE_TOYSH(OLDTOY(sh, toysh, "c:i", TOYFLAG_BIN)) +USE_SLEEP(NEWTOY(sleep, "<1", TOYFLAG_BIN)) USE_SYNC(NEWTOY(sync, NULL, TOYFLAG_BIN)) USE_TOUCH(NEWTOY(touch, "l#t:r:mca", TOYFLAG_BIN)) USE_TOYSH(NEWTOY(toysh, "c:i", TOYFLAG_BIN)) |