[comp.protocols.appletalk] Step-by-step CAP6 install guide & script

dank@blacks.jpl.nasa.gov (Dan Kegel) (05/16/91)

Last month, I posted instructions for installing CAP 6.0 on SunOS.
Since then, the instructions have been updated a bit, and now come
with a script for (nearly) automatically giving your Sun access to some or
all Appletalk Laserwriters, and for giving other Suns remote printer
access to these printers using your Sun as an lpd gateway.

- Dan Kegel (dank@blacks.jpl.nasa.gov)

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	CAP_HOWTO
# This archive created: Wed May 15 11:24:43 1991
export PATH; PATH=/bin:$PATH
if test ! -d 'CAP_HOWTO'
then
	mkdir 'CAP_HOWTO'
fi
cd 'CAP_HOWTO'
if test -f 'add_all_lw'
then
	echo shar: will not over-write existing file "'add_all_lw'"
else
cat << \SHAR_EOF > 'add_all_lw'
#!/bin/csh -f -e
# Script to add all printers in print server's cap.printers to /etc/printcap
# and /usr/spool.   Run this on the print server.
#
# Preserve the old printcap
rm -f /tmp/printcap.old
if (-f /etc/printcap.old) mv /etc/printcap.old /tmp
cp /etc/printcap /etc/printcap.old
#
# Get the list of printers
set LIST = ~cap/etc/cap.printers
#
# For each printer in the list, create an entry in /etc/printcap and /usr/spool
set LINE=`cat $LIST | wc -l`
while ($LINE > 0)
  set uname = `head -$LINE $LIST | tail -1 | sed 's/=.*//'`
  set aname = `head -$LINE $LIST | tail -1 | sed -e 's/.*=//' -e 's/:Laser.*//'`
  ./add_lw $uname "$aname"
  @ LINE--
end
SHAR_EOF
chmod +x 'add_all_lw'
fi # end of overwriting check
if test -f 'add_all_remote_lw'
then
	echo shar: will not over-write existing file "'add_all_remote_lw'"
