summaryrefslogtreecommitdiff
path: root/src/shared/conf-parser.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-23 20:50:22 +0100
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commitbf8743c89f67bd0c6016d41ac92ee70e962b74ff (patch)
tree45beeab9018ddd5b042902a3fe2ea588e3f42999 /src/shared/conf-parser.c
parent3b387a06cf8205c9938a1000ca8a14b98116502c (diff)
conf-parse: small prettification
Let's use first_word() instead of startswith(), it's more explanatory and a bit more correct. Also, let's use the return value instead of adding +9 when looking for the second part of the directive.
Diffstat (limited to 'src/shared/conf-parser.c')
-rw-r--r--src/shared/conf-parser.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 8a88820a1..c7b453e8d 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -184,7 +184,7 @@ static int parse_line(
char *l,
void *userdata) {
- char *e;
+ char *e, *include;
assert(filename);
assert(line > 0);
@@ -198,7 +198,8 @@ static int parse_line(
if (strchr(COMMENTS "\n", *l))
return 0;
- if (startswith(l, ".include ")) {
+ include = first_word(l, ".include");
+ if (include) {
_cleanup_free_ char *fn = NULL;
/* .includes are a bad idea, we only support them here
@@ -219,7 +220,7 @@ static int parse_line(
".include directives are deprecated, and support for them will be removed in a future version of elogind. "
"Please use drop-in files instead.");
- fn = file_in_same_dir(filename, strstrip(l+9));
+ fn = file_in_same_dir(filename, strstrip(include));
if (!fn)
return -ENOMEM;