summaryrefslogtreecommitdiff
path: root/kern/arg.h
blob: c4c2a2bbc5a23b5011cd021a2c9bc15a20365529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright (c) 2017 Richard Braun.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 * Kernel command line argument parsing.
 *
 * Arguments are separated by spaces (there is no escape character).
 * They can be of the form "name" when used as boolean values (present
 * or not), or "name=value".
 */

#ifndef KERN_ARG_H
#define KERN_ARG_H

#include <stdbool.h>

#include <kern/init.h>

#define ARG_CMDLINE_MAX_SIZE 256

/*
 * Set the command line string.
 *
 * This function must be called before calling the kernel main entry point.
 */
void arg_set_cmdline(const char *cmdline);

/*
 * Log command line information.
 */
void arg_log_info(void);

/*
 * Return true if an argument with the given name is present in the
 * command line.
 */
bool arg_present(const char *name);

/*
 * Return the value of the argument with the given name in the command
 * line.
 *
 * If the argument form is "name", the empty string is returned. If the
 * argument isn't present, NULL is returned.
 */
const char * arg_value(const char *name);

/*
 * This init operation provides :
 *  - command line arguments can be retrieved
 */
INIT_OP_DECLARE(arg_setup);

#endif /* KERN_ARG_H */