preparation de la lecture du fichier de conf
This commit is contained in:
61
core/parseconf.c
Normal file
61
core/parseconf.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
Reference in New Issue
Block a user