1libeconf(3) libeconf libeconf(3)
2
3
4
6 include/libeconf.h - Public API for the econf library.
7 include/libeconf_ext.h - Public extended API for the econf library.
8
9
11 libeconf is a highly flexible and configurable library to parse and
12 manage key=value configuration files.
13 It reads configuration file snippets from different directories and
14 builds the final configuration file for the application from it.
15
16 The first file is the vendor provided configuration file.
17
18 There are two methods of overriding this vendor settings: Copy the file
19 from /usr/_vendordir_ to /etc and modify the settings (see xample 1).
20
21 Alternatively, a directory named _file_._suffix_.d/ within /etc can be
22 created, with drop-in files in the form _name_._suffix_ (see Example
23 2).
24
25 These files contain only the changes of the specific settings the user
26 is interested in.
27 There can be several such drop-in files, they are processed in
28 lexicographic order of their filename.
29
30 The first method is useful to override the complete configuration file
31 with an own one, the vendor supplied configuration is ignored.
32
33 So, if /etc/_example_._suffix_ exists, /usr/_vendor_/_example_._suffix_
34 and /usr/_vendor_/_example_._suffix_.d/*._suffix_ will not be read.
35 The disadvantage is, that changes of the vendor configuration file, due
36 e.g. an package update, are ignored and the user has to manually merge
37 them.
38
39 The other method will continue to use /usr/_vendor_/_example_._suffix_
40 as base configuration file and merge all changes from
41 /etc/_example_._suffix_.d/*._suffix_.
42 So the user will automatically get improvements of the vendor, with the
43 drawback, that they could be incompatible with the user made changes.
44
45
46 Example 1
47 If a /etc/_example_._suffix_ files exists:
48
49 * /etc/_example_._suffix_
50
51 * /etc/_example_._suffix_.d/*._suffix_
52
53
54 Example 2
55 The list of files and directories read if **no**
56 /etc/_example_._suffix_ file exists:
57
58 * /usr/_vendor_/_example_._suffix_
59
60 * /usr/_vendor_/_example_._suffix_.d/*._suffix_
61
62 * /etc/_example_._suffix_.d/*._suffix_
63
64
66 #include <stdbool.h>
67 #include <stdint.h>
68 #include <stdlib.h>
69
70
71 Typedefs
72 typedef enum econf_err econf_err
73 typedef struct econf_file econf_file
74 typedef struct econf_ext_value econf_ext_value
75
76 Enumerations
77 enum econf_err { ECONF_SUCCESS = 0, ECONF_ERROR = 1, ECONF_NOMEM = 2,
78 ECONF_NOFILE = 3, ECONF_NOGROUP = 4, ECONF_NOKEY = 5,
79 ECONF_EMPTYKEY = 6, ECONF_WRITEERROR = 7, ECONF_PARSE_ERROR = 8,
80 ECONF_MISSING_BRACKET = 9, ECONF_MISSING_DELIMITER = 10,
81 ECONF_EMPTY_SECTION_NAME = 11, ECONF_TEXT_AFTER_SECTION = 12 }
82 libeconf error codes
83
84 Functions
85 econf_err econf_readFile (econf_file **result, const char *file_name,
86 const char *delim, const char *comment)
87 Process the file of the given file_name and save its contents into
88 key_file object.
89 econf_err econf_mergeFiles (econf_file **merged_file, econf_file
90 *usr_file, econf_file *etc_file)
91 Merge the contents of two key_files objects.
92 econf_err econf_readDirs (econf_file **key_file, const char
93 *usr_conf_dir, const char *etc_conf_dir, const char *project_name,
94 const char *config_suffix, const char *delim, const char *comment)
95 Evaluating key/values of a given configuration by reading and
96 merging all needed/available files in two different directories
97 (normally in /usr/etc and /etc).
98 econf_err econf_readDirsHistory (econf_file ***key_files, size_t *size,
99 const char *usr_conf_dir, const char *etc_conf_dir, const char
100 *project_name, const char *config_suffix, const char *delim, const
101 char *comment)
102 Evaluating key/values for every given configuration files in two
103 different directories (normally in /usr/etc and /etc).
104 econf_err econf_newKeyFile (econf_file **result, char delimiter, char
105 comment)
106 Create a new econf_file object.
107 econf_err econf_newIniFile (econf_file **result)
108 Create a new econf_file object in IniFile format.
109 econf_err econf_writeFile (econf_file *key_file, const char
110 *save_to_dir, const char *file_name)
111 Write content of a econf_file struct to specified location.
112 char * econf_getPath (econf_file *kf)
113 Evaluating path name of the regarding configuration file.
114 econf_err econf_getGroups (econf_file *kf, size_t *length, char
115 ***groups)
116 Evaluating all group entries.
117 econf_err econf_getKeys (econf_file *kf, const char *group, size_t
118 *length, char ***keys)
119 Evaluating all keys.
120 econf_err econf_getIntValue (econf_file *kf, const char *group, const
121 char *key, int32_t *result)
122 Evaluating int32 value for given group/key.
123 econf_err econf_getInt64Value (econf_file *kf, const char *group, const
124 char *key, int64_t *result)
125 Evaluating int64 value for given group/key.
126 econf_err econf_getUIntValue (econf_file *kf, const char *group, const
127 char *key, uint32_t *result)
128 Evaluating uint32 value for given group/key.
129 econf_err econf_getUInt64Value (econf_file *kf, const char *group,
130 const char *key, uint64_t *result)
131 Evaluating uint64 value for given group/key.
132 econf_err econf_getFloatValue (econf_file *kf, const char *group, const
133 char *key, float *result)
134 Evaluating float value for given group/key.
135 econf_err econf_getDoubleValue (econf_file *kf, const char *group,
136 const char *key, double *result)
137 Evaluating double value for given group/key.
138 econf_err econf_getStringValue (econf_file *kf, const char *group,
139 const char *key, char **result)
140 Evaluating string value for given group/key.
141 econf_err econf_getBoolValue (econf_file *kf, const char *group, const
142 char *key, bool *result)
143 Evaluating bool value for given group/key.
144 econf_err econf_getIntValueDef (econf_file *kf, const char *group,
145 const char *key, int32_t *result, int32_t def)
146 Evaluating int32 value for given group/key.
147 econf_err econf_getInt64ValueDef (econf_file *kf, const char *group,
148 const char *key, int64_t *result, int64_t def)
149 Evaluating int64 value for given group/key.
150 econf_err econf_getUIntValueDef (econf_file *kf, const char *group,
151 const char *key, uint32_t *result, uint32_t def)
152 Evaluating uint32 value for given group/key.
153 econf_err econf_getUInt64ValueDef (econf_file *kf, const char *group,
154 const char *key, uint64_t *result, uint64_t def)
155 Evaluating uint64 value for given group/key.
156 econf_err econf_getFloatValueDef (econf_file *kf, const char *group,
157 const char *key, float *result, float def)
158 Evaluating float value for given group/key.
159 econf_err econf_getDoubleValueDef (econf_file *kf, const char *group,
160 const char *key, double *result, double def)
161 Evaluating double value for given group/key.
162 econf_err econf_getStringValueDef (econf_file *kf, const char *group,
163 const char *key, char **result, char *def)
164 Evaluating string value for given group/key.
165 econf_err econf_getBoolValueDef (econf_file *kf, const char *group,
166 const char *key, bool *result, bool def)
167 Evaluating bool value for given group/key.
168 econf_err econf_setIntValue (econf_file *kf, const char *group, const
169 char *key, int32_t value)
170 Set int32 value for given group/key.
171 econf_err econf_setInt64Value (econf_file *kf, const char *group, const
172 char *key, int64_t value)
173 Set int64 value for given group/key.
174 econf_err econf_setUIntValue (econf_file *kf, const char *group, const
175 char *key, uint32_t value)
176 Set uint32 value for given group/key.
177 econf_err econf_setUInt64Value (econf_file *kf, const char *group,
178 const char *key, uint64_t value)
179 Set uint64 value for given group/key.
180 econf_err econf_setFloatValue (econf_file *kf, const char *group, const
181 char *key, float value)
182 Set float value for given group/key.
183 econf_err econf_setDoubleValue (econf_file *kf, const char *group,
184 const char *key, double value)
185 Set double value for given group/key.
186 econf_err econf_setStringValue (econf_file *kf, const char *group,
187 const char *key, const char *value)
188 Set string value for given group/key.
189 econf_err econf_setBoolValue (econf_file *kf, const char *group, const
190 char *key, const char *value)
191 Set bool value for given group/key.
192 const char * econf_errString (const econf_err error)
193 Convert an econf_err type to a string.
194 void econf_errLocation (char **filename, uint64_t *line_nr)
195 Info about where the error has happened.
196 void econf_freeArray (char **array)
197 Free an array of type char** created by econf_getGroups() or
198 econf_getKeys().
199 void econf_freeFile (econf_file *key_file)
200 Free memory allocated by e.g.
201 econf_err econf_getExtValue (econf_file *kf, const char *group, const
202 char *key, econf_ext_value **result)
203 Evaluating more information for given group/key.
204 void econf_freeExtValue (econf_ext_value *to_free)
205 Free an complete econf_ext_value struct.
206
208 Public API for the econf library.
209
210
211
212 Definition in file libeconf.h and libeconf_ext.h.
213
214
216 typedef struct econf_file econf_file
217 Container which includes all information about the configuration
218 file(s).
219
220 typedef struct econf_ext_value econf_ext_value
221 char ** values
222 Values of a given key in form of an string array.
223 char * file
224 Path of the configuration file where this value has been read.
225 uint64_t line_number
226 Line number of the configuration key/value.
227 char * comment_before_key
228 Comment before the key/value entry.
229 char * comment_after_value
230 Comment after the value entry.
231
232
233
235 enum econf_err
236 libeconf error codes
237
238 Enumerator
239
240 ECONF_SUCCESS
241 General purpose success code.
242
243 ECONF_ERROR
244 Generic Error.
245
246 ECONF_NOMEM
247 Out of memory.
248
249 ECONF_NOFILE
250 Config file not found.
251
252 ECONF_NOGROUP
253 Group not found.
254
255 ECONF_NOKEY
256 Key not found.
257
258 ECONF_EMPTYKEY
259 Key has empty value.
260
261 ECONF_WRITEERROR
262 Error creating or writing to a file.
263
264 ECONF_PARSE_ERROR
265 General syntax error in input file.
266
267 ECONF_MISSING_BRACKET
268 Missing closing section bracket.
269
270 ECONF_MISSING_DELIMITER
271 Missing delimiter.
272
273 ECONF_EMPTY_SECTION_NAME
274 Empty section name.
275
276 ECONF_TEXT_AFTER_SECTION
277 Text after section.
278
280 econf_err econf_readFile (econf_file ** result, const char * file_name,
281 const char * delim, const char * comment)
282 Process the file of the given file_name and save its contents into
283 key_file object.
284
285 Parameters:
286 result content of parsed file
287 file_name absolute path of parsed file
288 delim delimiters of key/value e.g. '\t ='
289 comment array of characters which define the start of a comment
290
291 Returns:
292 econf_err ECONF_SUCCESS or error code
293
294 Usage:
295
296 #include "libeconf.h"
297
298 econf_file *key_file = NULL;
299 econf_err error;
300
301 error = econf_readFile (&key_file, "/etc/test.conf", "=", "#");
302
303 econf_free (key_file);
304
305
306 Default behaviour if entries have the same name in one file: The first
307 hit will be returned. Further entries will be ignored. This can be
308 changed by setting the environment variable ECONF_JOIN_SAME_ENTRIES. In
309 that case entries with the same name will be joined to one single
310 entry.
311
312
313 econf_err econf_readDirsHistory (econf_file *** key_files, size_t * size,
314 const char * usr_conf_dir, const char * etc_conf_dir, const char *
315 project_name, const char * config_suffix, const char * delim, const
316 char * comment)
317 Evaluating key/values for every given configuration files in two
318 different directories (normally in /usr/etc and /etc). Returns a list
319 of read configuration files and their values.
320
321 Parameters:
322 key_files list of parsed file(s). Each entry includes all
323 key/value, path, comments,... information of the regarding file.
324 size Size of the evaluated key_files list.
325 usr_conf_dir absolute path of the first directory (normally
326 '/usr/etc')
327 etc_conf_dir absolute path of the second directory (normally
328 '/etc')
329 project_name basename of the configuration file
330 config_suffix suffix of the configuration file. Can also be NULL.
331 delim delimiters of key/value e.g. '\t ='
332 comment array of characters which define the start of a comment
333
334 Returns:
335 econf_err ECONF_SUCCESS or error code
336
337 econf_err econf_mergeFiles (econf_file ** merged_file, econf_file *
338 usr_file, econf_file * etc_file)
339 Merge the contents of two key_files objects. Entries in etc_file will
340 be prefered.
341
342 Parameters:
343 merged_file merged data
344 usr_file First data block which has to be merged.
345 etc_file Second data block which has to be merged.
346
347 Returns:
348 econf_err ECONF_SUCCESS or error code
349
350 Usage:
351
352 #include "libeconf.h"
353
354 econf_file *key_file_1 = NULL, *key_file_2 = NULL, *key_file_ret = NULL
355 econf_err error;
356
357 error = econf_readFile (&key_file1, "/usr/etc/test.conf", "=", "#");
358 error = econf_readFile (&key_file2, /etc/test.conf", "=", "#");
359 error = econf_mergeFiles (&key_file_ret, key_file_1, key_file_2);
360
361 econf_free (key_file_ret);
362 econf_free (key_file_1);
363 econf_free (key_file_2);
364
365
366 econf_err econf_readDirs (econf_file ** key_file, const char *
367 usr_conf_dir, const char * etc_conf_dir, const char * project_name,
368 const char * config_suffix, const char * delim, const char * comment)
369 Evaluating the content of a given configuration file by reading all
370 needed/available files in two different directories (normally in
371 /usr/etc and /etc).
372
373 Parameters:
374 key_file content of parsed file(s)
375 usr_conf_dir absolute path of the first directory (normally
376 '/usr/etc')
377 etc_conf_dir absolute path of the second directory (normally
378 '/etc')
379 project_name basename of the configuration file
380 config_suffix suffix of the configuration file. Can also be NULL.
381 delim delimiters of key/value e.g. '\t ='
382 comment array of characters which define the start of a comment
383
384 Returns:
385 econf_err ECONF_SUCCESS or error code
386
387 Example: Reading content of example.conf in /usr/etc and /etc
388 directory.
389
390 #include "libeconf.h"
391
392 econf_file *key_file = NULL;
393 econf_err error;
394
395 error = econf_readDirs (&key_file,
396 "/usr/etc",
397 "/etc",
398 "example",
399 "conf",
400 "=", "#");
401
402 econf_free (key_file);
403
404
405 econf_err econf_newKeyFile (econf_file ** result, char delimiter, char
406 comment)
407 Create a new econf_file object.
408
409 Parameters:
410 result Pointer to the allocated econf_file object.
411 delimiter delimiter of key/value e.g. '='
412 comment Character which defines the start of a comment.
413
414 Returns:
415 econf_err ECONF_SUCCESS or error code
416
417 econf_err econf_newIniFile (econf_file ** result)
418 Create a new econf_file object in IniFile format. So the delimiter will
419 be '=' and comments are beginning with '#'.
420
421 Parameters:
422 result Pointer to the allocated econf_file object.
423
424 Returns:
425 econf_err ECONF_SUCCESS or error code
426
427 econf_err econf_writeFile (econf_file * key_file, const char * save_to_dir,
428 const char * file_name)
429 Write content of a econf_file struct to specified location.
430
431 Parameters:
432 key_file Data which has to be written.
433 save_to_dir Directory into which the file has to be written.
434 file_name filename (with suffix)
435
436 Returns:
437 econf_err ECONF_SUCCESS or error code
438
439 char* econf_getPath (econf_file * kf)
440 Evaluating path name.
441
442 Parameters:
443 kf given/parsed data
444
445 Returns:
446 Absolute path name or an empty string if kf is a result of already
447 merged data (e.G. returned by econf_readDirs).
448
449 econf_err econf_getGroups (econf_file * kf, size_t * length, char ***
450 groups)
451 Evaluating all group entries.
452
453 Parameters:
454 kf given/parsed data
455 length Length of the returned group array.
456 groups String array of evaluated groups.
457
458 Returns:
459 econf_err ECONF_SUCCESS or error code
460
461 econf_err econf_getKeys (econf_file * kf, const char * group, size_t *
462 length, char *** keys)
463 Evaluating all keys.
464
465 Parameters:
466 kf given/parsed data
467 group Group name for which the keys have to be evaluated or NULL
468 for all keys.
469 length Length of the returned key array.
470 keys String array of evaluated keys.
471
472 Returns:
473 econf_err ECONF_SUCCESS or error code
474
475 econf_err econf_getIntValue (econf_file * kf, const char * group, const
476 char * key, int32_t * result)
477 Evaluating int32 value for given group/key.
478
479 Parameters:
480 kf given/parsed data
481 group Desired group or NULL if there is no group defined.
482 key Key for which the value is requested.
483 result determined value
484
485 Returns:
486 econf_err ECONF_SUCCESS or error code
487
488 econf_err econf_getInt64Value (econf_file * kf, const char * group, const
489 char * key, int64_t * result)
490 Evaluating int64 value for given group/key.
491
492 Parameters:
493 kf given/parsed data
494 group Desired group or NULL if there is no group defined.
495 key Key for which the value is requested.
496 result determined value
497
498 Returns:
499 econf_err ECONF_SUCCESS or error code
500
501 econf_err econf_getUIntValue (econf_file * kf, const char * group, const
502 char * key, uint32_t * result)
503 Evaluating uint32 value for given group/key.
504
505 Parameters:
506 kf given/parsed data
507 group Desired group or NULL if there is no group defined.
508 key Key for which the value is requested.
509 result determined value
510
511 Returns:
512 econf_err ECONF_SUCCESS or error code
513
514 econf_err econf_getUInt64Value (econf_file * kf, const char * group, const
515 char * key, uint64_t * result)
516 Evaluating uint64 value for given group/key.
517
518 Parameters:
519 kf given/parsed data
520 group Desired group or NULL if there is no group defined.
521 key Key for which the value is requested.
522 result determined value
523
524 Returns:
525 econf_err ECONF_SUCCESS or error code
526
527 econf_err econf_getFloatValue (econf_file * kf, const char * group, const
528 char * key, float * result)
529 Evaluating float value for given group/key.
530
531 Parameters:
532 kf given/parsed data
533 group Desired group or NULL if there is no group defined.
534 key Key for which the value is requested.
535 result determined value
536
537 Returns:
538 econf_err ECONF_SUCCESS or error code
539
540 econf_err econf_getDoubleValue (econf_file * kf, const char * group, const
541 char * key, double * result)
542 Evaluating double value for given group/key.
543
544 Parameters:
545 kf given/parsed data
546 group Desired group or NULL if there is no group defined.
547 key Key for which the value is requested.
548 result determined value
549
550 Returns:
551 econf_err ECONF_SUCCESS or error code
552
553 econf_err econf_getStringValue (econf_file * kf, const char * group, const
554 char * key, char ** result)
555 Evaluating string value for given group/key.
556
557 Parameters:
558 kf given/parsed data
559 group Desired group or NULL if there is no group defined.
560 key Key for which the value is requested.
561 result A newly allocated string or NULL in error case.
562
563 Returns:
564 econf_err ECONF_SUCCESS or error code
565
566 econf_err econf_getBoolValue (econf_file * kf, const char * group, const
567 char * key, bool * result)
568 Evaluating bool value for given group/key.
569
570 Parameters:
571 kf given/parsed data
572 group Desired group or NULL if there is no group defined.
573 key Key for which the value is requested.
574 result determined value
575
576 Returns:
577 econf_err ECONF_SUCCESS or error code
578
579 econf_err econf_getIntValueDef (econf_file * kf, const char * group, const
580 char * key, int32_t * result, int32_t def)
581 Evaluating int32 value for given group/key. If key is not found, the
582 default value is returned and error is ECONF_NOKEY.
583
584 Parameters:
585 kf given/parsed data
586 group Desired group or NULL if there is no group defined.
587 key Key for which the value is requested.
588 result determined value
589 def Default value if the value has not been found.
590
591 Returns:
592 econf_err ECONF_SUCCESS or error code
593
594 econf_err econf_getInt64ValueDef (econf_file * kf, const char * group,
595 const char * key, int64_t * result, int64_t def)
596 Evaluating int64 value for given group/key. If key is not found, the
597 default value is returned and error is ECONF_NOKEY.
598
599 Parameters:
600 kf given/parsed data
601 group Desired group or NULL if there is no group defined.
602 key Key for which the value is requested.
603 result determined value
604 def Default value if the value has not been found.
605
606 Returns:
607 econf_err ECONF_SUCCESS or error code
608
609 econf_err econf_getUIntValueDef (econf_file * kf, const char * group, const
610 char * key, uint32_t * result, uint32_t def)
611 Evaluating uint32 value for given group/key. If key is not found, the
612 default value is returned and error is ECONF_NOKEY.
613
614 Parameters:
615 kf given/parsed data
616 group Desired group or NULL if there is no group defined.
617 key Key for which the value is requested.
618 result determined value
619 def Default value if the value has not been found.
620
621 Returns:
622 econf_err ECONF_SUCCESS or error code
623
624 econf_err econf_getUInt64ValueDef (econf_file * kf, const char * group,
625 const char * key, uint64_t * result, uint64_t def)
626 Evaluating uint64 value for given group/key. If key is not found, the
627 default value is returned and error is ECONF_NOKEY.
628
629 Parameters:
630 kf given/parsed data
631 group Desired group or NULL if there is no group defined.
632 key Key for which the value is requested.
633 result determined value
634 def Default value if the value has not been found.
635
636 Returns:
637 econf_err ECONF_SUCCESS or error code
638
639 econf_err econf_getFloatValueDef (econf_file * kf, const char * group,
640 const char * key, float * result, float def)
641 Evaluating float value for given group/key. If key is not found, the
642 default value is returned and error is ECONF_NOKEY.
643
644 Parameters:
645 kf given/parsed data
646 group Desired group or NULL if there is no group defined.
647 key Key for which the value is requested.
648 result determined value
649 def Default value if the value has not been found.
650
651 Returns:
652 econf_err ECONF_SUCCESS or error code
653
654 econf_err econf_getDoubleValueDef (econf_file * kf, const char * group,
655 const char * key, double * result, double def)
656 Evaluating double value for given group/key. If key is not found, the
657 default value is returned and error is ECONF_NOKEY.
658
659 Parameters:
660 kf given/parsed data
661 group Desired group or NULL if there is no group defined.
662 key Key for which the value is requested.
663 result determined value
664 def Default value if the value has not been found.
665
666 Returns:
667 econf_err ECONF_SUCCESS or error code
668
669 econf_err econf_getStringValueDef (econf_file * kf, const char * group,
670 const char * key, char ** result, char * def)
671 Evaluating string value for given group/key. If key is not found, the
672 default value is returned and error is ECONF_NOKEY.
673
674 Parameters:
675 kf given/parsed data
676 group Desired group or NULL if there is no group defined.
677 key Key for which the value is requested.
678 result Returns a newly allocated string, even if 'default' is
679 returned.
680 def Default value if the value has not been found.
681
682 Returns:
683 econf_err ECONF_SUCCESS or error code
684
685 econf_err econf_getBoolValueDef (econf_file * kf, const char * group, const
686 char * key, bool * result, bool def)
687 Evaluating bool value for given group/key. If key is not found, the
688 default value is returned and error is ECONF_NOKEY.
689
690 Parameters:
691 kf given/parsed data
692 group Desired group or NULL if there is no group defined.
693 key Key for which the value is requested.
694 result determined value
695 def Default value if the value has not been found.
696
697 Returns:
698 econf_err ECONF_SUCCESS or error code
699
700 econf_err econf_setIntValue (econf_file * kf, const char * group, const
701 char * key, int32_t value)
702 Set int32 value for given group/key.
703
704 Parameters:
705 kf given/parsed data
706 group Desired group or NULL if there is no group defined.
707 key Key for which the value has to be set.
708 value Value which has to be set.
709
710 Returns:
711 econf_err ECONF_SUCCESS or error code
712
713 econf_err econf_setInt64Value (econf_file * kf, const char * group, const
714 char * key, int64_t value)
715 Set int64 value for given group/key.
716
717 Parameters:
718 kf given/parsed data
719 group Desired group or NULL if there is no group defined.
720 key Key for which the value has to be set.
721 value Value which has to be set.
722
723 Returns:
724 econf_err ECONF_SUCCESS or error code
725
726 econf_err econf_setUIntValue (econf_file * kf, const char * group, const
727 char * key, uint32_t value)
728 Set uint32 value for given group/key.
729
730 Parameters:
731 kf given/parsed data
732 group Desired group or NULL if there is no group defined.
733 key Key for which the value has to be set.
734 value Value which has to be set.
735
736 Returns:
737 econf_err ECONF_SUCCESS or error code
738
739 econf_err econf_setUInt64Value (econf_file * kf, const char * group, const
740 char * key, uint64_t value)
741 Set uint64 value for given group/key.
742
743 Parameters:
744 kf given/parsed data
745 group Desired group or NULL if there is no group defined.
746 key Key for which the value has to be set.
747 value Value which has to be set.
748
749 Returns:
750 econf_err ECONF_SUCCESS or error code
751
752 econf_err econf_setFloatValue (econf_file * kf, const char * group, const
753 char * key, float value)
754 Set float value for given group/key.
755
756 Parameters:
757 kf given/parsed data
758 group Desired group or NULL if there is no group defined.
759 key Key for which the value has to be set.
760 value Value which has to be set.
761
762 Returns:
763 econf_err ECONF_SUCCESS or error code
764
765 econf_err econf_setDoubleValue (econf_file * kf, const char * group, const
766 char * key, double value)
767 Set double value for given group/key.
768
769 Parameters:
770 kf given/parsed data
771 group Desired group or NULL if there is no group defined.
772 key Key for which the value has to be set.
773 value Value which has to be set.
774
775 Returns:
776 econf_err ECONF_SUCCESS or error code
777
778 econf_err econf_setStringValue (econf_file * kf, const char * group, const
779 char * key, const char * value)
780 Set string value for given group/key.
781
782 Parameters:
783 kf given/parsed data
784 group Desired group or NULL if there is no group defined.
785 key Key for which the value has to be set.
786 value Value which has to be set.
787
788 Returns:
789 econf_err ECONF_SUCCESS or error code
790
791 econf_err econf_setBoolValue (econf_file * kf, const char * group, const
792 char * key, const char * value)
793 Set bool value for given group/key.
794
795 Parameters:
796 kf given/parsed data
797 group Desired group or NULL if there is no group defined.
798 key Key for which the value has to be set.
799 value Value which has to be set.
800
801 Returns:
802 econf_err ECONF_SUCCESS or error code
803
804 const char* econf_errString (const econf_err error)
805 Convert an econf_err type to a string.
806
807 Parameters:
808 error error enum
809
810 Returns:
811 human readable string
812
813 void econf_errLocation (char ** filename, uint64_t * line_nr)
814 Info about where the error has happened.
815
816 Parameters:
817 filename Path of the last scanned file.
818 line_nr Number of the last handled line.
819
820 void econf_freeArray (char ** array)
821 Free an array of type char** created by econf_getGroups() or
822 econf_getKeys().
823
824 Parameters:
825 array array of strings
826
827 Returns:
828 void
829
830 void econf_freeFile (econf_file * key_file)
831 Free memory allocated by e.g. econf_readFile(), econf_readDirs(),...
832
833 Parameters:
834 key_file allocated data
835
836 Returns:
837 void
838
839 econf_err econf_getExtValue (econf_file * kf, const char * group, const
840 char * key, econf_ext_value ** result)
841 Evaluating more information for given group/key.
842
843 Parameters:
844 kf given/parsed data
845 group Desired group or NULL if there is no group defined.
846 key Key for which the value is requested.
847 result A newly allocated struct or NULL in error case.
848
849 Returns:
850 econf_err ECONF_SUCCESS or error code
851
852 void econf_freeExtValue (econf_ext_value * to_free)
853 Free an complete econf_ext_value struct.
854
855 Parameters:
856 to_free struct which has to be freed
857
858 Returns:
859 void
860
862 econftool
863
864
865
866Version 0.4.0 Thu Apr 8 2021 libeconf(3)