2! PROGRAM : FINMAI.BAS 5! VERSION : V1.1 6! EDIT : 02 7! EDIT DATE : 19-Mar-90 10 EXTEND 20 ! & & & ! M O D I F I C A T I O N H I S T O R Y & & & ! VER-ED EDIT DATE Who REASON & ! 1.0-00 06-Aug-89 TMK Initial coding for test & ! 1.1-01 10-Sep-89 TMK Add displays, nickname support & ! 1.1-02 19-Mar-90 TMK Handle deleted nicknames & & 30 ! & & & ! P R O G R A M D E S C R I P T I O N & & & ! This program reads the DECmail-11 names file and constructs & ! an ISAM file for use by RSTS/E Finger. No checking is done on & ! the names file, as it is assumed that it was verified by the & ! DECmail NAMES.TSK program first. & & 1000 PRINT "FINMAI V1.1-02 of 19-Mar-1990" & \ PRINT & \ NAMEFN%=1% & \ FINGFN%=2% & \ NUMNAM%=0% & \ NUMALI%=0% & \ ON ERROR GOTO 32000 & \ MAP (INDEXF) STRING PPN$=2%, USERNAME$=12%, PERSNAME$=31%, & FORWARD$=64%, ALIAS$=1%, FILLER$=18% & \ KILL "FINGER$:FINGER.DAT" & ! Initialize. Delete old Finger file if any. & 1010 OPEN "MAIL$:NAMES.DAT" FOR INPUT AS FILE NAMEFN% & \ OPEN "FINGER$:FINGER.DAT" AS FILE FINGFN%, & ORGANIZATION INDEXED, & RECORDSIZE 128%, & MAP INDEXF, & PRIMARY KEY PPN$, & ALTERNATE KEY USERNAME$ & \ PRINT " Processing MAIL$:NAMES.DAT..." ! Open our files. & 1020 INPUT LINE #NAMEFN%, MAIL$ & \ MAIL$=LEFT(MAIL$,LEN(MAIL$)-1%) & \ GOTO 1020 IF LEFT(MAIL$,1%)="!" & \ J%=INSTR(1%,MAIL$,"[") & \ GOTO 1020 IF J% <> 1% & \ J2%=INSTR(J%+1%,MAIL$,",") & \ J3%=INSTR(J2%+1%,MAIL$,"]") & \ J4%=INSTR(J3%+1%,MAIL$,",") & \ J5%=INSTR(J4%+1%,MAIL$,",") & \ J6%=INSTR(J5%+1%,MAIL$,"!") & \ J6%=LEN(MAIL$) IF J6%=0% & \ U.PROJ%=VAL(MID(MAIL$,J%+1%,J2%-J%-1%)) & \ U.PROG%=VAL(MID(MAIL$,J2%+1%,J3%-J2%-1%)) & \ P.NAME$=CVT$$(MID(MAIL$,J4%+1%,J5%-J4%-1%),136%) & \ U.NAME$=CVT$$(MID(MAIL$,J5%+1%,J6%-J5%-1%),38%) & \ PPN$=CVT%$(SWAP%(U.PROJ%)+U.PROG%) & \ USERNAME$=U.NAME$ & \ PERSNAME$=P.NAME$ & \ FORWARD$="" & \ ALIAS$="N" & \ NUMNAM%=NUMNAM%+1% & \ PUT #FINGFN% \ GOTO 1020 & ! Read a line from the mail NAMES file. Break it apart and build & ! the lines the way we want them. Write them into the ISAM file. & ! Repeat until EOF. & 1030 CLOSE #NAMEFN% & \ OPEN "MAIL$:MAIL.SYS" FOR INPUT AS FILE #NAMEFN% & \ PRINT " Processing MAIL$:MAIL.SYS..." & \ FIELD #NAMEFN%, 512% AS NAMBUF$ & \ GET #NAMEFN%, RECORD 1% & \ I%=ASCII(MID(NAMBUF$,39%,1%)) & ! Close the username file, open the nickname file. Set initial index & ! pointer. & 1040 GET #NAMEFN%, RECORD I% & \ M%=I% & \ NICREC$=NAMBUF$+"" & \ GOTO 1090 IF MID(NICREC$,17%,6%)<>"NICKNA" & \ I%=CVT$%(MID(NICREC$,2%,2%)) & \ FOR J%=33% TO 501% STEP 12% & \ NICK$=MID(NICREC$,J%,12%) & \ GOTO 1080 IF NICK$=" " ! V1.1-02 - handle deletions & 1050 GET #FINGFN%, KEY #1% EQ NICK$ & ! If we are here, this nickname matches an existing username, so it & ! must be a forwarding address. & 1060 K%=(J%-33%)/12% ! Compute slot number. & \ L%=(K%/8%) & \ K%=(K%-L%*8%)*64% & \ L%=L%+M%+1% & \ K%=K%+1% & ! L%=block number, K%=offset for matching forwarding address & \ GET #NAMEFN%, RECORD L% & \ FORWARD$=MID(NAMBUF$,K%,64%) & \ UPDATE #FINGFN% & \ GOTO 1080 & 1070 PPN$=CVT%$(NUMALI%) & \ USERNAME$=NICK$ & \ K%=(J%-33%)/12% ! Compute slot number. & \ L%=(K%/8%) & \ K%=(K%-L%*8%)*64% & \ L%=L%+M%+1% & \ K%=K%+1% & ! L%=block number, K%=offset for matching forwarding address & \ GET #NAMEFN%, RECORD L% & \ PERSNAME$=MID(NAMBUF$,K%,64%) & \ ALIAS$="Y" \ PERSNAME$="System distribution list "+USERNAME$ IF & MID(NAMBUF$,K%,1%)="@" & \ ALIAS$="S" IF MID(NAMBUF$,K%,1%)="@" & \ FORWARD$="" & \ NUMALI%=NUMALI%+1% & \ PUT #FINGFN% & ! If we got here this is a username we don't know about. Set the flag & ! (PPN$=0/0) to indicate special handling required and write it out. & 1080 NEXT J% & \ GOTO 1040 IF I%<>0% & 1090 CLOSE #NAMEFN% & ! Close the file. & 2000 \ CLOSE #FINGFN% & \ PRINT & \ PRINT "Total usernames entered = ";NUM1$(NUMNAM%) & \ PRINT "Total unique aliases entered = ";NUM1$(NUMALI%) & \ GOTO 32767 & 32000 RESUME 1010 IF ERL=1000 & \ RESUME 1030 IF ERL=1020 & \ RESUME 2000 IF ERL=1030 & \ RESUME 1070 IF ERL=1050 & \ PRINT & \ PRINT "?Unexpected error ";NUM1$(ERR);" at line ";NUM1$(ERL) & \ RESUME 32767 & ! A trivial error trap. & 32767 END