huntd/conf.c
/*
 * load various config file, allowing later ones to 
 * overwrite earlier values
 */
load various config file, allowing later ones to
overwrite earlier values
load various config file allowing later ones to overwrite earlier values
void
config()
{
	char *home;
	char nm[MAXNAMLEN + 1];
	static char *fnms[] = { 
		"/etc/hunt.conf",
		"%s/.hunt.conf", 
		".hunt.conf", 
		NULL
	};
	int fn;
	FILE *f;
	if ((home = getenv("HOME")) == NULL)
		home = "";
	for (fn = 0; fnms[fn]; fn++) {
		snprintf(nm, sizeof nm, fnms[fn], home);
		if ((f = fopen(nm, "r")) != NULL) {
			load_config(f, nm);
			fclose(f);
		} 
		else if (errno != ENOENT)
			logit(LOG_WARNING, "%s", nm);
	}
}
void config ( ) { char * home ; char nm [ MAXNAMLEN + 1 ] ; static char * fnms [ ] = { " " , " " , " " , NULL } ; int fn ; FILE * f ; if ( ( home = getenv ( " " ) ) == NULL ) home = " " ; for ( fn = 0 ; fnms [ fn ] ; fn ++ ) { snprintf ( nm , sizeof nm , fnms [ fn ] , home ) ; if ( ( f = fopen ( nm , " " ) ) != NULL ) { load_config ( f , nm ) ; fclose ( f ) ; } else if ( errno != ENOENT ) logit ( LOG_WARNING , " " , nm ) ; } }
load various config file, allowing later ones to
 overwrite earlier values
load various config file allowing later ones to overwrite earlier values
/* All the %s's get converted to $HOME */