mirror of
https://github.com/troglobit/finit.git
synced 2026-11-16 19:20:26 +00:00
conf: cleanup and relocation of common parsing functions and helpers
- legacy.[ch]: strictly legacy .conf parser boilerplate only - conf.[ch]: .conf parser and generic configuration functionality Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
9 files changed
+831
-826
No files matched your search
@@ -71,6 +71,7 @@ int print_result (int fail);
|
||||
void print_exit (void);
|
||||
|
||||
void set_hostname (char **hostname);
|
||||
void kmod_load (char *mod);
|
||||
void networking (int updown);
|
||||
int in_container (void);
|
||||
void setprocnm (const char *name);
|
||||
@@ -113,6 +114,19 @@ static inline int dprint(int fd, const char *s, size_t len)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static inline int istrue(char *arg, int defval)
|
||||
{
|
||||
if (!arg)
|
||||
goto fallback;
|
||||
|
||||
if (string_compare(arg, "true") || string_compare(arg, "on") || string_compare(arg, "1"))
|
||||
return 1;
|
||||
if (string_compare(arg, "false") || string_compare(arg, "off") || string_compare(arg, "0"))
|
||||
return 0;
|
||||
fallback:
|
||||
return defval;
|
||||
}
|
||||
|
||||
static inline char *fgetval(const char *line, const char *key, char *sep)
|
||||
{
|
||||
char *ptr, *str, *copy;
|
||||
|
||||
Reference in new issue
Block a user