! ----- READ_USER_ACTIONS.FUN ----- ! ! ----- SUBROUTINE TO READ IN ALL POSSIBLE USER ACTIONS ----- ! ! ---------- PASSED: ---------- ! ! ----- DEBUG_MODE = TRUE if debug mode is enabled ! ! ---------- RETURNED: ---------- ! ! ----- ACCOUNT_DESC = Default string for Account Name ! ----- ACCOUNT_LEN_MAX = Max length of account name field ! ----- ACCOUNT_LEN_MIN = Min length of account name field ! ----- ACCOUNT_NUMERIC = Whether Account Name field is numeric ! ----- DBMS_EXISTS = TRUE if DBMS application is installed ! ----- DBMS_PREFIX = 3-char identifier prefix for the database ! ----- product ! ----- DBMS_PRODUCT = Description of database product ! ----- DEFAULT_RESTRICTED = Default [Non-]Restricted response ! ----- DISPWDHIS = Whether to set the DISPWDHIS login flag when ! ----- adding a new user ! ----- DUPLICATE_NODES = List of nodes to duplicate data ! ----- between ! ----- FOUR_GL = Name of any installed 4GL ! ----- FOUR_GL_EXISTS = TRUE if 4GL is installed ! ----- FOUR_GL_PREFIX = 4-char identifier prefix for the 4GL ! ----- LGICMD_NON_RESTRICTED = Login Command Procedure for ! ----- Non-Restricted users ! ----- LGICMD_RESTRICTED = Login Command Procedure for ! ----- Restricted users ! ----- USER_ACTION_CTR = Count of user actions ! ----- USER_ACTIONS() = List of allowable user actions ! ----- USER_DESCS() = Menu description for this user action ! ----- USER_SEQS() = Count (n) of prompt sequences ! ----- USER_SEQ(, 1->n) = List of prompt sequences ! ! ----- Last Change 01/26/94 by Brian Lomasky ----- ! SUB READ_USER_ACTIONS %INCLUDE "NUSER.INC" DECLARE STRING A_SEQ ! AN EXTRACTED SEQUENCE NUMBER DECLARE STRING DBMS_LOGICAL ! LOGICAL NAME FOR DBMS DECLARE WORD ERR_FLAG ! LOCAL ERROR FLAG DECLARE STRING EXTRACTED_ACTION ! EXTRACTED USER ACTION DECLARE STRING EXTRACTED_DESC ! EXTRACTED DESCRIPTION DECLARE LONG EXTRACTED_SEQS ! COUNT OF EXTRACTED PROMPT SEQS DECLARE WORD FIRST_DESC_READ ! TRUE IF FIRST DESCRIPTION READ DECLARE STRING FOUR_GL_LOGICAL ! LOGICAL NAME FOR 4GL DECLARE STRING GRANT_DENY_DESC ! DESCRIPTION FOR GRANT/DENY OPT DECLARE LONG LOCAL_STATUS ! LOCAL SYSTEM SERVICE EXIT STAT DECLARE LONG TEMP ! TEMPORARY LONGWORD DECLARE STRING TEMP_STRING ! TEMPORARY STRING DECLARE STRING TEMP_STRING2 ! TEMPORARY STRING DECLARE STRING TRANSLATED_NAME ! LOGICAL_NAME TRANSLATION EXTERNAL LONG FUNCTION LOGICAL_NAME(STRING, & STRING) ! TRANSLATE LOGICAL NAME EXTERNAL WORD FUNCTION NUMERIC( & STRING) ! CHECK FOR NUMERIC STRING USER_ACTION_CTR = 0% ! INIT COUNT OF USER ACTIONS ERR_FLAG = FALSE ! INIT ERROR FLAG WHEN ERROR IN OPEN "TOOLS:NUSER_ACTIONS.DAT" FOR INPUT & AS FILE #99%, & SEQUENTIAL, ACCESS READ, ALLOW READ, & RECORDTYPE ANY USE IF ERR = FILE_NOT_FOUND THEN PRINT "Error - Can't find any existing" & + " TOOLS:NUSER_ACTIONS.DAT file" + BEL ERR_FLAG = TRUE CONTINUE END IF IF ERR = PROTECTION_VIOLATION THEN PRINT "You do not have the privilege" + & " to open TOOLS:NUSER_ACTIONS.DAT" + BEL ERR_FLAG = TRUE CONTINUE END IF IF ERR = CANNOT_OPEN_FILE THEN PRINT "Error - Can't open any existing" & + " TOOLS:NUSER_ACTIONS.DAT file" + BEL PRINT "VMS error status value:"; VMSSTATUS ERR_FLAG = TRUE CONTINUE END IF PRINT "VMS error status value:"; VMSSTATUS EXIT HANDLER END WHEN CALL SYS$EXIT(ERROR_WITH_NO_PUTMSG BY VALUE) IF ERR_FLAG ! ----- DEFAULT STRING FOR ACCOUNT NAME ----- ACCOUNT_DESC = "account name" ! ----- DEFAULT LENGTH OF ACCOUNT NAME FIELD ----- ACCOUNT_LEN_MIN = 0% ACCOUNT_LEN_MAX = 8% ! ----- DEFAULT NUMERIC FLAG FOR ACCOUNT NAME FIELD ----- ACCOUNT_NUMERIC = FALSE ! ----- ASSUME DBMS APPLICATION DOES NOT EXIST ----- DBMS_EXISTS = FALSE ! ----- DEFAULT LOGICAL NAME TO SEE IF DBMS APPLICATION IS ----- ! ----- INSTALLED ----- DBMS_LOGICAL = "DBMSAPPL" ! ----- DEFAULT IDENTIFIER PREFIX FOR THE DATABASE PRODUCT ----- DBMS_PREFIX = "DB_" ! ----- DEFAULT DESCRIPTION OF DATABASE PRODUCT ----- DBMS_PRODUCT = "DBMS" ! ----- DEFAULT RESPONSE FOR [NON-]RESTRICTED ----- DEFAULT_RESTRICTED = "N" ! ----- DEFAULT OF WHETHER TO SET THE DISPWDHIS LOGIN FLAG ----- ! ----- WHEN ADDING A NEW USER ----- DISPWDHIS = "N" ! ----- DEFAULT OF NO LIST OF NODES TO DUPLICATE DATA ----- ! ----- BETWEEN ----- DUPLICATE_NODES = "" ! ----- DEFAULT STRING FOR 4GL ----- FOUR_GL = "4GL" ! ----- ASSUME 4GL APPLICATION DOES NOT EXIST ----- FOUR_GL_EXISTS = FALSE ! ----- DEFAULT LOGICAL NAME TO SEE IF 4GL IS INSTALLED ----- FOUR_GL_LOGICAL = "FOURGL" ! ----- DEFAULT IDENTIFIER PREFIX FOR 4GL ----- FOUR_GL_PREFIX = "F" FIRST_DESC_READ = TRUE ! SET FOR FIRST DESCRIPTION READ GRANT_DENY_DESC = "" ! ----- DEFAULT LOGIN COMMAND PROCEDURE FOR NON-RESTRICTED ----- ! ----- USERS ----- LGICMD_NON_RESTRICTED = "LOGIN" ! ----- DEFAULT LOGIN COMMAND PROCEDURE FOR RESTRICTED ----- ! ----- USERS ----- LGICMD_RESTRICTED = "LOGIN" WHILE NOT ERR_FLAG WHEN ERROR IN LINPUT #99%, TEMP_STRING USE IF ERR = END_OF_FILE THEN ERR_FLAG = TRUE CONTINUE END IF PRINT PRINT "Unexpected BASIC Error " + & NUM1$(ERR) + " while reading" + & " TOOLS:NUSER_ACTIONS.DAT" + BEL PRINT "VMS error status value:"; VMSSTATUS EXIT HANDLER END WHEN IF NOT ERR_FLAG THEN IF USER_ACTION_CTR >= MAX_ACTIONS THEN PRINT "Error - Too many" + & " user actions found in" PRINT " TOOLS:" + & "NUSER_ACTIONS.DAT" + & " - Increase" + & " MAX_ACTIONS in" + BEL PRINT " NUSER.INC and recompile" CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF ! ----- REMOVE ANY LEADING/TRAILING SPACES ----- TEMP_STRING = EDIT$(TEMP_STRING, 136%) ! ----- SKIP ANY COMMENT LINES ----- ITERATE IF LEFT(TEMP_STRING, 1%) = "!" IF LEN(TEMP_STRING) < 5% THEN PRINT "%Bad" + & " NUSER_ACTIONS.DAT" + & " line #" + & NUM1$(USER_ACTION_CTR + & 1%) + " - Length Too" + & " Short" + BEL PRINT " for line: " + TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF IF LEFT(TEMP_STRING, 13%) = "ACCOUNT_DESC=" THEN ACCOUNT_DESC = RIGHT(TEMP_STRING, 14%) ITERATE END IF ! ----- MIN LENGTH OF ACCOUNT NAME FIELD ----- IF LEFT(TEMP_STRING, 13%) = "ACCT_LEN_MIN=" THEN TEMP_STRING = RIGHT(TEMP_STRING, 14%) IF NOT NUMERIC(TEMP_STRING) THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " ACCT_LEN_MIN value"& + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF ACCOUNT_LEN_MIN = INTEGER( & TEMP_STRING, LONG) IF ACCOUNT_LEN_MIN < 0% OR & ACCOUNT_LEN_MIN > 8% THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " ACCT_LEN_MIN range"& + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF ITERATE END IF ! ----- MAX LENGTH OF ACCOUNT NAME FIELD ----- IF LEFT(TEMP_STRING, 13%) = "ACCT_LEN_MAX=" THEN TEMP_STRING = RIGHT(TEMP_STRING, 14%) IF NOT NUMERIC(TEMP_STRING) THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " ACCT_LEN_MAX value"& + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF ACCOUNT_LEN_MAX = INTEGER( & TEMP_STRING, LONG) IF ACCOUNT_LEN_MAX < & ACCOUNT_LEN_MIN OR & ACCOUNT_LEN_MAX > 8% THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " ACCT_LEN_MAX range"& + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF ITERATE END IF ! ----- WHETHER ACCOUNT NAME FIELD MUST BE ----- ! ----- NUMERIC OR NOT ----- IF TEMP_STRING = "ACCT_NUMERIC=TRUE" THEN ACCOUNT_NUMERIC = TRUE ITERATE END IF IF TEMP_STRING = "ACCT_NUMERIC=FALSE" THEN ACCOUNT_NUMERIC = FALSE ITERATE END IF IF LEFT(TEMP_STRING, 13%) = "DBMS_LOGICAL=" THEN DBMS_LOGICAL = RIGHT(TEMP_STRING, 14%) ! ----- TRANSLATE ANY DBMS LOGICAL ----- ! ----- NAME ----- TEMP_STRING2 = TRM$(DBMS_LOGICAL) IF DEBUG_MODE THEN PRINT "DEBUG>TRANSLATE " + & TEMP_STRING2 END IF LOCAL_STATUS = LOGICAL_NAME( & TEMP_STRING2, TRANSLATED_NAME) SELECT LOCAL_STATUS CASE SS$_NOLOGNAM ! ----- DBMS APPLICATION ----- ! ----- IS NOT INSTALLED ----- DBMS_EXISTS = FALSE IF DEBUG_MODE THEN PRINT "DEBUG>NO DBMS" END IF CASE SS$_NORMAL ! ----- DBMS APPLICATION ----- ! ----- IS INSTALLED ----- DBMS_EXISTS = TRUE IF DEBUG_MODE THEN PRINT "DEBUG>IS DBMS" END IF CASE ELSE CALL LIB$STOP( & LOCAL_STATUS BY VALUE) END SELECT ITERATE END IF IF LEFT(TEMP_STRING, 12%) = "DBMS_PREFIX=" THEN DBMS_PREFIX = RIGHT(TEMP_STRING, 13%) ITERATE END IF IF LEFT(TEMP_STRING, 13%) = "DBMS_PRODUCT=" THEN DBMS_PRODUCT = RIGHT(TEMP_STRING, 14%) IF DBMS_EXISTS THEN IF DEBUG_MODE THEN PRINT "DEBUG>DBMS:" + & " GRANT_DE" + & "NY_DESC=" + & GRANT_DENY_DESC END IF IF GRANT_DENY_DESC = "" THEN GRANT_DENY_DESC & = TRM$( & DBMS_PRODUCT) ELSE GRANT_DENY_DESC & = GRANT_DENY_DESC & + " or " + & TRM$(DBMS_PRODUCT) END IF END IF ITERATE END IF IF LEFT(TEMP_STRING, 19%) = & "DEFAULT_RESTRICTED=" THEN DEFAULT_RESTRICTED = & MID(TEMP_STRING, 20%, 1%) IF DEFAULT_RESTRICTED <> "Y" & AND DEFAULT_RESTRICTED <> "N" THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " DEFAULT_RESTRICTED"& + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF ITERATE END IF IF LEFT(TEMP_STRING, 10%) = "DISPWDHIS=" THEN DISPWDHIS = MID(TEMP_STRING, 11%, 1%) IF DISPWDHIS <> "Y" AND & DISPWDHIS <> "N" THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " DISPWDHIS" + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF ITERATE END IF IF LEFT(TEMP_STRING, 16%) = "DUPLICATE_NODES=" THEN DUPLICATE_NODES = & RIGHT(TEMP_STRING, 17%) ITERATE END IF IF LEFT(TEMP_STRING, 9%) = "4GL_DESC=" THEN FOUR_GL = RIGHT(TEMP_STRING, 10%) IF FOUR_GL_EXISTS THEN IF DEBUG_MODE THEN PRINT "DEBUG>4GL:" + & " GRANT_DE" + & "NY_DESC=" + & GRANT_DENY_DESC END IF IF GRANT_DENY_DESC = "" THEN GRANT_DENY_DESC & = TRM$(FOUR_GL) ELSE GRANT_DENY_DESC & = GRANT_DENY_DESC & + " or " + & TRM$(FOUR_GL) END IF END IF ITERATE END IF IF LEFT(TEMP_STRING, 12%) = "4GL_LOGICAL=" THEN FOUR_GL_LOGICAL = & RIGHT(TEMP_STRING, 13%) ! ----- TRANSLATE ANY 4GL LOGICAL ----- ! ----- NAME ----- TEMP_STRING2 = TRM$(FOUR_GL_LOGICAL) IF DEBUG_MODE THEN PRINT "DEBUG>TRANSLATE " + & TEMP_STRING2 END IF LOCAL_STATUS = LOGICAL_NAME( & TEMP_STRING2, TRANSLATED_NAME) SELECT LOCAL_STATUS CASE SS$_NOLOGNAM ! ----- 4GL IS NOT ----- ! ----- INSTALLED ----- FOUR_GL_EXISTS = FALSE IF DEBUG_MODE THEN PRINT "DEBUG>NO 4GL" END IF CASE SS$_NORMAL ! ----- 4GL IS INSTALLED ----- FOUR_GL_EXISTS = TRUE IF DEBUG_MODE THEN PRINT "DEBUG>IS 4GL" END IF CASE ELSE CALL LIB$STOP( & LOCAL_STATUS BY VALUE) END SELECT ITERATE END IF IF LEFT(TEMP_STRING, 11%) = "4GL_PREFIX=" THEN FOUR_GL_PREFIX = RIGHT(TEMP_STRING, 12%) ITERATE END IF IF LEFT(TEMP_STRING, 22%) = & "LGICMD_NON_RESTRICTED=" THEN LGICMD_NON_RESTRICTED = & RIGHT(TEMP_STRING, 23%) ITERATE END IF IF LEFT(TEMP_STRING, 18%) = & "LGICMD_RESTRICTED=" THEN LGICMD_RESTRICTED = & RIGHT(TEMP_STRING, 19%) ITERATE END IF ! ----- PARSE AND EXTRACT ACTION LETTER ----- TEMP = POS(TEMP_STRING, ",", 1%) IF TEMP = 0% THEN PRINT "%Bad" + & " NUSER_ACTIONS.DAT" + & " line #" + & NUM1$(USER_ACTION_CTR + & 1%) + " - No 1st comma" + BEL PRINT " for line: " + TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF EXTRACTED_ACTION = LEFT(TEMP_STRING, TEMP - 1%) EXTRACTED_ACTION = "A" IF & EXTRACTED_ACTION = "" IF LEN(EXTRACTED_ACTION) <> 1% THEN PRINT "%Bad" + & " NUSER_ACTIONS.DAT" + & " line #" + & NUM1$(USER_ACTION_CTR + & 1%) + " - Bad action len" + BEL PRINT " for line: " + TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF TEMP_STRING = RIGHT(TEMP_STRING, TEMP + 1%) IF NOT DBMS_EXISTS AND NOT FOUR_GL_EXISTS THEN SELECT EXTRACTED_ACTION CASE "G", "X", "T" ITERATE END SELECT END IF IF NOT DBMS_EXISTS THEN SELECT EXTRACTED_ACTION CASE "T" ITERATE END SELECT END IF ! ----- PARSE AND EXTRACT ACTION DESC ----- TEMP = POS(TEMP_STRING, ",", 1%) IF TEMP = 0% THEN PRINT "%Bad" + & " NUSER_ACTIONS.DAT" + & " line #" + & NUM1$(USER_ACTION_CTR + & 1%) + " - No 2nd comma" + BEL PRINT " for line: " + TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF EXTRACTED_DESC = LEFT(TEMP_STRING, TEMP - 1%) TEMP_STRING = RIGHT(TEMP_STRING, TEMP + 1%) ! ----- FORMAT DESC FOR LINE ON SCREEN ----- IF DEBUG_MODE THEN PRINT "DEBUG>FORMAT DESC:" + & " GRANT_DENY_DESC=" + & GRANT_DENY_DESC END IF TEMP = POS(EXTRACTED_DESC, & "GRANT_DENY_OBJECTS", 1%) IF TEMP <> 0% THEN EXTRACTED_DESC = & LEFT(EXTRACTED_DESC, & TEMP - 1%) + & GRANT_DENY_DESC + & RIGHT(EXTRACTED_DESC, & TEMP + 18%) END IF TEMP = POS(EXTRACTED_DESC, "ACCOUNT_DESC", 1%) IF TEMP <> 0% THEN EXTRACTED_DESC = & LEFT(EXTRACTED_DESC, & TEMP - 1%) + & TRM$(ACCOUNT_DESC) + & RIGHT(EXTRACTED_DESC, & TEMP + 12%) END IF IF EXTRACTED_ACTION = "A" THEN IF FIRST_DESC_READ THEN EXTRACTED_DESC = & "Press" + & " to " & + EXTRACTED_DESC FIRST_DESC_READ = FALSE ELSE EXTRACTED_DESC = & " or press" + & " to " & + EXTRACTED_DESC END IF ELSE IF FIRST_DESC_READ THEN EXTRACTED_DESC = & "Type " + & EXTRACTED_ACTION& + " to " + & EXTRACTED_DESC FIRST_DESC_READ = FALSE ELSE EXTRACTED_DESC = & " or type " +& EXTRACTED_ACTION& + " to " + & EXTRACTED_DESC END IF END IF ! ----- PARSE AND EXTRACT ACTION SEQUENCES ----- EXTRACTED_SEQS = 0% TEMP = POS(TEMP_STRING, "|", 1%) WHILE TEMP <> 0% A_SEQ = LEFT(TEMP_STRING, TEMP - 1%) TEMP_STRING = RIGHT(TEMP_STRING,& TEMP + 1%) IF NOT NUMERIC(A_SEQ) THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " line #" + & NUM1$( & USER_ACTION_CTR & + 1%) + & " - Non-numeric"& + " user action"& + " sequence" + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF TEMP = INTEGER(A_SEQ, LONG) IF TEMP < 1% OR TEMP > MAX_SEQS THEN PRINT "%Aborting - Bad" & + " NUSER_ACTIONS.DAT" & + " line #" + & NUM1$( & USER_ACTION_CTR & + 1%) + & " - Seq out of" & + " range" + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF IF NOT DBMS_EXISTS AND NOT & FOUR_GL_EXISTS AND TEMP = 12% THEN PRINT "%Bad" + & " NUSER_ACTIONS.DAT" + & " Sequence of " + & NUM1$(TEMP) + & " due to no" + & " DBMS nor 4GL" & + " installed" + BEL PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF EXTRACTED_SEQS = EXTRACTED_SEQS + 1% IF EXTRACTED_SEQS > MAX_SEQS THEN PRINT "Error - Too many"& + " seqs found in" PRINT " TOOLS:" +& "NUSER_ACTIONS.DAT" + & " - Increase" + & " MAX_SEQS in" + BEL PRINT " " + & "NUSER.INC and" & + " recompile" PRINT " for line: " + & TEMP_STRING CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG & BY VALUE) END IF USER_SEQ(USER_ACTION_CTR + 1%, & EXTRACTED_SEQS) = TEMP TEMP = POS(TEMP_STRING, "|", 1%) NEXT USER_ACTION_CTR = USER_ACTION_CTR + 1% ! ----- STORE USER ACTION ----- USER_ACTIONS(USER_ACTION_CTR) = EXTRACTED_ACTION USER_DESCS(USER_ACTION_CTR) = EXTRACTED_DESC USER_SEQS(USER_ACTION_CTR) = EXTRACTED_SEQS END IF NEXT CLOSE #99% IF DEBUG_MODE THEN TEMP = 0% WHILE TEMP < USER_ACTION_CTR TEMP = TEMP + 1% PRINT "DEBUG>User Action Letter," + & " #Seqs=" + USER_ACTIONS(TEMP) +& " " + NUM1$(USER_SEQS(TEMP)) PRINT "DEBUG>User Desc=" + & TRM$(USER_DESCS(TEMP)) PRINT "DEBUG> User Seq="; EXTRACTED_SEQS = 0% WHILE EXTRACTED_SEQS < USER_SEQS(TEMP) EXTRACTED_SEQS = EXTRACTED_SEQS + 1% PRINT NUM1$(USER_SEQ(TEMP, & EXTRACTED_SEQS)) + " "; NEXT PRINT NEXT END IF END SUB