+------------------------Fortran 2003 Draft Standard-------------------------+
Purpose
Returns the value of the specified environment variable.
Class
Subroutine
Argument Type and Attributes
- NAME
- is a character string that identifies the name of the operating-system
environment variable. The string is case-significant. It is an
INTENT(IN) argument that must be scalar of type default
character.
- VALUE (optional)
- is the value of the environment variable, or a string of blanks if the
environment variable has no value or does not exist. It is an
INTENT(OUT) argument that must be scalar of type default
character.
- LENGTH (optional)
- is the significant length of the value, or 0 if the environment variable
has no value or does not exist. 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:
- 0, if either the environment variable exists and its value is succesfully
assigned to VALUE or the environment variable exists but has no value
- 1, if the environment variable does not exist
- -1, if the VALUE argument less than the significant length
of value of the environment variable.
- 3, if other error conditions occur
- TRIM_NAME (optional)
- is a logical value that specifies whether to trim trailing blanks in
NAME. By default, trailing blanks in NAME are
trimmed. If TRIM_NAME exists and has the value
.FALSE., trailing blanks in NAME are considered
significant. TRIM_NAME is an INTENT(IN) argument that
must be scalar of type logical.
Examples
integer num, len, status
character*15 value
call GET_ENVIRONMENT_VARIABLE('HOME', value, len, status)
print*, value
print*, len
print*, status
The following is sample output generated by the above program:
$ a.out
/home/xlfuser (followed by two spaces)
13
0
+---------------------End of Fortran 2003 Draft Standard---------------------+
