1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the GNU General Public License version 2 ("the License").
3 // You may not use this file except in compliance with the License.
8 import org.ibex.graphics.*;
9 import org.ibex.core.*;
10 import org.ibex.net.*;
12 /** Platform implementation for POSIX compliant operating systems */
13 public class POSIX extends GCJ {
15 // General Methods ///////////////////////////////////////////////////////
17 protected String getDescriptiveName() { return "GCJ Linux Binary"; }
19 /** returns the value of the environment variable key, or null if no such key exists */
20 protected native String _getEnv(String key);
22 /** spawns a process which is immune to SIGHUP */
23 private static native void spawnChildProcess(String[] command);
25 protected void _newBrowserWindow(String url) {
26 String browserString = getEnv("BROWSER");
27 if (browserString == null) {
28 browserString = "netscape " + url;
29 } else if (browserString.indexOf("%s") != -1) {
31 browserString.substring(0, browserString.indexOf("%s")) +
32 url + browserString.substring(browserString.indexOf("%s") + 2);
34 browserString += " " + url;
37 StringTokenizer st = new StringTokenizer(browserString, " ");
38 String[] cmd = new String[st.countTokens()];
39 for(int i=0; st.hasMoreTokens(); i++) cmd[i] = st.nextToken();
41 spawnChildProcess(cmd);