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