chiark / gitweb /
Allow braceless variables to be expanded
[elogind.git] / src / basic / proc-cmdline.h
1 #pragma once
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2010 Lennart Poettering
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU Lesser General Public License as published by
10   the Free Software Foundation; either version 2.1 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   Lesser General Public License for more details.
17
18   You should have received a copy of the GNU Lesser General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <stdbool.h>
23
24 #include "log.h"
25
26 enum {
27         PROC_CMDLINE_STRIP_RD_PREFIX = 1,
28         PROC_CMDLINE_VALUE_OPTIONAL = 2,
29 };
30
31 typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data);
32
33 int proc_cmdline(char **ret);
34
35 #if 0 /// UNNEEDED by elogind
36 int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, unsigned flags);
37
38 int proc_cmdline_get_key(const char *parameter, unsigned flags, char **value);
39 int proc_cmdline_get_bool(const char *key, bool *ret);
40
41 char *proc_cmdline_key_startswith(const char *s, const char *prefix);
42 bool proc_cmdline_key_streq(const char *x, const char *y);
43
44 int shall_restore_state(void);
45 const char* runlevel_to_target(const char *rl);
46 #endif // 0
47
48 /* A little helper call, to be used in proc_cmdline_parse_t callbacks */
49 static inline bool proc_cmdline_value_missing(const char *key, const char *value) {
50         if (!value) {
51                 log_warning("Missing argument for %s= kernel command line switch, ignoring.", key);
52                 return true;
53         }
54
55         return false;
56 }