3 Copyright (C) 2009 Jörg Pfähler
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <kernel/cmdline.hpp>
20 #include <kernel/log.hpp>
22 static const char* skip_param(const char* cmdline
)
25 while (*cmdline
!= '\0' && *cmdline
!= ' ')
27 while (*cmdline
!= '\0' && *cmdline
== ' ')
32 void kernel::parse_cmdline(const char* cmdline
,
33 bool (*arch_callback
)(const char*))
35 // Skip the kernel name
36 cmdline
= skip_param(cmdline
);
38 while (*cmdline
!= '\0')
40 if (!arch_callback(cmdline
) &&
41 !kernel::cmdline_args(cmdline
))
43 // Unknown command line option
44 FATAL("Unkown commandline option \"" << cmdline
<< "\".");
47 // Skip the processed parameter
48 cmdline
= skip_param(cmdline
);
52 bool kernel::cmdline_args(const char* arg
)
54 // NOTE: architecture independant arguments here