--- /dev/null
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL]
+package org.ibex.plat;
+
+import gnu.gcj.RawData;
+import java.util.*;
+
+/** Platform implementation for POSIX compliant operating systems */
+public class POSIX extends GCJ {
+
+ // General Methods ///////////////////////////////////////////////////////
+
+ protected String getDescriptiveName() { return "GCJ Linux Binary"; }
+
+ /** returns the value of the environment variable key, or null if no such key exists */
+ protected native String _getEnv(String key);
+
+ /** spawns a process which is immune to SIGHUP */
+ private static native void spawnChildProcess(String[] command);
+
+ protected void _newBrowserWindow(String url) {
+ String browserString = getEnv("BROWSER");
+ if (browserString == null) {
+ browserString = "netscape " + url;
+ } else if (browserString.indexOf("%s") != -1) {
+ browserString =
+ browserString.substring(0, browserString.indexOf("%s")) +
+ url + browserString.substring(browserString.indexOf("%s") + 2);
+ } else {
+ browserString += " " + url;
+ }
+
+ StringTokenizer st = new StringTokenizer(browserString, " ");
+ String[] cmd = new String[st.countTokens()];
+ for(int i=0; st.hasMoreTokens(); i++) cmd[i] = st.nextToken();
+
+ spawnChildProcess(cmd);
+ }
+
+ public POSIX() { }
+}
+
+
+