C+ C NAME: C AskWhat C PURPOSE: C Select entry from comma-separated list C CATEGORY: C I/O: user input C CALLING SEQUENCE: subroutine AskWhat(cPrmptIn,iC) C INPUTS: C cList character*(*) comma-separated list of choices C iC integer entry # of default item (if outside range C the first item is the default). C OUTPUTS: C iC integer entry # of selected item C (see PROCEDURE) C CALLS: C AskChar, AskWhatPrmpt, iAskWhatEntry, AskWhatEntry C SIDE EFFECTS: C > The input is NOT case-sensitive C > One space is permitted between the comma and the start of the next item C PROCEDURE: C > The return value of IC is 1 if the 1st item is selected, 2 for 2nd, etc. C > Override this default by adding an integer value preceded by the dollar C ($) sign to the prompt string. C E.g. if the prompt string is `prompt$0' then the return value of IC = 0 C if the first item is selected, etc. C > If the prompt contains a colon (':') the portion preceding the colon C (including the colon) are ignored in the selection process. C > The first item that starts with the input string is selected (i.e. only C the first few characters of an item have to be entered. C MODIFICATION HISTORY: C SEP-1994, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- character cPrmptIn*(*) integer iC character cPrmpt*60 character cWhatIn*20 character cWhat*20 call AskWhatPrmpt(iC,L1,L2,cPrmptIn,cPrmpt,cWhatIn) iP = 0 ! Prompt for valid response do while (iP .eq. 0) cWhat(3:) = cWhatIn call AskChar(cPrmptIn(:L2),cWhat(3:)) iP = iAskWhatEntry(cWhat,cWhatIn,cPrmpt(:L1)) end do ! iP is position of selected item call AskWhatEntry(iP,iC,cPrmpt(:L1)) return end