C+ C NAME: C AskChar C PURPOSE: C Prompt user for character value C CATEGORY: C I/O: user input C CALLING SEQUENCE: subroutine AskChar(cQueryIn,cVal) C INPUTS: C cQueryIn character*(*) string to be used as prompt C cVal character*(*) default value C OUTPUTS: C cVal character*(*) user-defined value C CALLS: C itrim, uppercase, iAskChar, bAskChar C INCLUDE: include 'dirspec.h' C PROCEDURE: C User is prompted for a new value. The current (input) value is C presented as default. The default is selected by hitting return. C > If cQuery ends with the substring '$file', then the input is accepted C only if it represents an existing file. The full filename is C returned in cVal. C > if cQuery ends with the substring '$dir', then the input is accepted C only if it represents an existing directory. The directory name is C returned in cVal. C > if cQuery ends with the substring '$u', then all input is converted to C uppercase. C MODIFICATION HISTORY: C Old, very old C- character cQueryIn*(*) character cVal*(*) parameter (LINE = 58) parameter (IFULL = LINE+7) character cOld*64 character cNew*64 character cH*61 /' '/ character cQuery*64 character cExit logical bExit logical bFile logical bDir logical bParse logical bUpper logical bAskChar logical bAsk cQuery = cQueryIn L = iAskChar(cQuery,M,bExit,bFile,bDir,bParse,bUpper,cExit,cVal,cOld) bAsk = .TRUE. do while (bAsk) K = IFULL-M-4 ! # spaces available to print prompt string I2 = K-L ! # blanks if ((LINE-L)/2+L .lt. K) I2 = LINE-L I1 = max(1,I2/2) I2 = max(1,K-I1-L) if (bUpper) call uppercase(cOld) if (cOpSys .eq. OS__VMS) then write (*,'(80(1H ))') write (*,'(1H+,3A,2H< ,A,2H >,$)') cH(:I1),cQuery(:L),cH(:I2),cOld(:max(1,M)) else write (*,'(1H ,3A,2H< ,A,2H >,$)') cH(:I1),cQuery(:L),cH(:I2),cOld(:max(1,M)) end if read (*,'(A)') cNew if (bUpper) call uppercase(cNew) bAsk = bAskChar(bExit,bFile,bDir,bParse,cExit,cOld,cNew,cVal) M = itrim(cOld) end do return end