Get list of all environment variables in Fortran in portable manner?

Viewed 133

In our Fortran software, debug parameters can be passed using environment variables with a pattern PREFIX_KEY. I want to perform a check, whether the given KEY exists in order to guard against typos.

I know about GET_ENVIRONMENT_VARIABLE (Fortran 2003), and this is what the code uses for querying the variables. Is there also a portable manner of enumerating all environment variables, so I can check them for unexpected PREFIX_KEY variables?

The software is running in both Linux and Windows environments, and built with different compilers for both platform support and code verification. Portability is thus a big concern.

1 Answers

There is no such functionality in the Fortran standard. In Linux you can run env, store the output to a file and parse it.

Related