]>
git.saurik.com Git - apple/xnu.git/blob - pexpert/gen/bootargs.c
63a90941de725f06c3a2f37ef4f1a2d5c691bbac
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 #include <pexpert/pexpert.h>
27 extern boolean_t
isargsep( char c
);
28 extern int argstrcpy(char *from
, char *to
);
29 extern int getval(char *s
, int *val
);
43 boolean_t arg_boolean
;
46 args
= PE_boot_args();
47 if (*args
== '\0') return FALSE
;
51 while(isargsep(*args
)) args
++;
61 while (!isargsep (*cp
) && *cp
!= '=')
63 if (*cp
!= '=' && !arg_boolean
)
69 if (strncmp(args
, arg_string
, i
) ||
70 (i
!=strlen(arg_string
)))
73 *(unsigned int *)arg_ptr
= TRUE
;
77 while (isargsep (*cp
))
79 if (*cp
== '=' && c
!= '=') {
84 switch (getval(cp
, &val
))
87 *(unsigned int *)arg_ptr
= val
;
91 argstrcpy(++cp
, (char *)arg_ptr
);
98 /* Skip over current arg */
99 while(!isargsep(*args
)) args
++;
101 /* Skip leading white space (catch end of args) */
102 while(*args
&& isargsep(*args
)) args
++;
111 if (c
== ' ' || c
== '\0' || c
== '\t')
124 while (!isargsep(*from
)) {
137 register unsigned radix
, intval
;
138 register unsigned char c
;
160 case '0': case '1': case '2': case '3':
161 case '4': case '5': case '6': case '7':
172 if (((c
= *s
++) >= '0') && (c
<= '9'))
174 else if ((c
>= 'a') && (c
<= 'f'))
176 else if ((c
>= 'A') && (c
<= 'F'))
178 else if (isargsep(c
))
187 *val
= intval
* sign
;