.;	*****************************************************************
.;	*                                                               *
.;	*                       I N U S E . C M D                       *
.;	*                                                               *
.;	*                         VERSION  2.25                         *
.;	*								*
.;	*                          WRITTEN  BY                          *
.;	*                                                               *
.;	*                     PATRICK MICHAEL BROMLEY                   *
.;	*                     ARNOLD SCOTT DE LARISCH                   *
.;      *                       ELIZABETH C. ROMAN                      *
.;	*                                                               *
.;      *                   Florida Atlantic University                 *
.;      *                      Boca Raton, FL  33431                    *
.;      *                                                               *
.;	*       THIS COMMAND PROCEDURE WAS WRITTEN WITH THE INTENT      *
.;	*       TO ALLOW A PERSON TO SAFELY WALK AWAY FROM THEIR        *
.;	*       TERMINAL FOR A SHORT TIME WITHOUT HAVING TO LOGOUT.     *
.;	*                                                               *
.;	*****************************************************************
.;
.;	HISTORY OF MODIFICATIONS
.;
.;	PMB113085	START OF VERSION 1.0
.;	ASDL120285	START OF VERSION 2.0
.;				ADDED LOTS OF ANSI BELLS AND WHISTLES
.;				PROVIDE A VISUAL COUNTDOWN OF TIME REMAINING
.;				PRIOR TO LOGOUT.
.;	ASDL010286	ADDED SUPPORT FOR NOECHO ON PASSWORD PROMPT
.;			FIXED CONTROL-Z FROM SPEEDING THE COUNTDOWN
.;			ALLOWED EXIT FROM PASSWORD PROMPT
.;	ASDL031086	DISPLAY USER NAME INSTEAD OF UIC
.;
.;	ASDL032286	START OF VERSION 2.1
.;			DETERMINES TERMINAL TYPE AND USES APPROPRIATE CONTROL
.;			SEQUENCES FOR SUCH.
.;
.;	ECR062586	START OF VERSION 2.2
.;			LETS THE USER KNOW HOW MANY BAD PASSWORDS HAVE BEEN
.;			ENTERED
.;			EXPLANATION OF THIS FILE TO A USER JUST LOGGING INTO
.;			IT AS WELL AS EXPLAINING THE PASSWORD ENTRY BY THE USER
.;	
.;	ASDL062786	START OF VERSION 2.21
.;			FIXED PROBLEM WITH VERSION 2.2 NOT SLAVING TERMINAL
.;			AVOIDED DELAY ON EXIT IF NO INCORRECT PASSWORD ENTERED
.;			MINOR CLEAN UP OF DIRECT CURSOR ADDRESSING
.;
.;	ASDL072886	START OF VERSION 2.22
.;			FIXED PROBLEM OF NULL PASSWORD
.;
.;	ASDL121586	START OF VERSION 2.23
.;			ALLOWS PRIVILEGED USER TO SET MAXIMUM NUMBER OF MIN
.;			(UP TO 99)
.;
.;	ASDL121786	START OF VERSION 2.231
.;			IT WAS BROUGHT TO MY ATTENTION THAT SOME (FOOLISH)
.;			PERSON WOULD TRY TO PUT A ZERO IN FOR THE AMOUNT
.;			OF TIME, THIS PROBLEM HAS BEEN FIXED. THANX LWM
.;
.;	ASDL010687	START OF VERSION 2.24
.;			FINALLY FIXED THE PROBLEM WITH BREAK
.;			(HA HA HA, GOT YA L.W.M.)
.;
.;	ASDL012787	START OF VERSION 2.25
.;			MODIFIED ESC STRINGS TO BE VARIABLES
.;			MODIFIED BELL CHARACTERS TO BE VARIABLES
.;			INFORMATION SCREEN INDICATED MINUTES FROM VARIABLES
.;

	.ENABLE SUBSTITUTION
	.ENABLE CONTROL-Z
	.ENABLE QUIET
	.DISABLE LOWERCASE
	.DISABLE DISPLAY
	.SETN ASCBEL 7						!ASDL012787
	.SETN ASCESC 33						!ASDL012787
	.SETS ESC "'ASCESC%V'"					!ASDL012787
	.SETS BEL "'ASCBEL%V'"					!ASDL012787
	.SETS CSI ESC+"["					!ASDL012787
	.SETS BEL2 BEL+BEL					!ASDL012787
	.SETS BEL3 BEL+BEL2					!ASDL012787
	.ENABLE DECIMAL						!ASDL121586
	.SETN MINLO 10						!ASDL121586
	.IFT <PRIVIL> .GOSUB 1010				!ASDL121586
	.PARSE <ACCOUN> "," NAME BULL
	.TEST NAME
	.SETS FIRST NAME[<STRLEN>-1:*]
	.SETS LAST NAME[1:<STRLEN>-1]
	.SETS FULNAM FIRST+". "+LAST
	.SETN BADP 0						!ECR062586-1
	.SETF ANSI
	.DISABLE DECIMAL
	.IF <TITYPE> EQ 11 .GOTO VT52OK
	.SETT ANSI
	.IF <TITYPE> EQ 15 .GOTO ANSIOK
	.IF <TITYPE> GT 24 .GOTO ANSIOK
	.GOTO NOTSUP
