/* * © 2002 Compaq Computer Corporation * * Compaq and the Compaq logo are trademarks of Compaq Information Technologies * Group, L.P. in the U.S. and other countries. * * Confidential computer software. Valid license from Compaq required for * possession, use or copying. Consistent with FAR 12.211 and 12.212, * Commercial Computer Software, Computer Software Documentation, and * Technical Data for Commercial Items are licensed to the U.S. Government * under vendor's standard commercial license. */ #include "getproxymanager.h" #include #include #include #include #include #include static $DESCRIPTOR (ice, "DECW$ICE"); static $DESCRIPTOR (pm, "DECW$PROXY_MANAGER"); static $DESCRIPTOR (display, "DECW$DISPLAY"); static $DESCRIPTOR (output, "SYS$OUTPUT"); static $DESCRIPTOR (pm_address, "DECW$PROXY_MANAGER_ADDRESS"); char* locateProxyManager ( void ) { int chan; char* retValue = 0; int status; struct dsc$descriptor value = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0 }; if ((DECW$WS_OpenDevice ( (struct dsc$descriptor*) &pm, &chan) == SS$_NORMAL) || (DECW$WS_OpenDevice ( (struct dsc$descriptor*) &ice, &chan) == SS$_NORMAL) || (DECW$WS_OpenDevice ( (struct dsc$descriptor*) &display, &chan) == SS$_NORMAL) || (DECW$WS_OpenDevice ( (struct dsc$descriptor*) &output, &chan) == SS$_NORMAL)) { status = DECW$WS_GetValue ( chan, (struct dsc$descriptor*) &pm_address, ',', &value); if ( ((status & 1) == 1) && ( value.dsc$w_length > 0 )) { retValue = (char*) malloc (value.dsc$w_length + 1); if (retValue != 0) { memcpy (retValue, value.dsc$a_pointer, value.dsc$w_length); retValue[value.dsc$w_length] = 0; } str$free1_dx (&value); } DECW$WS_CloseDevice (chan); } if (retValue == 0) { /* * No workstation defines the address * See if the standard UNIX-like definition exists * (Note getenv is not thread-safe) */ return getenv ("PROXY_MANAGER"); } return retValue; }