File: getsp.java

package info (click to toggle)
rjava 0.9-11-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,744 kB
  • sloc: java: 13,040; ansic: 5,169; sh: 3,624; xml: 291; makefile: 250; perl: 33
file content (29 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class getsp {
    public static void main(String[] args) {
	if (args!=null && args.length>0) {
	    if (args[0].compareTo("-libs")==0) {
		String prefix="-L";
		if (args.length>1) prefix=args[1];
		String lp=System.getProperty("java.library.path");
		// we're not using StringTokenizer in case the JVM is very crude
		int i=0,j,k=0;
		String r=null;
		String pss=System.getProperty("path.separator");
		char ps=':';
		if (pss!=null && pss.length()>0) ps=pss.charAt(0);
		j=lp.length();
		while (i<=j) {
		    if (i==j || lp.charAt(i)==ps) {
			String lib=lp.substring(k,i);
			k=i+1;
			if (lib.compareTo(".")!=0)
			    r=(r==null)?(prefix+lib):(r+" "+prefix+lib);
		    }
		    i++;
		}
		if (r!=null) System.out.println(r);
	    } else
		System.out.println(System.getProperty(args[0]));
	}
    }
}