# HG changeset patch # User Rob Landley # Date 1402544634 18000 # Node ID 76965793e8f47589ae64c15372f94e495c7567ba # Parent 667a65038e93830b9f43396f4477a236b78159e3 Option parsing for nohup needs to stop at first nonoption argument. Minor cleanups. diff -r 667a65038e93 -r 76965793e8f4 toys/posix/nohup.c --- a/toys/posix/nohup.c Wed Jun 11 22:41:25 2014 -0500 +++ b/toys/posix/nohup.c Wed Jun 11 22:43:54 2014 -0500 @@ -4,7 +4,7 @@ * * See http://opengroup.org/onlinepubs/9699919799/utilities/nohup.html -USE_NOHUP(NEWTOY(nohup, "<1", TOYFLAG_USR|TOYFLAG_BIN)) +USE_NOHUP(NEWTOY(nohup, "<1^", TOYFLAG_USR|TOYFLAG_BIN)) config NOHUP bool "nohup" @@ -13,8 +13,8 @@ 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" + + Redirect tty on stdin to /dev/null, tty on stdout to "nohup.out". */ #include "toys.h" @@ -29,7 +29,7 @@ { char *temp = getenv("HOME"); temp = xmprintf("%s/%s", temp ? temp : "", "nohup.out"); - xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, S_IRUSR|S_IWUSR); + xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, 0600); } } if (isatty(0)) {