Purpose
Returns the command that invoked
the program.
Argument type and attributes
- COMMAND (optional)
- An INTENT(OUT) CHARACTER scalar.
It is the command that invoked the program, or a string of blanks
if the command is unknown.
- LENGTH (optional)
- An INTENT(OUT) INTEGER scalar.
It 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.
- STATUS (optional)
- An INTENT(OUT) INTEGER scalar.
It is a status value.
STATUS has one
of the following values:
- 1 if the command retrieval fails
- -1 if the COMMAND argument is present
and has a length 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
code 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