C+ C NAME: C ForeignFile C PURPOSE: C Select a directory using foreign input information C CATEGORY: C Environment C CALLING SEQUENCE: subroutine ForeignFile(nVar,cVar,cKey,cWild) C INPUTS: C nVar integer # valid entries in cVar C setting the 1st argument to -nVar-1 < 0 C prevents setting cWild to the default if the C key is not found; instead cWild=' ' is returned. C cVar(*)*(*) character foreign input array C (these two arguments typically are output C arguments from a call to href=ForeignInput=) C cKey*(*) character key string to select entry in cVar C OUTPUTS: C cWild*(*) character directory and file selection C CALLS: C lowercase, uppercase, itrim, LocFirst, FileSelection C SEE ALSO: C ForeignInput C PROCEDURE: C All entries in cVar are searched for the string cKey with the equal C sign appended. If found than part of the cVar entry trailing the C equal sign is processed using href=FileSelection=. C If no match is found then the string cKey,,daily is processed. C EXAMPLE: C If cVar(1) = 'nagoya=nagoya,dat,nagoya,yearly' then C call SetForeignDir(1,cVar,'nagoya',cWild) C will return C cWild = /mnt/work/dat/nagoya/yearly C if 'dat' is defined as a logical pointing to /mnt/work/dat C The same is accomplished using the shorthand C cVar(1) = 'nagoya=nagoya,,yearly' C MODIFICATION HISTORY: C AUG-2000, Paul Hick (UCSD/CASS) C JUN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C Added option to input negative nVar. C- integer nVar character cVar(*)*(*) character cKey *(*) character cWild*(*) character cKeyLo*20 character cKeyHi*20 character cStr *100 cKeyLo = cKey call lowercase(cKeyLo) cKeyHi = cKey call uppercase(cKeyHi) iKey = itrim(cKeyLo) kVar = nVar if (nVar .lt. 0) kVar = -nVar-1 cStr = ' ' do iVar=1,kVar I = max(LocFirst(cKeyLo(:iKey)//'=',cVar(iVar)),LocFirst(cKeyHi(:iKey)//'=',cVar(iVar))) if (I .ne. 0) cStr = cVar(iVar)(I+iKey+1:) end do if (nVar .lt. 0 .and. cStr .eq. ' ') then cWild = ' ' else if (cStr .eq. ' ') cStr = cKeyLo(:iKey)//',,daily' call FileSelection(cStr,cWild) end if return end