|
|
@ -6,14 +6,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "config.h" |
|
|
|
#include "config.h" |
|
|
|
|
|
|
|
|
|
|
|
#define BUFSIZE 1024 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int parse_config(oal_config_t * const config, const char *file) { |
|
|
|
int parse_config(oal_config_t * const config, const char *file) { |
|
|
|
FILE *f; |
|
|
|
FILE *f; |
|
|
|
const size_t bufsize = 1024; |
|
|
|
enum { bufsize = 1024 }; |
|
|
|
unsigned short linenum = 0; |
|
|
|
unsigned short linenum = 0; |
|
|
|
char buf[BUFSIZE]; |
|
|
|
char buf[bufsize]; |
|
|
|
char err[BUFSIZE]; |
|
|
|
char err[bufsize]; |
|
|
|
char *key, *value; |
|
|
|
char *key, *value; |
|
|
|
size_t valsize; |
|
|
|
size_t valsize; |
|
|
|
|
|
|
|
|
|
|
@ -23,7 +21,7 @@ int parse_config(oal_config_t * const config, const char *file) { |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
while (fgets(buf, BUFSIZE, f)) { |
|
|
|
while (fgets(buf, bufsize, f)) { |
|
|
|
linenum++; |
|
|
|
linenum++; |
|
|
|
key = buf; |
|
|
|
key = buf; |
|
|
|
while (isspace(*key)) |
|
|
|
while (isspace(*key)) |
|
|
@ -74,4 +72,4 @@ int parse_config(oal_config_t * const config, const char *file) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|