model_server/machine_prefs/src/pref_registry.cxx
// Try to get preference value from the environment.
// Converts and folder seperators into '_'s.
// Searches both case sensitive and all caps.
Try to get preference value from the environment.
Converts and folder seperators into '_'s.
Searches both case sensitive and all caps.
Try to get preference value from the environment . Converts and folder seperators into ' _ ' s . Searches both case sensitive and all caps .
const char* prefRegistry::getPrefFromEnv(const char* prefName)
{
    Initialize(prefRegistry::getPrefFromEnv);
    const char * envStr = NULL;
    int len = strlen(prefName);
    char* envName = new char[len + 1];
    for (int i=0; i<len; i++) {
        if ( (prefName[i] == '.') || (prefName[i] == ':') )
            envName[i] = '_';
        else
            envName[i] = prefName[i];
    }
    envName[len] = '\0';
    envStr = (char *)OSapi_getenv(envName);
    if (envStr) {
       if (debugLevel > 1)
          msg("Got pref \'$1\' from env var \'$2.", normal_sev) << prefName << eoarg << envName << eom;
    } else {
        for (int i=0; i<len; i++) {
            if ( islower(envName[i]) )
                envName[i] = toupper(envName[i]);
        }
        envStr = (char *)OSapi_getenv(envName);
       if (envStr && (debugLevel > 1) )
            msg("Got pref \'$1\' from env var \'$2.", normal_sev) << prefName << eoarg << envName << eom;
    }
    delete [] envName;
    return(envStr);
}
const char * prefRegistry :: getPrefFromEnv ( const char * prefName ) { Initialize ( prefRegistry :: getPrefFromEnv ) ; const char * envStr = NULL ; int len = strlen ( prefName ) ; char * envName = new char [ len + 1 ] ; for ( int i = 0 ; i < len ; i ++ ) { if ( ( prefName [ i ] == ' ' ) || ( prefName [ i ] == ' ' ) ) envName [ i ] = ' ' ; else envName [ i ] = prefName [ i ] ; } envName [ len ] = ' \0 ' ; envStr = ( char * ) OSapi_getenv ( envName ) ; if ( envStr ) { if ( debugLevel > 1 ) msg ( " \' \' \' " , normal_sev ) << prefName << eoarg << envName << eom ; } else { for ( int i = 0 ; i < len ; i ++ ) { if ( islower ( envName [ i ] ) ) envName [ i ] = toupper ( envName [ i ] ) ; } envStr = ( char * ) OSapi_getenv ( envName ) ; if ( envStr && ( debugLevel > 1 ) ) msg ( " \' \' \' " , normal_sev ) << prefName << eoarg << envName << eom ; } delete [ ] envName ; return ( envStr ) ; }
Try to get preference value from the environment.
Try to get preference value from the environment .
// Env. name is keyname with  ":" or "." substituted with an "_". // Note - This should probably get list of seperators from the // Didn't find it. Try again with all caps.