62 lines
922 B
C
62 lines
922 B
C
|
/*
|
||
|
* parseconf
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
#include "config.h"
|
||
|
|
||
|
extern int verbosity;
|
||
|
extern Configuration config;
|
||
|
|
||
|
/* ---------------------------------------------------------------- */
|
||
|
int parse_config(char *fname, int flags)
|
||
|
{
|
||
|
FILE *fp;
|
||
|
char line[SZ_STRINGS+1];
|
||
|
|
||
|
|
||
|
#if DEBUG_LEVEL
|
||
|
fprintf(stderr, ">>> %s ( '%s' $%x )\n", fname, flags);
|
||
|
#endif
|
||
|
|
||
|
config.valid = 49;
|
||
|
|
||
|
if (NULL==(fp=fopen(fname, "r"))) {
|
||
|
perror(fname);
|
||
|
return -2;
|
||
|
}
|
||
|
|
||
|
while (fgets(line, SZ_STRINGS, fp))
|
||
|
{
|
||
|
/* massage the end of line */
|
||
|
|
||
|
/* skip comments */
|
||
|
|
||
|
/* seek for keyword */
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
fclose(fp);
|
||
|
|
||
|
return -1;
|
||
|
}
|
||
|
/* ---------------------------------------------------------------- */
|
||
|
int show_config(char *title)
|
||
|
{
|
||
|
|
||
|
if (verbosity) {
|
||
|
printf("********** %s **********\n", title);
|
||
|
}
|
||
|
|
||
|
printf("valid %d\n", config.valid);
|
||
|
|
||
|
puts("");
|
||
|
return 0;
|
||
|
}
|
||
|
/* ---------------------------------------------------------------- */
|