40 lines
701 B
C
40 lines
701 B
C
/*
|
|
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <fcntl.h>
|
|
|
|
#include <massert.h>
|
|
#include <rcache.h>
|
|
#include <cflexer.h>
|
|
|
|
int main(void) {
|
|
|
|
int fd = open("test.conf", O_RDONLY);
|
|
MASSERT(fd > 0);
|
|
|
|
rcache_t cache;
|
|
rcache_init(&cache, fd);
|
|
|
|
cflexer_t lexer;
|
|
cflexer_init(&lexer, &cache);
|
|
|
|
char token[1024];
|
|
int type = 0;
|
|
|
|
while ((type = cflexer_gettoken(&lexer, token)) != CFLEXTOK_END) {
|
|
printf("[%d]: [%s]\n", type, token);
|
|
}
|
|
printf("[%d]: [%s]\n", type, token);
|
|
|
|
rcache_destroy(&cache);
|
|
|
|
return 0;
|
|
}
|