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

Bug#173422: xdvi: sh wrapper and long options



Package: tetex-bin
Version: 1.0.7+20011202-7.1
Severity: normal

hi

$ xdvi -editor 'xdvi-emacs-editor +%l %f' file.dvi

fails because the shell wrapper does not deal correctly  with 
parameters that have spaces into them

a.

btw: if you want to see it, , I attach xdvi-emacs-editor

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux tonelli 2.4.19-k7 #1 Sun Oct 6 20:29:56 EST 2002 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages tetex-bin depends on:
ii  debianutils           1.16               Miscellaneous utilities specific t
ii  dpkg                  1.9.21             Package maintenance system for Deb
ii  ed                    0.2-19             The classic unix line editor
ii  libc6                 2.2.5-14.3         GNU C Library: Shared libraries an
ii  libkpathsea3          1.0.7+20011202-7.1 shared libkpathsea for teTeX
ii  libpng2               1.0.12-3.woody.2   PNG library - runtime
ii  libstdc++2.10-glibc2. 1:2.95.4-11woody1  The GNU stdc++ library
ii  libtiff3g             3.5.5-6            Tag Image File Format library
ii  libxaw7               4.1.0-16           X Athena widget set library
ii  tetex-base            1.0.2+20011202-2   basic teTeX library files
ii  xlibs                 4.1.0-16           X Window System client libraries
ii  zlib1g                1:1.1.4-1          compression library - runtime

-- 
Andrea Mennucc
 "E' un mondo difficile. Che vita intensa!" (Tonino Carotone)
#!/bin/sh


ba=`basename $0`

if which $ba > /dev/null 2> /dev/null ; then
 ex="$ba"
else
 ex="$0"
fi

if [ "$1" == "-h" -o "$1" == "--help" -o "$1" == "" ] ; then
cat<<EOF
 $ba
  Copyright A. Mennucci 2002 . License GPL
 Description:
  This script links xdvi and emacs. It is more user-friendly than
  using emacsclient (see the man page of xdvi, where it describes -editor )

  Usage:
   Start emacs and load the gnuserv into it, by issuing 
     <M-x> gnuserv-start <return>
   Start xdvi as follows
EOF
 if grep -iq xdvi.editor /usr/share/texmf/xdvi/XDvi || \
  xrdb -q  | grep -iq xdvi.editor ; then 
  echo "   xdvi -editor $ex  file.dvi"
 elif [ "$BASH" ] ; then
  echo "   XEDITOR='$ex +%l %f' xdvi   file.dvi"
 else
  echo "   xdvi -editor $ex  file.dvi"
 fi
 echo
 echo "   Hit ctrl-right-mouse-button in the xdvi window, and enjoy emacs editing."
exit
fi

debug=''

xwarn () {
  if [ -x /usr/bin/X11/xmessage ] ; then
   /usr/bin/X11/xmessage "$ba: $1"
  else
   echo "$ba: $1" 2>&1
  fi
}


 [ $debug ] && xwarn "args $* "

 linenum="$1"

 filename="$2"


 case "$filename" in
        /*)  ;;
        *) filename=`pwd`/$filename ;;
 esac

 [ $debug ] &&  xwarn " going to file ${filename} line $linenum ..."


if [ ! -w /tmp/gsrvdir`id -u`/gsrv ] ; then
   xwarn 'It seems that you did not start the gnuserv inside emacs.
 You should load it by issuing 
 <M-x> gnuserv-start <return>'
   exit 
fi

if [ -r "$filename" ] ; then
  #gnudoit '(switch-to-buffer "'${filename}'")' &&\

  { gnudoit '(find-file "'${filename}'")' > /dev/null && \
  { gnudoit "(goto-line $linenum)" > /dev/null ; } && \
    { gnudoit "(raise-frame)" > /dev/null ; } ; } || \
  xwarn 'It seems that the gnuserv is malfunctioning (did you restart emacs?).
 You should reload it by issuing 
 <M-x> gnuserv-start <return>'
 
 
else
  xwarn "file $filename unreadable"
  
fi

 #for b in galeon mozilla netscape ; do
  #  #[ -x /usr/bin/$b ] &&   exec /usr/bin/$b "$1"
  #done
 

Reply to: