texlive/texlive-texdoc.patch

217 lines
7.3 KiB
Diff
Raw Normal View History

2007-12-02 08:03:19 +00:00
diff -up texlive-2007/texk/tetex/texdoc.texdoc texlive-2007/texk/tetex/texdoc
--- texlive-2007/texk/tetex/texdoc.texdoc 2006-01-17 22:41:51.000000000 +0100
+++ texlive-2007/texk/tetex/texdoc 2008-08-27 13:35:33.000000000 +0200
2007-12-02 08:03:19 +00:00
@@ -17,6 +17,15 @@
#
# Support for compressed documentation implemented by adopting changes
# made by debian. Thomas Esser, Dec. 2004.
+#
+# Debian specific changes:
+# Denis Barbier <barbier@imacs.polytechnique.fr>, Feb 15 2000
+# * accept gzipped files on input
+# * temporary directory set according to TMPDIR
+#
+# Frank K<>ster <frank@debian.org>, 2004-11-23
+# * do not uncompress dvi.gz, xdvi can handle this
+# * go to background with uncompressed files
test -f /bin/sh5 && test -z "$RUNNING_SH5" \
&& { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
@@ -30,22 +39,22 @@ unset RUNNING_BSH
export PATH
-needsCleanup=false
+# needsCleanup=false
progname=texdoc
-tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/$progname.$$
+# tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/$progname.$$
###############################################################################
# setupTmpDir()
# set up a temp directory and a trap to remove it
###############################################################################
-setupTmpDir()
-{
- $needsCleanup && return
+# setupTmpDir()
+# {
+# $needsCleanup && return
- trap 'cleanup --force' 1 2 3 7 13 15
- needsCleanup=true
- mkdir "$tmpdir" || abort "could not create directory \`$tmpdir'"
-}
+# trap 'cleanup --force' 1 2 3 7 13 15
+# needsCleanup=true
+# mkdir "$tmpdir" || abort "could not create directory \`$tmpdir'"
+# }
###############################################################################
# abort(errmsg)
@@ -65,15 +74,21 @@ abort()
###############################################################################
cleanup()
{
- case $1 in
- --force)
- $needsCleanup && test -n "$tmpdir" && test -d "$tmpdir" \
- && { rm -f "$tmpdir"/*; cd /; rmdir "$tmpdir"; }
- ;;
- *) # directory might not be empty if some other viewer is still
- # running, so be quiet about it
- rmdir $tmpdir >/dev/null 2>&1;;
- esac
+# case $1 in
+# --force)
+# $needsCleanup && test -n "$tmpdir" && test -d "$tmpdir" \
+# && { rm -f "$tmpdir"/*; cd /; rmdir "$tmpdir"; }
+# ;;
+# *) # directory might not be empty if some other viewer is still
+# # running, so be quiet about it
+# rmdir $tmpdir >/dev/null 2>&1;;
+# esac
+ # is the temporary directory empty? If not, texdoc was called with
+ # two or more arguments, and one viewer is still running
+ if test "`echo $tmpdir/*`" = $tmpdir/'*'
+ then
+ rm -rf $tmpdir
+ fi
}
@@ -91,13 +106,12 @@ case `(uname -s) 2>/dev/null` in
extlist='.pdf .ps .txt .dvi .html'
2007-12-02 08:03:19 +00:00
;;
*)
- : ${TEXDOCVIEW_dvi='(xdvi %s) &'}
2007-12-02 08:03:19 +00:00
- : ${TEXDOCVIEW_pdf='(acroread %s) &'}
- : ${TEXDOCVIEW_ps='(gv %s) &'}
- : ${TEXDOCVIEW_html='mozilla -remote openURL'"'(%s)'"' 2>/dev/null || mozilla %s &'}
- : ${TEXDOCVIEW_txt="${PAGER-more} %s"}
- : ${TEXDOCVIEW_="${PAGER-more} %s"} # no extension, default to pager
- extlist='.dvi .dvi.gz .dvi.bz2 .pdf .pdf.gz .pdf.bz2 .ps .ps.gz .ps.bz2 .txt .txt.gz .txt.bz2 .html'
+ : ${TEXDOCVIEW_dvi='(xdg-open %s) &'}
2007-12-02 08:03:19 +00:00
+ : ${TEXDOCVIEW_pdf='(xdg-open %s) &'}
+ : ${TEXDOCVIEW_ps='(xdg-open %s) &'}
+ : ${TEXDOCVIEW_html='(xdg-open %s) &'}
+ : ${TEXDOCVIEW_txt='(xdg-open %s) &'}
+ : ${TEXDOCVIEW_='(xdg-open %s) &'}
# Commands run to uncompress files, according to filename extension.
: ${TEXDOCUNZIP_gz='gzip -d -c'}
@@ -105,6 +119,10 @@ case `(uname -s) 2>/dev/null` in
;;
esac
+extlist=`kpsewhich --expand-brace='$TEXDOCEXT' | tr ':' ' '`
+test -z "$extlist" && \
+extlist='.dvi .dvi.gz .dvi.bz2 .pdf .pdf.gz .pdf.bz2 .ps .ps.gz .ps.bz2 .txt .txt.gz .txt.bz2 .html'
+
mode=viewer
help='Usage: texdoc [OPTION]... [NAME]...
Search for NAME in the TeX documentation and start a viewer.
@@ -136,11 +154,14 @@ case $# in
;;
esac
+tmpdir=`mktemp -d -t texdoc.XXXXXXXX`
+trap 'rc=$?; cleanup; exit $rc' 1 2 6 13 15
+
for name
do
case $mode in
search)
- find `kpsewhich --expand-path='$TEXMF/doc' | tr : ' '` -type f -print |
+ find `kpsewhich --expand-path='$TEXDOCS' | tr : ' '` -follow -type f -print |
egrep $name
continue
;;
@@ -153,7 +174,6 @@ do
found=false
for ext in "" $extlist; do
-
filename=`kpsewhich -format='TeX system documentation' $name$ext 2>/dev/null`
test -z "$filename" && continue
found=true
@@ -177,7 +197,6 @@ do
# than once
test -f "$tmpdir/$src" && break
- setupTmpDir
eval "$uncompress $filename > $tmpdir/$src"
filename=$tmpdir/$src
viewer=`eval echo $viewer | sed -e "s|%s|$filename; rm -f $filename; cleanup|"`
diff -up texlive-2007/texk/tetex/texdoc.man.texdoc texlive-2007/texk/tetex/texdoc.man
--- texlive-2007/texk/tetex/texdoc.man.texdoc 2008-08-27 13:35:29.000000000 +0200
+++ texlive-2007/texk/tetex/texdoc.man 2008-08-27 13:35:33.000000000 +0200
@@ -28,28 +28,37 @@ distribution\&.
.PP
.SH "OPTIONS"
.PP
-.IP "\fB--help\fP"
+.IP "\fB\-\-help\fP"
Display a brief summary of options\&.
.IP
-.IP "\fB-l\fP"
+.IP "\fB\-l\fP"
List matching files\&. Does not start a viewer\&.
-.IP "\fB-v\fP"
+.PP
+.IP "\fB\-s\fP"
+Search the disk. From all documentation files found by texdoc, the
+ones whose names match the remaining arguments (as egrep pattern) will
+be displayed.
+.IP "\fB\-v\fP"
Sets verbose mode\&. Shows the command being used to
display the documentation\&.
.PP
.SH "ENVIRONMENT"
.PP
.IP "\fB$TEXDOCVIEW_dvi\fP"
-DVI viewer\&. Defaults to \fBxdvi\fP(1)\&.
+DVI viewer\&. The default is to use the program specified
+by the freedesktop standard\&.
.IP "\fB$TEXDOCVIEW_pdf\fP"
-PDF viewer\&. Defaults to \fBacroread\fP(1)\&.
+PDF viewer\&. The default is to use the program specified
+by the freedesktop standard\&.
.IP "\fB$TEXDOCVIEW_ps\fP"
-PostScript viewer\&. Defaults to
-\fBghostview\fP(1)\&.
+PostScript viewer\&. The default is to use the program specified
+by the freedesktop standard\&.
.IP "\fB$TEXDOCVIEW_html\fP"
-HTML viewer\&. Defaults to \fBnetscape\fP(1)\&.
+HTML viewer\&. The default is to use a program through
+\fBxdg-open\fP\&.
.IP "\fB$TEXDOCVIEW_txt\fP"
-Text viewer\&. Defaults to \fB$PAGER-more\fP\&.
+Text viewer\&. Defaults is to use the program specified
+by the freedesktop standard\&.
.PP
The environment variables should be set with a ``%s\&'\&' as a placeholder
for the name of the file\&. For example,
@@ -66,10 +75,18 @@ hostname$ TEXDOCVIEW_html="mozilla %s"
hostname$ export TEXDOCVIEW_html
.EE
.PP
+.SH "SPECIFIC TO DEBIAN AND FEDORA"
+.PP
+The Debian and Fedora TeX Live packages texdoc use the mime-support package to determine
+the appropriate viewer for the respective file type except for
+\fIdvi\fP. texdoc of Debian and Fedora is able to handle gzip- and
+bzip2-compressed files. If texdoc finds more than on file for a string
+the first hit is displayed. The file extensions are regarded and the
+search order can be configured in \fItexmf.cnf\fP (\fI90TeXDoc.cnf\fP).
+.PP
.SH "SEE ALSO"
.PP
-\fBacroread\fP(1), \fBgv\fP(1), \fBkpsewhich\fP(1),
-\fBless\fP(1), \fBmore\fP(1), \fBxdvi\fP(1)
+\fBxdg-open\fP(1)
.PP
Web page: <http://tug\&.org/texlive/>
.PP