[daip] Remaining problem with AIPS (31DEC99) Install

Sally Laurent-Muehleisen slauren at igpp.ucllnl.org
Mon Oct 23 18:54:57 EDT 2000


Hello,

	I wrote about 1 month ago reporting a problem with printing from my
linux-installed 31DEC99 AIPS.  I have now (nearly) successfully installed
31DEC99 on a solaris system, but have the same problem with printing.  I get the
error:

>go prtmsg
AIPS 1: ZLPOPN: printer file = /tmp/ZLPOPN.a17644
/first/lintilla1/AIPS99/31DEC99/SYSTEM/UNIX/ZLPCL2: syntax error at line 73: `(' unexpected
ZLPCL2: Illegal seek
AIPS 1: ZLPCL2: ignoring error 29 from pclose()
AIPS 1: a child process will delete /tmp/ZLPOPN.a17644 in 600 seconds
AIPS 1: User 2000:   547 messages, oldest written 23-OCT-2000  09:36:53
AIPS 1: Printed    546 messages


You previously asked for my $SYSUNIX/ZLPCL2 (and ZLASCL) files.  I will attach
them below.

				-Sally Laurent-Muehleisen


#!/bin/sh
#-----------------------------------------------------------------------
#;  Copyright (C) 1995-2000
#;  Associated Universities, Inc. Washington DC, USA.
#;
#;  This program is free software; you can redistribute it and/or
#;  modify it under the terms of the GNU General Public License as
#;  published by the Free Software Foundation; either version 2 of
#;  the License, or (at your option) any later version.
#;
#;  This program is distributed in the hope that it will be useful,
#;  but WITHOUT ANY WARRANTY; without even the implied warranty of
#;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#;  GNU General Public License for more details.
#;
#;  You should have received a copy of the GNU General Public
#;  License along with this program; if not, write to the Free
#;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
#;  MA 02139, USA.
#;
#;  Correspondence concerning AIPS should be addressed as follows:
#;         Internet email: aipsmail at nrao.edu.
#;         Postal address: AIPS Project Office
#;                         National Radio Astronomy Observatory
#;                         520 Edgemont Road
#;                         Charlottesville, VA 22903-2475 USA
#-----------------------------------------------------------------------
# Usage: ZLPCL2 file page_length
#-----------------------------------------------------------------------
# This script prints a file on the selected printer.  The first argument
# is the filename to be printed, the second is the page length from
# AIPS.  The latter is only used for PostScript or plain text printers.
#
# When AIPS opens the "line printer", it creates a temporary file such
# as /tmp/ZLPCL2.XXXXXX where XXXXXX is a unique extension.  When
# closed, ZLPCL2.C runs this script via a unix pipe.  The printer output
# contains Fortran carriage control characters in the first column
# which are processed by one of the AIPS-supplied filters (F2PS for
# direct PostScript output and F2TEXT for plain text or QUIC).  As these
# filters are normally compiled automatically at install time, no
# customization should be needed in this script for plain text or
# PostScript printers, other than for the F2PS and F2TEXT options
# indicated in the comments below.
#-----------------------------------------------------------------------
#                                       Filter plain text to postscript
#                                       Pass the no. of lines to the
#                                       filter and let it decide the
#                                       orientation/font based on that.
#                                       no. lines set via RUN SETPAR.
size="97"
[ "$2" != "" ] && size=$2
#                                       Uncomment for US A size
psfilter="$SYSLOCAL/F2PS -$size
#                                       Uncomment for Euro/Aussie A4...
# psfilter="$SYSLOCAL/F2PS -A4 -$size"
#                                       Plain text filter
filter=$SYSLOCAL/F2TEXT
#                                       Uncomment for extra form feed at
#                                       the end of each print job.
#filter="$SYSLOCAL/F2TEXT -e"
#                                       Only other customization needed
#                                       is QUIC setup/termination, and
#                                       only for QMS/Talaris printers
#-----------------------------------------------------------------------
#                                       Clean up on signals 1, 2, 3
#                                       and 15.
trap 'rm -f $file.$$ /tmp/ZLPCL2.$$; exit 1' 1 2 3 15
#                                       initialization
printed=false
file=$1
#                                       Check for sanity
if [ "$LPDEV" = "" ] ; then
   echo "No printer (LPDEV) chosen, cannot print anything!"
   exit 1
fi
if [ ! -f $file ] ; then
   echo "Cannot find $file, so I cannot print anything.  So sorry."
   exit 1
fi
#                                       Get printer information
printer="$LPNAM"
printype="$PRTYPE"
printext="$LPDESC"
printopt="$LPOPT"
case $LPNAM in
   /dev/null|NULL|null|NONE|none)
   echo "null printer ($LPNAM: $LPDESC)"
   echo "I hope you really meant this to be deleted!"
   exit 0
;;
esac
#                                       Print and status commands
#                                       Is this SYSV or Berkeley?
printcmd=""
chcmd=""
case $ARCH in
   SUN*|IBM|*LINUX*|ALPHA|ULTRIX|*BSD)
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lpr ] ; then
#                                       -h means no header
#                                       -s means make a symlink
#                                       -P is for specifying printer
            printcmd="lpr -h -s -P"
            break
         fi
      done
      if [ "$printcmd" = "" ] ; then
         echo "Cannot find lpr in the search PATH; nothing printed"
         echo "On architecture $ARCH, $SYSUNIX/ZLPCL2 expects lpr!"
         echo "(PATH is $PATH)"
         exit 1
      fi
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lpq ] ; then
#                                       -P is for specifying printer
	    chcmd="lpq -P"
	    break
         fi
      done
      ;;
   SOL*|SUL|SGI|HP|HP2)
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lp ] ; then
#                                       -d is for specifying printer
            printcmd="lp -d"
            break
         fi
      done
      if [ "$printcmd" = "" ] ; then
         echo "Cannot find lp in the search PATH; nothing printed"
         echo "On architecture $ARCH, $SYSUNIX/ZLASCL expects lp!"
         echo "(PATH is $PATH)"
         exit 1
      fi
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lpstat ] ; then
            chcmd="lpstat "
#                                       Common Unix Printing System
            if [ "$CUPS_SERVER" != "" ] ; then
               chcmd="lpstat -p"
            fi
            break
         fi
      done
      ;;
   *)
      echo "$SYSUNIX/ZLPCL2 does not know"
      echo "about your architecture ($ARCH); please fix it"
      ;;

esac
#                                       Check for oversize print jobs
bb=""
if [ "$BIGPRINT" != "" ] ; then
   if [ \( $BIGPRINT -lt 1 \) -o \
        \( $BIGPRINT -gt $LPDEVS \) ] ; then
      echo "The 'big' printer number ($BIGPRINT) is out of range."
      echo "This should not happen; please notify the AIPS manager."
      BIGPRINT=$LPDEV
   fi
   BIGTHRESH=${BIGTHRESH-1000}
   nlines=`cat $file | wc -l`
   if [ $nlines -gt $BIGTHRESH ] ; then
#                                       See if BIGPRINT is chosen anyway
      if [ $BIGPRINT -ne $LPDEV ] ; then
	 echo "Your job is $nlines lines, more than $BIGTHRESH"
         echo "This is TOO BIG for the $printext!"
         bb=" >>"
#                                       Need to get revised parameters
#                                       for big printer.  In 15jul94+
#                                       scheme, these won't be defined
#                                       so we need to set them.
	 printer="\$LPDEV$BIGPRINT"
	 printer=`eval echo $printer`
         if [ "$printer" = "" ] ; then
            LPDEV=$BIGPRINT; export LPDEV
            lpfile=$AIPS_ROOT/PRDEVS.SH
            [ ! -f $lpfile ] && lpfile=$SYSUNIX/PRDEVS.SH
            . $lpfile
            printer="\$LPDEV$LPDEV"
	    printer=`eval echo $printer`
 	    printype="\$LPTYPE$LPDEV"
            printype=`eval echo $printype`
            printext="\$LPDESC$LPDEV"
            printext="`eval echo $printext` instead"
         else
#                                       Backwards compatibility
	    printype="\$LPTYPE$BIGPRINT"
            printype=`eval echo $printype`
            printext="\$LPDESC$BIGPRINT"
            printext="`eval echo $printext` instead"
         fi
      fi
   fi
fi
#                                       Special stuff for CV
if [ "$SITE" = NRAOCV -a "$LPDEV" = "$BIGPRINT" ] ; then
   cvlog=/AIPS/BIGPRINT.LOG
   if [ -f $cvlog ] ; then
      echo "$bb `date` $file `cat $file | wc -l`" >>$cvlog 2>/dev/null
   fi
fi
if [ $printype = PS -o $printype = "PS-CMYK" ] ; then
#                                       Postscript printer, need filter
   case $printopt in
      *DUP*) psfilter="$psfilter -d" ;;
   esac
   cat $file | $psfilter | $printcmd$printer
   printed=true
elif [ $printype = QMS ] ; then
#                                       QMS/Talaris/QUIC printer.
#                                       Prepend a QUIC header, postpend
#                                       trailer, pipe thru F2TEXT filter
#                                       IGNORES LINES PER PAGE!  One
#                                       could modify this code to change
#                                       the QUIC commands but one would
#                                       need a QUIC printer to test it!
   tmpfil=$file.$$
   echo "^PY^-" >$tmpfil
   echo "^F^ISYNTAX00000^G" >>$tmpfil
   echo "^IOL^G^IS00010^G^IC0000^G^IL0880^G" >>$tmpfil
   echo "^IMH0050010500^G^IMV0050008000^G^O^-" >>$tmpfil
   echo "^PN^-" >>$tmpfil
   cat $file | $filter >>$tmpfil
   echo "^PY^-" >>$tmpfil
   echo "^F^IGE^G^IWE^G^IP0000^G^ISYNTAX00000^G" >>$tmpfil
   echo "^IOL^G^ISTF00^G^IS00010^G^IC0000^G^IL0880^G" >>$tmpfil
   echo "^IMH0050010500^G^IMV0050008000^G^O^-" >>$tmpfil
   echo "^PN^-" >>$tmpfil
   rm -f $file; mv $tmpfil $file
   cat $file | $printcmd$printer
   printed=true
elif [ $printype = TEXT ] ; then
#                                       Plain text printer.
   cat $file | $filter -$2 | $printcmd$printer
   printed=true
elif [ \( $printype = PREVIEW \) -o \
       \( $printype = REMOTE \) ] ; then
#                                       Allow tricks like printing to a
#                                       remote printer, etc. for shell
#                                       script hackers/wizards.  Note
#                                       the "-" after the command.
   OLDIFS=$IFS
   IFS=$IFS:
   found=no
   for i in $PATH ; do
      [ -f $i/$printer ] && found=yes && break
   done
   IFS=$OLDIFS
   if [ $found = no ] ; then
      echo "Cannot find program $printer in your PATH"
      echo "so nothing will be printed"
   else
      echo "Running program $printer on output..."
      cat $file | $psfilter | $printer
#                                       Use this if not a PS printer
#     cat $file | $printer
      printed=true
   fi
   stat=$?
   if [ $stat -ne 0 ] ; then
      echo "Tried to send PostScript to $cmd thus:"
      echo " "
      echo "      cat $file | $psfilter -$2 | $cmd -"
      echo " "
      echo "but it failed with status $stat for some reason.  Sorry!"
      exit $stat
   fi
else
   echo "Unknown printer type $printype on the $printext"
   echo "(ZLPCL2 doesn't know what to do for that type of printer)"
   exit 1
fi
#                                       See if it got printed
if [ "$printed" = true ] ; then
   echo "Messages sent to the $printext"
   [ "$chcmd" != "" ] && $chcmd$printer
fi
exit 0


#!/bin/sh
#-----------------------------------------------------------------------
#;  Copyright (C) 1995-2000
#;  Associated Universities, Inc. Washington DC, USA.
#;
#;  This program is free software; you can redistribute it and/or
#;  modify it under the terms of the GNU General Public License as
#;  published by the Free Software Foundation; either version 2 of
#;  the License, or (at your option) any later version.
#;
#;  This program is distributed in the hope that it will be useful,
#;  but WITHOUT ANY WARRANTY; without even the implied warranty of
#;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#;  GNU General Public License for more details.
#;
#;  You should have received a copy of the GNU General Public
#;  License along with this program; if not, write to the Free
#;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
#;  MA 02139, USA.
#;
#;  Correspondence concerning AIPS should be addressed as follows:
#;         Internet email: aipsmail at nrao.edu.
#;         Postal address: AIPS Project Office
#;                         National Radio Astronomy Observatory
#;                         520 Edgemont Road
#;                         Charlottesville, VA 22903-2475 USA
#-----------------------------------------------------------------------
# Usage: ZLASCL file [file ...]
#-----------------------------------------------------------------------
# This script prints a file on the selected printer.  The first argument
# is the filename to be printed, the second is the page length from
# AIPS.  The latter is only used for PostScript printers.
#
# When AIPS opens the "plotter", it creates a temporary file such as
# /tmp/ZLASC2.XXXXXX where XXXXXX is a unique extension.  When closed,
# ZLASC2.C runs this script via a unix pipe.
#
# This script parses the first line of the file to be printed, and sends
# the file either to a Postscript printer or a QMS printer depending on
# what was found.  It also knows about color postscript.  Printer
# information is set in the $NET0/PRDEVS.LIST file and is defined only
# via the $SYSUNIX/PRDEVS.SH shell script; it will either define the
# device name, type and description for a specific printer or for all.
# ----------------------------------------------------------------------
#                                       Clean up signals 1 2 3 and 15.
#                                       $PLOTTER not used for now...
trap 'rm -f $PLOTTER/ZLWIO.$$ $PLOTTER/ZLASIO.$$; exit 1' 1 2 3 15
#                                       initialization
printed=false
#                                       Check for sanity
if [ ${LPDEV-.} = . ] ; then
  echo "no printer (LPDEV) chosen, cannot print anything"
  exit 1
fi
#                                       Get printer information
#                                       Revised and simplified scheme
printer="$LPNAM"
printype="$PRTYPE"
printext="$LPDESC"
#                                       Not yet used here...
printopt="$LPOPT"
#                                       Print and status commands
#                                       Is this SYSV or Berkeley?
printcmd=""
case $LPNAM in
   /dev/null|NULL|null|NONE|none)
   echo "null printer ($LPNAM: $LPDESC)"
   echo "I hope you really meant this to be deleted!"
   exit 0
;;
esac
chcmd=""
case $ARCH in
   SUN*|IBM|*LINUX*|ALPHA|ULTRIX|FREEBSD)
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lpr ] ; then
#                                       -h means no header
#                                       -s means make a symlink
#                                       -P is for specifying printer
            printcmd="lpr -h -s -P"
            break
         fi
      done
      if [ "$printcmd" = "" ] ; then
         echo "Cannot find lpr in the search PATH; nothing printed"
         echo "On architecture $ARCH, $SYSUNIX/ZLASCL expects lpr!"
         echo "(PATH is $PATH)"
         exit 1
      fi
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lpq ] ; then
#                                       -P is for specifying printer
            chcmd="lpq -P"
            break
         fi
      done
      ;;
   SOL*|SUL|SGI|HP|HP2)
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lp ] ; then
#                                       -d is for specifying printer
            printcmd="lp -d"
            break
         fi
      done
      if [ "$printcmd" = "" ] ; then
         echo "Cannot find lp in the search PATH; nothing printed"
         echo "On architecture $ARCH, $SYSUNIX/ZLASCL expects lp!"
         echo "(PATH is $PATH)"
         exit 1
      fi
      for i in `echo $PATH | sed -e 's#:# #g'` ; do
         if [ -f $i/lpstat ] ; then
            chcmd="lpstat "
#                                       Common Unix Printing System
            if [ "$CUPS_SERVER" != "" ] ; then
               chcmd="lpstat -p"
            fi
            break
         fi
      done
      ;;
   *)
      echo "$SYSUNIX/ZLASCL does not know"
      echo "about your architecture ($ARCH); please fix it"
      ;;
esac
#                                       For each file, check its type
nfiles=0
for file in $* ; do
#
   if [ ! -f $file ] ; then
      echo "Cannot find $file, so I cannot print anything.  So sorry."
      continue
   fi
   firstline=`head -1 $file`
   case $firstline in
#                                       PostScript, check for CMYK
      %!*)
#                                       This round-about test is needed
#                                       to cope with a particularly
#                                       nasty IBM bug which loses the
#                                       status returned by a program
#                                       invoked by a shell script that
#                                       is in turn invoked from a
#                                       FORTRAN 77 program.  Still?
         count=`grep '^%%Extensions:' $file | grep 'CMYK' | wc -l`
         if [ $count = 0 ] ; then
            filetype="PS"
         else
            filetype="PS-CMYK"
         fi
         ;;
#                                       QUIC, so assume QMS or TALARIS
      \^PY\^*)
         filetype="QMS"
         ;;
      *)
#                                       Should NEVER happen!
         filetype="TEXT"
         ;;
   esac
#                                       Special case: preview
   case $printype in
#                                       Postscript previewer
      PREVIEW)
         if [ "$filetype" != "PS-CMYK" -a "$filetype" != "PS" ] ; then
            echo "don't know how to preview $filetype output"
            exit 1
         fi
         if [ "$printer" = pageview ] ; then
#                                       Sun NeWS-specific pageview
#                                       Need LD_LIBRARY_PATH and
#                                       OPENWINHOME defined
            if [ ${OPENWINHOME-.} != . -a \
                 ${LD_LIBRARY_PATH-.} != . ] ; then
               $OPENWINHOME/bin/pageview $file &
            else
               echo "OPENWINHOME or LD_LIBRARY_PATH undefined!"
               echo "Cannot run pageview without these variables!!"
               exit 2
            fi
         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/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
            if [ "$gs" = "" ] ; then
               echo "no ghostview or gs found in the PATH"
               exit 2
            else
               echo "Shedding $gs to view output..."
               ($gs $file &)
            fi
         fi
      ;;
#                                       Custom program or script; do not
#                                       mess with the file type.
      REMOTE)
         OLDIFS=$IFS
         IFS=$IFS:
         found=no
         for i in $PATH ; do
            [ -f $i/$printer ] && found=yes && break
         done
         IFS=$OLDIFS
         if [ $found = no ] ; then
            echo "Cannot find program $printer in your PATH"
            echo "so nothing will be printed"
         else
            echo "Running program $printer on output..."
            cat $file | $printer
            printed=true; nfiles=`expr $nfiles + 1`
         fi
      ;;
      *)
#                                       All other non-preview printers.
#                                       See if printer is right type
         if [ "$printype" = "$filetype" ] ; then
            $printcmd$printer $file
            printed=true; nfiles=`expr $nfiles + 1`
#                                       Make exceptions for PS on PSCMYK
         elif [ \( "$printype" = "PS-CMYK" \) -a \
                \( "$filetype" = "PS" \) ] ; then
            echo "Warning!  Monochrome file on color PS printer!"
            $printcmd$printer $file
            printed=true; nfiles=`expr $nfiles + 1`
         else
#                                       No, so look for an alternative.
            if [ $LPDEVS -gt 1 ] ; then
               n=0
               found=no
               LPDEV=""
#                                       First see if config file exists
               if [ -f $NET0/PRDEVS.LIST ] ; then
                  new=`cat $NET0/PRDEVS.LIST | \
                       awk '($2 == "'$filetype'") {print $0}' | head -1`
                  if [ "$new" != "" ] ; then
                     printer=`echo $new | awk '{print $1}'`
                     printext=`echo "$new" | \
                        awk '{for (j=4; j<=NF; j++) {printf " %s", $j}}'`
                     found=yes
                  fi
#                                       No it didn't; give up
               else
		  echo "No PRDEVS.LIST found in NET0: area"
		  echo "(NET0=$NET0)"
		  found=no
               fi
               if [ "$found" = no ] ; then
                  echo \
                  "no $filetype printer, cannot print graphics"
                  exit 3
               fi
               echo "You tried to print a $filetype file on"
               echo "a $printype printer!  This will not work!"
               echo "Instead I will use the $printext."
               $printcmd$printer $*
               printed=true; nfiles=`expr $nfiles + 1`
            else
               echo \
               "no $filetype printer, cannot print graphics"
               exit 4
            fi
         fi
      ;;
   esac
   if [ "$printed" = true ] ; then
      echo "graphics sent to the $printext"
#                                       IBM's still have lpq, but it
#                                       doesn't work on printer "lp"???
      if [ "$ARCH" = "IBM" ] ; then
         chcmd="lpq -P$printer"
         [ "$printer" = "lp" ] && chcmd="lpq"
      else
         chcmd="$chcmd$printer"
      fi
      case $printype in
         REMOTE|PREVIEW) ;;
         *) $chcmd ;;
      esac
   fi
done
case $nfiles in
   0) echo "No files printed";;
   1) echo "One file printed";;
   *) echo "Total of $nfiles files printed";;
esac
exit 0



More information about the Daip mailing list