remove parseCommandLine

This commit is contained in:
Doug MacEachern 2008-03-27 01:07:40 +00:00
parent 974f80e18f
commit 0b876faf31
1 changed files with 0 additions and 51 deletions

View File

@ -19,15 +19,12 @@
package org.hyperic.sigar.win32; package org.hyperic.sigar.win32;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.StringTokenizer;
import org.hyperic.sigar.Sigar; import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException; import org.hyperic.sigar.SigarException;
public abstract class Win32 { public abstract class Win32 {
public static final String EXE_EXT = ".exe"; public static final String EXE_EXT = ".exe";
private static final String EXE_EXT_U = EXE_EXT.toUpperCase();
static { static {
try { try {
@ -82,54 +79,6 @@ public abstract class Win32 {
return exe; return exe;
} }
public static String[] parseCommandLine(String args) {
ArrayList res = new ArrayList();
StringTokenizer quoteTok;
boolean inQuote = false;
if ((args == null) ||
((args = args.trim()).length() == 0))
{
return new String[0];
}
if (!args.startsWith("\"") &&
(args.endsWith(EXE_EXT) ||
args.endsWith(EXE_EXT_U)) &&
new File(args).exists())
{
return new String[] { args };
}
quoteTok = new StringTokenizer(args, "\"", true);
while (quoteTok.hasMoreTokens()) {
String elem = (String)quoteTok.nextElement();
if (elem.equals("\"")) {
inQuote = !inQuote;
continue;
}
if (inQuote) {
res.add(elem);
}
else {
StringTokenizer spaceTok = new StringTokenizer(elem.trim());
while (spaceTok.hasMoreTokens()) {
res.add(spaceTok.nextToken());
}
}
}
if (inQuote) {
throw new IllegalArgumentException("Unbalanced quotation marks");
}
return (String[])res.toArray(new String[0]);
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
for (int i=0; i<args.length; i++) { for (int i=0; i<args.length; i++) {
String file = String file =