10 EXTEND 20 ! INFO.BAS - 1.00-00 02-Nov-87 - tmk - Directory pgm for DECMAIL-11 & ! 1.10-01 05-Nov-87 - tmk - Add CCL entry, command args, & ! better help & ! 1.20-02 17-Nov-87 - tmk - Move substringing into subrou- & ! tine, add DECNET/E support & ! & ! NOTICE - See the comments at line 11000 regarding DECnet/E support & ! before compiling or installing this software. & ! & 100 ON ERROR GOTO 32400 ! SET STANDARD ERROR TRAP & \ PRINT "MAIL directory program V1.20-02 - 17-Nov-87 - tmk" & \ PRINT "" & \ PRINT "Enter 'HELP' at the Info> prompt for help." & 110 OPEN "_KB:INFO.CMD" AS FILE #2% & \ NODE$="" ! DEFAULT TO LOCAL NODE & 120 PRINT & \ GOTO 32760 IF CCLENT%<>0% & \ CCLENT%=0% 125 PRINT "Info> "; ! PRINT PROMPT & \ INPUT LINE #2%, CMND$ ! GET COMMAND 130 CLOSE #1% ! CLOSE MAIL NAMES FILE 140 CMND$=CVT$$(CMND$,189%) ! MAKE IT U/C & \ GOTO 125 IF CMND$="" & \ GOTO 125 IF CMND$=" " & \ ARG$="" & \ I%=INSTR(1%,CMND$," ") ! ANY ARGUMENTS? & \ GOTO 150 IF I%=0% ! IF NOT & \ ARG$=MID(CMND$,I%+1%,LEN(CMND$)) 150 GOTO 1000 IF LEFT(CMND$,1%)="H" & \ GOTO 2000 IF LEFT(CMND$,1%)="S" & \ GOTO 3000 IF LEFT(CMND$,1%)="D" & \ GOTO 4000 IF LEFT(CMND$,1%)="W" & \ GOTO 5000 IF LEFT(CMND$,1%)="V" & \ GOTO 6000 IF LEFT(CMND$,1%)="N" & \ GOTO 32760 IF LEFT(CMND$,1%)="Q" & \ PRINT "Unknown command '";CMND$;"'." & \ GOTO 120 & 1000 ! HELP FUNCTION & ! & PRINT "" & \ PRINT "INFO is a program which allows you to look up users in the MAIL" & \ PRINT "database on this system or on other RSTS/E systems (if you have" & \ PRINT "the DECnet/E package) by a number of options. The options which" & \ PRINT "are available are:" & \ PRINT "" & \ PRINT " SEARCH - Locate a person by department, title, name, etc." & \ PRINT " You enter the text you want to look for. All rec-" & \ PRINT " ords which match will be displayed. " & \ PRINT " DIRECTORY - Display the entire user directory on the terminal." & \ PRINT " WHO - Display detailed information about a specific user" & \ PRINT " on the terminal. This is the only way to view the" & \ PRINT " entire data for a user." & \ PRINT " NODE - Allows you to specify a different RSTS/E system to" & \ PRINT " look up users on (if you have the DECnet/E package" & \ PRINT " installed). By default, lookups are done on your" & \ PRINT " computer system." & \ PRINT " VERSION - Display the version number of this program." & \ PRINT " QUIT - Exit from this program." & \ PRINT "" & \ PRINT "If you wish to update your own information, simply send MAIL to" & \ PRINT "INFO detailing the changes you want made. Similarly, department" & \ PRINT "chairs may request the addition or deletion of faculty member's" & \ PRINT "information." & \ GOTO 120 & 2000 ! SEARCH FUNCTION & ! & SCAN$=ARG$ & \ PRINT "Search string? "; IF SCAN$="" & \ INPUT LINE #2%,SCAN$ IF SCAN$="" & \ SCAN$=CVT$$(SCAN$,37%) & \ GOSUB 11000 ! OPEN NAMES FILE 2010 LIN%=0% & \ PRINT "Listing of matching users on "; & \ PRINT "local node" UNLESS NODE$<>"" & \ PRINT "node ";NODE$;"::" IF NODE$<>"" & \ PRINT "UserID Full username Account "+ & "Department" & \ PRINT "------------ ---------------------------- --------- "+ & "---------------------------" 2020 GOSUB 10000 ! GET RECORD & SNIP & \ GOTO 2030 IF SPLIT1%=0% ! ON EOF & \ GOTO 2020 IF INSTR(1%,CVT$$(DATUM$,32%),SCAN$)=0% & \ PRINT U.ID$; & \ PRINT TAB(13%);U.NAME$; & \ PRINT TAB(42%);U.ACCT$; & \ PRINT TAB(52%);U.DEPT$ & \ LIN%=LIN%+1% & \ GOTO 2020 IF LIN%<19% ! MORE ROOM ON SCREEN & \ PRINT "Press [RETURN] for next screen or any key to exit..." & \ INPUT #2%, CMND$ & \ GOTO 2010 IF CMND$="" & \ GOTO 120 2030 PRINT "End of requested listing." & \ GOTO 120 & 3000 ! DIRECTORY FUNCTION & ! & GOSUB 11000 ! OPEN NAMES FILE 3005 LIN%=0% & \ PRINT "Directory of users on "; \ PRINT "local node" UNLESS NODE$<>"" & \ PRINT "node ";NODE$;"::" IF NODE$<>"" & \ PRINT "UserID Full username Account "+ & "Department" & \ PRINT "------------ ---------------------------- --------- "+ & "---------------------------" 3010 GOSUB 10000 ! GET RECORD & SNIP & \ GOTO 3020 IF SPLIT1%=0% ! ON EOF & \ PRINT U.ID$; & \ PRINT TAB(13%);U.NAME$; & \ PRINT TAB(42%);U.ACCT$; & \ PRINT TAB(52%);U.DEPT$ & \ LIN%=LIN%+1% & \ GOTO 3010 IF LIN%<19% ! MORE ROOM ON SCREEN & \ PRINT "Press [RETURN] for next screen or any key to exit..." & \ INPUT #2%, CMND$ & \ GOTO 3005 IF CMND$="" & \ GOTO 120 3020 PRINT "End of requested listing." & \ GOTO 120 & 4000 ! WHO FUNCTION (DOCTOR, DOCTOR...) & ! & USERID$=ARG$ & \ PRINT "UserID? "; IF USERID$="" & \ INPUT LINE #2, USERID$ IF USERID$="" & \ USERID$=CVT$$(USERID$,37%) & \ GOSUB 11000 ! OPEN NAMES FILE 4010 GOSUB 10000 ! GET RECORD AND SNIP & \ GOTO 4060 IF SPLIT1%=0% ! IF EOF & \ GOTO 4010 IF USERID$<>MID(DATUM$,SPLIT2%+1%,SPLIT3%-SPLIT2%-1%) & \ PRINT "UserID: ";TAB(15%); & \ PRINT NODE$+"::"; IF NODE$<>"" & \ PRINT U.ID$ & \ PRINT "Full username: ";TAB(15%);U.NAME$ & \ PRINT "Department: ";TAB(15%);U.DEPT$ & \ PRINT "Title: ";TAB(15%);U.TITLE$ & \ PRINT "Phone no.: ";TAB(15%);U.PHONE$ & \ PRINT "Account: ";TAB(15%);U.ACCT$ & \ PRINT "Comment field: ";TAB(15%);U.COMNT$ & \ PRINT "Last login: ";TAB(15%);U.LSTLG$ \ GOTO 120 IF NODE$<>"" ! NO AUTOANSWER IF REMOTE NODE 4020 FILNAM$=U.ACCT$+"AUTOAN.MSG" & \ OPEN FILNAM$ FOR INPUT AS FILE #3% & \ PRINT "" & \ PRINT "Auto answer message:" 4030 INPUT LINE #3%, MSG$ & \ PRINT MSG$; & \ GOTO 4030 4040 CLOSE #3% 4050 GOTO 120 4060 PRINT "UserID not found." & \ GOTO 120 & 5000 ! VERSION FUNCTION & ! & PRINT "INFO V1.20-02 - 17-Nov-87 - tmk" & \ GOTO 120 & 6000 ! NODE FUNCTION & ! & NODE$=ARG$ & \ PRINT "Node? "; IF NODE$="" & \ INPUT LINE #2, NODE$ IF NODE$="" & \ NODE$=CVT$$(NODE$,37%) & \ GOTO 120 & 10000 INPUT LINE #1%,DATUM$ & \ U.DEPT$="" & \ U.TITLE$="" & \ U.PHONE$="" & \ U.COMNT$="" & \ DATUM$=LEFT(DATUM$,LEN(DATUM$)-2%) & \ GOTO 10000 IF LEFT(DATUM$,1%)="!" & \ SPLIT1%=INSTR(1%,DATUM$,"],")+1% & \ SPLIT2%=INSTR(SPLIT1%+1%,DATUM$,",") & \ SPLIT3%=INSTR(SPLIT2%+1%,DATUM$,CHR$(9%)) & \ SPLIT3%=LEN(DATUM$)+1% IF SPLIT3%=0% & \ SPLIT4%=INSTR(SPLIT3%+1%,DATUM$,"!") & \ SPLIT5%=INSTR(SPLIT4%+1%,DATUM$,",") & \ SPLIT6%=INSTR(SPLIT5%+1%,DATUM$,",") & \ SPLIT7%=INSTR(SPLIT6%+1%,DATUM$,",") & \ U.ID$=MID(DATUM$,SPLIT2%+1%,SPLIT3%-SPLIT2%-1%) & \ U.NAME$=MID(DATUM$,SPLIT1%+1%,SPLIT2%-SPLIT1%-1%) & \ U.ACCT$=LEFT(DATUM$,SPLIT1%-1%) & \ GOTO 10010 IF SPLIT3%=LEN(DATUM$)+1% & \ U.DEPT$=MID(DATUM$,SPLIT4%+1%,SPLIT5%-SPLIT4%-1%) & \ U.TITLE$=MID(DATUM$,SPLIT5%+1%,SPLIT6%-SPLIT5%-1%) & \ U.PHONE$=MID(DATUM$,SPLIT6%+1%,SPLIT7%-SPLIT6%-1%) & \ U.COMNT$=MID(DATUM$,SPLIT7%+1%,80%) 10010 U.LSTLG$="" & \ U.LSTLG$="" IF NODE$<>"" & \ GOTO 10020 IF NODE$<>"" ! IF NOT SAME NODE, NO LAST LOGIN & \ SPLIT1A%=INSTR(1%,DATUM$,",") & \ PROJ%=VAL(MID(DATUM$,2%,SPLIT1A%-2%)) & \ PROG%=VAL(MID(DATUM$,SPLIT1A%+1%,SPLIT1%-SPLIT1A%-2%)) & \ MSG$=SYS(CHR$(6%)+CHR$(-25%)+CHR$(-1%)+CHR$(4%)+CHR$(PROG%)+ & CHR$(PROJ%)) & \ GOTO 10020 IF CVT$%(MID(MSG$,9%,2%))=0% & \ U.LSTLG$=DATE$(SWAP%(CVT$%(MID(MSG$,9%,2%))))+ & " "+TIME$(SWAP%(CVT$%(MID(MSG$,11%,2%))) AND 2047%) 10020 RETURN ! RETURN WITH RECORD 10030 SPLIT1%=0% ! ERROR TRAP & \ RETURN ! RETURN EOF & 11000 ! OPEN NAMES FILE ON DESIGNATED NODE & ! & ! Note - If you don't have BP2 or DECnet/E, replace this whole & ! subroutine with: & ! OPEN "MAIL$:NAMES.DAT" FOR INPUT AS FILE #1% & ! If you have DECnet/E, you must change the data: & ! "[2,2] FOOBAR BARFOO" to the account and passwords for your & ! default DECnet account on the remote node. N.B. All remote & ! nodes must have the same account/password information. & ! & MAINAM$="MAIL$:NAMES.DAT" & \ MAINAM$=NODE$+'"[2,2] FOOBAR BARFOO"::'+MAINAM$ IF NODE$<>"" & \ OPEN MAINAM$ FOR INPUT AS FILE #1%, ORGANIZATION SEQUENTIAL, & ACCESS READ & \ RETURN ! FILE OPENED, EXIT 11010 GOTO 11020 IF NODE$="" ! IF HAPPENED HERE & \ PRINT "?"+NODE$+":: is an unknown or unreachable node, or the login" & \ PRINT " information provided was invalid at the remote node." & \ NODE$="" ! COULDN'T OPEN, KILL NODE & \ GOTO 120 ! AND DO WITHOUT 11020 PRINT "?Unable to access MAIL$:MAIL.SYS file. Please contact" & \ PRINT " your system managment personnel or support staff." & \ GOTO 32767 & 30000 ! CCL ENTRY & ! & ON ERROR GOTO 32400 & \ OPEN "_KB:INFO.CMD" AS FILE #2% & \ NODE$="" ! DEFAULT TO LOCAL NODE & \ CMND$=SYS(CHR$(7%)) ! GET CORE COMMON & \ CMND$=CVT$$(CMND$,189%) ! CONVERT IT & \ I%=INSTR(1%,CMND$," ") ! ANY OPTIONS? & \ GOTO 120 IF I%=0% ! NOPE, CONTINUE & \ CMND$=MID(CMND$,I%+1%,LEN(CMND$)) & \ CCLENT%=1% & \ GOTO 130 & 32400 ! ERROR TRAP & ! & RESUME 140 IF ERL=130% ! UNABLE TO CLOSE NAMES FILE & \ RESUME 10030 IF ERL=10000% ! EOF ON NAMES FILE & \ RESUME 10020 IF ERL=10010% ! NO LAST LOGIN INFO & \ RESUME 11010 IF ERL=11000% ! BAD NODENAME & \ RESUME 4050 IF ERL=4020% ! NO AUTOAN.MSG FILE & \ RESUME 4040 IF ERL=4030% ! EOF ON AUTOAN.MSG & \ RESUME 32760 IF ERL=125% ! EOF AT MAIN PROMPT & \ RESUME 120 IF ERR=11% ! EOF ON USER INPUT & \ RESUME 32750 ! UNKNOWN ERROR & 32750 PRINT "?Received error ";NUM1$(ERR);" at line ";NUM1$(ERL);"." 32760 ON ERROR GOTO 32767 & \ CLOSE #1% 32767 END