Trailing-Edge
-
PDP-10 Archives
-
BB-4172H-BM
-
4-1-sources/rdmail.mac
There are 20 other files named rdmail.mac in the archive. Click here to see a list.
;<5.UTILITIES>RDMAIL.MAC.3, 28-Oct-81 15:34:47, EDIT BY GRANT
;Change major version to 5
;<4.UTILITIES>RDMAIL.MAC.17, 3-Jan-80 15:26:42, EDIT BY R.ACE
;UPDATE COPYRIGHT DATE
;<4.UTILITIES>RDMAIL.MAC.16, 5-Sep-79 10:21:49, EDIT BY R.ACE
;TCO 4.2441 - FIX MESSAGE TO TELL YOU THE NAME OF THE BAD FILE
;<4.UTILITIES>RDMAIL.MAC.14, 15-Aug-79 16:46:18, Edit by LCAMPBELL
;<4.UTILITIES>RDMAIL.MAC.13, 15-Aug-79 16:42:09, Edit by LCAMPBELL
;<4.UTILITIES>RDMAIL.MAC.12, 15-Aug-79 16:39:26, Edit by LCAMPBELL
;<4.UTILITIES>RDMAIL.MAC.11, 15-Aug-79 16:15:05, Edit by LCAMPBELL
; TCO 4.2402 - Remove code which understands Rel. 1 (binary-header) mail files
;<4.UTILITIES>RDMAIL.MAC.10, 29-May-79 09:40:55, EDIT BY OSMAN
;tco 4.2259 - change /H to /HELP in prompt
;<4.UTILITIES>RDMAIL.MAC.9, 25-May-79 16:38:32, EDIT BY DBELL
;UPDATE THE HELP MESSAGE TO INCLUDE TYPING IN A TIME BY ITSELF.
;<4.UTILITIES>RDMAIL.MAC.8, 27-Apr-79 11:41:18, Edit by LCAMPBELL
; Don't check for ARPA monitor, the distinction is no longer significant
;<4.UTILITIES>RDMAIL.MAC.7, 25-Apr-79 13:52:15, EDIT BY OSMAN
;<4.UTILITIES>RDMAIL.MAC.6, 25-Apr-79 13:51:49, EDIT BY OSMAN
;parse date-time before date or time, so "MAR 10, 79 12" gets interpreted as single entity
;<4.UTILITIES>RDMAIL.MAC.5, 12-Mar-79 14:14:57, EDIT BY KONEN
;UPDATE COPYRIGHT FOR RELEASE 4
;<4.UTILITIES>RDMAIL.MAC.4, 25-Jan-79 15:59:51, Edit by KONEN
;<4.UTILITIES>RDMAIL.MAC.3, 24-Jan-79 11:04:45, Edit by KONEN
;SET COMPILE TO LOOK IN DSK: FOR CMD.REL, INSTEAD OF SYS: FOR .CTL
;<4.UTILITIES>RDMAIL.MAC.2, 23-Jan-79 16:20:14, Edit by KONEN
;UPDATE VERSION NUMBER FOR RELEASE 4
;<4.UTILITIES>RDMAIL.MAC.1, 19-Dec-78 14:21:04, EDIT BY OSMAN
;EXPAND SWITCH NAMES TO FULL WORDS
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976,1977,1978,1979,1980 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
SEARCH MONSYM,MACSYM,CMD
.REQUIRE SYS:MACREL,CMD
TITLE RDMAIL
SALL
IFNDEF .PSECT,<
.DIRECT .XTABM>
IFDEF .PSECT,<
.DIRECT FLBLST
>
;DEFINE REGISTERS
A==1
B==2
C==3
D==4
W==5
W1==6
W2==7
P==17
;DEFINE VERSION CONSTITUENTS
PRGVER==5 ;VERSION 4
PRGMIN==0 ;MINOR VERSION
PRGEDT==13 ;EDIT NUMBER
PRGCST==0 ;DEC SOFTWARE
;LOCAL STORAGE
STKSIZ==200
STACK: BLOCK STKSIZ
CMDSTG ;COMND JSYS STORAGE
JFN: Z 0 ;JFN OF INPUT FILE
OJFN: BLOCK 1 ;OUTPUT JFN
STOP: Z ; STOP AFTER EACH MESSAGE
PRUSE: Z
MOD: Z 0 ;MESSAGE OF THE DAY FLAG
FILFND: Z 0 ;FILE FOUND FLAG
HLPFLG: 0 ;SAYS HELP WANTED
RLDATE: Z 0 ;FLAG
TIME: Z 0 ;DATE AND TIME TO BEGIN
MESSNO: Z 0 ;INTERNAL MESSAGE COUNTER
THISDT: 0 ;GTAD OF CURRENT TEXT-FORM MSG
BEGM: 0 ;CHAR COUNT AT START OF TEXT MSG
FILLEN: 0 ;EOF POINTER OF FILE
SKIPCH: 0 ;CHAR COUNT OF CURRENT MSG, TEXT FORM
FRMERC: 0 ;FORMAT ERROR MESSAGE COUNTER
BIGSTR==5000 ;BUFFER AREA
BIGBUF==BIGSTR+6 ;START OF BUFFER AREA
BUFSIZ==10000 ;SIZE OF BUFFER AREA
;THE ENTER VECTOR
ENTVEC: JRST START ;MAIN ENTRY
JRST START ;SAME AS MAIN
PRGVER_^D24!PRGMIN_^D18!PRGEDT!PRGCST_^D33
XWD TIME,START2
ENDVEC==. ;END OF ENTRY VECTOR
START: RESET
MOVEI A,.PRIOU ;DEFAULT OUTPUT JFN
MOVEM A,OJFN
MOVE P,[IOWD STKSIZ,STACK]
CALL CMDINI ;INITIALIZE FOR COMND JSYS
CALL CLRSTR ;CLEAR MAP
MOVEI A,.FHSLF ; SEE IF ENABLED
RPCAP ; GET THEM
TRNE C,-1 ; ANY SPECIALS SET?
JRST SPCIAL ; YES. MUST ASK THEN
NOSPC: GJINF ; GET JOB INFORMATION
MOVE B,A ; DIRECTORY NUMBER TO B
DOFILE: MOVE A,[POINT 7,BIGBUF] ;WHERE TO BUILD NAME
PUSH P,B ;SAVE DIR NUMBER
HRROI B,[ASCIZ /PS:</]
SETZ C,
SOUT ;MAKE IT GO TO PS ALWAYS
POP P,B ;RESTORE DIR NUMBER
DIRST ;GET HIS NAME
JFCL
MOVEI C,">" ;GET TERMINATOR
IDPB C,A ;STORE IT
HRROI B,[ASCIZ /MAIL.TXT/] ;THE FILE
SETZ C,
SOUT ;COPY IT
MOVX A,GJ%OLD!GJ%SHT+1 ;ONLY VERSION 1
HRROI B,BIGBUF ; THE NAME BUFFER
GTJFN ;GET IT
JRST [ SETOM FILFND ;NO LOCAL MESSAGE FILE FOUND
JRST GETDAT] ;GO DO SOME PROCESSING
SETZM FILFND ;INDICATE FILE FOUND
MOVEM A,JFN ;SAVE JFN
MOVE B,[1,,.FBREF] ;SAVE LAST READ DTAE
MOVEI C,D ;WHERE IT GOES
GTFDB ;GET IT
MOVEM D,TIME ;SAEV IT IN CASE
;FILE IS NOW OPEN. ASK HIM FOR DATE AND TINM TO START PROCESSING
GETDAT: PROMPT <Date and time (/HELP for help) >
SETZM HLPFLG ;NO HELP REQUEST YET
SETZM RLDATE ;NO REAL DATE YET
SETZM PRUSE ;ASSUME NO PERUSING
SETZM STOP ; ASSUME NO STOPPING
SETZM MOD ;NOT DOING MESSAGE OF THE DAY
MORE1: MOVEI A,[FLDDB. .CMCFM,,,,,[FLDDB. .CMTAD,CM%SDH,CM%IDA!CM%ITM,,,[FLDDB. .CMTAD,CM%SDH,CM%IDA,,,[FLDDB. .CMTAD,CM%SDH,CM%ITM,,,[FLDDB. .CMTAD,,CM%IDA!CM%ITM,,,[FLDDB. .CMSWI,,SWTAB]]]]]]
CALL RFIELD
LDB C,[331100,,(C)] ;SEE WHAT WAS INPUT
CAIE C,.CMTAD ;DATE INPUT?
JRST NODAT1 ;NO
MOVEM B,TIME ;REMEMBER THE TIME TYPED
SETOM RLDATE ;MARK THAT DATE TYPED
JRST MORE1 ;GET MORE OF LINE
NODAT1: CAIE C,.CMSWI ;SWITCH?
JRST NOSWI ;NO
MOVE B,(B) ;GET ENTRY FROM TABLE
CALL (B) ;EXECUTE THE SWITCH
JRST MORE1 ;GET MORE INPUT
SWTAB: %N,,%N
T ALL
T HELP
T LIST
T MESSAGE-OF-THE-DAY,.M
T PERUSE
T STOP
%N==.-SWTAB-1
.LIST: MOVX A,GJ%FOU+GJ%SHT
HRROI B,[ASCIZ /LPT:RDMAIL.OUT/]
GTJFN ;GET OUTPUT JFN
JRST [ HRROI A,[ASCIZ /
?LPT: not available for output
/]
PSOUT
RET] ;IGNORE IT
MOVE B,[070000,,100000]
OPENF ;OPEN LPT
JRST [ HRROI A,[ASCIZ /
?LPT: not available for output
/]
PSOUT
RET] ;GIVE UP
MOVEM A,OJFN ;NEW OUTPUT JFN
RET ;DONE
.PERUS: SETOM PRUSE ;YES. SET THE FLAG
RET
.ALL: SETZM TIME ;YES.
SETOM RLDATE ;AND SAY FOUND A REAL TIME
RET
.STOP: SETOM STOP ;YES REMEMBER THIS
RET
.M: SETOM MOD ;YES. REMEMBER THIS
SKIPE RLDATE ;HAVE A REAL DATE YET?
POPJ P, ;YES. ALL DONE THEN
MOVNI A,5 ;GET CONSOLE TIME FOR THE JOB
RUNTM ;GET IT
GTAD ;GET NOW
IDIV C,B ;GET SECONDS
MUL C,[1B17]
DIVI C,^D<3600*24> ;COMPUTE FRACTIONS OF A DAY
SUB A,C ;COMPUTE LOGIN DATE AND TIME
MOVEM A,TIME ;NEW DEFAULT TIME
POPJ P, ;GO BACK
;READY TO PROCESS THE FILE
NOSWI: SKIPN HLPFLG ;HELP WANTED?
JRST NOSWI1 ;NO
CALL HLPOUT ;YES, PRINT IT
JRST GETDAT ;FLUSH REST OF LINE
NOSWI1: SKIPE MOD ;WANT MESSAGE OF THE DAY?
JRST START2 ;YES. GO DO IT
SKIPE FILFND ;NO. HAVE A LOCAL MESSAGE FILE?
JRST [ HALTF ;NO. STOP THEN
JRST START]
MOVE B,[070000,,200000] ;OPENF BITS
MOVE A,JFN ;THE JFN OF THE MESSAGE FILE
SKIPE PRUSE ;PERUSING?
TXO B,OF%PDT ;YES. SUPPRESS REFERNCE DATE UPDATE
OPENF ;OPEN IT
OPNFAL: JRST [ MOVE D,A ;SAVE ERROR MESSAGE
MOVE A,JFN ;GET FILE JFN
RLJFN ;GET RID OF JFN
JFCL
MOVEI A,101
MOVE B,[400000,,-1]
SETZ C,
CAIE D,OPNX2 ;WAS IT A ZERO LENGTH MAIL FILE?
ERSTR ;NO,LET MONITOR TELL HIM WHAT HAPPENED
JFCL
JFCL
HALTF ;DIE
JRST START] ;AND TRY AGAIN
MOVEI A,.FHSLF
EIR ;TURN ON THE INTERRUPT SYSTEM
SETZM MESSNO ;CLEAR INTERNAL COUNTER
SETOM FRMERC ;NO FORMAT ERROR MESSAGES YET
MOVE A,JFN ; get JFN back
SETO B, ;NOW SELECT EOF
SFPTR ; ..
JRST NODSK
RFPTR ;AND FIND WHERE EOF IS
JRST NODSK
MOVEM B,FILLEN ;UPDATE TO LENGTH OF FILE
MOVEI B,0 ;START OF FILE
SFPTR ;AND MOVE JFN POINTER BACK WHERE IT WAS
JRST NODSK
SETZM BEGM ;SAY AT BEGINING OF FILE
MOVSI B,(IT%AIS) ;REQUIRE SECONDS IN TIME OF MSG
IDTIM ;GET TIME STAMP OF MSG
JRST TXTOLY ;NOT TIME STAMP MUST BE TEXT FILE.
MOVEM B,THISDT ;SAVE DATE/TIME WORD
MOVE A,JFN ;THE JFN OF THE MESSAGE FILE
JRST TXTLP2 ;CONTINUE PROCESSING THIS MESSAGE
TXTLP: MOVSI B,(IT%AIS) ;REQUIRE SECONDS IN TIME OF MSG
IDTIM ;GET TIME STAMP OF MSG
JRST BADFRM ;NOT IN REQUIRED FORMAT
TXTLP1: MOVEM B,THISDT ;SAVE DATE/TIME WORD
TXTLP2: MOVEI C,12 ;NOW CHARACTERS IN DECIMAL
NIN
JRST BADFRM ;NOT IN REQUIRED FORMAT
MOVEM B,SKIPCH ;SAVE NUMBER CHARS IN THIS MSG
HRROI B,BIGSTR ;SCRATCH SPACE
MOVEI C,100 ;MAX OTHER STUFF ON LINE 1
MOVEI D,12 ;QUIT AT END OF LINE
SIN
JUMPE C,BADFRM ;IF READ THAT MUCH, IT'S JUNK.
MOVE B,THISDT ;NOW CHECK THE DATE
CAMGE B,TIME ;MESSAGE NEW ENOUGH TO PRINT?
JRST NXTMS1 ;NO, SKIP IT.
PUSHJ P,COPY ;YES, PUT IT ON OUTPUT FILE
;...
;DO NEXT MESSAGE IF THERE IS ONE
NXTMSG: MOVE A,OJFN ;WAIT IF ON TTY
CAIN A,.PRIOU
DOBE ;WAIT IF ON PRIMARY
NXTMS1: MOVE A,JFN ;THE MAIL FILE
RFPTR ;WHERE ARE WE
JRST NODSK
ADD B,SKIPCH ;ADD THE AMOUNT IN MSG
SFPTR ;MOVE BEYOND THIS MESSAGE
JRST NODSK
MOVEM B,BEGM ;SAVE START OF NEXT MESSAGE
GTSTS ; IF FIND A NULL
TLNE B,1000 ; ..
JRST DONE ;EOF. QUIT.
MOVE B,BEGM ;GET BACK CURRENT POINTER
JRST TXTLP ; get next message
;MORE OF TEXT-FORM MAIL FILE PROCESSING
BADFRM: SETZM SKIPCH ;DON'T TRY TO SKIP THE MSG
HRROI A,[ASCIZ /
%MAIL.TXT File contains undated entries or improper format.
/]
AOSN FRMERC ;PRINT THIS MESSAGE JUST ONCE
PSOUT
MOVE A,JFN ;NOW GO BACK TO START OF THE JUNK
MOVE B,BEGM
SFPTR
JRST NODSK
BADF1: MOVE A,JFN ;NOW GO A LINE AT A TIME
BIN ;CHECK FOR EOF FIRST
JUMPE B,[GTSTS ; IF FIND A NULL
TLNE B,1000 ; ..
JRST DONE ;EOF. QUIT.
JRST BADF1] ;NULL. IGNORE IT.
MOVE A,OJFN ;COPY THE BAD CHAR TO OUTPUT
BOUT
CAIN B,12 ;LINEFEED?
JRST NXTMS1 ;YES. SEE IF CAN PARSE HERE.
JRST BADF1 ;NO, GO ON IN THE JUNK.
NODSK: HRROI A,[ASCIZ /
? Input file is not DSK:
/]
ESOUT
JRST DONE
COPY: SKIPLE STOP ;WANT TO PAUSE?
CALL STOPW ;WAIT FOR GO AHEAD
MOVSI A,(1B0)
ANDCAM A,STOP ;MAKE STOP POSITIVE
MOVE A,OJFN ;WRITE THE CURRENT MESSAGE ON
CAIN A,.PRIOU ;THE OUTPUT FILE.
DOBE
MOVEI C,0 ;GET MESSAGE LENGTH
EXCH C,SKIPCH ;AS A POSITIVE NUMBER
MOVE A,JFN ;GET THE JFN
RFPTR ;GET CURRENT POSITION
JRST NODSK
ADD B,C ;GET END OF MESSAGE
MOVEM B,BEGM ;SAVE IT
SKIPE PRUSE ;PERUSING?
JRST COPYP ;YES
COPY1: MOVE A,JFN ;INPUT
BIN ;GET FIRST CHAR
JUMPE B,COPY4 ;CHECK FOR EOF
MOVE A,OJFN ;PUT THE BYTE ON OUTPUT FILE
BOUT
COPY2: SOJG C,COPY1 ;LOOP FOR ALL N CHARACTERS
POPJ P,0 ;END OF COPY ROUTINE
COPY4: GTSTS ;CHECK FOR EOF AGAIN
TLNE B,1000
JRST [POP P,A ;BYPASS THE RETURN FROM COPY
JRST DONE]
JRST COPY2 ;A NULL IN MESSAGE. SKIP IT.
COPYP: CALL DOPRSE ;GO PERUSE FILE
COPYE: MOVE A,JFN ;GET THE JFN BACK
MOVE B,BEGM ;AND BEGINING OF NEXT MESSAGE
SFPTR
JRST NODSK
POPJ P,0 ;END OF COPY ROUTINE
;HERE TO PRINT FILE THAT IS ALL TEST
TXTOLY: MOVE A,FILLEN ;GET LENGTH OF FILE
MOVEM A,SKIPCH ;SAVE AS LENGTH TO PRINT
CALL COPY ;GO PRINT IT
JRST DONE
;CODE TO DO THE PERUSE OF THE RELEVANT MESSAGES
DOPRSE: HRROI B,BIGBUF ;WHERE THE DATA SHOULD GO
HRRZ A,JFN ;THE FILE ID
MOVEI C,-1 ;LOTS OF BYTES
MOVEI D,12 ;UP TO THE END OF THE LINE
SIN ;DO IT
LDB A,[POINT 7,BIGBUF,6] ;GET FIRST CHARACTER
CAIN A,15 ;NULL LINE
JRST DOPRS1 ;GO FINISH UP
MOVE A,OJFN ;GET OUTPUT JFN
HRROI B,BIGBUF ;WHERE THE DTAT IS
MOVEI C,-1 ;LOTS OF BYTES
MOVEI D,12 ;UP TO THE END OF THE LINE
DOBE
SOUT ;DO IT
JRST DOPRSE ;NO GO DO ANOTHER LINE
DOPRS1: HRROI A,[ASCIZ /
/]
PSOUT ;CLEAN UP THE LINE
DOPRSX: POPJ P, ;RETURN
;THIS IS THE CODE TO PRINT THE HELP MESSAGE
.HELP: SETOM HLPFLG ;SAY HELP WANTED
RET
HLPOUT: HRROI A,HLPTXT
PSOUT
POPJ P, ;ALL DONE HELPING
HLPTXT: ASCIZ ^
Type in a date and time in TOPS-20 format as follows:
MMM DD,YYYY HH:MM
or
MMM DD,YYYY
or
HH:MM
The second case will assume time 00:01, and the last case
will assume today's date. (For example, a valid date and
time is MAR 16,1976 15:30)
or Type an empty line and get all messages since the last
reading of the message file.
/HELP Print this text
/ALL Types all messages in the file
/PERUSE For perusing messages only
/STOP Will cause RDMAIL to pause after each message typed
/MESSAGE-OF-THE-DAY Will use the message of the day file for message type out
/LIST Will output messages to the line printer
^
;ALL DONE
DONE: CLOSF ;CLOSE THE FILE
JFCL
MOVE A,OJFN ;GET OUTPUT JFN
CLOSF ;CLOSE IT
JFCL
HALTF
JRST START ;START OVER
START2: RESET
MOVEI A,.PRIOU ;DEFAULT OUTPUT
MOVEM A,OJFN
SETZM MOD ;ALREADY DOING MESSAGE OF THE DAY
MOVE P,[IOWD STKSIZ,STACK]
HRROI B,[ASCIZ /PS:<SYSTEM>MAIL.TXT/]
MOVSI A,100001 ;GET MESSAGE OF THE DAY FILE
GTJFN ;GET JFN FOR IT
JRST [ HALTF ;NONE THERE. DIE QUIETLY
JRST START] ;TRY AGAIN
MOVEM A,JFN ;SAVE THE HANDLE
SETZM FILFND ;SAY FOUND A MESSAGE FILE
JRST NOSWI ;TIME IS ALL SET UP. GO DO IT
;DO SPECIAL PROCESSING
SPAGN: MOVEI A,.PRIIN
CFIBF ;CLEAR INPUT ON ERROR
SPCIAL: PROMPT <Special user (y or n)? >
MOVEI A,[FLDDB. .CMKEY,CM%SDH,[ 2,,2
T NO,0
T YES,-1],<YES or NO>,NO]
CALL CFIELD ;GET ANSWER
HRRE B,(B) ;GET 0 FOR NO AND -1 FOR YES
JUMPE B,NOSPC ;NOT SPECIAL
;WANTS SPECIAL DIRECTORY. GO READ IT
MOVEI A,.PRIIN
RFCOC ; GET ECHO BITS
TRZ C,3B19
SFCOC
GETDIR: PROMPT <User name: >
MOVEI A,[FLDDB. .CMUSR]
CALL CFIELD ;GET SPECIAL USER
JRST DOFILE
;ROUTINE TO PUT A WORD OUT AS BYTE ON OJFN
PUTWD: MOVE A,OJFN ;OUTPUT JFN
MOVE D,B ;MOVE BYTE
HRROI B,D
MOVNI C,5 ;DO ALL FIVE BYTES
SOUT ;OUPUT TO TTY
EPRNLW: RET
;SUBROUTINE TO WAIT FOR GO AHEAD ON STOP
STOPW: PROMPT <[Type <CR> for more] >
CONFRM ;WAIT FOR CONFIRMATION
POPJ P, ;RETURN
;SUBROUTINE TO CLEAR MAP FOR BIGSTR
CLRSTR: SETO A,
MOVE B,[.FHSLF,,BIGSTR/1000]
SETZ C, ;ONLY ONE PAGE PLEASE
PMAP ;CLEAR MAP
RET ;AND DONE
END <ENDVEC-ENTVEC,,ENTVEC>