else
cat << \SHAR_EOF > 'add_all_remote_lw'
#!/bin/csh -f -e
# Script to add all printers in print server's cap.printers to /etc/printcap
# as remote via host CAPHOST.  Don't run this on the print server!
# Requires CAPHOST to have this system in its /.rhosts for the rsh;
# after this executes, CAPHOST need only have this system in /etc/hosts.lpd.
#
set echo
if ($#argv != 1) then
    echo Usage: add_all_remote_lw server
    echo Run this script on a client to get access to all Laserwriters
    echo that the given server talks to via CAP
    exit 1
endif

# Set name of print server, the computer that talks to the printers of interest
set CAPHOST = $1
#
# Preserve the old printcap
rm -f /tmp/printcap.old
if (-f /etc/printcap.old) mv /etc/printcap.old /tmp
cp /etc/printcap /etc/printcap.old
#
# Get the print server's list of printers
set LIST = /tmp/cap.printers
rsh $CAPHOST cat /etc/cap/cap.printers > $LIST
#
# For each printer in the list, create an entry in /etc/printcap and /usr/spool
set LINE=`cat $LIST | wc -l`
while ($LINE > 0)
  set uname = `head -$LINE $LIST | tail -1 | sed 's/=.*//'`
  set aname = `head -$LINE $LIST | tail -1 | sed -e 's/.*=//' -e 's/:Laser.*//'`
  ./add_remote_lp $uname "$aname" $CAPHOST
  @ LINE--
end
rm $LIST
SHAR_EOF
chmod +x 'add_all_remote_lw'
fi # end of overwriting check
if test -f 'add_lw'
then
	echo shar: will not over-write existing file "'add_lw'"
else
cat << \SHAR_EOF > 'add_lw'
#!/bin/csh -f -e
if ($#argv != 2) then
    echo Usage: add_lw shortName longName
    echo Adds an AppleTalk laserwriter to /etc/printcap, /usr/spool, /usr/adm
    echo Usually invoked by add_all_lw
    exit 1
endif
# Short Unix name for printer.
set uname = $1
# Remove special characters from Appletalk printer name to create long Unix name.
set aname = `echo $2 | tr '/: ' ___ | tr -d \' `
if (-d /usr/spool/cap/$uname) then
    echo Printer $uname, Appletalk name $aname not added, because it already exists.
    exit 0
endif
echo Adding printer $uname, Appletalk name:  $aname
#
# Create an entry in /etc/printcap for the printer.  
# This tells Unix how to access the printer.
# Note: this arbitrarily puts printer's directory in /usr/spool/cap/ for easy 
# uninstallation later, even though it usually lives directly in /usr/spool/.
sed -e s/UNAME/$uname/ -e "s/ANAME/$aname/" >> /etc/printcap <<_EOF_
#
# AppleTalk laserwriter.  AppleTalk name for printer is given after Unix name.
UNAME|ANAME:\
    :lp=/usr/spool/cap/UNAME/fakedev:\
    :sd=/usr/spool/cap/UNAME:\
    :pl#72:pw#85:\
    :sf:\
    :lf=/usr/adm/UNAME-lpd-errs:\
    :af=/usr/adm/UNAME-lpd.acct:\
    :if=/usr/local/cap/etc/UNAME:\
    :of=/usr/local/cap/bin/papof:
_EOF_
#
# Create the spool directory, fake printer device, and log file
# mentioned in the above printcap entry:
#
if (! -d /usr/spool/cap) then
    mkdir /usr/spool/cap
    chmod 755 /usr/spool/cap
    chown bin /usr/spool/cap
    chgrp bin /usr/spool/cap
endif
cd /usr/spool/cap
mkdir $uname
touch $uname/fakedev
chmod 666 $uname/fakedev
chown -R daemon $uname
touch /usr/adm/$uname-lpd-errs
#
# The input filter mentioned in the above printcap entry should
# actually be a shell script that sets up a few environment usr and
# invokes the printer interface program ~cap/bin/papif.
# The shell script name should be the same as the abbreviated printer name
# (this is how the shell script knows which printer it is talking to).
# $0 and $arg0 are escaped so they won't be expanded before cat is executed.
#
cd /usr/local/cap/etc
cat > $uname <<_EOF_
#!/bin/csh -f
# Printer input filter for use with CAP.
# Invoked by lpd as a result of a if=pathname entry in /etc/printcap.
# Tell papif which printer to look up in ~cap/etc/cap.printers.
set arg0 = \$0; setenv PRINTER \$arg0:t
# Run papif to copy stdin to printer.
/usr/local/cap/bin/papif
_EOF_
chown cap $uname
SHAR_EOF
chmod +x 'add_lw'
fi # end of overwriting check
if test -f 'add_remote_lp'
then
	echo shar: will not over-write existing file "'add_remote_lp'"
else
cat << \SHAR_EOF > 'add_remote_lp'
#!/bin/csh -f -e
# Usage: add_remote_lp shortName longName gateway
set echo
if ($#argv != 3) then
    echo Usage: add_remote_lp shortName longName gateway
    echo Adds a remote printer to /etc/printcap, /usr/spool, and /usr/adm
    exit 1
endif
# Short Unix name for printer.
set uname = $1
# Remove special characters from Appletalk printer name to create long Unix name.
set aname = `echo $2 | tr '/: ' ___ | tr -d \' `
if (-d /usr/spool/cap/$uname) then
    echo Printer $uname, Appletalk name $aname not added, because it already exists.
    exit 0
endif
set gname = $3
echo Adding printer $uname, long name $aname, remote on host $gname
if (! -d /usr/spool/cap) then
    mkdir /usr/spool/cap
    chmod 755 /usr/spool/cap
    chown bin /usr/spool/cap
    chgrp bin /usr/spool/cap
endif
cd /usr/spool/cap
mkdir $uname
chown -R daemon $uname
sed -e s/UNAME/$uname/g -e "s/ANAME/$aname/" -e s/GNAME/$gname/ >> /etc/printcap <<_EOF_
#
# Remote printer on host GNAME.
UNAME|ANAME:\
    :lp=:rm=GNAME:rp=UNAME:sd=/usr/spool/cap/UNAME:
_EOF_
SHAR_EOF
chmod +x 'add_remote_lp'
fi # end of overwriting check
if test -f 'README.CAP'
then
	echo shar: will not over-write existing file "'README.CAP'"
else
cat << \SHAR_EOF > 'README.CAP'
I wanted to install CAP such that (a) it could be trivially uninstalled,
(b) could be trivially mounted from an NFS fileserver, and (c) allows you
to print ASCII files to LocalTalk Laserwriters without having a copy of 
TranScript.
(a) and (b) require that CAP live as much as possible in a single directory, 
and that this directory be mountable read-only. 
The following procedure satisfies these desires, and provides a simple program
to convert ASCII to PostScript.

Procedure to install CAP/UAB into /usr/local/cap on a Sun4 running SunOS 4.1.1
such that ALL read-only files live in /usr/local/cap, and all read-write files
live in /etc/cap.  This makes for easy deinstallation and copying to new 
systems.
In the following, #% indicates the shell prompt for super-user, 
% indicates the shell prompt for user cap, and ~ indicates /usr/local/cap.

INSTALLATION
0) Become superuser, create area for cap to save data in, add user 
   'cap' to /etc/passwd with home directory /usr/local/cap, and give
   the account a password.
   No program will execute as user cap; if you don't want to add this
   pseudouser, you can install the files with owner bin.
   /usr/local can be mounted read-only after installation is complete.
   $ su
   #% /usr/etc/install/add_user cap 59999 10 "Columbia Appletalk Package" \
     /usr/local/cap /bin/csh
   #% passwd cap

1) Become user cap, and Create subdirectories in ~cap:
   #% su cap
   #% mkdir /etc/cap
   #% chown cap /etc/cap			# for convenience later in setup
   % cd ~
   % mkdir bin include lib
   % ln -s /etc/cap etc

2) Grab and unpack tarfile.  Choose the closest FTP site; some sites
   that carry CAP6.0 are
        rutgers.EDU     src/cap60.tar.Z
                        src/cap60.patches/*
        ftp.UU.NET      networking/cap/cap60.tar.Z
        munnari.OZ.AU   mac/cap60.tar.Z
                        mac/cap.patches/*
        lth.SE          Mac/Unix/Cap/cap60.tar.Z
        mcsun.EU.NET    network/appletalk.cap60.tar.Z
   For example:

   % cd /usr/local/cap
   % ftp ftp.uu.net
   FTP> binary
   FTP> cd networking/cap
   FTP> get cap60.tar.Z
   FTP> quit
   % zcat cap60.tar.Z | tar xvf -		# creates subdirectory cap60.

3) CAP's Makefiles aren't smart enough to deal with include files or libraries
   in nonstandard places yet, so build a wrapper around the C compiler like so:
   Create cc in ~cap/bin, and add ~cap/bin to the path:
    % cat > ~/bin/cc
    #!/bin/csh -f
    /usr/ucb/cc -I/usr/local/cap/include -L/usr/local/cap/lib $*
    ^D
    % chmod +x ~/bin/cc
    % set path = (~/bin $path)

4) Let cap autoconfigure itself.  Answer 'yes' to the question about
   using UAB, and about slowing down output for Kinetics boxes, but
   otherwise just use the default answers:
    % cd ~/cap60
    % ./Configure

5) Edit m4.setup to restict all CAP files to live in /usr/local/cap.
   (Note that the 'debug' flag in m4.setup provides almost this
   functionality, but the etc, bin, and lib directories are mixed
   in with the source directories.  This way keeps them separate.)

    % cd ~/cap60
    % vi m4.setup

	line	old			new
	90	/usr/include		/usr/local/cap/include
	94	/etc			/usr/local/cap/etc
	97,99	/usr/local/cap		/usr/local/cap/bin
	101	/usr/local/lib/cap	/usr/local/cap/lib
	103	/usr/local/lib		/usr/local/cap/lib
	158	/etc/cap.auth		/usr/local/cap/etc/cap.auth

	Uncomment line 215 to define capprinters.

6) Create all the makefiles according to the new configuration files:
    % cd ~/cap60
    % ./gen.makes

7) Steps 5 and 6 should have been enough, but there are hardcoded paths
   in several source files.  Fix these by patching makefiles:

7a) Patch ~/cap60/support/uab/makefile to keep its database in 
   /usr/local/cap/etc instead of /etc by changing the line
	CFLAGS=-DDEBUG  -O
   to read
	CFLAGS=-DDEBUG  -O -DMTAB=\"/usr/local/cap/etc/etalk.local\"
   near the top.

7b) Patch ~/cap60/lib/cap/makefile to keep its database in 
   /usr/local/cap/etc instead of /etc by changing the line
	CFLAGS= -O
   to read
	CFLAGS= -O -DETAB=\"/usr/local/cap/etc/etalk.local\"
   near the top.

8) Patch cap60/man/makefile to install man pages for SunOS by adding following
   lines after the rule for 'all:'.  Be careful to start each line after
   'install' with a tab, and not with spaces, or Make will choke.
   % cd ~/cap60/man
   % vi makefile			# and add following lines:

 # Added 4/91 by Dan Kegel (dank@blacks.jpl.nasa.gov)
 # to install man pages into a private area suitable for
 # use with man, catman, and apropos via the MANPATH environment variable.
 DESTDIR = /usr/local/cap/man
 install:
	mkdir $(DESTDIR)
	mkdir $(DESTDIR)/man1 $(DESTDIR)/man3 $(DESTDIR)/man5 $(DESTDIR)/man8 
	mkdir $(DESTDIR)/cat1 $(DESTDIR)/cat3 $(DESTDIR)/cat5 $(DESTDIR)/cat8
	cp *.1 $(DESTDIR)/man1
	cp *.3 $(DESTDIR)/man3
	cp *.5 $(DESTDIR)/man5
	cp *.8 $(DESTDIR)/man8
	ln -s papif.8 $(DESTDIR)/man8/papof.8
	ln -s atprint.1 $(DESTDIR)/man1/tlw.1
	ln -s atprint.1 $(DESTDIR)/man1/lwpr.1
	cp    atprint.1 $(DESTDIR)/man8/isrv.8
	ln -s atprint.1 $(DESTDIR)/man1/iwpr.1
	ln -s CAP.3 $(DESTDIR)/man3/libcap.3
	ln -s CAP.3 $(DESTDIR)/man3/libafpc.3
	ln -s CAP.3 $(DESTDIR)/man3/libafp.3
	ln -s cvt2apple.1 $(DESTDIR)/man1/cvt2cap.1
	ln -s atlook.1 $(DESTDIR)/man1/atpinger.1
	ln -s atlook.1 $(DESTDIR)/man1/atlooklws.1
	/usr/etc/catman -M $(DESTDIR)
	sort -u $(DESTDIR)/whatis > /tmp/whatis
	mv /tmp/whatis $(DESTDIR)
	# Now add $(DESTDIR) to your MANPATH environment variable.
# Caution: above lines start with TAB, not blanks

8) Install cap's man pages (ignore errors from opendir):
    % cd ~/cap60/man
    % make install

9) Install cap's include files:
    % cd ~
    % mkdir include/netat
    % cp cap60/netat/*.h include/netat

10) Compile the programs and install them in ~/bin:
    % cd ~/cap60
    % make install

11) Create script that lets users access CAP if needed:
    % cat > ~/bin/setup_env
    # C-shell users add the line 'source /usr/local/cap/bin/setup_env'
    # to their .cshrc to use CAP programs, manpages, or libraries directly.
    set path = (/usr/local/cap/bin $path)
    setenv MANPATH ${MANPATH}:/usr/local/cap/man
    ^D

12) Create ~/etc/bridge_desc.
    Replace 'blacks' in the following examples with your hostname.
    For Sun4/470's and all others using the Intel ethernet chip (ie0):
    % cat > ~/etc/bridge_desc
    blacks  [elap,ie:0]     mkip    [0]
    blacks  [async,as:0]    none    [127.127,fakeZone]
    ^D

    For Sparcstation 2's and all others using the AMD Lance ethernet chip (le0)
    % cat > ~/etc/bridge_desc
    blacks  [elap,le:0]     mkip    [0]
    blacks  [async,as:0]    none    [127.127,fakeZone]
    ^D

13) Create read-write and read-only folders available to all Mac users.
    % mkdir ~/macpub ~/macpub/.finderinfo ~/macpub/.resource
    % chmod -R 755 ~/macpub
    % mkdir /usr/tmp/mactmp 
    % mkdir /usr/tmp/mactmp/.finderinfo /usr/tmp/mactmp/.resource
    % chmod -R 777 /usr/tmp/mactmp

    You might want to create a crontab entry for root that deletes 
    and recreates /usr/tmp/mactmp at midnight, to keep old files from choking
    your system.

14) Create a file describing the public folders.  Replace 'blacks' with 
    your hostname:
    % cat > ~/etc/afpvols
	/usr/local/cap/macpub:macpub
	/usr/tmp/mactmp:mactmp
	^D

15) Create a shell script to start CAP, and invoke it in /etc/rc.local:

    % su
    #% cat > /etc/cap/rc.cap
	#!/bin/sh
	### sample start servers file; start from '/etc/rc.local'
	LOGd=/usr/tmp
	LOGf=/dev/null
	CAP=/usr/local/cap/bin
	ETC=/usr/local/cap/etc
	LIB=/usr/local/cap/lib
	#LWARGS="-a ${LIB}/procsets -f ${LIB}/LW+Fonts"
	#
	# Start UAB first.
	# Assumes you've created /usr/local/cap/etc/bridge_desc.
	# If you run into problems, try adding the option -l /dev/console
	# to display log messages to the console.
	${CAP}/uab -f ${ETC}/bridge_desc
	sleep 10
	#
	# allow atis to startup before other CAP programs
	${CAP}/atis
	sleep 5
	#
	${CAP}/snitch -S -f "SUN 4 SunOS 4.1.1 UNIX" -l lwsrv
	# Start up fileserver. Assumes you've created /usr/local/cap/etc/afpvols
	${CAP}/aufs -U 20 -V ${ETC}/afpvols -l ${LOGf} -n `hostname`
	# Start up print server.
	# Assumes there's a printer called lw.`hostname` in /etc/printcap.
	#${CAP}/lwsrv -n "Laserwriter on "`hostname` -p lw.`hostname` ${LWARGS}
	^D
    #% chmod +x /etc/cap/rc.cap
    #% vi /etc/rc.local		# Add the following lines at the bottom:
	#
	# Start up Appletalk fileserver & print server.
	#
	if [ -f /etc/cap/rc.cap ]; then
	    /etc/cap/rc.cap; echo "Appletalk fileserver"
	fi
    ^D

16) Bring up CAP by rebooting or by executing /etc/cap/rc.cap by hand as root.
    #% /etc/cap/rc.cap

17) Test the installation by seeing if your fileserver is visible, and by
    logging in to it with ash (replace blacks with your hostname):
    % source ~cap/bin/setup_env
    % man atlook
    % man ash
    % atlook
    % ash "blacks:AFPServer@*"

PRINTER INSTALLATION
    See README.PRINTER.

DEINSTALLATION

Delete any Localtalk LaserWriters you added in /etc/printcap.
Delete /var/spool/cap (the spool directory directory for above printers).
Delete lines invoking /etc/cap/rc.cap from /etc/rc.local.
Delete /usr/tmp/mactmp.
Delete /etc/cap.
Delete or umount /usr/local/cap.
Delete user cap from /etc/passwd.

- Dan Kegel (dank@blacks.jpl.nasa.gov)
SHAR_EOF
fi # end of overwriting check
if test -f 'README.PRINTER'
then
	echo shar: will not over-write existing file "'README.PRINTER'"
else
cat << \SHAR_EOF > 'README.PRINTER'
Procedure to install CAP's printer support on a Sun4 running SunOS 4.1.1
and to enable other Suns to use the machine running CAP as a printer gateway.

In the following, #% indicates the shell prompt for super-user, 
% indicates the shell prompt for user cap, and ~ indicates /usr/local/cap.

INSTALLATION ON THE SERVER
1)  In order to be able to print ASCII files rather than just PostScript files:

    a) Find an ASCII-to-Postscript filter.
       If your computer has Adobe TranScript, use /usr/local/lib/ps/pstext.
       If your computer doesn't have Adobe TranScript, you'll have to get
       a filter.  The source code for a simple one is included in
       the file ascii2ps.c.  Compile and install it as follows:
	% cd ~cap
	% cc ascii2ps.c -o bin/ascii2ps

       A fancier one called 'text2ps' is available via ftp from 
       wuarchive.wustl.edu in usenet/comp.binaries.ibm.pc/volume01/text2ps
       as file text2ps.uue.Z.  You'll need to uncompress, uudecode, and arc -x
       this file, then compile it and install it in ~cap/bin as above.
       I haven't tried it, but it looks very flexible.

    b) Modify papif to know about your ASCII to PostScript converter.
	% cd ~cap/cap60/applications/papif
	% vi makefile
	    Uncomment line 31:
		WPSTEXT="-DPSTEXT=\"/usr/local/lib/ps/pstext\"
	    If you are not using Adobe TranScript, replace the reference to
	    /usr/local/lib/ps/pstext with a path to your ASCII-to-Postscript 
	    filter, e.g.
		WPSTEXT="-DPSTEXT=\"/usr/local/cap/bin/ascii2ps\"
	% rm -f papif.o papif
	% make install

2) Arrange for your Unix system to be able to talk to a Laserwriter
    on your Localtalk network.  
    These instructions assume your computer uses a BSD-style lpr print spooler.
    They also assume that scripts find_all_lw, add_all_lw, add_all_remote_lw,
    and add_remote_lp that were included with this README.PRINTER file are
    in the current directory.

    a) CAP expects the file cap.printers to contain a list of all LocalTalk
       printers to support.  Use the script find_all_lw to get a list of
       all LocalTalk printers on your network:
	   % find_all_lw > ~cap/etc/cap.printers

    b) UNIX can't handle long printer names like Appletalk can, so cap.printers
       has both a short name and a long name for each printer, separated by
       an equals sign.
       find_all_lw picks the short name 'shortname' for every printer, so
       you have to use a text editor to replace 'shortname' with an appropriate
       abbreviation:
	   % vi ~cap/etc/cap.printers
       The abbreviations should be short, unique, and contain no punctuation 
       or spaces.

       For instance, here is part of my cap.printers before I edited it:
	    shortname=AIR Laser :LaserWriter@*
	    shortname=Terri's LaserWriter in 235L:LaserWriter@*
	and here is the same part after I chose abbreviations:
	    airlaser=AIR Laser :LaserWriter@*
	    terri=Terri's LaserWriter in 235L:LaserWriter@*

    c) Now that you've listed all the printers in ~cap/etc/cap.printers,
       tell Unix about them by modifying /etc/printcap and creating entries
       in /usr/spool:
       % su
       # ./add_all_lw

    d) Examine /etc/printcap; make sure the default printer comes first in the file
       (for compatibility with the brain-damaged printtool utility from Sun)
       and has the aliases 'lp' and 'Postscript'; also make sure the file
       doesn't contain duplicate entries for any printers.
       For example, the first entry in our /etc/printcap is:
	# AppleTalk laserwriter.
	airlaser|AIR_Laser|lp|ps|PostScript|lw|LaserWriter:\

    You should now be able to print Postscript and ASCII files to your printer.

ACCESSING PRINTERS THRU A REMOTE MACHINE RUNNING CAP
    Once a machine on your network has been set up to run CAP and talk to your
    printers, you can use it as a printing gateway to avoid having to install
    CAP everywhere just to talk to printers.  To do this, log in to the 
    server, and:
	% su
	# vi /etc/hosts.lpd	# Add the hostname of the client
	# vi /.rhosts		# Add the hostname of the client temporarily

    Log in to the client, and give the commands:
	% su
	# add_all_remote_lw SERVERNAME
    where SERVERNAME is the hostname of the server running CAP.
    Examine /etc/printcap; make sure the default printer comes first in the file
    (for compatibility with the brain-damaged printtool utility from Sun)
    and has the aliases 'lp' and 'Postscript'; also make sure the file
    doesn't contain duplicate entries for any printers.

    Finally, on the server again, delete the client's hostname from 
    /.rhosts if you didn't want it there.


PRINTER DEINSTALLATION
Delete any Localtalk LaserWriters you added in /etc/printcap (they are
easy to recognize, as they are the only printers that reference /usr/spool/cap.)
Delete /usr/spool/cap.

- Dan Kegel (dank@blacks.jpl.nasa.gov)
SHAR_EOF
fi # end of overwriting check
if test -f 'find_all_lw'
then
	echo shar: will not over-write existing file "'find_all_lw'"
else
cat << \SHAR_EOF > 'find_all_lw'
#!/bin/csh -f
# Script to find Appletalk name of all LaserWriters
# Just runs atlook and strips off extra garbage.
atlook | grep LaserWriter \
    | sed -e 's/^ *[0-9]* *- *//' -e 's/LaserWriter@\*.*/LaserWriter@*/' \
    | awk '{print "shortname=" $0}'
