1
0
Fork 0
mirror of https://github.com/pygos/pkg-utils.git synced 2024-05-17 03:36:14 +02:00
pkg-utils/include/input_file.h
David Oberhollenzer a32a4cb149 Cleanup: unify input file processing code
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-01-31 22:15:41 +01:00

28 lines
546 B
C

#ifndef INPUT_FILE_H
#define INPUT_FILE_H
#include <stdio.h>
typedef struct {
FILE *f;
char *line;
const char *filename;
size_t linenum;
} input_file_t;
typedef struct {
const char *name;
int (*handle)(input_file_t *f, void *obj);
} keyword_handler_t;
void cleanup_file(input_file_t *f);
int open_file(input_file_t *f, const char *filename);
int process_file(input_file_t *f, const keyword_handler_t *handlers,
size_t count, void *obj);
void input_file_complain(const input_file_t *f, const char *msg);
#endif /* INPUT_FILE_H */