.title noecho - subroutines to control the tty $ttdef $tt2def $fabdef GLOBAL $namdef GLOBAL p1 = 4 .psect data,rd,wrt,noshr,gbl ttchan: .blkw 1 ttnam: .ascid /SYS$COMMAND:/ oldchar: .blkl 3 ; old tt characteristics newchar: .blkl 3 ; new tt characteristics ehcb: .blkl 1 .address myexit .long 1 .address status status: .blkl 1 .subtitle noecho - sets up some characteristics .psect code,rd,nowrt,shr .entry noecho,^m<> .enabl lsb tstl oldchar ; see if we've assigned a channel beql 5$ ; no, so do the assigning brw 100$ 5$: $assign_s chan=ttchan,- ; assign a channel to the terminal devnam=ttnam blbc r0,exit ; get out on error $qiow_s chan=ttchan,- ; read the current characteristics func=#io$_sensemode,- p1=oldchar,- p2=#12 blbc r0,exit ; get out on error cmpb #dc$_term,oldchar ; make sure this is a terminal bneq exit ; forget it, if its not a terminal movl oldchar,newchar ; copy the characteristics movl oldchar+4,newchar+4 movl oldchar+8,newchar+8 $dclexh_s ehcb ; declare an exit handler blbs r0,10$ ; go on if no errors exit: $exit_s 10$: bisl #,- newchar+4 ; make sure proper bits are set bicl #,- newchar+4 ; and these are cleared bicl #,- newchar+8 ; and this one too 100$: tstl p1(ap) ; see if this is set noecho or clear bneq 120$ ; reset noecho if false $qiow_s chan=ttchan,- ; set the new characteristics func=#io$_setmode,- p1=oldchar,- p2=#12 blbc r0,exit ; get out on error ret 120$: $qiow_s chan=ttchan,- ; set the new characteristics func=#io$_setmode,- p1=newchar,- p2=#12 blbc r0,exit ; get out on error ret .entry myexit,^m<> $qiow_s chan=ttchan,- ; set the new characteristics func=#io$_setmode,- p1=oldchar,- p2=#12 ret .end