/* * * File : config_parser.c * * Author : Zurcher Jeremy * * Date : * * Purpose : * */ #include #include #include #include #include #include #include "config_parser.h" #define COMMENT '#' #define STREND '\0' #define NEWLINE '\n' #define TABULATION '\t' #define SPACE ' ' enum { NOPE, UNFINISHED_LINE, UNFINISHED_COMMENT }; struct config_reader { int fd; int last; char *pos; char *end; int state; int current_line; char buffer[BUFFLEN]; }; static struct config_reader reader = { 0 }; #ifdef _DEBUG_ static void debug_buffer() { printf("\tBUFFER : "); int i; for (i=0; i