[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#66947: Why xdvi cannot handle .gz/.bz2 dvi files ?



At Sun, 9 Jul 2000 09:14:00 +0100,
Julian Gilbey <J.D.Gilbey@qmw.ac.uk> wrote:
> > Package: tetex-bin
> > Version: 1.0.6-7
> > Severity: wishlist
> > 
> > Why does current /usr/X11R6/bin/xdvi comment out below lines?
> > The former version of tetex-bin can handle .gz/.bz2 dvi files,
> > but current version cannot. Please fix to eliminate these
> > comment out suffix '#'.
> 
> Because it couldn't handle command-line options at the same time.

Thanks your responce.

Below patch avoids the problem?
Please test and apply.

--- xdvi.vannila        Tue Jul 11 00:18:43 2000
+++ xdvi        Tue Jul 11 00:18:15 2000
@@ -45,24 +45,40 @@
   XFILESEARCHPATH="$xdviapppath:${XFILESEARCHPATH-%D}"; export XFILESEARCHPATH
 fi
 
-exec xdvi.bin $NAMEOPT ${1+"$@"}
-#filename=${1+"$@"}
-#compress=0
-#tempfile=`tempfile -p tetex -s .dvi`
-#case "${filename}X" in
-#  *.gzX)
-#    gzip -d -c $filename > $tempfile
-#    compress=1
-#    ;;
-#  *.bz2X)
-#    bzip2 -d -c $filename > $tempfile
-#    compress=1
-#    ;;
-#esac
-#if test $compress = 1; then
-#    trap "rm -f $tempfile" 0 1 2 15
-#    filename=$tempfile
-#fi
-#
-#xdvi.bin $NAMEOPT $filename || exit 1
-#exit 0
+# exec xdvi.bin $NAMEOPT ${1+"$@"}
+files=${1+"$@"}
+compress=0
+tempfile=`tempfile -p tetex -s .dvi`
+for filename in $files; do
+    if [ -e $filename ]; then
+        case "${filename}X" in
+         *.gzX)
+           gzip -d -c $filename > $tempfile
+           compress=1
+           ;;
+         *.bz2X)
+           bzip2 -d -c $filename > $tempfile
+           compress=1
+           ;;
+       esac
+    fi
+done
+
+if [ $compress = 0 ]; then
+    filename=$files
+fi
+
+OPTION=
+if test $compress = 1; then
+    for tmp in $files; do
+        if [ $tmp != $filename ]; then
+           OPTION="$tmp $OPTION"
+       fi
+    done
+
+    trap "rm -f $tempfile" 0 1 2 15
+    filename=$tempfile
+fi
+
+xdvi.bin $NAMEOPT $OPTION $filename || exit 1
+exit 0



Reply to: