MGE System Utility Library - API Documentation  v1.4.7
Library of system utility functions.
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  * *
32  ************************************************************************
33  */
34 
35 #ifndef CONFIGFILE_H
36 #define CONFIGFILE_H
37 
38 #include <portability.h>
39 
40 BEGIN_C_DECLS
41 
43 #define MAX_KEYVAL_LENGTH 1000
44 
46 #define MAX_KEYS_PER_SECTION 1000
47 
49 #define MAX_LINE_LENGTH 1000
50 
52 struct confkey {
53  char *key;
54  int mandatory;
55  int present;
57 };
58 
60 struct confsection {
61  char *section;
62  int mandatory;
63  int present;
65 };
66 
67 int parsefile(struct confsection *params, int nparams, char *filename);
68 
69 END_C_DECLS
70 
71 #endif /* ndef CONFIGFILE_H */
72 
#define MAX_KEYS_PER_SECTION
Max number of keys per section.
Definition: configfile.h:46
int parsefile(struct confsection *params, int nparams, char *filename)
Parse a configuration file.
Definition: configfile.c:104
#define MAX_KEYVAL_LENGTH
Max length of Key and value.
Definition: configfile.h:43
Configuration Key / Value Pair.
Definition: configfile.h:52
int present
Pair present, 1 = true, 0 =false.
Definition: configfile.h:55
char value[MAX_KEYVAL_LENGTH]
Value part of pair.
Definition: configfile.h:56
char * key
Key part of pair.
Definition: configfile.h:53
int mandatory
Mandatory, 1 = true, 0 = false.
Definition: configfile.h:54
Configuration section definition.
Definition: configfile.h:60
int present
Pair present, 1 = true, 0 =false.
Definition: configfile.h:63
char * section
Section name.
Definition: configfile.h:61
struct confkey keys[MAX_KEYS_PER_SECTION]
Array of KV Pairs.
Definition: configfile.h:64
int mandatory
Mandatory, 1 = true, 0 = false.
Definition: configfile.h:62