home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!elroy.jpl!poseur.JPL.NASA.GOV!earle
- From: earle@poseur.JPL.NASA.GOV
- Newsgroups: comp.windows.x
- Date: 18 Jul 92 16:30 MDT
- Subject: ANNOUNCEMENT: New version of X11-on
- Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
- Message-ID: <1992Jul18.123036.26328@elroy.jpl>
- Nf-ID: #N:1992Jul18.123036.26328@elroy.jpl:76191303:001:7165
- Nf-From: poseur.JPL.NASA.GOV!earle Jul 18 16:30:00 1992
- Lines: 186
-
-
- I have released a new version of my Perl ersatz "DocViewer" replacement
- for enabling the use of AnswerBook on X11-only servers. Version 2.0 now
- supports AnswerBook 2.0 SMCC Version A, the version of AnswerBook released in
- tandem with Solaris 2.0 SMCC Version A. This new version follows below.
- (It also lives on export.LCS.MIT.EDU in ~ftp/contrib/xdocviewer-2.0 with an
- accompaning README file.)
-
- What "xdocviewer-2.0" is:
- -------------------------
-
- xdocviewer 2.0 is a Perl script that can be named "docviewer" and put into your
- search $PATH ahead of the normal directory where the AnswerBook's version of
- "docviewer" lives. If this is done (it needs a small mod to your "answerbook"
- shell script to work properly; see below), this script will get invoked when
- the Navigator program goes to invoke the DocViewer to display the AnswerBook's
- PostScript HyperText documentation. This gets around the problem of using
- AnswerBook on non-OpenWindows servers, such as plain X11 or X terminals, as
- the script invokes a GhostScript previewer to display the document.
-
- What "xdocviewer-2.0" is NOT:
- -----------------------------
-
- This script is most emphatically not a replacement for the "real" DocViewer
- that comes with AnswerBook! It's a "crippled crutch" to merely allow you to
- use the Navigator and get a PostScript document up on your screen. You lose
- the HyperText capability right away, and every document you choose (or
- manually double-click on in the Navigator) results in a new GhostScript
- previewer process being run, as the Navigator and GhostScript previewers don't
- talk to one another. You also can't go past the end of a document (or, vice
- versa, go back before the start of one) and have the viewer automatically
- "know" how to get to the next document (or the previous document). Etc., etc.
-
- The problem of having the "real" DocViewer work on plain X11-only servers is
- being dealt with by the AnswerBook folks. In the meantime, try this out and
- see if it is useful to you. (I use it daily, as the AnswerBook is too useful
- a tool to not be able to use it, no matter how limited a fashion it may be.)
-
- Prerequisites to use xdocviewer-2.0:
- ------------------------------------
-
- - You need Perl (-: I use 4.0 pl 19; I suspect 4.0 pl 35 will work fine.
-
- - You need GhostScript. 2.4.1 is supported/preferred. aeneas.MIT.EDU has it.
-
- - You need a GhostScript previewer. GhostView 1.3 and GSpreview 2.1 are the
- supported previewers currently (those versions supply the "-page" option
- which is needed for this to work). Check on export or aeneas for these.
-
- - You need the XView shared libraries - libxview, libolgx - installed somewhere
- that's accessible, either /usr/lib or /usr/local/lib or someplace accessible
- via LD_LIBRARY_PATH. You can either build those libraries from the XView 3.0
- distribution with R5, or else nick them from your favorite local OpenWindows
- $OPENWINHOME/lib directory. The Navigator needs these shared libraries.
-
- - You need a BOOKINFO file (default /etc/bookinfo). With the AnswerBook 1.3
- release CD-ROM, you could create one by running the "answerbook_demo" script
- and hand-editting the /tmp/bookinfo file it emits. The Solaris 2.0 AB will
- create a temporary bookinfo file on the fly and use that; e.g.:
-
- poseur:2:1278 % head -2 /tmp/bookinfo*
- SUNWab_2_1:../../../../NonReloc_SUNWabook/_data:../../PostScriptDEST:../../PostScriptDEST/sr_index/SUNWab_2_1:Solaris 2.0 AnswerBook
- ABGTOUR:../../../../NonReloc_SUNWabook/_data:../../PostScriptDEST::Solaris 2.0 AnswerBook
-
- (These caveats are repeated in the comments in the script below.)
-
- Please address all bug reports/questions/comments to me:
-
- Enjoy,
-
- - Greg Earle
- Sun Microsystems, Inc. - Los Angeles
- JPL on-site Software Support Engineer
- earle@poseur.JPL.NASA.GOV, earle@Sun.COM
-
- ------------------------------ >8 Cut here 8< ------------------------------
- #!/usr/local/bin/perl
- #
- # @(#)docviewer.sh 2.0 92/07/17 SMI
-
- # Display AnswerBook document pages using ndbm database keys and data
-
- # If you don't have "perl", too bad. Go get it.
-
- # This is Version 1.0 (meaning, it's the first thing that I got to work)
-
- # Revision history:
- #
- # 1.0Alpha 92/06/06 Initial release. First thing I got to work
- # 1.0Beta 92/06/07 Changed several things thanks to Wayne Thompson
- # All changes due to my own Perl brain-death
- # 1.0 92/06/08 BOOKINFO and GSVIEWER now have default values
- # 2.0 92/07/17 Fixed bugs that showed up when attempting to
- # use with Solaris 2.0 AnswerBook 2.0 - things
- # were not quite as they seemed. Code is now
- # more general and supports AB 2.0
- #
- # Requirements:
-
- # Needs the XView libraries installed (libxview.s[oa].3.x and libolgx.s[oa].3.x)
- # somewhere reachable, either in /usr/lib or /usr/local/lib or in your X11 R[45]
- # lib directory or ... etc. - if the latter, e.g. $OPENWINHOME/lib, you'll
- # probably have to set the LD_LIBRARY_PATH variable to point to that directory
- # in order to pick the libraries up. Otherwise, the Navigator program won't
- # come up.
-
- # Needs BOOKINFO set (default is /etc/bookinfo) either in the environment or in
- # the "answerbook" script so it can find where the AnswerBook data files are
-
- # Needs a new environment variable named GSVIEWER set to your preferred
- # GhostScript previewer that's available in your $PATH - common choices are
- # "ghostview" (requires version 1.3 to work!) or "gspreview" (requires 2.1)
- # Default is "gspreview" (I flipped a coin (-: )
-
- # Warning: normal "answerbook" script puts DocViewer directory at the front of
- # the search path, so to get this version first, I recommend changing it; e.g.:
- #
- # *** /cdrom/AnswerBook1.3/answerbook Thu Dec 19 11:06:28 1991
- # --- /usr/local/bin/answerbook Sat Jun 6 04:20:29 1992
- # ***************
- # *** 49,53 ****
- # echo $PATH | fgrep -s "$dvbin" ||
- # {
- # ! PATH="$dvbin:$PATH"
- # }
- #
- # --- 60,65 ----
- # echo $PATH | fgrep -s "$dvbin" ||
- # {
- # ! # PATH="$dvbin:$PATH"
- # ! PATH="$PATH:$dvbin"
- # }
-
- sub getbookinfo {
-
- $ENV{'BOOKINFO'} = $ENV{'BOOKINFO'} || "/etc/bookinfo";
-
- open(BOOKINFO, $ENV{'BOOKINFO'}) || die "Can't open bookinfo file!\n";
-
- while (<BOOKINFO>) {
- ($db, $dbpathhead, $pspathhead) = split(/:/);
- if ($db eq $dbname) {
- return $dbpathhead;
- }
- }
- close(BOOKINFO);
- }
-
- $ENV{'GSVIEWER'} = $ENV{'GSVIEWER'} || "gspreview";
-
- # Kill off any running ghostview/gspreview/whatever processes
-
- open(PS, "/bin/ps -xc 2>&1 |");
- while (<PS>) {
- if (/$ENV{'GSVIEWER'}/) {
- split(' ');
- push(@pids, $_[0]);
- }
- }
- close(PS);
- $nkilled = kill("SIGTERM", @pids);
-
- ($dbname) = ((join($",@ARGV)) =~ /^.*<(\S+)>/);
- ($dbtoken) = (join('', '<', $dbname, '>', ((join($",@ARGV)) =~ /^.*>(\S+)/)));
-
- $dbhead = &getbookinfo();
-
- $dbpath = "$dbhead/$dbname";
- $pspath = "$pspathhead/$dbname";
-
- dbmopen(ABDB, $dbpath, undef) || die "can't dbmopen AnswerBook database";
-
- while (($key, $val) = each %ABDB) {
- local ($data, $datum);
-
- $datum = unpack('@8A*', $key);
- @data = split(/:/, $val);
-
- $page = @data[$#data];
- $doc = @data[$#data-1];
- last if (($datum eq $ARGV[$#ARGV]) || ($datum eq $dbtoken));
- }
-
- dbmclose(ABDB);
- exec($ENV{GSVIEWER}, '-page', $page, "$pspath/$doc");
-
-