-
Notifications
You must be signed in to change notification settings - Fork 3
/
conf_parser.h
48 lines (39 loc) · 1.08 KB
/
conf_parser.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
/****************************************************************************
* Copyright 2023 UT Battelle, LLC
*
* This work was supported by the Oak Ridge Leadership Computing Facility at
* the Oak Ridge National Laboratory, which is managed by UT Battelle, LLC for
* the U.S. DOE (under the contract No. DE-AC05-00OR22725).
*
* This file is part of the LCIO project.
****************************************************************************/
//
// Created by Matthew Bachstein on 5/23/18.
//
#ifndef LCIO_CONF_PARSER_H
#define LCIO_CONF_PARSER_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
struct attr {
char* key;
char* val;
};
struct section {
int num;
char* key;
struct attr **attrs;
};
struct conf {
int num;
char* file_name;
struct section** sections;
};
struct conf* parse_conf_file(char *);
void print_cfg(struct conf*);
struct section* get_section(char*, struct conf*);
char* get_attr(char* key, struct section* sec);
char** get_keys(struct section* sec);
#endif //LCIO_CONF_PARSER_H