/* MSN Conf file processor * filename: /src/conf.c * Coded by James Greig * James@mor-pah.net * Date: 30/06/03 */ #include #include #include "headers/defs.h" #include "headers/conf.h" extern char certificate[128]; extern int args[3][1]; int get_var(); void conf() { int ctr, tmp; int flag = 0; FILE *fp; char ch; char pre[255]; /* Temp Buffer for config lines */ char _confstr[MAX_NO_LINES][MAX_LINE_LENGTH]; /* Temp buffer for valid config lines */ if ( (fp = fopen(CONF_LOCATION, "r")) != NULL ){ cli_msg("Reading msn.conf...\n"); } else { cli_msg("No config file found at: %s\n", CONF_LOCATION); cli_msg("Continuing with command line args and defaults\n"); return; } ctr = 0; while(!feof(fp)) { memset(pre, '\0', sizeof(pre)); fgets(pre, MAX_LINE_LENGTH, fp); if ( ( strstr(pre, "user") > 0 ) || ( strstr(pre, "pass") > 0 ) || ( strstr(pre, "cert") > 0 ) || ( strstr(pre, "log") > 0 )){ strcpy(_confstr[ctr], pre); ctr++; } } /* Username was not specified by an arg switch, so fetch from conf */ if ( username[0] == 0 || certificate[0] == 0) { for(tmp=0;tmp