1 // Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL]
5 import org.ibex.graphics.*;
6 import org.ibex.core.*;
9 /** Platform implementation for POSIX compliant operating systems */
10 public class POSIX extends GCJ {
12 // General Methods ///////////////////////////////////////////////////////
14 protected String getDescriptiveName() { return "GCJ Linux Binary"; }
16 /** returns the value of the environment variable key, or null if no such key exists */
17 protected native String _getEnv(String key);
19 /** spawns a process which is immune to SIGHUP */
20 private static native void spawnChildProcess(String[] command);
22 protected void _newBrowserWindow(String url) {
23 String browserString = getEnv("BROWSER");
24 if (browserString == null) {
25 browserString = "netscape " + url;
26 } else if (browserString.indexOf("%s") != -1) {
28 browserString.substring(0, browserString.indexOf("%s")) +
29 url + browserString.substring(browserString.indexOf("%s") + 2);
31 browserString += " " + url;
34 StringTokenizer st = new StringTokenizer(browserString, " ");
35 String[] cmd = new String[st.countTokens()];
36 for(int i=0; st.hasMoreTokens(); i++) cmd[i] = st.nextToken();
38 spawnChildProcess(cmd);