Programming-Idioms

History of Idiom 205 > diff from v3 to v4

Edit summary for version 4 :
[Fortran] Apply name change env -> foo

Version 3

2019-09-29, 19:10:17

Version 4

2019-09-29, 19:11:09

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Extra Keywords
envvar os system
Extra Keywords
envvar os system
Code
  call get_environment_variable ("FOO", length=n, status=st)
  if (st /= 0) then
    env = "none"
  else
    allocate (character(len=n) :: env)
    call get_environment_variable ("FOO", value=env)
  end if 
Code
  call get_environment_variable ("FOO", length=n, status=st)
  if (st /= 0) then
    foo = "none"
  else
    allocate (character(len=n) :: foo)
    call get_environment_variable ("FOO", value=foo)
  end if