+------------------------Fortran 2003 Draft Standard-------------------------+
Purpose
Returns the command that invoked the program.
Class
Subroutine
Argument Type and Attributes
- COMMAND (optional)
- is the command that invoked the program, or a string of blanks if the
command is unknown. COMMAND is an INTENT(OUT)
argument that must be scalar of type default character.
- LENGTH (optional)
- is the significant length of the command that invoked the program, or 0 if
the length of the command is unknown. This length includes significant
trailing blanks of each argument. It does not include any truncation or
padding that occurs when the command is assigned to the COMMAND
argument. It is an INTENT(OUT) argument that must be scalar of
type default integer.
- STATUS (optional)
- is a status value. It is an INTENT(OUT) argument that must
be scalar of type default integer.
STATUS has one of the following values:
- 1 if the command retrieval fails
- -1 if the COMMAND argument is present and has a value less than
the significant length of the command
- 0 otherwise
Examples
integer len, status
character(7) :: cmd
call GET_COMMAND(cmd, len, status)
print*, cmd
print*, len
print*, status
end
The following is sample output the above program generates:
$ a.out
a.out (followed by two spaces)
5
0
$ a.out aa
a.out a
8
-1
+---------------------End of Fortran 2003 Draft Standard---------------------+
