[comp.protocols.appletalk] Patches to CAP for A/UX 2.0 native AppleTalk

liam@cs.qmw.ac.uk (William Roberts) (07/28/90)

I have done enough work on the CAP system to make it work with A?UX 2.0
native support for AppleTalk that I can now compile and run both
lwsrv and aufs. Note that you don't need atis anymore, and that A/UX 2.0
comes supplied with its own equivalent of papif.

What you need is actually fairly small. 

You need the following patches, which modify the Configure script,
the top-level Makefile, the lib/cap Makefile.m4 and the lib/cap/whatiswhat
file. This is all harmless and sets you up for the two new files in
the lib/cap directory that do the work of talking to A/UX's own built-in
DDP and NBP implementation.

You will be please to hear that no other changes are required, and that
I didn't fiddle with the existing ab*.c files at all.


I started from the Rutgers CAP distribution (ru-cap) which we fetched
a month or so ago - I did send out some other unrelated Patches at
around that time.  If people have problems applying the patches then
I will simply send out the revised files complete, since they too are
not very big.


Happy patching....

William Roberts
liam@cs.qmw.ac.uk

These are the patches to the Rutgers distribution of CAP (ru-cap)
that make things happen and arrange to include the new auxat_*.c
files provided in the shar file.

Patch for Configure (also adds support for Sequent's DYNIX os):
----------------------------------
*** /tmp/,RCSt1a03554	Fri Jul 27 21:03:09 1990
--- Configure	Fri Jul 27 15:31:02 1990
***************
*** 1,7 ****
  #!/bin/sh
! # $Author: root $ $Date: 90/06/18 12:31:01 $
! # $Header: Configure,v 1.1 90/06/18 12:31:01 root Exp $
! # $Revision: 1.1 $
  # CAP configuration shell script.  This ain't perfect, but it's a start
  # execute with /bin/sh Configure if your system won't run it (ksh is okay
  # too)
--- 1,7 ----
  #!/bin/sh
! # $Author: root $ $Date: 90/07/27 15:30:31 $
! # $Header: Configure,v 1.3 90/07/27 15:30:31 root Locked $
! # $Revision: 1.3 $
  # CAP configuration shell script.  This ain't perfect, but it's a start
  # execute with /bin/sh Configure if your system won't run it (ksh is okay
  # too)
***************
*** 97,103 ****
--- 97,113 ----
                  "A/UX")
                          echo "A/UX"
                          osdefault="aux"
+ 			if [ `uname -r` -ge 2 ]; then
+ 				echo "Release 2.0 or greater"
+ 				echo "defaulting to native AppleTalk"
+ 				useauxappletalk=1
+ 				lpd="lpr"
+ 			else
+ 				echo "Release 1.1.1 or less"
+ echo "If you have AppleTalk for A/UX, you will need to edit"
+ echo "something to set useauxappletalk=1 to use it"
                          	lpd="lp"
+ 		        fi
                          break
                  ;;
                  "HP-UX")
***************
*** 115,120 ****
--- 125,138 ----
                  esac
          fi
  fi
+ # Sequent Balance
+ if [ -z "${osdefault}" ]; then
+         echo "Checking for Sequent Balance"
+         if [ -f /dynix ]; then
+                         echo "Sequent Balance"
+                         osdefault="dynix"
+         fi
+ fi
  # Default
  if [ -z "${osdefault}" ]; then
    echo "Establishing default as BSD"
***************
*** 142,147 ****
--- 160,166 ----
          "pyr") valid=1;;
          "sunos") valid=1;;
          "next") valid=1;;
+         "dynix") valid=1;;
          "?"|*)
                  if [ "${os}" != "?" ]; then
                          echo "unknown type ${os}, valid are:"
***************
*** 154,159 ****
--- 173,179 ----
                  echo "  pyr - pyramid";
                  echo "  sunos - suns";
                  echo "  next - NeXT/MACH";
+                 echo "  dynix - Sequent Balance";
           ;;
    esac
  done
***************
*** 209,215 ****
  echo "#ifndef _TYPES" >> /tmp/cx$$.c
  echo "# include <sys/types.h>" >> /tmp/cx$$.c
  echo "#endif" >> /tmp/cx$$.c
