From 1e45a14105a4d5a218af2e718b58858f846c3f70 Mon Sep 17 00:00:00 2001 From: Bryce McKinlay <bryce@albatross.co.nz> Date: Wed, 9 Jun 1999 17:42:26 +0000 Subject: Runtime.java (exec): Convert prog name and arguments to string array. * java/lang/Runtime.java (exec): Convert prog name and arguments to string array. * java/lang/natPosixProcess.cc (startProcess): Fix typo in environment array conversion. Preserve current environment if envp not passed. Preserve PATH unless explicitly specified. * java/io/DataInputStream.java (readLine): Fix case where '\r' is followed by EOF. Set a flag when a line is terminated by '\r' and ignore following '\n' if set. From-SVN: r27458 --- libjava/java/lang/Runtime.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libjava/java/lang/Runtime.java') diff --git a/libjava/java/lang/Runtime.java b/libjava/java/lang/Runtime.java index 62a7c18..cdba9a3 100644 --- a/libjava/java/lang/Runtime.java +++ b/libjava/java/lang/Runtime.java @@ -13,6 +13,7 @@ package java.lang; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.StringTokenizer; /** * @author Tom Tromey <tromey@cygnus.com> @@ -30,15 +31,15 @@ public class Runtime { public Process exec (String prog) throws IOException { - String[] a = new String[1]; - a[0] = prog; - return exec (a, null); + return exec (prog, null); } public Process exec (String prog, String[] envp) throws IOException { - String[] a = new String[1]; - a[0] = prog; + StringTokenizer st = new StringTokenizer(prog); + String[] a = new String[st.countTokens ()]; + for (int i = 0; i < a.length; i++) + a[i] = st.nextToken (); return exec (a, envp); } -- cgit v1.1