kdb
kdb

Reputation: 4426

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

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.

Upvotes: 2

Views: 248

Answers (1)

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

Upvotes: 1

Related Questions