MGE System Utility Library - API Documentation  v1.5.1
Library of system utility functions.
mge-configfile.h
Go to the documentation of this file.
1 
16 /* **********************************************************************
17  * *
18  * Changelog *
19  * *
20  * Date Author Version Description *
21  * *
22  * 12/07/2015 MG 1.0.1 First release. *
23  * 16/07/2016 MG 1.0.2 Move towards kernel coding style. *
24  * 17/07/2016 MG 1.0.3 Further coding style changes. *
25  * 07/11/2017 MG 1.0.4 Add Doxygen comments. *
26  * 10/11/2017 MG 1.0.5 Add SPDX license tag. *
27  * 02/01/2018 MG 1.0.6 Move to new source directory structure. *
28  * 16/05/2019 MG 1.0.7 Collapse AT subprojects into one. *
29  * 30/10/2019 MG 1.0.8 Apply clang-format. *
30  * 06/12/2021 MG 1.0.9 Tighten SPDX tag. *
31  * 19/08/2022 MG 1.0.10 Rename portability.h *
32  * 15/09/2022 MG 1.1.1 Rename to mge-configfile.h *
33  * Use pkginclude location. *
34  * *
35  ************************************************************************
36  */
37 
38 #ifndef MGE_CONFIGFILE_H
39 #define MGE_CONFIGFILE_H
40 
41 #include <libmgec/mge-portability.h>
42 
43 BEGIN_C_DECLS
44 
46 #define MAX_KEYVAL_LENGTH 1000
47 
49 #define MAX_KEYS_PER_SECTION 1000
50 
52 #define MAX_LINE_LENGTH 1000
53 
55 struct confkey {
56  char *key;
57  int mandatory;
58  int present;
60 };
61 
63 struct confsection {
64  char *section;
65  int mandatory;
66  int present;
68 };
69 
70 int parsefile(struct confsection *params, int nparams, char *filename);
71 
72 END_C_DECLS
73 
74 #endif /* ndef MGE_CONFIGFILE_H */
#define MAX_KEYS_PER_SECTION
Max number of keys per section.
Definition: mge-configfile.h:49
int parsefile(struct confsection *params, int nparams, char *filename)
Parse a configuration file.
Definition: configfile.c:117
#define MAX_KEYVAL_LENGTH
Max length of Key and value.
Definition: mge-configfile.h:46
Configuration Key / Value Pair.
Definition: mge-configfile.h:55
int present
Pair present, 1 = true, 0 =false.
Definition: mge-configfile.h:58
char value[MAX_KEYVAL_LENGTH]
Value part of pair.
Definition: mge-configfile.h:59
char * key
Key part of pair.
Definition: mge-configfile.h:56
int mandatory
Mandatory, 1 = true, 0 = false.
Definition: mge-configfile.h:57
Configuration section definition.
Definition: mge-configfile.h:63
int present
Pair present, 1 = true, 0 =false.
Definition: mge-configfile.h:66
char * section
Section name.
Definition: mge-configfile.h:64
struct confkey keys[MAX_KEYS_PER_SECTION]
Array of KV Pairs.
Definition: mge-configfile.h:67
int mandatory
Mandatory, 1 = true, 0 = false.
Definition: mge-configfile.h:65