! ${ccompiler} -c /tmp/cx$$.c > /dev/null 2>/dev/null
  rc=$?
  if [ $rc -ne 0 ]; then
    echo
--- 229,235 ----
  echo "#ifndef _TYPES" >> /tmp/cx$$.c
  echo "# include <sys/types.h>" >> /tmp/cx$$.c
  echo "#endif" >> /tmp/cx$$.c
! ${ccompiler} -c /tmp/cx$$.c > /dev/null
  rc=$?
  if [ $rc -ne 0 ]; then
    echo
***************
*** 222,228 ****
    echo "can be made to work by define _TYPES everywhere"
    echo "[Hit carriage return to continue]"
    read ans
!   ${ccompiler} -c -D_TYPES /tmp/cx$$.c > /dev/null 2>/dev/null
    rc=$?
    if [ $rc -ne 0 ]; then
      echo
--- 242,248 ----
    echo "can be made to work by define _TYPES everywhere"
    echo "[Hit carriage return to continue]"
    read ans
!   ${ccompiler} -c -D_TYPES /tmp/cx$$.c > /dev/null
    rc=$?
    if [ $rc -ne 0 ]; then
      echo
***************
*** 302,307 ****
--- 322,328 ----
  #   "pyr" - pyramid (in BSD universe)
  #   "sunos" - SunOS
  #   "next" - NeXT/MACH
+ #   "dynix" - Sequent Balance
  # Warning: hpux, pyr are hardcoded in some of the makefiles (sorry)
  
  # MAJOR CONFIGURATION
***************
*** 315,326 ****
  ${PCAT} m4.tmp
  echo
  echo "# GETOPT support"
! echo "ifdef([X_GETOPT],[],[define([needgetopt],[att_getopt.o])])"
  echo "# VPRINTF support"
  echo "ifdef([X_VPRINTF],[define([usevprintf], 1)],[])"
  echo
  echo "# Path to cap sources: useful for testing"
  echo "define([cwd],[${mydir}])" 
  echo "# turn on if your system sends packets very quickly (see"
  echo "# applications/aufs/INSTALLATION)"
  echo "${fastether}"
--- 336,353 ----
  ${PCAT} m4.tmp
  echo
  echo "# GETOPT support"
! if [ "${os}" = "dynix" ]; then
!     echo "# Dynix provides getopt in -lseq "
! else
!     echo "ifdef([X_GETOPT],[],[define([needgetopt],[att_getopt.o])])"
! fi
  echo "# VPRINTF support"
  echo "ifdef([X_VPRINTF],[define([usevprintf], 1)],[])"
  echo
  echo "# Path to cap sources: useful for testing"
  echo "define([cwd],[${mydir}])"
+ echo "# define([debug],1) # for installing in source directories"
+ echo
  echo "# turn on if your system sends packets very quickly (see"
  echo "# applications/aufs/INSTALLATION)"
  echo "${fastether}"
***************
*** 329,339 ****
  echo "# prevent itself from being included twice"
  echo "# define _TYPES"
  echo "${needselfdef}"
  ${PCAT} <<\EOT1
  # MINOR CONFIGURATION: configure various programs
  
! #define([columbia],1) # so columbia can do things quickly
! #define([debug],1) # testing things (without disrupting)
  
  # location of include files
  define([includedir],[[/usr/include]])
--- 356,370 ----
  echo "# prevent itself from being included twice"
  echo "# define _TYPES"
  echo "${needselfdef}"
+ echo
+ if [ "${useauxappletalk}" = "1" ]; then
+     echo "# can we use A/UX native support for AppleTalk.."
+     echo "define([useauxappletalk],1)"
+ fi
  ${PCAT} <<\EOT1
  # MINOR CONFIGURATION: configure various programs
  
! # define([columbia],1) # so columbia can do things quickly
  
  # location of include files
  define([includedir],[[/usr/include]])
***************
*** 355,370 ****
  define([afplib],[[libafp.a]])
  define([afpclib],[[libafpc.a]])
  # names to load cap libraries with
! define([libcap],[[-lcap]])
  define([libafp],[[-lafp]])
  define([libafpc],[[-lafpc]])
  # any special libraries
  define([libspecial],[])
! 
  # Aufs: see applications/aufs/INSTALLATION
  
  # WARNING: OS DEPENDENT
