Ilya Zakharevich on Sat, 29 Jun 2002 09:56:57 -0400 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PATCH 2.2.3] gphelp |
On Sat, Jun 29, 2002 at 09:23:11AM -0400, Ilya Zakharevich wrote: > This patch: > > a) allows uninstalled operation of gp help system from TOPDIR or > TOPDIR/Oarch directories; > > b) Makes better error messages in the case of failure of TeXing; This patch was testing a "correctness" of a directory via a presence of userch3.tex; but this file may have been compressed. What follows tests for "translations", which has no variants. Sorry for the noise, Ilya *** ./doc/gphelp~ Sat Jun 22 19:05:34 2002 --- ./doc/gphelp Sat Jun 29 15:56:20 2002 *************** *** 46,53 **** $miscdir= "/usr/local/lib/pari"; # no expanded material (@key@) below $wwwsite= "http://www.parigp-home.de/"; ! $docdir = $ENV{GPDOCDIR} || $ENV{GPHELP_DOCDIR} || "$miscdir/doc"; $xdvi = $ENV{GPXDVI} || "xdvi"; $xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm"; $gzip = "gzip"; --- 46,69 ---- $miscdir= "/usr/local/lib/pari"; # no expanded material (@key@) below $wwwsite= "http://www.parigp-home.de/"; ! $docdir = $ENV{GPDOCDIR} || $ENV{GPHELP_DOCDIR}; + if (!defined $docdir) { + # work from TOPDIR/Oarch or TOPDIR too: may be uninstalled yet; + for ("$miscdir/doc", './doc', '../doc') { + if (-r "$_/translations") { + $docdir = $_; + last; + } + } + $docdir ||= "$miscdir/doc"; # Last resort + } + + if ($docdir =~ /^\./) { + require Cwd; + $docdir = Cwd::cwd() . "/$docdir"; + } + $xdvi = $ENV{GPXDVI} || "xdvi"; $xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm"; $gzip = "gzip"; *************** *** 363,373 **** sub posttex { ! print TEX "\\vfill\\eject\\bye"; close(TEX); chdir($tmpdir); ! system("tex $texfile.tex 2>/dev/null > /dev/null < /dev/null") == 0 ! || die "could not process $texfile.dvi" if (! -f "$texfile.dvi"); setsid; # detach from terminal (^C will not kill xdvi) system("($xdvi $texfile.dvi 2>/dev/null >/dev/null; rm -f $texfile.tex $texfile.dvi $texfile.log)&"); } --- 379,391 ---- sub posttex { ! print TEX "\\vfill\\eject\\bye"; ! close(TEX) || die "Error closing '$texfile.tex': $!"; chdir($tmpdir); ! $out = `tex $texfile.tex 2>&1 < /dev/null`; ! $? == 0 && -f "$texfile.dvi" ! || die "could not create '$texfile.dvi': status=$?, $out"; setsid; # detach from terminal (^C will not kill xdvi) system("($xdvi $texfile.dvi 2>/dev/null >/dev/null; rm -f $texfile.tex $texfile.dvi $texfile.log)&"); }