From: <chr...@us...> - 2009-04-01 04:24:07
|
Revision: 5202 http://jnode.svn.sourceforge.net/jnode/?rev=5202&view=rev Author: chrisboertien Date: 2009-04-01 04:23:57 +0000 (Wed, 01 Apr 2009) Log Message: ----------- More fs-archive command implementation Signed-off-by: Chris Boertien <chr...@gm...> Modified Paths: -------------- trunk/fs/descriptors/org.apache.tools.archive.xml trunk/fs/descriptors/org.jnode.fs.command.archive.xml trunk/fs/src/fs/org/jnode/fs/command/archive/ArchiveCommand.java trunk/fs/src/fs/org/jnode/fs/command/archive/BUnzipCommand.java trunk/fs/src/fs/org/jnode/fs/command/archive/BZip.java trunk/fs/src/fs/org/jnode/fs/command/archive/BZipCommand.java trunk/fs/src/fs/org/jnode/fs/command/archive/GUnzipCommand.java trunk/fs/src/fs/org/jnode/fs/command/archive/GZip.java trunk/fs/src/fs/org/jnode/fs/command/archive/GZipCommand.java trunk/fs/src/fs/org/jnode/fs/command/archive/TarCommand.java trunk/fs/src/fs/org/jnode/fs/command/archive/ZCatCommand.java Modified: trunk/fs/descriptors/org.apache.tools.archive.xml =================================================================== --- trunk/fs/descriptors/org.apache.tools.archive.xml 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/descriptors/org.apache.tools.archive.xml 2009-04-01 04:23:57 UTC (rev 5202) @@ -12,7 +12,7 @@ <library name="ant.jar"> <export name="org.apache.tools.tar.*" /> <export name="org.apache.tools.zip.*" /> - <export name="org.apache.tools.bzip.*" /> + <export name="org.apache.tools.bzip2.*" /> </library> </runtime> Modified: trunk/fs/descriptors/org.jnode.fs.command.archive.xml =================================================================== --- trunk/fs/descriptors/org.jnode.fs.command.archive.xml 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/descriptors/org.jnode.fs.command.archive.xml 2009-04-01 04:23:57 UTC (rev 5202) @@ -54,13 +54,13 @@ <option argLabel="fileList" shortName="T" longName="files-from"/> <option argLabel="gzip" shortName="z" longName="gzip" /> <option argLabel="interact" shortName="w" longName="interactive" /> - <option argLabel="keepFiles" shortName="k" longName="keep-old-files" /> + <option argLabel="keep" shortName="k" longName="keep-old-files" /> <option argLabel="noRecurse" longName="no-recursion" /> <option argLabel="recurse" longName="recursion" /> <option argLabel="removeFiles" longName="remove-files" /> <option argLabel="showTotals" longName="totals" /> <option argLabel="suffix" longName="suffix" /> - <option argLabel="useStdout" shortName="O" longName="to-stdout" /> + <option argLabel="stdout" shortName="O" longName="to-stdout" /> <option argLabel="verbose" shortName="v" longName="verbose" /> <option argLabel="verify" shortName="W" longName="verify" /> <option argLabel="xfile" shortName="X" longName="exclude-from"/> @@ -70,7 +70,7 @@ --> </optionSet> <repeat minCount="0"> - <argument argLabel="paths" label="file/dir"/> + <argument argLabel="paths"/> </repeat> </sequence> </syntax> @@ -85,16 +85,16 @@ <option argLabel="force" shortName="f" longName="force" /> <option argLabel="quiet" shortName="q" longName="quiet" /> <option argLabel="verbose" shortName="v" longName="verbose" /> - <option argLabel="lvl1" shortName="1" longName="fast" /> + <option argLabel="c1" shortName="1" longName="fast" /> <option argLabel="debug" longName="debug" /> - <option argLabel="recursive" shortName="r" longName="recursive" /> + <option argLabel="recurse" shortName="r" longName="recursive" /> <option argLabel="test" shortName="t" longName="test" /> <option argLabel="list" shortName="l" longName="list" /> - <option argLabel="lvl9" shortName="9" longName="best" /> + <option argLabel="c9" shortName="9" longName="best" /> </optionSet> <optional eager="true"><option argLabel="suffix" shortName="S" longName="suffix" /></optional> <repeat minCount="1"> - <argument argLabel="file" /> + <argument argLabel="files" /> </repeat> </sequence> </syntax> @@ -103,7 +103,7 @@ <sequence description="decompress files"> <optionSet> <option argLabel="debug" longName="debug" /> - <option argLabel="recursive" shortName="r" longName="recursive" /> + <option argLabel="recurse" shortName="r" longName="recursive" /> <option argLabel="test" shortName="t" longName="test" /> <option argLabel="list" shortName="l" longName="list" /> <option argLabel="noname" shortName="n" longName="no-name" /> @@ -115,7 +115,7 @@ </optionSet> <optional eager="true"><option argLabel="suffix" shortName="S" longName="suffix" /></optional> <repeat minCount="1"> - <argument argLabel="file" /> + <argument argLabel="files" /> </repeat> </sequence> </syntax> @@ -128,7 +128,7 @@ <option argLabel="debug" longName="debug" /> </optionSet> <repeat minCount="1"> - <argument argLabel="file" /> + <argument argLabel="files" /> </repeat> </sequence> </syntax> @@ -137,10 +137,62 @@ <syntax alias="unzip"> </syntax> <syntax alias="bzip2"> + <empty description="compress stdin to stdout" /> + <sequence description="compress files"> + <optionSet> + <option argLabel="stdout" shortName="c" longName="stdout" /> + <option argLabel="decompress" shortName="d" longName="decompress" /> + <option argLabel="compress" shortName="z" longName="compress" /> + <option argLabel="test" shortName="t" longName="test" /> + <option argLabel="force" shortName="f" longName="force" /> + <option argLabel="keep" shortName="k" longName="keep" /> + <option argLabel="small" shortName="s" longName="small" /> + <option argLabel="verbose" shortName="v" longName="verbose" /> + <option argLabel="quiet" shortName="q" longName="quiet" /> + <option argLabel="debug" longName="debug" /> + <option argLabel="c1" shortName="1" longName="fast" /> + <option argLabel="c2" shortName="2" /> + <option argLabel="c3" shortName="3" /> + <option argLabel="c4" shortName="4" /> + <option argLabel="c5" shortName="5" /> + <option argLabel="c6" shortName="6" /> + <option argLabel="c7" shortName="7" /> + <option argLabel="c8" shortName="8" /> + <option argLabel="c9" shortName="9" longName="best" /> + </optionSet> + <repeat> + <argument argLabel="files" /> + </repeat> + </sequence> </syntax> <syntax alias="bunzip2"> + <empty description="decompress stdin to stdout" /> + <sequence description="decompress files"> + <optionSet> + <option argLabel="stdout" shortName="c" longName="stdout" /> + <option argLabel="test" shortName="t" longName="test" /> + <option argLabel="force" shortName="f" longName="force" /> + <option argLabel="keep" shortName="k" longName="keep" /> + <option argLabel="small" shortName="s" longName="small" /> + <option argLabel="verbose" shortName="v" longName="verbose" /> + <option argLabel="quiet" shortName="q" longName="quiet" /> + <option argLabel="debug" longName="debug" /> + </optionSet> + <repeat> + <argument argLabel="files" /> + </repeat> + </sequence> </syntax> <syntax alias="bzcat"> + <empty description="decompress stdin to stdout" /> + <sequence description="decompress files to stdout"> + <optionSet> + <option argLabel="small" shortName="s" longName="small" /> + </optionSet> + <repeat> + <argument argLabel="files" /> + </repeat> + </sequence> </syntax> </extension> Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/ArchiveCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/ArchiveCommand.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/ArchiveCommand.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -21,6 +21,8 @@ package org.jnode.fs.command.archive; import org.jnode.shell.AbstractCommand; +import org.jnode.shell.syntax.Argument; +import org.jnode.shell.syntax.FlagArgument; import java.io.File; import java.io.FileInputStream; @@ -31,35 +33,133 @@ import java.io.Reader; import java.io.IOException; +import java.util.ArrayList; + public class ArchiveCommand extends AbstractCommand { - protected static final int OUT_ERROR = 0x01; - protected static final int OUT_WARN = 0x02; - protected static final int OUT_NOTICE = 0x04; + private static final String help_verbose = "show the compression ratio for each file compressed"; + private static final String help_debug = "internal debug output"; + private static final String help_quiet = "supress non-essential warning messages"; + private static final String help_stdout = "pipe data to stdout"; + private static final String help_force = "force overwrite of output files"; + protected static final String help_decompress = "force decompression"; + + protected static final String prompt_overwrite = " already exists. Do you wish to overwrite? [Y/n]: "; + + protected static final String err_exception_uncaught = "Unhandled Exception thrown"; + protected static final String err_file_create = "Could not create file: "; + protected static final String err_file_not_exist = "Could not find file: "; + protected static final String err_stream_create = "Could not create stream: "; + + protected static final String fmt_size_diff = "%s:\t%f.2%% -- replaced with %s"; + + protected final FlagArgument Quiet = new FlagArgument("quiet", Argument.OPTIONAL, help_quiet); + protected final FlagArgument Verbose = new FlagArgument("verbose", Argument.OPTIONAL, help_verbose); + protected final FlagArgument Debug = new FlagArgument("debug", Argument.OPTIONAL, help_debug); + protected final FlagArgument Stdout = new FlagArgument("stdout", Argument.OPTIONAL, help_stdout); + protected final FlagArgument Force = new FlagArgument("force", Argument.OPTIONAL, help_force); + + protected static final int OUT_FATAL = 0x01; + protected static final int OUT_ERROR = 0x02; + protected static final int OUT_WARN = 0x04; + protected static final int OUT_NOTICE = 0x08; protected static final int OUT_DEBUG = 0x80; + protected static final int BUFFER_SIZE = 4096; + protected int outMode = OUT_ERROR | OUT_WARN; protected PrintWriter stdoutWriter; protected PrintWriter stderrWriter; protected Reader stdinReader; + protected InputStream stdin; + protected OutputStream stdout; + protected String commandName; + protected boolean use_stdout; + protected boolean force; + protected boolean compress; + private byte[] buffer; + private ArchiveCommand() {} + protected ArchiveCommand(String s) { super(s); + registerArguments(Quiet, Verbose, Debug, Stdout, Force); } - protected void setup() { + public void execute() { stdoutWriter = getOutput().getPrintWriter(); stderrWriter = getError().getPrintWriter(); stdinReader = getInput().getReader(); + stdin = getInput().getInputStream(); + stdout = getOutput().getOutputStream(); + + if (Quiet.isSet()) { + outMode = 0; + } else { + if (Verbose.isSet()) { + outMode |= OUT_NOTICE; + } + if (Debug.isSet()) { + outMode |= OUT_DEBUG; + } + } + + if (!use_stdout) use_stdout = Stdout.isSet(); + force = Force.isSet(); } protected void createStreamBuffer(int size) { buffer = new byte[size]; } + protected File[] processFileList(File[] files, boolean recurse) { + if (files == null || files.length == 0) return null; + + if (files.length == 1 && !files[0].isDirectory()) { + if (files[0].getName().equals("-")) return null; + return files; + } + + ArrayList<File> _files = new ArrayList<File>(); + + for (File file : files) { + debug(file.getName()); + if (file.getName().equals("-")) { + if (use_stdout) { + // A special case where '-' is found amongst a list of files and are + // being piped to stdout. The idea is that the content from - should + // be concated amongst the list of files. Its more of an error if the + // destination is not stdout. + _files.add(file); + } else { + fatal("Found stdin in file list.", 1); + } + } + if (!file.exists()) { + error(err_file_not_exist + file); + continue; + } + if (file.isDirectory() && recurse) { + File[] dirList = file.listFiles(); + for (File subFile : dirList) { + if (subFile.isFile()) { + _files.add(subFile); + } + } + } else { + if (file.isFile()) { + _files.add(file); + } + } + } + + if (_files.size() == 0) return null; + return _files.toArray(files); + } + /** * Pipes the contents of the InputStream into the OutputStream. * @@ -93,12 +193,17 @@ protected OutputStream openFileWrite(File file , boolean delete , boolean forced) { try { boolean createNew = true; + if (file == null) { + error(err_file_create + "null"); + return null; + } + if (file.exists()) { if (delete) { if (forced) { file.delete(); } else { - if (prompt_yn(file + "exists. Overwrite? ")) { + if (prompt_yn(file + prompt_overwrite, true)) { file.delete(); } else { notice("Skipping " + file); @@ -110,12 +215,12 @@ } } if (createNew && !file.createNewFile()) { - error("Could not create file: " + file); + error(err_file_create + file); return null; } return new FileOutputStream(file); } catch (IOException ioe) { - error("Could not open stream: " + file + " : " + ioe.getLocalizedMessage()); + error(err_stream_create + file); return null; } } @@ -131,9 +236,13 @@ */ protected InputStream openFileRead(File file) { try { + if (file == null || !file.exists()) { + error(err_file_not_exist + file); + return null; + } return new FileInputStream(file); } catch (IOException ioe) { - error("Cannot open stream: " + file + " : " + ioe.getLocalizedMessage()); + error(err_stream_create + file); return null; } } @@ -144,26 +253,30 @@ * @param String the question to ask the user * @return true if the user said yes, false if the user said no */ - protected boolean prompt_yn(String s) { + protected boolean prompt_yn(String s, boolean defaultY) { int choice; for (;;) { - stdoutWriter.print(s + " [y/n]"); + stdoutWriter.print(s); try { choice = stdinReader.read(); } catch (IOException _) { - choice = 0; + throw new RuntimeException("Problem with stdin"); } stdoutWriter.println(); - if (choice == 'y' || choice == 'n') break; + if (choice == 'y') return true; + if (choice == 'n') return false; + if (choice == '\n') return defaultY; } - - return choice == 'y'; } protected void out(String s) { stdoutWriter.println(s); } + protected void err(String s) { + stderrWriter.println(s); + } + protected void debug(String s) { if ((outMode & OUT_DEBUG) == OUT_DEBUG) { stderrWriter.print("debug: "); @@ -182,4 +295,9 @@ protected void error(String s) { if ((outMode & OUT_ERROR) == OUT_ERROR) stderrWriter.println(s); } + + protected void fatal(String s, int exit_code) { + stderrWriter.println("Fatal error: " + s); + exit(exit_code); + } } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/BUnzipCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/BUnzipCommand.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/BUnzipCommand.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -28,6 +28,7 @@ } public void execute() { - setup(); + compress = false; + super.execute(); } } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/BZip.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/BZip.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/BZip.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -20,9 +20,203 @@ package org.jnode.fs.command.archive; +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.IOException; + +import org.jnode.shell.syntax.Argument; +import org.jnode.shell.syntax.FileArgument; +import org.jnode.shell.syntax.FlagArgument; + +import org.apache.tools.bzip2.CBZip2InputStream; +import org.apache.tools.bzip2.CBZip2OutputStream; + +/** + * + * @author chris boertien + */ public class BZip extends ArchiveCommand { + private static final String help_compress = "forces compression; regardless of invocation name"; + private static final String help_files = "space seperated list of files to compress"; + private static final String help_keep = "Keep input files"; + private static final String help_small = "(ignored)"; + private static final String help_test = "test the file integrity"; + + private static final String fmt_suffix_bad = "Can't guess original name for %s -- using %s.out"; + + protected final FlagArgument Compress = new FlagArgument("compress", Argument.OPTIONAL, help_compress); + protected final FlagArgument Decompress = new FlagArgument("decompress", Argument.OPTIONAL, help_decompress); + protected final FileArgument Files = new FileArgument("files", Argument.OPTIONAL | Argument.MULTIPLE, help_files); + protected final FlagArgument Keep = new FlagArgument("keep", Argument.OPTIONAL, help_keep); + protected final FlagArgument Small = new FlagArgument("small", Argument.OPTIONAL, help_small); + protected final FlagArgument Test = new FlagArgument("test", Argument.OPTIONAL, help_test); + + protected int clevel = 9; + protected boolean keep; + public BZip(String s) { super(s); + registerArguments(Compress, Decompress, Files, Keep, Small, Test); + createStreamBuffer(4096); } + + public void execute() { + super.execute(); + + if (compress && Decompress.isSet()) { + compress = false; + } + if (!compress && Compress.isSet()) { + compress = true; + } + + keep = Keep.isSet(); + + if (!keep && use_stdout) { + keep = true; + } + + try { + if (compress) { + compress(processFileList(Files.getValues(), true)); + } else { + decompress(processFileList(Files.getValues(), true)); + } + } catch (IOException e) { + e.printStackTrace(); + fatal(err_exception_uncaught, 1); + } + } + + private void compress(File[] files) throws IOException { + InputStream in; + OutputStream out = null; + CBZip2OutputStream bzout = null; + File bzfile = null; + float sizeDiff; + + if (files == null) { + processStream(stdin, new CBZip2OutputStream(stdout, clevel)); + return; + } + + if (use_stdout) { + bzout = new CBZip2OutputStream(stdout, clevel); + } + + for (File file : files) { + if (!use_stdout) { + bzfile = new File(file.getAbsolutePath() + ".bz2"); + if ((out = openFileWrite(bzfile, true, force)) == null) continue; + bzout = new CBZip2OutputStream(out, clevel); + } + + if (file.getName().equals("-")) { + processStream(stdin, bzout); + continue; + } + + if ((in = openFileRead(file)) == null) { + if (!use_stdout) bzout.close(); + continue; + } + processStream(in, bzout); + in.close(); + + if (!use_stdout) { + bzout.close(); + sizeDiff = ((float) bzfile.length() / (float) file.length()) * 100; + notice(String.format(fmt_size_diff, file, sizeDiff, bzfile)); + if (!keep) file.delete(); + } + } + + if (use_stdout) { + bzout.close(); + } + } + + private void decompress(File[] files) throws IOException { + InputStream in; + OutputStream out = null; + File file = null; + float sizeDiff; + + if (files == null) { + processStream(new CBZip2InputStream(stdin), stdout); + return; + } + + if (use_stdout) { + out = stdout; + } + + for (File bzfile : files) { + if (!use_stdout) { + file = stripSuffix(bzfile); + if ((out = openFileWrite(file, true, force)) == null) continue; + } + + if (bzfile.getName().equals("-")) { + processStream(new CBZip2InputStream(stdin), out); + continue; + } + + if ((in = new CBZip2InputStream(openFileRead(bzfile))) == null) { + if (!use_stdout) out.close(); + continue; + } + processStream(in, out); + in.close(); + + if (!use_stdout) { + out.close(); + sizeDiff = ((float) bzfile.length() / (float) file.length()) * 100; + notice(String.format(fmt_size_diff, bzfile, sizeDiff, file)); + if (!keep) bzfile.delete(); + } + } + } + + private void test(File[] files) { + // requires patch to apache ant to have CBZip2InputStream fail with an + // exception, instead it just prints to stderr and doesn't tell us if + // it failed. + // + // Otherwise we would have to read and compute the crc ourself. + } + + private File stripSuffix(File bzfile) { + String name = bzfile.getName(); + int len = 0; + String newSuffix = null; + + if (name.endsWith(".bz")) { + len = 3; + } else if (name.endsWith(".bz2")) { + len = 4; + } else if (name.endsWith(".tbz")) { + len = 4; + newSuffix = ".tar"; + } else if (name.endsWith(".tbz2")) { + len = 5; + newSuffix = ".tar"; + } else { + notice(String.format(fmt_suffix_bad, bzfile, bzfile)); + notice("Can't guess original name for " + bzfile + " -- using " + bzfile + ".out"); + return new File(name + ".out"); + } + + if (len > 0) { + name = name.substring(0, name.length() - len); + } + + if (newSuffix != null) { + name = name + newSuffix; + } + + return new File(name); + } } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/BZipCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/BZipCommand.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/BZipCommand.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -20,13 +20,31 @@ package org.jnode.fs.command.archive; +import org.jnode.shell.syntax.Argument; +import org.jnode.shell.syntax.FlagArgument; + public class BZipCommand extends BZip { + private static final String help_fast = "compress faster"; + private static final String help_best = "compress better"; + + private final FlagArgument C1 = new FlagArgument("c1", Argument.OPTIONAL, help_fast); + private final FlagArgument C2 = new FlagArgument("c2", Argument.OPTIONAL, " "); + private final FlagArgument C3 = new FlagArgument("c3", Argument.OPTIONAL, " "); + private final FlagArgument C4 = new FlagArgument("c4", Argument.OPTIONAL, " "); + private final FlagArgument C5 = new FlagArgument("c5", Argument.OPTIONAL, " "); + private final FlagArgument C6 = new FlagArgument("c6", Argument.OPTIONAL, " "); + private final FlagArgument C7 = new FlagArgument("c7", Argument.OPTIONAL, " "); + private final FlagArgument C8 = new FlagArgument("c8", Argument.OPTIONAL, " "); + private final FlagArgument C9 = new FlagArgument("c9", Argument.OPTIONAL, help_best); + public BZipCommand() { super("compresses data with bzip2"); + registerArguments(C1, C2, C3, C4, C5, C6, C7, C8, C9); } public void execute() { - setup(); + compress = true; + super.execute(); } } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/GUnzipCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/GUnzipCommand.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/GUnzipCommand.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -20,11 +20,6 @@ package org.jnode.fs.command.archive; -import org.jnode.shell.syntax.Argument; -import org.jnode.shell.syntax.FileArgument; -import org.jnode.shell.syntax.FlagArgument; -import org.jnode.shell.syntax.StringArgument; - /** * Decompresses data in the gzip format. * @@ -38,60 +33,13 @@ */ public class GUnzipCommand extends GZip { - - private static final String msg_stdout = "Write output on standard output, keep original files"; - private static final String msg_force = "force overwrite of output files and compress links"; - private static final String msg_list = "list compressed file contents"; - private static final String msg_noname = "do not save or restore the original name and time stamp"; - private static final String msg_name = "save or restore the original name and time stamp"; - private static final String msg_quiet = "suppress all warning"; - private static final String msg_recurse = "operate recursively on directories"; - private static final String msg_suffix = "use suffix SUF on compressed files"; - private static final String msg_test = "test compressed file integrity"; - private static final String msg_verbose = "verbose mode"; - private static final String msg_file = "the files to compress, use stdin if FILE is '-' or no files are listed"; - private final FileArgument ArgFile = new FileArgument("file", Argument.OPTIONAL | Argument.MULTIPLE, msg_file); - private final StringArgument ArgSuffix = new StringArgument("suffix", Argument.OPTIONAL, msg_suffix); - private final FlagArgument ArgStdout = new FlagArgument("stdout", Argument.OPTIONAL, msg_stdout); - private final FlagArgument ArgForce = new FlagArgument("force", Argument.OPTIONAL, msg_force); - private final FlagArgument ArgList = new FlagArgument("list", Argument.OPTIONAL, msg_list); - private final FlagArgument ArgNoname = new FlagArgument("noname", Argument.OPTIONAL, msg_noname); - private final FlagArgument ArgName = new FlagArgument("name", Argument.OPTIONAL, msg_name); - private final FlagArgument ArgQuiet = new FlagArgument("quiet", Argument.OPTIONAL, msg_quiet); - private final FlagArgument ArgRecurse = new FlagArgument("recursive", Argument.OPTIONAL, msg_recurse); - private final FlagArgument ArgTest = new FlagArgument("test", Argument.OPTIONAL, msg_test); - private final FlagArgument ArgVerbose = new FlagArgument("verbose", Argument.OPTIONAL, msg_verbose); - private final FlagArgument ArgDebug = new FlagArgument("debug", Argument.OPTIONAL, " "); - public GUnzipCommand() { super("decompresses files/data"); - registerArguments(ArgFile, ArgSuffix, ArgStdout, ArgForce, ArgList, ArgNoname, ArgName, ArgQuiet, ArgRecurse, - ArgTest, ArgVerbose, ArgDebug); } public void execute() { - if (ArgQuiet.isSet()) { - outMode = 0; - } else { - if (ArgDebug.isSet()) { - outMode |= OUT_DEBUG; - } - if (ArgVerbose.isSet()) { - outMode |= OUT_NOTICE; - } - } - - if (ArgSuffix.isSet()) suffix = ArgSuffix.getValue(); - - if (ArgList.isSet()) mode = GZIP_LIST; - else if (ArgTest.isSet()) mode = GZIP_TEST; - else mode = GZIP_DECOMPRESS; - - try { - execute(ArgFile.getValues(), ArgForce.isSet(), ArgStdout.isSet(), ArgRecurse.isSet()); - } catch (Exception e) { - e.printStackTrace(); - } + compress = false; + super.execute(); } } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/GZip.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/GZip.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/GZip.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -24,10 +24,14 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; -import java.util.ArrayList; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; +import org.jnode.shell.syntax.Argument; +import org.jnode.shell.syntax.FlagArgument; +import org.jnode.shell.syntax.FileArgument; +import org.jnode.shell.syntax.StringArgument; + /** * * TODO implement test/list @@ -37,140 +41,139 @@ */ public class GZip extends ArchiveCommand { - private static final String msg_exists_prompt = " already exists; do you wish to overwrite (y or n)? "; - private static final String msg_exists_skip = "gzip: skipping file: "; - private static final String msg_err_open = "gzip: Cannot open file: "; - private static final String msg_err_create = "gzip: Cannot create file: "; - private static final String msg_err_bad_suffix = "gzip: Invalid suffix, expecting "; - - private static final int BUFFER_SIZE = 4096; + private static final String help_suffix = "append <suffix> on compressed files"; + private static final String help_list = "list compressed file contents"; + private static final String help_noname = "do not save or restore the original name and time stamp"; + private static final String help_name = "save or restore the original name and time stamp"; + private static final String help_recurse = "operate recursively on directories"; + private static final String help_test = "test compressed file integrity"; + private static final String help_file = "the files to compress, use stdin if FILE is '-' or no files are listed"; - private File[] files; - private InputStream stdinStream; - private OutputStream stdoutStream; + private final FileArgument Files = new FileArgument("files", Argument.OPTIONAL | Argument.MULTIPLE, help_file); + private final FlagArgument List = new FlagArgument("list", Argument.OPTIONAL, help_list); + private final FlagArgument NoName = new FlagArgument("noname", Argument.OPTIONAL, help_noname); + private final FlagArgument Name = new FlagArgument("name", Argument.OPTIONAL, help_name); + private final FlagArgument Recurse = new FlagArgument("recurse", Argument.OPTIONAL, help_recurse); + private final FlagArgument Test = new FlagArgument("test", Argument.OPTIONAL, help_test); + private final StringArgument Suffix = new StringArgument("suffix", Argument.OPTIONAL, help_suffix); - protected static final int GZIP_LIST = 1; - protected static final int GZIP_TEST = 2; - protected static final int GZIP_DECOMPRESS = 3; - protected static final int GZIP_COMPRESS = 4; - protected String suffix = ".gz"; - protected int mode; + protected boolean recurse; protected GZip(String s) { super(s); - createStreamBuffer(BUFFER_SIZE); + registerArguments(Files, List, NoName, Name, Recurse, Test, Suffix); + createStreamBuffer(4096); } - public void execute(File[] files , boolean forced , boolean use_stdout , boolean recurse) throws IOException { - setup(); - stdinStream = getInput().getInputStream(); - stdoutStream = getOutput().getOutputStream(); + public void execute() { + super.execute(); - switch(mode) { - case GZIP_LIST : - list(processFiles(files, recurse)); return; - case GZIP_TEST : - test(processFiles(files, recurse)); return; - case GZIP_COMPRESS : - compress(processFiles(files, recurse), forced, use_stdout); return; - case GZIP_DECOMPRESS : - decompress(processFiles(files, recurse), forced, use_stdout); return; + if (Suffix.isSet()) suffix = Suffix.getValue(); + + recurse = Recurse.isSet(); + + try { + if (compress) { + compress(processFileList(Files.getValues(), recurse)); + } else { + decompress(processFileList(Files.getValues(), recurse)); + } + } catch (IOException e) { + e.printStackTrace(); + fatal(err_exception_uncaught, 1); } } - protected void compress(File[] files , boolean forced , boolean use_stdout) throws IOException { + private void compress(File[] files) throws IOException { InputStream in; OutputStream out = null; GZIPOutputStream gzout = null; - File gzFile = null; + File gzfile = null; float sizeDiff; - debug("Compress"); - debug("forced=" + forced); - debug("use_stdout=" + use_stdout); - if (files == null) { - debug("stdin > stdout"); - processStream(stdinStream, new GZIPOutputStream(stdoutStream, BUFFER_SIZE)); - } else { - if (use_stdout) gzout = new GZIPOutputStream(stdoutStream, BUFFER_SIZE); - if (use_stdout) debug("files > stdout"); - else debug("files > files"); + processStream(stdin, new GZIPOutputStream(stdout, BUFFER_SIZE)); + return; + } - for (File file : files) { - debug(file.getName()); - if (!file.exists()) { - error("File does not exist: " + file.getName()); - continue; - } - if (!use_stdout) { - gzFile = new File(file.getAbsolutePath() + suffix); - if ((out = openFileWrite(gzFile, true, forced)) == null) continue; - gzout = new GZIPOutputStream(out, BUFFER_SIZE); - } - if ((in = openFileRead(file)) == null) continue; - processStream(in, gzout); - if (!use_stdout) { - gzout.finish(); - gzout.close(); - sizeDiff = ((float) gzFile.length() / (float) file.length()) * 100; - notice(file + ":\t" + sizeDiff + "% -- replaced with " + gzFile); - file.delete(); - } - in.close(); + if (use_stdout) { + gzout = new GZIPOutputStream(stdout, BUFFER_SIZE); + } + + for (File file : files) { + if (!use_stdout) { + gzfile = new File(file.getAbsolutePath() + suffix); + if ((out = openFileWrite(gzfile, true, force)) == null) continue; + gzout = new GZIPOutputStream(out, BUFFER_SIZE); } - if (use_stdout) gzout.finish(); + + if (file.getName().equals("-")) { + processStream(stdin, gzout); + continue; + } + + if ((in = openFileRead(file)) == null) { + if (!use_stdout) gzout.close(); + continue; + } + processStream(in, gzout); + + if (!use_stdout) { + gzout.finish(); + gzout.close(); + sizeDiff = ((float) gzfile.length() / (float) file.length()) * 100; + notice(String.format(fmt_size_diff, file, sizeDiff, gzfile)); + file.delete(); + } + in.close(); } + + if (use_stdout) { + gzout.finish(); + gzout.close(); + } } - protected void decompress(File[] files , boolean forced , boolean use_stdout) throws IOException { + private void decompress(File[] files) throws IOException { InputStream in; OutputStream out = null; - String name; File file = null; float sizeDiff; - debug("Decompress"); - debug("forced=" + forced); - debug("use_stdout=" + use_stdout); + if (files == null) { + processStream(new GZIPInputStream(stdin, BUFFER_SIZE), stdout); + return; + } - if (use_stdout) out = stdoutStream; + if (use_stdout) { + out = stdout; + } - if (files == null) { - debug("stdin > stdout"); - processStream(new GZIPInputStream(stdinStream, BUFFER_SIZE), stdoutStream); - } else { - if (use_stdout) debug("files > stdout"); - else debug("files > files"); + for (File gzfile : files) { + if (!use_stdout) { + file = stripSuffix(gzfile); + if ((out = openFileWrite(file, true, force)) == null) continue; + } - for (File gzFile : files) { - debug(gzFile.getName()); - if (!gzFile.exists()) { - error("File not found: " + gzFile); - continue; - } - if (!gzFile.getName().endsWith(suffix)) { - notice("gzip: " + file + ": unknown suffix -- ignored"); - continue; - } - if (!use_stdout) { - name = gzFile.getAbsolutePath(); - name = name.substring(0, name.length() - suffix.length()); - file = new File(name); - if ((out = openFileWrite(file, true, forced)) == null) continue; - } - - if ((in = new GZIPInputStream(openFileRead(gzFile), BUFFER_SIZE)) == null) continue; - processStream(in, out); - in.close(); - if (!use_stdout) { - sizeDiff = ((float) gzFile.length() / (float) file.length()) * 100; - notice(gzFile + ":\t" + sizeDiff + "% -- replaced with " + file); - gzFile.delete(); - out.close(); - } + if (gzfile.getName().equals("-")) { + processStream(new GZIPInputStream(stdin, BUFFER_SIZE), out); + continue; } + + if ((in = new GZIPInputStream(openFileRead(gzfile), BUFFER_SIZE)) == null) { + if (!use_stdout) out.close(); + continue; + } + processStream(in, out); + in.close(); + + if (!use_stdout) { + out.close(); + sizeDiff = ((float) gzfile.length() / (float) file.length()) * 100; + notice(String.format(fmt_size_diff, gzfile, sizeDiff, file)); + gzfile.delete(); + } } } @@ -178,43 +181,16 @@ protected void list(File[] files) {} - private File[] processFiles(File[] files , boolean recurse) { - if (files == null || files.length == 0) return null; + private File stripSuffix(File file) { + String name = file.getAbsolutePath(); - debug("processFiles(files(" + files.length + ")," + recurse + ")"); - - ArrayList<File> _files = new ArrayList<File>(); - - for (File file : files) { - debug(file.getName()); - if (file.getName().equals("-")) { - debug("found stdin"); - return null; - } - if (!file.exists()) { - error("Cannot find file: " + file); - continue; - } - if (file.isDirectory() && recurse) { - debug("searching directory: " + file); - File[] dirList = file.listFiles(); - for (File subFile : dirList) { - debug(subFile.getName()); - if (subFile.isFile()) { - debug(subFile + " added"); - _files.add(subFile); - } - } - } else { - if (file.isFile()) { - debug(file + " added"); - _files.add(file); - } - } + if (!name.endsWith(suffix)) { + notice(name + " unknown suffix -- ignore"); + return null; } - if (_files.size() == 0) return null; - debug("Found " + _files.size() + " files"); - return _files.toArray(files); + name = name.substring(0, name.length() - suffix.length()); + + return new File(name); } } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/GZipCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/GZipCommand.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/GZipCommand.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -21,9 +21,7 @@ package org.jnode.fs.command.archive; import org.jnode.shell.syntax.Argument; -import org.jnode.shell.syntax.FileArgument; import org.jnode.shell.syntax.FlagArgument; -import org.jnode.shell.syntax.StringArgument; /** * Compresses or decompresses data in the gzip format. @@ -38,69 +36,20 @@ */ public class GZipCommand extends GZip { - private static final String msg_stdout = "Write output on standard output, keep original files"; - private static final String msg_decomp = "decompress"; - private static final String msg_force = "force overwrite of output files and compress links"; - private static final String msg_list = "list compressed file contents"; - private static final String msg_noname = "do not save or restore the original name and time stamp"; - private static final String msg_name = "save or restore the original name and time stamp"; - private static final String msg_quiet = "suppress all warning"; - private static final String msg_recurse = "operate recursively on directories"; - private static final String msg_suffix = "use suffix SUF on compressed files"; - private static final String msg_test = "test compressed file integrity"; - private static final String msg_verbose = "verbose mode"; - private static final String msg_fast = "compress faster"; - private static final String msg_best = "compress better"; - private static final String msg_file = "the files to compress, use stdin if FILE is '-' or no files are listed"; + private static final String help_fast = "compress faster"; + private static final String help_best = "compress better"; - private final FileArgument ArgFile = new FileArgument("file", Argument.OPTIONAL | Argument.MULTIPLE, msg_file); - private final StringArgument ArgSuffix = new StringArgument("suffix", Argument.OPTIONAL, msg_suffix); - private final FlagArgument ArgStdout = new FlagArgument("stdout", Argument.OPTIONAL, msg_stdout); - private final FlagArgument ArgDecomp = new FlagArgument("decompress", Argument.OPTIONAL, msg_decomp); - private final FlagArgument ArgForce = new FlagArgument("force", Argument.OPTIONAL, msg_force); - private final FlagArgument ArgList = new FlagArgument("list", Argument.OPTIONAL, msg_list); - private final FlagArgument ArgNoname = new FlagArgument("noname", Argument.OPTIONAL, msg_noname); - private final FlagArgument ArgName = new FlagArgument("name", Argument.OPTIONAL, msg_name); - private final FlagArgument ArgQuiet = new FlagArgument("quiet", Argument.OPTIONAL, msg_quiet); - private final FlagArgument ArgRecurse = new FlagArgument("recursive", Argument.OPTIONAL, msg_recurse); - private final FlagArgument ArgTest = new FlagArgument("test", Argument.OPTIONAL, msg_test); - private final FlagArgument ArgVerbose = new FlagArgument("verbose", Argument.OPTIONAL, msg_verbose); - private final FlagArgument ArgLvl1 = new FlagArgument("lvl1", Argument.OPTIONAL, msg_fast); - private final FlagArgument ArgLvl9 = new FlagArgument("lvl9", Argument.OPTIONAL, msg_best); - private final FlagArgument ArgDebug = new FlagArgument("debug", Argument.OPTIONAL, " "); + private final FlagArgument Decompress = new FlagArgument("decompress", Argument.OPTIONAL, help_decompress); + private final FlagArgument C1 = new FlagArgument("c1", Argument.OPTIONAL, help_fast); + private final FlagArgument C9 = new FlagArgument("c9", Argument.OPTIONAL, help_best); public GZipCommand() { super("compresses and decompresses files/data"); - registerArguments(ArgFile, ArgSuffix, ArgDecomp, ArgNoname, ArgName, ArgStdout, ArgForce, - ArgQuiet, ArgVerbose, ArgLvl1, ArgLvl9, ArgRecurse, ArgTest, ArgList, ArgDebug); + registerArguments(Decompress, C1, C9); } public void execute() { - if (ArgQuiet.isSet()) { - outMode = 0; - } else { - if (ArgDebug.isSet()) { - outMode |= OUT_DEBUG; - } - if (ArgVerbose.isSet()) { - outMode |= OUT_NOTICE; - } - } - - if (ArgSuffix.isSet()) suffix = ArgSuffix.getValue(); - - if (ArgList.isSet()) mode = GZIP_LIST; - else if (ArgTest.isSet()) mode = GZIP_TEST; - else if (ArgDecomp.isSet()) mode = GZIP_DECOMPRESS; - else mode = GZIP_COMPRESS; - - try { - execute(ArgFile.getValues(), ArgForce.isSet(), ArgStdout.isSet(), ArgRecurse.isSet()); - } catch (Exception e) { - e.printStackTrace(); - exit(1); - } + compress = !Decompress.isSet(); + super.execute(); } - - } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/TarCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/TarCommand.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/TarCommand.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -68,6 +68,8 @@ private static final String help_verify = "verify the archive after writing it"; private static final String help_xfile = "exclude files matching patterns in <file>"; + private static final String err_options = "required options -Acdtrux not found, or multiple options set"; + private static final int TAR_APPEND = 0x01; private static final int TAR_CREATE = 0x02; private static final int TAR_CONCAT = 0x04; @@ -89,21 +91,18 @@ private final FlagArgument Backup = new FlagArgument("backup", Argument.OPTIONAL, help_backup); private final FlagArgument UseBzip = new FlagArgument("bzip", Argument.OPTIONAL, help_bzip); - private final FlagArgument Debug = new FlagArgument("debug", Argument.OPTIONAL, " "); private final FileArgument ChangeDir = new FileArgument("dir", Argument.OPTIONAL, help_dir); private final StringArgument Exclude = new StringArgument("exclude", Argument.OPTIONAL, help_exclude); private final FileArgument Archive = new FileArgument("file", Argument.OPTIONAL, help_file); private final FileArgument FileList = new FileArgument("fileList", Argument.OPTIONAL, help_file_list); private final FlagArgument UseGzip = new FlagArgument("gzip", Argument.OPTIONAL, help_gzip); private final FlagArgument Interact = new FlagArgument("interact", Argument.OPTIONAL, help_interact); - private final FlagArgument KeepFiles = new FlagArgument("keepFiles", Argument.OPTIONAL, help_keep_old); + private final FlagArgument Keep = new FlagArgument("keep", Argument.OPTIONAL, help_keep_old); private final FlagArgument NoRecurse = new FlagArgument("noRecurse", Argument.OPTIONAL, help_norecurse); private final FlagArgument Recurse = new FlagArgument("recurse", Argument.OPTIONAL, help_recurse); private final FlagArgument RemoveFiles = new FlagArgument("removeFiles", Argument.OPTIONAL, help_remove); private final FlagArgument ShowTotals = new FlagArgument("showTotals", Argument.OPTIONAL, help_totals); private final StringArgument Suffix = new StringArgument("suffix", Argument.OPTIONAL, help_suffix); - private final FlagArgument UseStdout = new FlagArgument("useStdout", Argument.OPTIONAL, help_stdout); - private final FlagArgument Verbose = new FlagArgument("verbose", Argument.OPTIONAL, help_verbose); private final FlagArgument Verify = new FlagArgument("verify", Argument.OPTIONAL, help_verify); private final FileArgument ExcludeFile = new FileArgument("xfile", Argument.OPTIONAL, help_xfile); @@ -122,23 +121,20 @@ private boolean gzip; private boolean interact; private boolean verify; - private boolean use_stdout; private boolean showTotals; - private boolean keepOldFiles; + private boolean keep; public TarCommand() { super("Create/Modify/Extract tape archives"); registerArguments(DoAppend, DoConcat, DoCreate, DoDelete, DoDiff, DoExtract, DoList, DoUpdate, - Backup, UseBzip, Debug, ChangeDir, Exclude, Archive, FileList, UseGzip, Interact, - KeepFiles, NoRecurse, Recurse, RemoveFiles, ShowTotals, Suffix, UseStdout, Verbose, - Verify, Paths, ExcludeFile); + Backup, UseBzip, ChangeDir, Exclude, Archive, FileList, UseGzip, Interact, + Keep, NoRecurse, Recurse, RemoveFiles, ShowTotals, Suffix, Verify, Paths, ExcludeFile); } public void execute() { - setup(); + super.execute(); if (!checkMode()) { - error("required options -Acdtrux not found, or multiple options set"); - exit(1); + fatal(err_options, 1); } if (DoAppend.isSet()) mode = TAR_APPEND; else if (DoConcat.isSet()) mode = TAR_CONCAT; @@ -149,9 +145,6 @@ else if (DoList.isSet()) mode = TAR_LIST; else if (DoUpdate.isSet()) mode = TAR_UPDATE; - if (Debug.isSet()) outMode |= OUT_DEBUG; - if (Verbose.isSet()) outMode |= OUT_NOTICE; - if (Suffix.isSet()) suffix = Suffix.getValue(); if (Exclude.isSet()) exclude = Exclude.getValue(); if (ExcludeFile.isSet()) excludeFile = ExcludeFile.getValue(); @@ -162,9 +155,8 @@ gzip = UseGzip.isSet(); interact = Interact.isSet(); verify = Verify.isSet(); - use_stdout = UseStdout.isSet(); showTotals = ShowTotals.isSet(); - keepOldFiles = KeepFiles.isSet(); + keep = Keep.isSet(); recurse = !NoRecurse.isSet(); if (Archive.isSet()) archive = Archive.getValue(); else error("No archive given"); @@ -183,7 +175,7 @@ debug("Recurse: " + recurse); debug("Verify: " + verify); debug("Use StdOut: " + use_stdout); - debug("Keep Old Files: " + keepOldFiles); + debug("Keep Old Files: " + keep); debug("Show Totals: " + showTotals); debug("pipeInOut: " + pipeInOut); @@ -202,7 +194,7 @@ } } catch (Exception e) { e.printStackTrace(); - exit(2); + fatal(err_exception_uncaught, 1); } } @@ -217,8 +209,7 @@ if (mode == TAR_CREATE || (mode == TAR_APPEND && !archive.exists())) createArchive(); if ((out = openFileWrite(archive, false, false)) == null) { - error("Could not open stream: " + archive); - exit(1); + fatal(err_stream_create + archive, 1); } } else { debug("out=stdout"); @@ -250,13 +241,10 @@ TarInputStream tin; File file; + // add support for reading compress archives with gzip/bzip + if (archive != null) { - if (archive.exists()) { - if ((in = openFileRead(archive)) == null) { - exit(1); - } - } else { - error("File does not exist: " + archive); + if ((in = openFileRead(archive)) == null) { exit(1); } } else { @@ -295,10 +283,6 @@ InputStream in = null; TarInputStream tin; - if (archive == null || !archive.exists()) { - error("Cannot find file: " + archive); - exit(1); - } if ((in = openFileRead(archive)) == null) { exit(1); } @@ -316,10 +300,6 @@ TarInputStream tin; File file; - if (archive == null || !archive.exists()) { - error("Cannot find file: " + archive); - exit(1); - } if ((in = openFileRead(archive)) == null) { exit(1); } @@ -348,11 +328,9 @@ if (archive.exists()) { archive.delete(); } - debug("creating archive: " + archive); archive.createNewFile(); } catch (IOException e) { - error("Could not create file: " + archive); - exit(1); + fatal(err_file_create + archive, 1); } } Modified: trunk/fs/src/fs/org/jnode/fs/command/archive/ZCatCommand.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/command/archive/ZCatCommand.java 2009-03-31 20:21:47 UTC (rev 5201) +++ trunk/fs/src/fs/org/jnode/fs/command/archive/ZCatCommand.java 2009-04-01 04:23:57 UTC (rev 5202) @@ -20,46 +20,19 @@ package org.jnode.fs.command.archive; -import org.jnode.shell.syntax.Argument; -import org.jnode.shell.syntax.FileArgument; -import org.jnode.shell.syntax.FlagArgument; - /** * Outputs compressed files to standard out. */ public class ZCatCommand extends GZip { - private static final String msg_file = "the files to compress, use stdin if FILE is '-' or no files are listed"; - - private final FileArgument ArgFile = new FileArgument("file", Argument.OPTIONAL | Argument.MULTIPLE, msg_file); - private final FlagArgument ArgDebug = new FlagArgument("debug", Argument.OPTIONAL, " "); - private final FlagArgument ArgVerbose = new FlagArgument("verbose", Argument.OPTIONAL, " "); - private final FlagArgument ArgQuiet = new FlagArgument("quiet", Argument.OPTIONAL, " "); - public ZCatCommand() { super("decompresses files to standard output"); - registerArguments(ArgFile, ArgDebug, ArgVerbose, ArgQuiet); } public void execute() { - if (ArgQuiet.isSet()) { - outMode = 0; - } else { - if (ArgDebug.isSet()) { - outMode |= OUT_DEBUG; - } - if (ArgVerbose.isSet()) { - outMode |= OUT_NOTICE; - } - } - - mode = GZIP_DECOMPRESS; - - try { - execute(ArgFile.getValues(), false, true, false); - } catch (Exception e) { - e.printStackTrace(); - } + use_stdout = true; + compress = false; + super.execute(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |