You can see the environment variables that are passed to your program using the printenv command.
One way programs can look at their environment is to use the getenv call so that you can use the LD_PRELOAD tracer program or trick to wrap this call and find out what they are looking for.
However, not all programs use getenv to view their environment. If the program uses the following (unusual) format for the main one, it can view environment variables using the envp pointer:
int main(int argc, char *argv[], char *envp[]) { }
In addition, programs can access the environment through the environment variable.
You will probably be able to track getenv calls, but this does not guarantee that it depends on the program and the program.
source share