Mercurial > hg > toybox
view toys/posix/nohup.c @ 818:264b9da809df
Simplify license text, as mentioned on the mailing list.
Reasoning: it was never my intent to require anybody to copy license
text into another project if they cut and pasted something out of
toybox. The "permission for any purpose" is as close to public domain
as you can get in our current screwed up legal system without making
people uncomfortable the _other_ way. (Besides, my initial reading of
that was "all copies of the source code" but that's not what it says,
and somebody pointed out that Android has "show license text" options
because paranoid lawyers think that sort of thing applies to the BINARY
version, which is nuts.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 14 Mar 2013 09:02:37 -0500 |
parents | 786841fdb1e0 |
children | 144d5ba7d410 |
line wrap: on
line source
/* 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); }