.TITLE LOGOUT Logout program .NLIST BEX .ENABL LC ; ; Logout program ; ; This program is used to log a user off the system, either as the result ; of an explicit call or implicitly by a chain from another program. An ; explicit call causes the default directory to be reset and the user (if any) ; to be logged off the system. An implicit call causes the default directory ; to be reset. In addition, if no user is logged on the process is released. ; ; Conditional assembly switches ; CS.EOT = 0 ;send eot on disconnect (1=yes, 0=no) ; ; External symbols ; .GLOBL LOGOUT,CONECT ;user routines ; ; Entry symbols ; .GLOBL PRBYT ;char i/o routines ; ; System definitions ; .ASECT .MCALL .COM,.CHR,.PSA,.CLP,.IOD,.FLG,.LGD ;dcnlib definitions .MCALL .MSG ;dcnlib macros .MCALL .GVAL,.EXIT,.LOOKU,.TTYOU ;rt-11 macros .MCALL CALL,FORMAT ;netlib definitions .COM ;common definitions .CHR ;ascii character codes .PSA ;supervisor psa and par definitions .CLP ;rt-11 monitor area definitions .IOD ;emulator monitor area extension .FLG ;flag bit definitions .LGD ;define login file entry ; ; Module definitions ; ; Procedure segment ; .PSECT $BOSI,RO,I ; ; Logout program ; START: .GVAL #ARGBLK,#CONFIG ;fetch configuration word MOV R0,CONWRD BIT #FUZZY$,CONWRD ;is this a fuzzball BEQ 3$ ;branch if no MOV @#SYSPTR,R5 ;yes. rebuild addressability BIT #CHAIN$,@#JSW ;is this explicit call BEQ 1$ ;branch if yes CALL CONECT,#0,#0,#0 ;implicit call. reset default directory BITB #AF.LOG,IOHCAP(R5) ;is user logged on BNE 2$ ;branch if yes MOV IOHPAR(R5),R3 ;no. release process BIC #140000,PAROPT(R3) BR 2$ ; 1$: CALL LOGOUT,#PROFIL ;explicit call. log user off BIC #CLSBIT,IOHFLG(R5) ;close telnet connection ASL R0 ;output message MOV R0,R2 FORMAT USETXT(R2),#PROFIL ;logout message .IF NE,CS.EOT ;conditional assembly MOV #NUL,R0 ;send 3 nul to flush uart buffers JSR PC,PRBYT MOV #NUL,R0 JSR PC,PRBYT MOV #NUL,R0 JSR PC,PRBYT MOV #EOT,R0 ;send eot to hang up JSR PC,PRBYT .ENDC TST R2 BNE 2$ ;branch if error .MSG <#^RLOG> ;log info message FORMAT #USE99,#PROFIL 2$: .MSG <#^RTT > ;switch to virtual terminal and flush buffer 3$: .EXIT ; ; Subroutine to write byte ; R0 = byte ; PRBYT: .TTYOU ;put byte RTS PC ; ; Data segments ; .PSECT $BOSD,RO,D ;read-only data ; ; User/asg subroutine error codes ; USETXT: .WORD USE00 ;0 logout message .WORD USE02 ;1 directory not found .WORD USE03 ;2 login file error .WORD USE04 ;3 login incorrect .WORD USE05 ;4 not logged in ; ; Text strings ; USE99: .ASCIZ '?LOGOUT-I-User ^A'' logout complete' USE00: .ASCIZ 'Logout ^A'' ^LD ^LT' USE02: .ASCIZ '?LOGOUT-F-Directory not found' USE03: .ASCIZ '?LOGOUT-F-Login file error' USE04: .ASCIZ '?LOGOUT-F-Login incorrect' USE05: .ASCIZ '?LOGOUT-F-Not logged in' .EVEN ; .PSECT $DATA,RW,I ;read/write data ; CONWRD: .BLKW 1 ;configuration word ARGBLK: .BLKW 5 ;rt-11 argument block PROFIL: .BLKB LF.LEN ;login profile .EVEN ; .END START