/* * Copyright (c) 2026, Apollo Telephone Laboratories. * Provided under the BSD-3 clause. */ #include #include #include #include int atas_state_init(const char *in_file, struct atas_state *state) { if (in_file == NULL || state == NULL) { errno = EINVAL; return -1; } state->in_file = fopen(in_file, "r"); if (state->in_file == NULL) { return -1; } return 0; } void atas_state_destroy(struct atas_state *state) { if (state == NULL) { return; } fclose(state->in_file); state->in_file = NULL; } void atas_fatal(struct atas_state *state) { assert(state != NULL && "state cannot be NULL\n"); atas_state_destroy(state); exit(1); }