// Copyright 2000-2005 the Contributors, as shown in the revision logs. // Licensed under the GNU General Public License version 2 ("the License"). // You may not use this file except in compliance with the License. package org.ibex.plat; import java.util.*; import org.ibex.graphics.*; import org.ibex.core.*; import org.ibex.net.*; /** 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); } }