2 * Copyright (C) 2014 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35 /** Use raw (unpatched) BCD files */
38 /** Use raw (unpatched) WIM files */
41 /** Inhibit debugging output */
44 /** Allow graphical output from bootmgr/bootmgfw */
47 /** Pause before booting OS */
50 /** Pause without displaying any prompt */
51 int cmdline_pause_quiet
;
53 /** Use linear (unpaged) memory model */
57 unsigned int cmdline_index
;
60 char cmdline_vf_path
[MAX_VF
][64];
62 file_size_pf pfventoy_file_size
;
63 file_read_pf pfventoy_file_read
;
66 * Process command line
68 * @v cmdline Command line
70 void process_cmdline ( char *cmdline
) {
76 /* Do nothing if we have no command line */
77 if ( ( cmdline
== NULL
) || ( cmdline
[0] == '\0' ) )
80 /* Parse command line */
84 while ( isspace ( *tmp
) )
87 /* Find value (if any) and end of this argument */
91 if ( isspace ( *tmp
) ) {
94 } else if ( *tmp
== '=' ) {
102 /* Process this argument */
103 if ( strcmp ( key
, "rawbcd" ) == 0 ) {
105 } else if ( strcmp ( key
, "rawwim" ) == 0 ) {
107 } else if ( strcmp ( key
, "gui" ) == 0 ) {
111 else if ((key
[0] == 'v') && (key
[1] == 'f') ) {
112 if (cmdline_vf_num
>= MAX_VF
)
113 die("Too many vf\n");
114 snprintf(cmdline_vf_path
[cmdline_vf_num
], 64, "%s", value
);
116 }else if ( strcmp ( key
, "pfsize" ) == 0 ) {
117 pfventoy_file_size
= (file_size_pf
)strtoul(value
, &endp
, 0);
118 } else if ( strcmp ( key
, "pfread" ) == 0 ) {
119 pfventoy_file_read
= (file_read_pf
)strtoul(value
, &endp
, 0 );
122 else if ( strcmp ( key
, "linear" ) == 0 ) {
124 } else if ( strcmp ( key
, "quiet" ) == 0 ) {
126 } else if ( strcmp ( key
, "pause" ) == 0 ) {
128 if ( value
&& ( strcmp ( value
, "quiet" ) == 0 ) )
129 cmdline_pause_quiet
= 1;
130 } else if ( strcmp ( key
, "index" ) == 0 ) {
131 if ( ( ! value
) || ( ! value
[0] ) )
132 die ( "Argument \"index\" needs a value\n" );
133 cmdline_index
= strtoul ( value
, &endp
, 0 );
135 die ( "Invalid index \"%s\"\n", value
);
136 } else if ( strcmp ( key
, "initrdfile" ) == 0 ) {
137 /* Ignore this keyword to allow for use with syslinux */
138 } else if ( key
== cmdline
) {
139 /* Ignore unknown initial arguments, which may
140 * be the program name.
143 die ( "Unrecognised argument \"%s%s%s\"\n", key
,
144 ( value
? "=" : "" ), ( value
? value
: "" ) );
148 /* Show command line (after parsing "quiet" option) */
149 DBG ( "Command line: \"%s\" vf=%d pfsize=%p pfread=%p\n",
150 cmdline
, cmdline_vf_num
, pfventoy_file_size
, pfventoy_file_read
);