]>
git.saurik.com Git - apple/xnu.git/blob - pexpert/gen/bootargs.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #include <pexpert/pexpert.h>
24 extern boolean_t
isargsep( char c
);
25 extern int argstrcpy(char *from
, char *to
);
26 extern int getval(char *s
, int *val
);
40 boolean_t arg_boolean
;
43 args
= PE_boot_args();
44 if (*args
== '\0') return FALSE
;
48 while(isargsep(*args
)) args
++;
58 while (!isargsep (*cp
) && *cp
!= '=')
60 if (*cp
!= '=' && !arg_boolean
)
66 if (strncmp(args
, arg_string
, i
) ||
67 (i
!=strlen(arg_string
)))
70 *(unsigned int *)arg_ptr
= TRUE
;
74 while (isargsep (*cp
))
76 if (*cp
== '=' && c
!= '=') {
81 switch (getval(cp
, &val
))
84 *(unsigned int *)arg_ptr
= val
;
88 argstrcpy(++cp
, (char *)arg_ptr
);
95 /* Skip over current arg */
96 while(!isargsep(*args
)) args
++;
98 /* Skip leading white space (catch end of args) */
99 while(*args
&& isargsep(*args
)) args
++;
108 if (c
== ' ' || c
== '\0' || c
== '\t')
121 while (!isargsep(*from
)) {
134 register unsigned radix
, intval
;
135 register unsigned char c
;
157 case '0': case '1': case '2': case '3':
158 case '4': case '5': case '6': case '7':
169 if (((c
= *s
++) >= '0') && (c
<= '9'))
171 else if ((c
>= 'a') && (c
<= 'f'))
173 else if ((c
>= 'A') && (c
<= 'F'))
175 else if (isargsep(c
))
184 *val
= intval
* sign
;