! ----- GET_USER_ACTION.FUN ----- ! ! ----- SUBROUTINE TO GET USER'S DESIRED MAIN PROGRAM ACTION ----- ! ! ---------- PASSED: ---------- ! ! ----- BACKWARDS = TRUE if we're moving backwards thru prompts ! ----- HELD_DIVS_CTR = Count of held MASTER_div identifiers ! ----- HELD_DBS_CTR = Count of held MASTER_nnn identifiers ! ----- PRIVILEGED = TRUE if user has SETPRV privilege ! ----- FLAGS(0%) = User's SYSUAF Login Flags ! ----- PLEASE_TRY_AGAIN = "Please Try Again" error message ! ! ---------- RETURNED: ---------- ! ! ----- ACTION_INDEX = Index into USER_ACTIONS() array ! ----- corresponding to the user-entered program ! ----- action (ACTION_INDEX is -1 to exit ! ----- program) ! ----- ACTION_SEQ = Next User Input Sequence routine (always 1) ! ----- BACKWARDS = TRUE if we're moving backwards thru prompts ! ----- COPY_USERS_ACCOUNT is always set to FALSE ! ----- NODE_COUNTER is always set to zero ! ----- DEBUG_MODE = TRUE if Debug Mode was enabled ! ! ----- Last Change 07/13/93 by Brian Lomasky ----- ! SUB GET_USER_ACTION %INCLUDE "NUSER.INC" DECLARE WORD RECORD_FOUND ! TRUE IF MATCHING RECORD FOUND DECLARE LONG TEMP ! TEMPORARY LONGWORD VARIABLE DECLARE STRING TEMP_STRING ! TEMPORARY STRING VARIABLE DECLARE WORD VALID_ENTRY ! TRUE IF VALID ENTRY ACTION_INDEX = -1% ! ASSUME NORMAL END OF PROGRAM BACKWARDS = FALSE ! NOT MOVING BACK THRU PROMPTS PRINT VALID_ENTRY = FALSE WHILE NOT VALID_ENTRY RECORD_FOUND = TRUE WHEN ERROR IN IF HELD_DIVS_CTR <> 0% OR HELD_DBS_CTR & <> 0% OR PRIVILEGED THEN ! ----- FOR EACH USER ACTION: ----- TEMP = 0% WHILE TEMP < USER_ACTION_CTR TEMP = TEMP + 1% SELECT USER_ACTIONS(TEMP) CASE "Q", "Z" IF NOT PRIVILEGED THEN ITERATE END IF END SELECT PRINT TRM$(USER_DESCS(TEMP)) NEXT ELSE PRINT " Type S to change" + & " your own password" + & " on all of the cluster nodes," END IF LINPUT #98%, & " or type B (or press Control/Z) to exit program: ";& TEMP_STRING USE RECORD_FOUND = FALSE CONTINUE END WHEN EXIT SUB IF NOT RECORD_FOUND ! ----- UPPERCASE AND DISCARD ANY GARBAGE CHARS ----- TEMP_STRING = EDIT$(TEMP_STRING, 38%) EXIT SUB IF TEMP_STRING = "B" IF TEMP_STRING = "DEBUG" THEN DEBUG_MODE = TRUE PRINT PRINT "DEBUG>Debug Mode On" PRINT ITERATE END IF TEMP_STRING = "A" IF LEN(TEMP_STRING) = 0% ! ----- CHECK FOR A MATCHING USER ACTION ----- TEMP = 0% WHILE TEMP < USER_ACTION_CTR TEMP = TEMP + 1% IF USER_ACTIONS(TEMP) = TEMP_STRING THEN ACTION_INDEX = TEMP END IF NEXT ! ----- SEE IF A PRIVILEGED OPTION WAS SELECTED ----- IF TEMP_STRING = "Q" OR TEMP_STRING = "Z" THEN IF NOT PRIVILEGED THEN ACTION_INDEX = -1% END IF END IF IF TEMP_STRING = "S" THEN ! ----- SEE IF "SET PASSWORD" IS DISABLED ----- IF (FLAGS(0%) AND 4%) <> 0% THEN PRINT PRINT "Error - You can not" + & " change a locked" + & " password" + & TRM$(PLEASE_TRY_AGAIN) PRINT ITERATE END IF ! ----- SEE IF GENERATED PASSWORDS ARE ----- ! ----- REQUIRED ----- IF (FLAGS(1%) AND 1%) <> 0% THEN PRINT PRINT "Error - You can not" + & " change generated" + & " passwords" + & TRM$(PLEASE_TRY_AGAIN) PRINT ITERATE END IF ELSE IF HELD_DIVS_CTR = 0% AND HELD_DBS_CTR & = 0% AND NOT PRIVILEGED THEN ACTION_INDEX = -1% END IF END IF ! ----- SEE IF AN INVALID RESPONSE WAS ENTERED ----- IF ACTION_INDEX = -1% THEN PRINT PRINT "Error - Invalid response" + & TRM$(PLEASE_TRY_AGAIN) PRINT ITERATE END IF VALID_ENTRY = TRUE NEXT ACTION_SEQ = 1% ! SET TO PROMPT FOR FIRST INPUT COPY_USERS_ACCOUNT = FALSE ! ASSUME NOT COPYING ACCOUNT NODE_COUNTER = 0% ! INIT COUNT OF NODES END SUB