Files
cacti/dev/poller/conf.c
T
rixx 7bc165dece bug fixes
git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/trunk/cacti@499 860744bd-22fc-0310-8c96-e9fe5004b5ca
2003-02-11 18:48:37 +00:00

28 lines
792 B
C

#include "inc.h"
//read config file
int read_conf(){
extern conf_t conf;
FILE *cfile;
char buffer[256];
cfile=fopen("cactid.conf","r");
if(cfile!=NULL){
fscanf(cfile, " %s %s\n", buffer, (conf.sqluser));
fscanf(cfile, " %s %s\n", buffer, (conf.sqlpw));
if(!strcmp(conf.sqlpw,"none")) sprintf(conf.sqlpw, "");
fscanf(cfile, " %s %s", buffer, (conf.sqlhost));
fscanf(cfile, " %s %s", buffer, (conf.sqldb));
fscanf(cfile, " %s %i", buffer, &(conf.interval));
fclose(cfile);
} else {
printf("conf not found\n");
exit(1);
}
printf("CONF: user: %s\n", conf.sqluser);
printf("CONF: pw: %s\n", conf.sqlpw);
printf("CONF: host: %s\n", conf.sqlhost);
printf("CONF: db: %s\n", conf.sqldb);
printf("CONF: interval: %i\n", conf.interval);
}