diff options
Diffstat (limited to 'core/state.c')
| -rw-r--r-- | core/state.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/core/state.c b/core/state.c new file mode 100644 index 0000000..ce1c286 --- /dev/null +++ b/core/state.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2026, Apollo Telephone Laboratories. + * Provided under the BSD-3 clause. + */ + +#include <stdio.h> +#include "defconf/state.h" + +int +defconf_state_init(const char *in_path, struct defconf_state *state) +{ + if (in_path == NULL || state == NULL) { + return -1; + } + + state->in_fp = fopen(in_path, "r"); + if (state->in_fp == NULL) { + perror("fopen"); + return -1; + } + + state->lex_cache = '\0'; + return 0; +} + +void +defconf_state_destroy(struct defconf_state *state) +{ + if (state == NULL) { + return; + } + + fclose(state->in_fp); + state->in_fp = NULL; +} |
