I do not know the Solaris and have just begun learning Unix (Mac OS X is Unix based), so I may be wrong. I think the environment variables are stored in text files like /etc/bashrc for the bash shell. You could read the file and parse out the variables of interest.
Lynn