Xyris  0.5
Arguments.cpp
Go to the documentation of this file.
1 /**
2  * @file Arguments.cpp
3  * @author Keeton Feavel ([email protected])
4  * @brief Kernel command argument parsing
5  * @version 0.1
6  * @date 2021-08-10
7  *
8  * @copyright Copyright the Xyris Contributors (c) 2021
9  *
10  */
11 #include <Bootloader/Arguments.hpp>
12 #include <Library/stdio.hpp>
13 #include <Library/string.hpp>
14 
15 namespace Boot {
16 
17 void parseCommandLine(char* cmdline)
18 {
19  for (struct argument* arg = _ARGUMENTS_START; arg < _ARGUMENTS_END; arg++) {
20  if (strstr(cmdline, arg->arg)) {
21  arg->callback(arg->arg);
22  }
23  }
24 }
25 
26 } // !namespace Boot
stdio.hpp
Boot::argument
Definition: Arguments.hpp:22
_ARGUMENTS_START
struct Boot::argument _ARGUMENTS_START[0]
strstr
const char * strstr(const char *haystack, const char *needle)
Locates a substring (needle) within a containing string (haystack)
Definition: string.cpp:65
_ARGUMENTS_END
struct Boot::argument _ARGUMENTS_END[0]
Arguments.hpp
Kernel command argument parsing.
string.hpp
Standard string and memory utility library.
Boot
Definition: Arguments.cpp:15
Boot::parseCommandLine
void parseCommandLine(char *cmdline)
Parse a command line for registered arguments.
Definition: Arguments.cpp:17