Browse Source

* add oal_error()

master
Alex 'AdUser' Z 7 years ago
parent
commit
34930adb92
  1. 10
      src/config.c
  2. 3
      src/config.h

10
src/config.c

@ -3,12 +3,22 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include "config.h"
enum { bufsize = 1024 };
int
oal_error(oal_config_t * const c, const char *fmt, ...) {
va_list args;
va_start(args, fmt);
vsnprintf(c->error, sizeof(c->error), fmt, args);
va_end(args);
return 1;
}
int parse_config(oal_config_t * const config, const char *file) {
FILE *f;
unsigned short linenum = 0;

3
src/config.h

@ -12,6 +12,9 @@ typedef struct {
char error[1024]; /** parser error */
} oal_config_t;
int oal_error(oal_config_t * const c, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
int parse_config(oal_config_t * const config, const char *file);
int check_config(oal_config_t * const config);

Loading…
Cancel
Save