C+ C NAME: C ForeignArgs C PURPOSE: C Get input from DCL command line invoking main program executable C Split off argument switches C CATEGORY: C Command line processing C CALLING SEQUENCE: subroutine ForeignArgs(cSep,iVar,cVar,iArg,cArg) C INPUTS: C cSep character*1 Separator character used to delimit individual C arguments on command line C iVar integer maximum # of (cSep-separated) entries read C from command line into cVar C iArg integer maximum # of argument switches extracted from C cVar array C OUTPUTS: C iVar integer actual number of entries read into cVar C (after argument switches have been removed for C ForeignArg and ForeignArgs) C cVar character(iVar)*(*) C values of valid entries C iArg integer actual number of argument switches found C cArg character(iArg)*(*) C values of argument switches (array of strings) C SEE ALSO: C ForeignInput C CALLS: C ForeignArg, itrim, LocFirstLen C INCLUDE: include 'dirspec.h' C RESTRICTIONS: C >>> The separator character cSep must be only one character long. C At most 500 characters are read from the DCL command line. C C > Only the first iVar elements of cVar and the first iArg elements of C cArg contain valid entries. C > No warning is given if # arguments on the command line exceed the C input values of iVar or iArg, or if they do not fit into the cArg C string (they will simply be ignored). C PROCEDURE: C > href=iOSGetForeign= is used to read the argument list into the character*200 C string cStr. cStr is interpreted using the cSep character as delimiter. C > A switch begins at the character '/' and ends at the next cSep, blank or C '/'. Switches are returned in the cArg array with each element in the form C '/switch'. Only non-zero length switches are stored. C MODIFICATION HISTORY: C MAR-1995, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- character cSep integer iVar character cVar(iVar)*(*) integer iArg character cArg(iArg)*(*) character Arg*500 call ForeignArg(cSep,iVar,cVar,Arg) ! Fill Arg string !------- ! Arg has the form '/sw1/sw2/sw3'. There is no white space and all ! slashes are followed by at least one character that is not a slash ! (i.e. a valid switch). nArg = iArg iArg = 0 L = itrim(Arg) I1 = 1 ! Location of first cSwitch do while (I1 .lt. L) I2 = I1+LocFirstLen(cSwitch,Arg(I1+1:L))! Next slash or L+1 iArg = iArg+1 cArg(iArg) = Arg(I1:I2-1) if (iArg .eq. nArg) I2 = L+1 I1 = I2 end do return end