.PROC,KERMINS.
.******************************
.*
.*  BUILD KERMIT V3 BINARY FROM SOURCE
.*
.*  WRITTEN BY JOERG HALLBAUER -- CAL STATE UNIVERSITIES
.*  REVISED FOR V3 RELEASE BY STEVE ROSEMAN  --  LEHIGH UNIVERSITY
.*  REVISED FOR 3.4 BY OLAF PORS -- UNIVERSITY OF VIRGINIA
.*
.*  INPUT@D   KERMSRC    KERMIT UPDATE SOURCE FILE
.*           KERMOD1     FIRST (OPTIONAL) MODS FILE
.*           KERMOD2     SECOND (OPTIONAL) MODS FILE
.*  OUTPUT@D  KERMIT     KERMIT EXECUTABLE OVERLAY FILE
.*           KERMLST    COMPILATION LISTING AND LOAD MAP
.*
.*  THE REASON FOR TWO MODS FILES IS THAT THE KERMIT RELEASE
.*  MAY CONSIST OF A BASE SOURCE FILE (SAY VERSION 3.3),
.*  AND A MODSET WHICH IS THE DIFFERENCE BETWEEN VERSION 3.3
.*  AND THE LATEST VERSION.  IT IS ADVISABLE TO RETAIN SUCH 
.*  A MODSET IN THE RELEASE TO ELIMINATE QUESTIONS LIKE
.*  "DO I HAVE THE LATEST SOURCE FILE?", AND TO BE ABLE TO
.*  BACK OUT CHANGES IF PROBLEMS ARISE.  THE SECOND MODSET
.*  IS WHATEVER MODS A SITE IS ADDING TO THE RELEASED KERMIT.
.*  IF THE SECOND MODSET IS TO BE A PERMANENT ADDITION TO
.*  THE RELEASED KERMIT, IT SHOULD BE APPENDED TO THE
.*  FIRST AND SHIPPED BACK TO COLUMBIA (ONLY THE COMBINED
.*  MODSET NEEDS TO BE SENT; THE BASE FILE WILL REMAIN THE SAME).
.*  ONLY IF THE FIRST MODSET GETS TOO BIG SHOULD A NEW BASE 
.*  FILE BE CREATED.
********************************
$RETURN,B1,B2,B3,KERMITB,COMPILE,KERMLST.
$REWIND(*)
$IF,FILE(KERMSRC,.NOT.AS),GETIT.
   $GET,KERMSRC/NA. 
   $IF,FILE(KERMSRC,.NOT.AS),ATTACHIT.
      $ATTACH,KERMSRC/NA.
      $IF,FILE(KERMSRC,.NOT.AS),MISSING.
         $NOTE(,NR)+ +FILE *KERMSRC* IS MISSING!+ +
         $REVERT,ABORT.
      $ENDIF,MISSING.
   $ENDIF,ATTACHIT. 
$ENDIF,GETIT.
.*  CREATE KERMIT PL FROM THE BASE SOURCE FILE.
$UPDATE,N=KERMPL,I=KERMSRC,C=0.
.IF(FILE(KERMOD1,.NOT.AS))GET,KERMOD1/NA.
.IF(FILE(KERMOD2,.NOT.AS))GET,KERMOD2/NA.
$REWIND(KERMOD1,KERMOD2,UPDIR)
$COPYBR,KERMOD1,UPDIR.
$COPYBR,KERMOD2,UPDIR.
$NOTE(UPDIR,NR)+*COMPILE,KERMIT,KERMLIB 
$PACK(UPDIR)
.*  CREATE COMPILE FILE INCLUDING THE TWO MODSETS.
$UPDATE,Q,P=KERMPL,I=UPDIR,O=KERMLST,L=1234.
$FTN5,OPT=2,I,B=B1,L=KERMLST,LO=S/-A,EL=F,S,PN,BL,CS,ET=F,S=NOSTEXT,S=PSSTEXT.
$FTN5,OPT=2,I,B=B2,L=KERMLST,LO=S/-A,EL=F,S,PN,BL,CS,ET=F,S=NOSTEXT,S=PSSTEXT.
$LIBGEN,F=B2,P=KERMLIB.
$LDSET,LIB=KERMLIB/FTN5LIB/SRVLIB,ERR=ALL.
$LDSET,MAP=SB/KERMLST.
$LOAD,B1. 
$NOGO,KERMITB.
$LIBEDIT,C,P=KERMITB,I=LIBDIR,L=0,B=0.
$RETURN,B1,B2,B3,COMPILE,LIBDIR,KERMPL,UPDIR,KERMLIB,NEW.
$RENAME,KERMIT=KERMITB.
$REVERT.KERMIT BUILD COMPLETE 
$EXIT.
$REVERT,ABORT.ERROR IN KERMIT BUILD.
.DATA LIBDIR
*COMMENT OVL/KRM0100 KERMIT - INITIALIZATION
*COMMENT OVL/KRM0200 KERMIT - EXECUTE CONTROL STATEMENT
*COMMENT OVL/KRM0300 KERMIT - HELP
*COMMENT OVL/KRM0400 KERMIT - RECEIVE FILE
*COMMENT OVL/KRM0500 KERMIT - SEND FILE 
*COMMENT OVL/KRM0600 KERMIT - SET ATTRIBUTES
*COMMENT OVL/KRM0700 KERMIT - SHOW SETTINGS
*COMMENT OVL/KRM1000 KERMIT - STATUS OF TRANSFER
*COMMENT OVL/KRM1100 KERMIT - SERVER MODE
*COMMENT OVL/KRM1101 KERMIT - SERVER RECEIVE
*COMMENT OVL/KRM1102 KERMIT - SERVER INITIALIZE
*COMMENT OVL/KRM1103 KERMIT - SERVER SEND
*COMMENT OVL/KRM1104 KERMIT - SERVER GENERIC FUNCTIONS
*COMMENT OVL/KRM1200 KERMIT - DIRECTORY COMMAND
*COMMENT OVL/KRM1300 KERMIT - TAKE COMMAND
