Z264: Returns Command Line Arguments

Author(s): F. Carminati, M. Marquina Library: KERNLIB or Fortran Run-Time Library
Submitter: Submitted: 13.07.1988
Language: Fortran + C Revised: 15.03.1993

IARGC is used to return arguments that the user has given to an executable module on the command line.

Structure:

FUNCTION subprograms
User Entry Names: GETARG, IARGC

Usage:

    NPAR = IARGC()
sets NPAR to the number of blank delimited arguments present after the program name on the command line. NPAR and IARGC are of type INTEGER.
    CALL GETARG(IARG,GOTEXT)
IARG
(INTEGER) Contains, on entry, the number of the argument to retrieve. Unchanged on exit.
GOTEXT
(CHARACTER) Contains, on exit, the IARG-th argument.

Notes:

  1. Arguments surrounded by double quotes (") are treated as single, e.g.
        "a variable here"
    is equivalent to one argument.
  2. On VM/CMS, due to technical restrictions, at least one of the routines must be called before any I/O (typically a PRINT statement).
  3. GETARG(0,GOTEXT) returns name of executing program (not VM).

Example:

    CHARACTER*100 STRING
C
C-- Retrieve the number of arguments given to this program
C
    NPAR=IARGC()
C-- and then get one by one, storing it in STRING
    DO 10 N = 1,NPAR
    CALL GETARG(N,STRING)
    PRINT *, STRING(1:LENOCC(STRING))
 10 CONTINUE
    END
tex2html_wrap_inline63

Michel Goossens Wed Jun 5 10:04:19 METDST 1996