[EMAIL PROTECTED] writes: > I am looking for information on how to obtain environment variables in > Netscape 6.2.1. > > What I am looking for is how to use the replacement for getenv() which > according to the documentation at: > > > http://www.mozilla.org/projects/nspr/reference/html/prsystem.html > > appears to be PR_GetEnv . > > > I am currently testing the Alpha version of NADM from Netscape which > will be the replacement for the MCD tool that shipped with 4.7x. This > allows me to create a netscape.cfg file that reads a configuration file. > I have the following lines in my configuration file: > > /*Obtain Information from LDAP and environment */ > > var env_user = PR_GetEnv("USER"); //Unix username > var env_home = PR_GetEnv("HOME"); //User Homedir > > //LDAP information > host = "ldap1"; > base = "dc=xyz, dc=com"; > > //Query to LDAP for information > > getLDAPAttributes ( host, base, "uid=" + env_user, ""); > > > // Callback function to process the values returned by directory server > > function processLDAPValues (values) { > > var values = getLDAPAttributes ( host, base, "uid=" + env_user, ""); > var uid = getLDAPValue ( values, "uid" ); > var cn = getLDAPValue ( values, "cn" ); > var rfc822 = getLDAPValue ( values, "mail" ); > var mailhost = getLDAPValue (values, "mailhost" ); > } > > I thought that using > > var env_user = PR_GetEnv("USER"); //Unix username > var env_home = PR_GetEnv("HOME"); //User Homedir > > would obtain the environment variables that I need, however this doesn't > seem to be the case. > > Any assistance that you can provide on using PR_GetEnv() would be > appriciated.
PR_GetEnv is a C function, and (as far as I can find out) is not directly exposed to xpconnected JS (I'm ccing the .xpcom group on the chance that someone knows of a way to do this that I'm missing). Assuming that the JS context that autoconfig is running in has XPConnect enabled (I don't know whether it does); one could work around this by writing a tiny C++ XPCOM component to expose PR_GetEnv(). Dan