SHAR_EOF
chmod +x 'find_all_lw'
fi # end of overwriting check
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
cat << \SHAR_EOF > 'README'
This directory contains Dan Kegel's installation procedure for CAP.
Files:
-rw-r--r--  1 cap           990 May 15 11:22 README
-rw-r--r--  1 cap          9292 May  3 15:48 README.CAP
-rw-r--r--  1 cap          4894 May 15 11:19 README.PRINTER
-rwxr-xr-x  1 cap           659 Apr 25 19:26 add_all_lw*
-rwxr-xr-x  1 cap          1212 Apr 25 19:26 add_all_remote_lw*
-rwxr-xr-x  1 cap          2406 May  3 15:31 add_lw*
-rwxr-xr-x  1 cap          1040 May 13 15:31 add_remote_lp*
-rw-r--r--  1 cap          2118 May 15 11:20 ascii2ps.c
-rwxr-xr-x  1 cap           254 Apr 25 18:30 find_all_lw*

README.CAP tells how to install CAP/UAB.
README.PRINTER tells how to access Appletalk printers once you have installed
CAP, and how to use Appletalk printers without running CAP.
The shell scripts add* and find_all_lw are described in README.PRINTER.
ascii2ps.c is the source for a simple text-to-Postscript converter; it
is also described in README.PRINTER.
- Dan Kegel (dank@blacks.jpl.nasa.gov)
SHAR_EOF
fi # end of overwriting check
if test -f 'ascii2ps.c'
then
	echo shar: will not over-write existing file "'ascii2ps.c'"
