PROGRAM SCREEN C C Routine to scan a list of terminals to determine if they C are logged in. This is done using the Get Command Interpreter C Information directive. When using this directive with a specified C terminal, it returns the name of the CLI, information about the C CLI, name of the task serving as CLI, Terminals U.CW2, Terminals C protection UIC, Terminals current UIC, and the CLI default prompt C string. C C This information can be used (as it is done here) to handling the C screens in a clean manner. This task will run at 1 minute intervals C and will erase the screens of all VT100's, VT-52's, and any other C terminal type specified during off hours only if the terminal is C not being used (ie. logged in). During working hours, the screens C will be displaying the current time and the number of users on the C system. The cursor will be left so that a new user can easily logon C without a messy display. The display message will walk across the C screen. This will prevent the burn-in of one message, C even if on only during working hours. C C ** COMPILE and Task build commands ** C C FORTRAN/F77 SCREEN/TRACEBACK:NONE C SCREEN/PR:0=SCREEN C LB:[1,24]CHSLIB/LB C / C UNITS=1 C ACTFIL=1 C SUPLIB=FCSFSL:SV C // C PARAMETER (MAXTRM="62) C IMPLICIT INTEGER (A-Z) DIMENSION INFO(6),USERS(MAXTRM),DPB(6),ISB(2) LOGICAL WRKHRS,WORKIN BYTE VT100M(40),VT52M(40),VC404M(40),TT(5),ESC,CTRLX,CRB CHARACTER*75 MESS CHARACTER TIMES*8,DATES*9,CR,LF EQUIVALENCE (INFO(6),UCW2) C PARAMETER (TTDEV=1,U2LOG="400,VT100=13,VT2XX=30,VT52=9,VC404=128) PARAMETER (IOWBT="500) PARAMETER (CTRLX="30,ESC="33,CRB="15) C DATA CR,LF/"15,"12/ DATA TT/'T','T','0','0',':'/ DATA VT100M/ESC,'<',CRB,ESC,'[','?','6','l',CRB,ESC,'[','2','J', $ CRB,ESC,'[','?','4','l',CRB,ESC,'[','?','8','h', $ CRB,ESC,'[','?','7','h',CRB,ESC,'[','?','5','l',3*0/ DATA VT1LEN/37/ DATA VT52M/ESC,'H',CRB,ESC,'J',35*0/ DATA VT5LEN/5/ DATA VC404M/CTRLX,39*0/ DATA VC4LEN/20/ DATA UNTIDX,TIMIDX,DATIDX,USRIDX/4,23,29,62/ C MESS(1:1) = CR MESS(2:22) = 'TTnn: is available. ' MESS(23:39) = 'hh:mm dd-mmm-yy ' MESS(40:63) = 'No. users on system = nn' MESLEN = 63 NUSERS = 0 NOFF = 0 C DO 10 UNIT=1,MAXTRM CALL GETCII(INFO,12,,TT,UNIT,IDS) ! Get the info C C Build up logged off list C IF (IAND(UCW2,U2LOG).EQ.0) THEN NUSERS = NUSERS+1 ! Bump number of users ELSE NOFF = NOFF+1 USERS(NOFF) = UNIT ! Bump number of non-users ENDIF 10 CONTINUE C C Check if time is during working hours C WORKIN = WRKHRS(DUM) ! Check if workhours CALL DATE(DATES) CALL TIME(TIMES) MESS(MESLEN+1:MESLEN+1) = CR MESS(MESLEN+2:MESLEN+2) = LF MESS(MESLEN+3:MESLEN+3) = '>' MESS(TIMIDX:TIMIDX+4) = TIMES(1:5) MESS(DATIDX:DATIDX+8) = DATES ENCODE (2,11,MESS(USRIDX:USRIDX+1)) NUSERS 11 FORMAT (I2) MESLEN = MESLEN+3 C C Want to have the display "walk" across the top, use the time C as the driver. C CALL ITIME(HR,MIN,SEC) ! Get current minute # NSPACS = MOD(MIN,10) ! Number of leading blanks MESS(NSPACS+2:MESLEN+NSPACS) = MESS(2:MESLEN) MESS(2:NSPACS+1) = ' ' MESLEN = MESLEN+NSPACS MESS = MESS(1:MESLEN) C C Loop through the logged off terminals C DO 25 I=1,NOFF C C Determine the type of terminal that is logged off C ENCODE (2,16,TT(3)) USERS(I) ! Get the terminal assigned 16 FORMAT (O2.2) CALL ASSIGN(TTDEV,TT,5) TTY = TTYPE(TTDEV) C C Send the appropriate codes to the terminals, just erase if C off hours, time, date, number of users etc. if working hours C IF (TTY.EQ.VT100.OR.TTY.EQ.VT2XX) THEN CALL GETADR(DPB,VT100M) ! Set up for the I/O DPB(2) = VT1LEN ELSEIF (TTY.EQ.VT52) THEN CALL GETADR(DPB,VT52M) DPB(2) = VT5LEN ELSEIF (TTY.EQ.VC404) THEN CALL GETADR(DPB,VC404M) DPB(2) = VC4LEN ELSE GO TO 25 ENDIF CALL WTQIO(IOWBT,TTDEV,1,,ISB,DPB) ! Write the erase line IF (WORKIN) THEN ENCODE(2,16,MESS(UNTIDX+NSPACS:UNTIDX+1+NSPACS)) USERS(I) CALL GETADR(DPB,MESS) DPB(2) = MESLEN CALL WTQIO(IOWBT,TTDEV,1,,ISB,DPB) ENDIF CLOSE (UNIT=TTDEV) 25 CONTINUE C C That does it! C END LOGICAL FUNCTION WRKHRS(DUM) C C Routine to return a logical *TRUE* if current time is during C working hours. *FALSE* if not. C C The weekday count is determined from the number of days from C January 1,1983 which was a Saturday. C IMPLICIT INTEGER (A-Z) REAL TIM C NDAYS = 4 ! Offset for Saturday, January 1, 1983 CALL IDATE(MON,DAY,YEAR) ! Get current year C C Loop through past years C DO 10 I=83,YEAR-1 IF (MOD(I,4).EQ.0) THEN NDAYS = NDAYS+366 ELSE NDAYS = NDAYS+365 ENDIF 10 CONTINUE CALL JULIAN(I) ! Get day count for this year NDAYS = NDAYS+I WEKDAY = MOD(NDAYS,7)+1 WRKHRS = WEKDAY.LE.5 ! Numbering starts at 1 for Monday. C C If work day, check for work hours (0800-1600 here). C IF (WRKHRS) THEN CALL ITIME(HR,MIN,SEC) WRKHRS = HR.GE.8.AND.HR.LT.16 ! 0800 to 1600 ENDIF RETURN END INTEGER FUNCTION TTYPE(LUN) C C Routine to return the terminal type of the terminal that C is assigned to the specified LUN. What is returned is C actually a terminal type number, which is one of the C following: C C 0 Unknown type (Tektronix's, etc.) C 1 ASR33 C 2 KSR33 C 3 ASR35 C 4 LA30S C 5 LA30P C 6 LA36 C 7 VT05 C 8 VT50 C 9 VT52 C 10 VT55 C 11 VT61 C 12 LA180S C 13 VT100 C 14 LA120 C 15 undefined - don't set a terminal to this C 16 LA12 C 17 LA100 C 18 LA34 C 19 LA38 C 20 VT101 C 21 VT102 C 22 VT105 C 23 VT125 C 24 VT131 C 25 VT132 C 30 VT2XX C C Numbers 0-131 are reserved for DEC above. Below is open to the user. C C 128 VC404 C C Note: These terminal types are correctly returned only when C the system is aware of the terminal type (ie. not unknown) C by means of the SET /TERM= command. C INTEGER LUN,DPB(2),ISB(2) BYTE CMD(2) CALL GETADR(DPB,CMD) DPB(2) = 2 CMD(1) = "10 CALL WTQIO("2560,LUN,1,,ISB,DPB) ! SF.GMC get multiple char. TTYPE = CMD(2) IF (TTYPE.LT.0) TTYPE=TTYPE+256 RETURN END