blob: ce1c28617792f41c7bf49053e25020c3e8c7ef97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}
|