.ANSIOK:
	.ENABLE DECIMAL
	.OPEN TI:
	.SETF DCL
	.IF <CLI> = "DCL" .SETT DCL
	.IFT DCL SET /MCR
	SET /SLAVE=TI:						!ASDL062886
	CLR
	.DATA           WELCOME TO THE INUSE COMMAND FILE!!
	.DATA
	.DATA THIS INUSE FILE ALLOWS YOU TO RESERVE YOUR TERMINAL FOR 'MINLO'
	.DATA MINUTES WITHOUT LOSING YOUR PLACE AT THE TERMINAL.
	.DATA ENTER ANY PASSWORD, WHICH DOES NOT HAVE TO BE THE SAME
	.DATA AS YOUR ACCOUNT PASSWORD. WHEN YOU RE-ENTER THE CORRECT PASSWORD,
	.DATA YOU CAN REACCESS YOUR ACCOUNT.  IF YOU DO NOT DO THIS WITHIN
	.DATA 'MINLO' MINUTES, YOU WILL BE LOGGED OFF.
.100:
	SET /NOECHO=TI:
	.ASKS PAS1 'CSI'12;1HENTER PASSWORD >>> 
	.IFT <EOF> .GOTO PASOK
	.TEST PAS1
	.IF <STRLEN> < 1 .GOTO TOSHRT
	.ASKS PAS2 'CSI'14;1HPASSWORD VERIFICATION >>> 
	.IFT <EOF> .GOTO PASOK
	.IF PAS2 = PAS1 .GOTO 101
	.DATA
	.DATA 'CSI'17;1HPASSWORDS DO NOT MATCH --- TRY AGAIN'BEL3'
	.DELAY 5S
.;								!ASDL062786
	.DATA 'CSI'17;1H'CSI'K
	.GOTO 100
.;								!ASDL072886
.TOSHRT:.DATA 'CSI'17;1HPASSWORD TOO SHORT --- TRY AGAIN'BEL3'
	.DELAY 5S
	.DATA 'CSI'17;1H'CSI'K
	.GOTO 100
.101:	CLR
	.SETN N MINLO
	.DATA
	.DATA 'CSI'2;1H'CSI'1m'ESC'#6'ESC'#3T H I S   T E R M I N A L'CSI'0m
	.DATA 'CSI'3;1H'CSI'1m'ESC'#6'ESC'#4T H I S   T E R M I N A L'CSI'0m
	.DATA 'CSI'5;1H'CSI'1m'ESC'#6'ESC'#3I S    I N   U S E    B Y'CSI'0m
	.DATA 'CSI'6;1H'CSI'1m'ESC'#6'ESC'#4I S    I N   U S E    B Y'CSI'0m
	.DATA 'CSI'8;1H'CSI'1m'ESC'#6'ESC'#3U S E R :    'FULNAM''CSI'0m
	.DATA 'CSI'9;1H'CSI'1m'ESC'#6'ESC'#4U S E R :    'FULNAM''CSI'0m
	.DATA 'CSI'14;1HIF CORRECT PASSWORD IS NOT TYPED IN    MINUTES YOU WILL BE LOGGED OFF'CSI'0m
.20:	.IF N < 10  .DATA 'CSI'14;37H'CSI'5m 'N''CSI'0m
	.IF N >= 10 .DATA 'CSI'14;37H'CSI'5m'N''CSI'0m
	.ONERR 20
	.ASKS [:::1M] PASON 'CSI'16;1HENTER PASSWORD TO GET BACK ON THE SYSTEM >>> 
	.IFT <EOF> .GOTO 20
	.DEC N
        .IF N = 0 .GOTO BYEBYE
	.IF PASON = PAS1 .GOTO PASOK
	.IFT <TIMOUT> .GOTO 20
	.DATA 'BEL3'
	.DATA 'CSI'18;1H'CSI'5;1mB A D    P A S S W O R D --  Please Try Again'CSI'0m
	.INC BADP						!ECR062586-1
       	.DATA 
	.DELAY 3S
	.DATA 'CSI'18;1H'CSI'2K
       	.SETN N MINLO
	.GOTO 20

.PASOK:	SET /NOSLAVE=TI:
	SET /ECHO=TI:
	CLR
	.IFT DCL SET /DCL=TI:
