aboutsummaryrefslogtreecommitdiff
path: root/toys/nohup.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-08-25 14:25:22 -0500
committerRob Landley <rob@landley.net>2012-08-25 14:25:22 -0500
commit3a9241add947cb6d24b5de7a8927517426a78795 (patch)
treed122ab6570439cd6b17c7d73ed8d4e085e0b8a95 /toys/nohup.c
parent689f095bc976417bf50810fe59a3b3ac32b21105 (diff)
downloadtoybox-3a9241add947cb6d24b5de7a8927517426a78795.tar.gz
Move commands into "posix", "lsb", and "other" menus/directories.
Diffstat (limited to 'toys/nohup.c')
-rw-r--r--toys/nohup.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/toys/nohup.c b/toys/nohup.c
deleted file mode 100644
index e11fb094..00000000
--- a/toys/nohup.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* vi: set sw=4 ts=4:
- *
- * nohup.c - run commandline with SIGHUP blocked.
- *
- * Copyright 2011 Rob Landley <rob@landley.net>
- *
- * See http://opengroup.org/onlinepubs/9699919799/utilities/nohup.html
-
-USE_NOHUP(NEWTOY(nohup, "<1", TOYFLAG_USR|TOYFLAG_BIN))
-
-config NOHUP
- bool "nohup"
- default y
- help
- usage: nohup COMMAND [ARGS...]
-
- Run a command that survives the end of its terminal.
- If stdin is a tty, redirect from /dev/null
- If stdout is a tty, redirect to file "nohup.out"
-*/
-
-#include "toys.h"
-
-void nohup_main(void)
-{
- signal(SIGHUP, SIG_IGN);
- if (isatty(1)) {
- close(1);
- if (-1 == open("nohup.out", O_CREAT|O_APPEND|O_WRONLY,
- S_IRUSR|S_IWUSR ))
- {
- char *temp = getenv("HOME");
- temp = xmsprintf("%s/%s", temp ? temp : "", "nohup.out");
- xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, S_IRUSR|S_IWUSR);
- }
- }
- if (isatty(0)) {
- close(0);
- open("/dev/null", O_RDONLY);
- }
- xexec(toys.optargs);
-}