diff options
author | Richard Braun <rbraun@sceen.net> | 2017-05-11 06:30:55 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-05-11 06:30:55 +0200 |
commit | 3cf59e5e72669ced763b00659ab270c9b2436b4f (patch) | |
tree | 40fbe9ca5532c86601319d6dee347a779d766e34 /kern/arg.h | |
parent | 268e45101d5def9aeb053d19ae5c531a0f43f052 (diff) |
kern/arg: new module
Diffstat (limited to 'kern/arg.h')
-rw-r--r-- | kern/arg.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/kern/arg.h b/kern/arg.h new file mode 100644 index 00000000..937f596b --- /dev/null +++ b/kern/arg.h @@ -0,0 +1,57 @@ +/* + * 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> + +#define ARG_CMDLINE_MAX_SIZE 256 + +/* + * Initialize the arg module. + */ +void arg_setup(const char *cmdline); + +/* + * Display command line information. + */ +void arg_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); + +#endif /* _KERN_ARG_H */ |