else
cat << \SHAR_EOF > 'ascii2ps.c'
/*--------------------------------------------------------------------------
 Program to convert ASCII to PostScript.
 Written by Dan Kegel, April '91.  I lay no claim on this software.
--------------------------------------------------------------------------*/

#include <stdio.h>
#include <string.h>

#define IBUFLEN 1024

#define LINES 66
#define COLS 80

main()
{
    int page;
    int line;
    int ibuffull = 0;	/* kludge to handle ^L and long lines */
    char ibuf[IBUFLEN];

    /* Document header */
    fputs("\
%!PS-Adobe-1.0\n\
%%Creator: ascii2ps\n\
%%DocumentFonts: Courier\n\
/ld -11.4 def\n\
/E{ count { gsave show grestore } repeat 0 ld rmoveto } def\n\
/Courier findfont 11 scalefont setfont\n\
%%EndProlog\n\
", stdout);

    for (page=1; !feof(stdin); page++) {

	/* Page header */
	printf("%%%%Page: %d %d\n", page, page);
	printf("/sv save def 48 760 moveto\n");

	for (line=1; line<=LINES && !feof(stdin); line++) {
	    char obuf[IBUFLEN*2];
	    char *p, *q;
	    int c;
	    int col;

	    if (!ibuffull) {
		int len;
		if (fgets(ibuf, IBUFLEN, stdin) == NULL)
		    break;

		/* Strip trailing newline, if any */
		len = strlen(ibuf);
		if (ibuf[len-1] == '\n')
		    ibuf[len-1] = 0;
	    }

	    /* Expand tabs, escape backslashes and parens */
	    col = 0;
	    ibuffull = 0;	/* unless otherwise noted, eat all of ibuf */
	    for (p = ibuf, q=obuf; (c = *p++) != 0; ) {
		if (c == '(' || c == ')' || c == '\\')
		    *q++ = '\\';
		if (c == '\t') {
		    do {
			*q++ = ' ';
			col++;
		    } while (col % 8);
		} else if (c == '\014') {
		    /* Form feed- stop reading input line, go to next page */
		    line = LINES+1;
		    col = COLS+1;
		} else {
		    *q++ = c;
		    col++;
		}
		/* Wrap long lines onto next line.  Assumes last tabstop
		 * is at COLS+1.
		 */
		if (col >= COLS) {
		    bcopy(p, ibuf, strlen(p)+1);
		    ibuffull = 1;
		    break;
		}
	    }
	    *q = 0;

	    /* Encapsulate and print */
	    printf("(%s)E\n", obuf);
	}

	/* Page trailer */
	printf("showpage sv restore\n");
    }

    /* Document trailer */
    printf("%%Trailer\n");

    exit(0);
}
SHAR_EOF
fi # end of overwriting check
cd ..
#	End of shell archive
exit 0

gtw@EXTRO.UCC.SU.OZ.AU (G Taylor-Wood) (05/20/91)

Dear Dan
I have been working through your CAP installation guide and found it
very useful. I now have a suggestion and a request.

The suggestion: Down the bottom of m4.setup at line 230 or so it is
                possible to globally redefine the c compiler and loader
                so that as an example, I did
                    define([theccompiler],[cc -I/usr/local/include])
                which seems to work OK

The request:    Can I use your document as the basis for a local
                installation guide
regards
  Gilbert