mass rename and rebranding from xwt to ibex - fixed to use ixt files
[org.ibex.core.git] / src / org / ibex / plat / POSIX.java
diff --git a/src/org/ibex/plat/POSIX.java b/src/org/ibex/plat/POSIX.java
new file mode 100644 (file)
index 0000000..e8c3ff1
--- /dev/null
@@ -0,0 +1,43 @@
+// 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() { }
+}
+
+
+