! #define([smartunixfinderinfo],1)
  
  # valid here are -DNONXLATE, -DFULL_NCS_SUPPORT
  #  or GGTYPE="gid_t"
--- 386,409 ----
  define([afplib],[[libafp.a]])
  define([afpclib],[[libafpc.a]])
  # names to load cap libraries with
! # NB: when you write YOUR m4-based system like this, make sure that
! #     you never ever choose a name (e.g. libcap) which could
! #     possibly occur in any of the vriables you use. The debug
! #     option turns libcap into $cwd/lib/libcap.a and this causes
! #     much horridness, including the test in this definition...
! define([libcap],ifdef([useauxappletalk],[[-lcap -lat]],[[-lcap]]))
  define([libafp],[[-lafp]])
  define([libafpc],[[-lafpc]])
+ 
+ 
  # any special libraries
  define([libspecial],[])
! # override for Dynix getopt in -lseq
! ifelse(os,[dynix],[define([libspecial],[[-lseq]])])
  # Aufs: see applications/aufs/INSTALLATION
  
  # WARNING: OS DEPENDENT
! # define([smartunixfinderinfo],1)
  
  # valid here are -DNONXLATE, -DFULL_NCS_SUPPORT
  #  or GGTYPE="gid_t"
***************
*** 452,457 ****
--- 491,497 ----
                  os,[bsd],[Standard BSD],
                  os,[pyr],[Pyramid in BSD universe],
                  os,[next],[NeXT/MACH],
+                 os,[dynix],[Sequent Balance],
                  [Unknown]))
  define([cflags],ifdef([selfdefinetypes],[-O -D_TYPES],[-O]))
  define([bigcflags],ifelse(os,[hpux],[+Nd2000 +Ns2000]))
***************
*** 534,540 ****
   define([afplib],[[libafp.a]])
   define([afpclib],[[libafpc.a]])
  # names to load cap libraries with
