Fix support for .ONESHELL when dealing with non-POSIX shells.
authorPaul Smith <psmith@gnu.org>
Sat, 27 Apr 2013 21:28:05 +0000 (17:28 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 27 Apr 2013 21:28:05 +0000 (17:28 -0400)
ChangeLog
job.c

index 57528a98c6b8eee25c99f0c595165e6852db204d..d0dabb1e1579d80b76873be7db8e036a0caeaf04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2013-04-27  Paul Smith  <psmith@gnu.org>
 
+       * job.c (construct_command_argv_internal): Fix oneshell support
+       for non-POSIX-sh shells.
+
        * load.c (load_object): Extract all POSIX-isms into a separate
        function for portability.
        (load_file): Check the .LOADED variable first and don't invoke
diff --git a/job.c b/job.c
index 61568f940d3b35a776bd2b024cfb4713997a777c..addeca2d7e1fc0d9d029f5d94620e7ce5c9cd23d 100644 (file)
--- a/job.c
+++ b/job.c
@@ -3272,30 +3272,6 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
                   }
               }
             *t = '\0';
-
-           /* Create an argv list for the shell command line.  */
-           {
-             int n = 0;
-
-             new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *));
-             new_argv[n++] = xstrdup (shell);
-
-             /* Chop up the shellflags (if any) and assign them.  */
-             if (! shellflags)
-               new_argv[n++] = xstrdup ("");
-             else
-               {
-                 const char *s = shellflags;
-                 char *t;
-                 unsigned int len;
-                 while ((t = find_next_token (&s, &len)) != 0)
-                   new_argv[n++] = xstrndup (t, len);
-               }
-
-             /* Set the command to invoke.  */
-             new_argv[n++] = line;
-             new_argv[n++] = NULL;
-           }
           }
 #ifdef WINDOWS32
        else    /* non-Posix shell */
@@ -3368,8 +3344,32 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
            new_argv[0] = xstrdup (*batch_filename);
            new_argv[1] = NULL;
          }
-#endif  /* WINDOWS32 */
-       return new_argv;
+#else /* WINDOWS32 */
+        /* Create an argv list for the shell command line.  */
+        {
+          int n = 0;
+
+          new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *));
+          new_argv[n++] = xstrdup (shell);
+
+          /* Chop up the shellflags (if any) and assign them.  */
+          if (! shellflags)
+            new_argv[n++] = xstrdup ("");
+          else
+            {
+              const char *s = shellflags;
+              char *t;
+              unsigned int len;
+              while ((t = find_next_token (&s, &len)) != 0)
+                new_argv[n++] = xstrndup (t, len);
+            }
+
+          /* Set the command to invoke.  */
+          new_argv[n++] = line;
+          new_argv[n++] = NULL;
+        }
+#endif /* WINDOWS32 */
+        return new_argv;
       }
 
     new_line = xmalloc ((shell_len*2) + 1 + sflags_len + 1