.;								!ECR062586-2
	.IF BADP > 0 .DATA 'BEL2'INUSE -- *WARNING* 'BADP' BAD PASSWORDS HAVE BEEN LOGGED
	.IF BADP = 0 CLR
	.CLOSE
	.EXIT

.BYEBYE:.DATA 'CSI'18;1H'CSI'5;1mI N U S E -- TIME EXCEEDED ... NOW LOGGING YOU OFF'CSI'0m
	SET /ECHO=TI:
	SET /NOSLAVE=TI:
	.CLOSE
	BYE

.NOTSUP:
	.OPEN TI:
	.DATA 
	.DATA SORRY, INUSE CAN ONLY BE RUN ON VT52 OR ANSI STANDARD TERMINALS
	.DATA 
	.CLOSE
	.EXIT

.VT52OK:CLR
	.ENABLE DECIMAL
	.OPEN TI:
	.SETF DCL
	.IF <CLI> = "DCL" .SETT DCL
	.IFT DCL SET /MCR
	SET /SLAVE=TI:						!ASDL062786
	.DATA              WELCOME TO THE INUSE FILE!!
	.DATA
	.DATA THIS INUSE FILE ALLOWS YOU TO RESERVE YOUR TERMINAL FOR 'MINLO'
	.DATA MINUTES WITHOUT LOSING YOUR PLACE AT THE TERMINAL.
	.DATA ENTER ANY PASSWORD, WHICH DOES NOT HAVE TO BE THE SAME
	.DATA AS YOUR ACCOUNT PASSWORD. WHEN YOU RE-ENTER THE CORRECT PASSWORD,
	.DATA YOU CAN REACCESS YOUR ACCOUNT.  IF YOU DO NOT DO THIS WITHIN
	.DATA 'MINLO' MINUTES, YOU WILL BE LOGGED OFF.
.500:
	SET /NOECHO=TI:
.;								!ASDL062886
	.ASKS PAS1 'ESC'Y+ ENTER PASSWORD >>> 
	.IFT <EOF> .GOTO PASOK
.;								!ASDL062886
	.ASKS PAS2 'ESC'Y- PASSWORD VERIFICATION >>> 
	.IFT <EOF> .GOTO PASOK
	.IF PAS2 = PAS1 .GOTO 501
	.DATA
	.DATA 'ESC'Y/ PASSWORDS DO NOT MATCH --- TRY AGAIN'BEL3'
	.DELAY 5S
	.DATA 'ESC'Y/ 'ESC'K
	.GOTO 500
.501:	CLR
 	.SETN N MINLO
	.DATA
	.DATA 'ESC'Y" T H I S   T E R M I N A L
	.DATA 'ESC'Y$ I S    I N  U S E    B Y
	.DATA 'ESC'Y& U S E R :    'FULNAM'
	.DATA 'ESC'Y) IF CORRECT PASSWORD IS NOT TYPED IN    MINUTES YOU WILL BE LOGGED OFF
.520:	.IF N < 10  .DATA 'ESC'Y)D 'N'
	.IF N >= 10 .DATA 'ESC'Y)D'N'
	.ONERR 520						!ASDL010687
	.ASKS [:::1M] PASON 'ESC'Y+ ENTER PASSWORD TO GET BACK ON THE SYSTEM >>> 
	.IFT <EOF> .GOTO 520
	.DEC N
        .IF N = 0 .GOTO BYE52
	.IF PASON = PAS1 .GOTO PASOK
	.IFT <TIMOUT> .GOTO 520
	.DATA 'BEL3'
	.DATA 'ESC'Y. B A D    P A S S W O R D --  Please Try Again
	.INC BADP						!ECR062586-1
	.DATA 
	.DELAY 3S
	.DATA 'ESC'Y. 'ESC'K
	.SETN N MINLO
	.GOTO 520


.BYE52:.DATA 'ESC'Y2 I N U S E -- TIME EXCEEDED ... NOW LOGGING YOU OFF
.;								!ECR062586-2
	.IF BADP > 0 .DATA 'BEL2'INUSE -- *WARNING* 'BADP' BAD PASSWORDS HAVE BEEN LOGGED
	.IF BADP = 0 CLR					!ASDL062786
	SET /ECHO=TI:
	SET /NOSLAVE=TI:
	.CLOSE
	BYE
.;
.; This allows privileged users to choose the length of the INUSE protection!
.;
.1010: .ONERR 1011						!ASDL121586
	.IF P1 = "" .RETURN					!ASDL121586
	.TEST P1						!ASDL121586
	.IFF <NUMBER> .RETURN					!ASDL121586
	.IF <STRLEN> > 2 .RETURN				!ASDL121586
	.SETN MINLO 'P1'					!ASDL121586
	.IF MINLO < 10 .SETN MINLO 10				!ASDL121786
.1011:	.RETURN							!ASDL121586
