Ilya Zakharevich on Sat, 29 Jun 2002 09:23:11 -0400


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

[PATCH 2.2.3] gphelp


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;

*** ./doc/gphelp~	Sat Jun 22 19:05:34 2002
--- ./doc/gphelp	Sat Jun 29 15:17:42 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 "$_/usersch3.tex") {
+       $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)&");
  }