changeset 1355:76965793e8f4 draft

Option parsing for nohup needs to stop at first nonoption argument. Minor cleanups.
author Rob Landley <rob@landley.net>
date Wed, 11 Jun 2014 22:43:54 -0500
parents 667a65038e93
children fee58d039b72
files toys/posix/nohup.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)) {