#! /bin/sh -e

# DP: gjar: support @ arguments.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
	uudecode $0
	tar -xv -f jar-main-classes.tar.bz2 -C ${dir}libjava
	rm -f jar-main-classes.tar.bz2*
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

From: Christian Thalinger <twisti@complang.tuwien.ac.at>

While building OpenJDK b16 I noticed that jar does not support @
arguments.  OpenJDK e.g. uses it to import the binary plug files.

This patch adds support for @filelist, where the file filelist may only
contain files and not options, as the spec says.

Index: libjava/classpath/tools/gnu/classpath/tools/jar/Main.java
===================================================================
RCS file: /cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/Main.java,v
retrieving revision 1.9
diff -u -3 -p -r1.9 Main.java
--- libjava/classpath/tools/gnu/classpath/tools/jar/Main.java     31 Jan 2007 17:05:34 -0000     1.9
+++ libjava/classpath/tools/gnu/classpath/tools/jar/Main.java     23 Jul 2007 18:31:19 -0000
@@ -47,6 +47,8 @@ import gnu.classpath.tools.getopt.Parser
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.InputStreamReader;
 import java.io.IOException;
 import java.text.MessageFormat;
@@ -102,14 +104,51 @@ public class Main
     public void notifyFile(String fileArgument)
     {
       Entry entry;
+
+      if (fileArgument.charAt(0) == '@')
+        {
+          BufferedReader br = null;
+          String filename;
+
+          try
+            {
+              br =
+                new BufferedReader(new FileReader(fileArgument.substring(1)));
+            }
+          catch (FileNotFoundException fnfe)
+            {
+              System.err.println(fnfe);
+              System.exit(1);
+            }
+
+          try
+            {
+              while ((filename = br.readLine()) != null)
+                addEntry(filename);
+            }
+          catch (IOException ioe)
+            {
+              ioe.printStackTrace();
+            }
+        }
+      else
+        {
+          addEntry(fileArgument);
+        }
+    }
+
+    private final void addEntry(String filename)
+    {
+      Entry entry;
+
       if (changedDirectory != null)
         {
-          entry = new Entry(new File(changedDirectory, fileArgument),
-                            fileArgument);
+          entry = new Entry(new File(changedDirectory, filename),
+                            filename);
           changedDirectory = null;
         }
       else
-        entry = new Entry(new File(fileArgument));
+        entry = new Entry(new File(filename));
       entries.add(entry);
     }
   }


begin-base64 644 jar-main-classes.tar.bz2
QlpoOTFBWSZTWW4Pr8QAFqP/////////////////////////////////////
////////4BOPr29evtt9a93vvsuw0a9lKAaOfcb1vZ9At3H0B99gLzH0+EA8
2AFAAVnBDJEBMhPRMkZlDI0Mo2ERp6jE8mjSD0EaDaU9GU/Sm2U0zSDT1MNJ
k0mBphNG1TxTGpvSaT0xGU02iYEbRoD1NBNqbQ0abU0NNNDJoeoyNtVBkiJp
kDIGk01NpNpqegniaJoanqeQnqaZNGmj1ANAwhoaGgAaMgAGTQyaaAMgNABo
ADQaAGQ0AGgDQAAAEIASamamIgNqZAADQDQDQDQAABoAAAADIAAAAAAAAAAA
AAAAAAAaAAAEhSKYqAfpQ9Q0aGgBoDTQBo9QAPUDTQAZABo0AeoaaAGgAAAA
NMgA0AAANAAAAAaAA0AAilKek2kKfkU/UHokPCJoek0AaABhMgyPU9R6gBo0
0AGgDQ0AMQBhDQADID1AAAAAABkAyaMJoAAAESiCZAgTCBpGaTCp7RP1Gqex
KepsaZU9TDSNP0pp6myIAMn6o2kZHptU0NNAPUGhtQDRoAANAaGgADQAAAAA
AAANORgXkIhhCi1SRyiIoJ2mm1Wt12x2sXO5wkZ8kLEfmiQoH/XjqQsgDANT
ZFNpCAbQFPZAlk3xj7KoxTNdac3Clvk4ClApjUVWEBqaOkwUmcJbpFrAK6kH
JVugdJN5bL/awNpwKg0UMv0kioqlgFCUlJVKVZlasWQNKiRZjxgsDK57Fz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