!  define([libcap],concat(cwd,[[[/lib/libcap.a]]]))
   define([libafp],concat(cwd,[[[/lib/libafp.a]]]))
   define([libafpc],concat(cwd,[[[/lib/libafpc.a]]]))
   define([capprinters],concat([\"],etcdest,[/],[cap.printers],[\"]))
--- 574,586 ----
   define([afplib],[[libafp.a]])
   define([afpclib],[[libafpc.a]])
  # names to load cap libraries with
! # see note above about the stupidity of chosing libcap as the
! # m4 variable name for a string containing the letters libcap...
! # Still, I don't fancy changing all those Makefile.m4 files.
!  define([libcap],concat(cwd,[[[/lib/libcap.a]]],
!                         ifdef([useauxappletalk],[ -lat],[])
!                  )
!  )
   define([libafp],concat(cwd,[[[/lib/libafp.a]]]))
   define([libafpc],concat(cwd,[[[/lib/libafpc.a]]]))
   define([capprinters],concat([\"],etcdest,[/],[cap.printers],[\"]))
***************
*** 554,559 ****
--- 600,606 ----
  LFLAGS=lflags()
  CC=thecompiler()
  LD=theloader()
+ SHELL=/bin/sh
  EOT4
  exec > /dev/tty
  echo "${of} configured"
-------------------------------

Patches for the Makefile (makes it a bit more robust):
-------------------------------
*** /tmp/,RCSt1a03565	Fri Jul 27 21:04:57 1990
--- Makefile	Fri Jul 27 18:44:40 1990
***************
*** 20,34 ****
  	touch libinstall
  	
  programs: libinstall
! 	(cd samples; make)
! 	(cd contrib; make)
! 	(cd applications; make)
  	touch programs
  
  install: libinstall programs
! 	(cd samples; make install)
! 	(cd contrib; make install)
! 	(cd applications; make install)
  
  cap.shar: listtodist
  	cap.dist shar
--- 20,34 ----
  	touch libinstall
  	
  programs: libinstall
! 	-(cd samples; make)
! 	-(cd contrib; make)
! 	-(cd applications; make)
  	touch programs
  
  install: libinstall programs
! 	-(cd samples; make install)
! 	-(cd contrib; make install)
! 	-(cd applications; make install)
  
  cap.shar: listtodist
  	cap.dist shar
-------------------------------------------


Now change to lib/cap and apply the following patches to 
the Makefile.m4 and whatiswhat:

-------------------------
*** /tmp/,RCSt1a03580	Fri Jul 27 21:06:57 1990
--- lib/cap/Makefile.m4	Fri Jul 27 17:10:39 1990
***************
*** 1,12 ****
  CFLAGS=cflags() caposdefs()
  I=includedir()
  NBPFLAGS=nbpflags()
! LIBABSRCS=abatp.c abddp.c abmisc.c abnbp.c \
  	abpap.c abpapc.c abpaps.c abpp.c abqueue.c abasp.c \
! 	abzip.c abversion.c atalkdbm.c absched.c abkip.c
! LIBABOBJS=abatp.o abddp.o abmisc.o abnbp.o \
  	abpap.o abpapc.o abpaps.o abpp.o abqueue.o abasp.o \
! 	abzip.o abversion.o atalkdbm.o absched.o abkip.o
  LIBCAP=caplib()
  DESTDIR=libdestdir()
  
--- 1,19 ----
  CFLAGS=cflags() caposdefs()
  I=includedir()
  NBPFLAGS=nbpflags()
! 
! AUXATSRCS=auxat_ddp.c auxat_nbp.c
! AUXATOBJS=auxat_ddp.o auxat_nbp.o
! 
! KIPSRCS=abddp.c abkip.c abnbp.c atalkdbm.c
! KIPOBJS=abddp.o abkip.o abnbp.o atalkdbm.o
! 
! LIBABSRCS=abatp.c abmisc.c abversion.c absched.c \
  	abpap.c abpapc.c abpaps.c abpp.c abqueue.c abasp.c \
! 	ifdef([useauxappletalk],[$(AUXATSRCS)],[$(KIPSRCS)])
! LIBABOBJS=abatp.o abmisc.o abversion.o absched.o \
  	abpap.o abpapc.o abpaps.o abpp.o abqueue.o abasp.o \
! 	ifdef([useauxappletalk],[$(AUXATOBJS)],[$(KIPOBJS)])
  LIBCAP=caplib()
  DESTDIR=libdestdir()
  
***************
*** 15,21 ****
  	[ar rv  $(LIBCAP) $(LIBABOBJS)])
  
  clean:
! 	-rm ${LIBABOBJS} ${LIBCAP} core *~
  
  install:	$(LIBCAP)
  	ifdef([sysvinstall],[install -f $(DESTDIR)],[install]) $(LIBCAP) $(DESTDIR)
--- 22,28 ----
  	[ar rv  $(LIBCAP) $(LIBABOBJS)])
  
  clean:
! 	-rm -f ${LIBABOBJS} ${LIBCAP} core *~
  
  install:	$(LIBCAP)
  	ifdef([sysvinstall],[install -f $(DESTDIR)],[install]) $(LIBCAP) $(DESTDIR)
***************
*** 60,62 ****
--- 67,71 ----
  abversion.o:	abversion.c	$I/netat/appletalk.h
  absched.o:	absched.c	$I/netat/appletalk.h $I/netat/compat.h
  atalkdbm.o:     atalkdbm.c
+ 
+ # I.O.U for the dependencies in auxat_*.c
---------------------------------------

Because I'm a tidy soul, here is a revised whatiswhat file:
---------------------------------------
*** /tmp/,RCSt1a03591	Fri Jul 27 21:08:15 1990
--- lib/cap/whatiswhat	Fri Jul 27 18:47:07 1990
***************
*** 16,18 ****
--- 16,24 ----
    atalkdbm.c	- Appletalk routing table handler (SUMEX)
  		  [SHOULD BE SPECIFIC TO KIP(UDP) ENCAPSULATION]
    abkip.c	- Glue to KIP (UDP) encapsulation
+ 
+   auxat_ddp.c	- DDP routines for native A/UX AppleTalk support
+   auxat_nbp.c	- NBP routines for native A/UX AppleTalk support
+ 
+ There should also be auxat_atp.c and auxat_zip.c, but they will have
+ to wait for now...
---------------------------


In addition to these patches (which are all harmless and should be
applied to any version of CAP whether you intend to build it on
A/UX 2.0 or not), there are the two new files auxat_ddp.c and
auxat_nbp.c which replace the KIP functionality.
-- 

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  071-975 5250 (Fax: 081-980 6533)