Commit 8de15ffc by Tom Tromey Committed by Tom Tromey

* resource/gnu/classpath/tools/jar/messages.properties

	(Main.Stdin): New message.
	* tools/gnu/classpath/tools/jar/Main.java (initializeParser): Add
	'-@' option.
	(readNames): New method.
	(run): Use it.

From-SVN: r121424
parent 4fc78423
2007-01-31 Tom Tromey <tromey@redhat.com>
* resource/gnu/classpath/tools/jar/messages.properties
(Main.Stdin): New message.
* tools/gnu/classpath/tools/jar/Main.java (initializeParser): Add
'-@' option.
(readNames): New method.
(run): Use it.
2007-01-26 Andrew Haley <aph@redhat.com> 2007-01-26 Andrew Haley <aph@redhat.com>
* java/lang/SecurityManager.java: Load and initialize * java/lang/SecurityManager.java: Load and initialize
...@@ -69,3 +69,4 @@ Main.FileNameGroup=File name selection ...@@ -69,3 +69,4 @@ Main.FileNameGroup=File name selection
Main.ChangeDir=change to directory before the next file Main.ChangeDir=change to directory before the next file
Main.ChangeDirArg=DIR FILE Main.ChangeDirArg=DIR FILE
Main.InternalError=jar: internal error: Main.InternalError=jar: internal error:
Main.Stdin=Read file names from stdin
/* Main.java - jar program main() /* Main.java - jar program main()
Copyright (C) 2006 Free Software Foundation, Inc. Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -45,7 +45,9 @@ import gnu.classpath.tools.getopt.OptionException; ...@@ -45,7 +45,9 @@ import gnu.classpath.tools.getopt.OptionException;
import gnu.classpath.tools.getopt.OptionGroup; import gnu.classpath.tools.getopt.OptionGroup;
import gnu.classpath.tools.getopt.Parser; import gnu.classpath.tools.getopt.Parser;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.InputStreamReader;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -232,11 +234,34 @@ public class Main ...@@ -232,11 +234,34 @@ public class Main
changedDirectory = argument; changedDirectory = argument;
} }
}); });
grp.add(new Option('@', Messages.getString("Main.Stdin"))
{
public void parsed(String argument) throws OptionException
{
readNamesFromStdin = true;
}
});
p.add(grp); p.add(grp);
return p; return p;
} }
private void readNames()
{
String line;
try
{
BufferedReader br
= new BufferedReader(new InputStreamReader(System.in));
while ((line = br.readLine()) != null)
entries.add(new Entry(new File(line)));
}
catch (IOException _)
{
// Ignore.
}
}
private void run(String[] args) private void run(String[] args)
throws InstantiationException, IllegalAccessException, IOException throws InstantiationException, IllegalAccessException, IOException
{ {
...@@ -245,6 +270,8 @@ public class Main ...@@ -245,6 +270,8 @@ public class Main
if (args.length > 0 && args[0].charAt(0) != '-') if (args.length > 0 && args[0].charAt(0) != '-')
args[0] = '-' + args[0]; args[0] = '-' + args[0];
p.parse(args, new HandleFile()); p.parse(args, new HandleFile());
if (readNamesFromStdin)
readNames();
Action t = (Action) operationMode.newInstance(); Action t = (Action) operationMode.newInstance();
t.run(this); t.run(this);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment