JOHNC%CAD2.DECnet@ge-crd.arpa (04/22/87)
I am trying to determine from within a Fortran program whether or not the
user has enabled echo, ie $SET TERM/ECHO. I assign a channel to the terminal
and do an IO$SENSEMODE QIO. This returns 3 bytes of terminal characteristics,
one bit of which should be set to 1 if the device is set /NOECHO. The mask
TT$M_NOECHO has all but the correct bit (bit 2) set to 0. (ref p 8-21 and
8-45 IO User's Guide, pt 1)
Here's the relevant part of the code:
implicit none
parameter p1size = 8 !size of qiow status buffer
integer*4 IOSBL(2)
INTEGER*2 CHANNEL,IOSB(4),P1BUF(4)
INTEGER*4 SYS$QIOW,RETCODE,SYS$ASSIGN
EQUIVALENCE (IOSB,IOSBL)
include '($ttdef)'
include '($ssdef)'
include '($iodef)'
.
.
.
RETCODE = SYS$ASSIGN('TT',CHANNEL,,)
(check return code for SS$_NORMAL)
RETCODE = SYS$QIOW(,%VAL(CHANNEL),%VAL(IO$_SENSEMODE),IOSB,,,
1 %REF(P1BUF),%VAL(P1SIZE),,,,)
(check return code for SS$_NORMAL)
print '(1x,z8.8/1x,z8.8)', iosbl(1),iosbl(2)
if ((iosbl(2) .and. tt$m_noecho) .eq. 0) then
print *, 'echo is on'
else
print *, 'echo is off'
endif
.
.
.
This code always returns the same values for IOSBL, regardless of whether
the terminal has been set /echo or /noecho.
What am I doing wrong? Any hints will be appreciated.
------------------------------------------------------------------------------
John Child
"Hack, hack, hack. Don't you ever do anything General Electric
but play with the computer?" Aircraft Engines
- a loved one Lynn, MAjkw@a.UUCP (Jay Wooten) (04/24/87)
> if ((iosbl(2) .and. tt$m_noecho) .eq. 0) then
^^^^^^^^
You are looking in the wrong place -- the terminal characteristic
info is in the 2nd longword of the P1 buffer, not in the IOSB.