.TITLE DMPFIL - DUMP A FILE TO THE REMOTE .IDENT /3.1/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: DMPFIL ; Author: Gary Larsen & Robin Miller ; Date: April 2, 1982 ; ; Description: ; ; This module will dump a file from the local system to the remote. ; The remote file must already be open (by PIP, CREATE, etc.) in order ; for the dump to occur. ; ; Modification History: ; ;- .ENABL AMA .NLIST BEX .MCALL CLOSE$, DIR$, GET$, QIOW$S, QIO$S, WTSE$S ; Local equates: BELL = 7 ; BELL LF = 10. ; LINE FEED CR = 13. ; CARRIAGE RETURN ; Termination table for terminal read. TTABLE:: .WORD 20000 ; TERMINATE ON ONLY .BLKW 15. ; REMAINING TABLE ZERO ; Messages: DFILEH: .ASCIZ "DUMP_FILE" SUCMSG: .ASCIZ "File successfully transferred - " ABOMSG: .ASCIZ "File transmission aborted - " CTRLCM: .ASCII .ASCII "*** Type CTRL/C to abort the file transmission. ***" DSPACE::.ASCIZ .EVEN .SBTTL DMPFIL - DUMP A FILE TO THE REMOTE SYSTEM ;+ ; ; DMPFIL - DUMP A FILE TO THE REMOTE SYSTEM. ; ; Description: ; ; This module dumps a file from the local system to a file ; on the remote system. The remote file must be opened via (PIP, ; CREATE, etc.) before the dump command is issued ; ; All registers are preserved. ; ;- DMPFIL:: CALL $SAVAL ; SAVE THE REGISTERS CALL INTALL ; INITIALIZE ALL COUNTERS MOV #DUMP,MODE ; SHOW IN DUMP MODE ; Request the file names to dump to remote. 10$: MOV #INCMD,R1 ; ADDRESS TO STORE INPUT MOV #LFILEQ,R2 ; ADDRESS OF THE PROMPT MOV #DFILEH,HLPADR ; ADDRESS OF HELP STRING CALL PROMPT ; GO ASK THE QUESTION TST BCKFLG ; USER WANT TO BACKUP ? BEQ 20$ ; IF EQ, NO (CONTINUE) JMP 140$ ; YES, JUST RETURN 20$: TSTB (R1) ; IS THERE A FILSPEC ? BEQ 10$ ; IF EQ, NO (TRY AGAIN) MOV R1,R2 ; COPY THE INPUT ADDRESS MOV #INFDB,R0 ; ADDRESS OF INPUT FDB ; Check for command file input. CMPB (R2),#'@ ; IS THERE A COMMAND FILE ? BNE 30$ ; IF NE, NO CALL CMDFIL ; YES, GO OPEN IT BR 40$ ; AND CONTINUE... 30$: MOV #INFDB+F.FNB,R1 ; ADDRESS OF THE FNB MOV #'R,R3 ; SET FOR READ CALL OPEN ; TRY TO OPEN THE FILE BCC 40$ ; IF CC, SUCCESS CALL FILERR ; ELSE REPORT THE ERROR BR 10$ ; AND TRY AGAIN 40$: CALL WRTCCM ; TELL USER HOW TO ABORT 50$: CALL MAKNAM ; MAKE THE FILE NAME CALL INTFIL ; CLEAR NEXT FILE COUNTERS 60$: TST ABOFLG ; CTRL/C TYPED TO ABORT ? BNE 100$ ; IF NE, YES (CLOSE FILE) GET$ R0,#LBUFF,#FILSIZ ; GET THE NEXT RECORD BCS 90$ ; IF CS, ERROR QIO$S #IO.RTT,#REMOTE,#REMOTE,,#RIOSB,,<#RBUFF,#FILSIZ,#3.,#TTABLE> MOV F.NRBD+2(R0),R2 ; COPY THE BUFFER ADDRESS MOV F.NRBD(R0),R3 ; COPY THE BYTE COUNT BEQ 70$ ; IF EQ, BLANK RECORD ; Write the buffer to the remote. QIO$S #IO.WAL!TF.CCO,#REMOTE,,,,, BR 80$ ; AND CONTINUE ... ; Write our own carriage return for blank records. 70$: QIO$S #IO.WAL!TF.CCO,#REMOTE,,,,,<#CRLF,#1,#0> ; Read the echo from the remote. 80$: WTSE$S #REMOTE ; WAIT FOR REMOTE READ CALL CHKRIO ; CHECK FOR ERRORS CALL RSTAT ; UPDATE RECORD STATISTICS BR 60$ ; GET THE NEXT RECORD 90$: CMPB F.ERR(R0),#IE.EOF ; ENCOUNTER END OF FILE ? BEQ 100$ ; IF EQ, YES (EXPECTED) CALL FILERR ; REPORT THE ERROR 100$: CLOSE$ R0 ; CLOSE THE FILE CALL TBLANK ; WRITE BLANK LINE TO TTY TST ABOFLG ; ARE WE ABORTING ? BNE 120$ ; IF NE, YES (RETURN) CALL WRTSUC ; WRITE SUCCESS MESSAGE MOV #INFDB,R0 ; ADDRESS OF INPUT FDB MOV #INFDB+F.FNB,R1 ; ADDRESS OF THE FNB CALL ONEXT ; OPEN THE NEXT FILE BCC 110$ ; IF CC, MORE TO GO CALL NXTFIL ; GET NEXT FROM COMMAND FILE BCS 130$ ; IF CS, WE'RE ALL DONE 110$: JMP 50$ ; GO DUMP THE NEXT FILE 120$: CALL CLOCMD ; CLOSE COMMAND FILE (IF OPEN) CALL WRTABO ; WRITE THE ABORT MESSAGE 130$: CALL TOTALS ; OUTPUT THE RSXNET TOTALS 140$: RETURN .SBTTL WRTCCM - WRITE CONTROL/C MESSAGE ;+ ; ; WRTCCM - Write Control/C message so user knows how to abort. ; ;- WRTCCM:: JSR R5,$SAVRG ; SAVE REGISTERS R3 - R5 MOV #CTRLCM,R4 ; ADDRESS OF CTRL/C MESSAGE CALL WRITE ; WRITE IT RETURN .SBTTL WRTSUC - WRITE THE SUCCESS MESSAGE ;+ ; ; WRTSUC - Write the success message. ; ;- WRTSUC:: JSR R5,$SAVRG ; SAVE REGISTERS R3 - R5 MOV #SUCMSG,R4 ; ADDRESS OF SUCCESS MESSAGE CALL WRITE ; WRITE IT BR WRTFIL ; NOW WRITE THE FILE NAME .SBTTL WRTABO - WRITE THE ABORT MESSAGE ;+ ; ; WRTABO - Write the abort message. ; ;- WRTABO:: JSR R5,$SAVRG ; SAVE REGISTERS R3 - R5 MOV #ABOMSG,R4 ; ADDRESS OF ABORT MESSAGE CALL WRITE ; AND WRITE IT ; Common subroutine to write the file name. WRTFIL: MOV #FILNAM,R4 ; ADDRESS OF FILE NAME CALL WRITE ; WRITE IT RETURN .END