1
2 package org.xwt.plat;
3
4 import gnu.gcj.RawData;
5 import java.net.*;
6 import java.lang.reflect.*;
7 import java.io.*;
8 import java.util.*;
9 import org.xwt.util.*;
10 import org.xwt.*;
11
12
13 public class POSIX extends GCJ {
14
15
16
17 protected String getDescriptiveName() { return "GCJ Linux Binary"; }
18
19
20 protected native String _getEnv(String key);
21
22
23 private static native void spawnChildProcess(String[] command);
24
25 protected void _newBrowserWindow(String url) {
26 String browserString = getEnv("BROWSER");
27 if (browserString == null) {
28 browserString = "netscape " + url;
29 } else if (browserString.indexOf("%s") != -1) {
30 browserString =
31 browserString.substring(0, browserString.indexOf("%s")) +
32 url + browserString.substring(browserString.indexOf("%s") + 2);
33 } else {
34 browserString += " " + url;
35 }
36
37 StringTokenizer st = new StringTokenizer(browserString, " ");
38 String[] cmd = new String[st.countTokens()];
39 for(int i=0; st.hasMoreTokens(); i++) cmd[i] = st.nextToken();
40
41 spawnChildProcess(cmd);
42 }
43
44 public POSIX() { }
45 }
46
47
48
49