[daip] ZLASCL feature?

Patrick P. Murphy pmurphy at NRAO.EDU
Mon Oct 30 12:47:37 EST 2000


On Mon, 30 Oct 2000 16:24:17 +0100 (MET), "Lorant Sjouwerman, JIVE"
   <sjouwerm at jive.nl> said: 

> We have 15OCT99 and 31DEC99 versions of aips for Solaris and Linux.
> We found a feature that we cannot explain in $SYSUNIX/ZLASCL;
> (Line 183 - 188):
>             for i in `echo $PATH | sed -e 's/:/ /g'` ; do
>                [ -s $i/ghostview ] && gs=$i/ghostview && break
>                [ -s $i/gv ] && gs=$i/gs && break
>                [ -s $i/gs ] && gs=$i/gs && break
>                [ -s $i/ghostscript ] && gs=$i/gs && break
>             done

It's clear to me what my intent was, but I didn't quite get it right.

> First of all there is a typo in line 185: gs=$i/gs -> gs=$i/gv
>                                                 ^^          ^^ 

Right; about to be fixed, will come across in your next MNJ.

The code above was intended as a last-ditch effort to find an alternative
ONLY if the selected previewer (gv, ghostview, gs, ghostscript) was not
found in the PATH.  The test to check for this condition was missing.
I've now redone it:


         elif [ "$printer" = ghostscript -o "$printer" = gs -o \
                "$printer" = ghostview -o "$printer" = gv ] ; then
#                                    Look for ghostview or gs
            gs=""
            for i in `echo $PATH | sed -e 's/:/ /g'` ; do
               [ -s $i/$printer ] && gs=$i/$printer && break
            done
#                                       Failsafe, if not found
            if [ "$gs" = "" ] ; then
               echo "No $printer found in PATH, check for alternate..."
               for i in `echo $PATH | sed -e 's/:/ /g'` ; do
                  [ -s $i/ghostview ] && gs=$i/ghostview && break
                  [ -s $i/gv ] && gs=$i/gv && break
                  [ -s $i/gs ] && gs=$i/gs && break
                  [ -s $i/ghostscript ] && gs=$i/gs && break
               done
            fi
            if [ "$gs" = "" ] ; then
               echo "no $printer or alternate found in your PATH"
               echo ' - cannot preview; sorry!'
               exit 2
            else
               echo "Shedding $gs to view output..."
               ($gs $file &)
            fi
         fi

I've tested this under Linux and it seems to do the right thing.  We have
both ghostview and gv configured and I can get it to do these correctly.

> Furthermore, although Solaris behaves fine, it seems that Linux does not
> handle the 'break' properly (at least not when starting up with the default
> printer at start is PREVIEW) - we always got ghostscript no matter what
> $DA00/PRDEVS.LIST says as defenition, both in 15OCT99 and 31DEC99.

I wonder if this was an artefact not of Linux but of the fact that
ghostscript happened to appear first in your PATH?  If ghostscript is in
the same directory as the others (gv in particular), that blows away my
theory.  I'll do a few simple tests to see if I can figure out any
potential problem with the " [ test ] && foo && bar " sequence (done;
works for me under bash (1.14.7(1); yeah, I know...) and RH Linux 6.2 with
most possible permutations).

				- Pat



More information about the Daip mailing list