e77dcca9b1bffc335f2843c8cfce67119b3d039d braney Wed Nov 30 16:25:50 2011 -0800 allow specifying different names for the hubPublic and hubStatus tables (#6162) diff --git src/hg/lib/hgConfig.c src/hg/lib/hgConfig.c index d8509c6..9d836fe 100644 --- src/hg/lib/hgConfig.c +++ src/hg/lib/hgConfig.c @@ -274,30 +274,39 @@ if (val == NULL) val = def; return val; } char *cfgOptionEnv(char *envName, char* name) /* get a configuration optional value, from either the environment or the cfg * file, with the env take precedence. Return NULL if not found */ { char *val = getenv(envName); if (val == NULL || (strlen(val) == 0)) val = cfgOption(name); return val; } +char *cfgOptionEnvDefault(char *envName, char* name, char *def) +/* get a configuration optional value, from either the environment or the cfg + * file, with the env take precedence. Return default if not found */ +{ +char *val = cfgOptionEnv(envName, name); + +return (val == NULL) ? def : val; +} + char *cfgVal(char *name) /* Return option with given name. Squawk and die if it * doesn't exist. */ { char *val = cfgOption(name); if (val == NULL) errAbort("%s doesn't exist in hg.conf file", name); return val; } struct slName *cfgNames() /* get list of names in config file. slFreeList when finished */ { if(cfgOptionsHash == NULL) initConfig();