]>
git.saurik.com Git - apple/xnu.git/blob - pexpert/gen/bootargs.c
193261b2e9b0f8949c5e89b31d22c4689c106eb2
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();
46 while(isargsep(*args
)) args
++;
56 while (!isargsep (*cp
) && *cp
!= '=')
58 if (*cp
!= '=' && !arg_boolean
)
64 if (strncmp(args
, arg_string
, i
) ||
65 (i
!=strlen(arg_string
)))
68 *(unsigned int *)arg_ptr
= TRUE
;
72 while (isargsep (*cp
))
74 if (*cp
== '=' && c
!= '=') {
79 switch (getval(cp
, &val
))
82 *(unsigned int *)arg_ptr
= val
;
86 argstrcpy(++cp
, (char *)arg_ptr
);
93 /* Skip over current arg */
94 while(!isargsep(*args
)) args
++;
96 /* Skip leading white space (catch end of args) */
97 while(*args
&& isargsep(*args
)) args
++;
106 if (c
== ' ' || c
== '\0' || c
== '\t')
119 while (!isargsep(*from
)) {
132 register unsigned radix
, intval
;
133 register unsigned char c
;
155 case '0': case '1': case '2': case '3':
156 case '4': case '5': case '6': case '7':
167 if (((c
= *s
++) >= '0') && (c
<= '9'))
169 else if ((c
>= 'a') && (c
<= 'f'))
171 else if ((c
>= 'A') && (c
<= 'F'))
173 else if (isargsep(c
))
182 *val
= intval
* sign
;