Root/
Source at commit 2381 created 10 years 21 days ago. By ifabio, Apply patch: (Credits to Thomas Jansen aka tja) - Reading options from all devices during boot. The options for the boot menu are only read from the devices rd(0,0) or bt(0,0). Consequently, boot menu options (e.g. "Quiet Boot", "Timeout", etc.) in plists on other devices (like most users have) are ignored. This patch extends the list of paths to search for the options plist on all devices that can be found. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights␊ |
7 | * Reserved. This file contains Original Code and/or Modifications of␊ |
8 | * Original Code as defined in and that are subject to the Apple Public␊ |
9 | * Source License Version 2.0 (the "License"). You may not use this file␊ |
10 | * except in compliance with the License. Please obtain a copy of the␊ |
11 | * License at http://www.apple.com/publicsource and read it before using␊ |
12 | * this file.␊ |
13 | * ␊ |
14 | * The Original Code and all software distributed under the License are␊ |
15 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the␊ |
19 | * License for the specific language governing rights and limitations␊ |
20 | * under the License.␊ |
21 | * ␊ |
22 | * @APPLE_LICENSE_HEADER_END@␊ |
23 | */␊ |
24 | /* ␊ |
25 | * Mach Operating System␊ |
26 | * Copyright (c) 1990 Carnegie-Mellon University␊ |
27 | * Copyright (c) 1989 Carnegie-Mellon University␊ |
28 | * Copyright (c) 1988 Carnegie-Mellon University␊ |
29 | * Copyright (c) 1987 Carnegie-Mellon University␊ |
30 | * All rights reserved. The CMU software License Agreement specifies␊ |
31 | * the terms and conditions for use and redistribution.␊ |
32 | */␊ |
33 | /*␊ |
34 | * Copyright (c) 1982, 1986 Regents of the University of California.␊ |
35 | * All rights reserved. The Berkeley software License Agreement␊ |
36 | * specifies the terms and conditions for redistribution.␊ |
37 | *␊ |
38 | *␉@(#)prf.c␉7.1 (Berkeley) 6/5/86␊ |
39 | */␊ |
40 | ␊ |
41 | #include <sys/param.h>␊ |
42 | ␊ |
43 | #define SPACE␉1␊ |
44 | #define ZERO␉2␊ |
45 | #define UCASE 16␊ |
46 | ␊ |
47 | /*␊ |
48 | * Scaled down version of C Library printf.␊ |
49 | * Used to print diagnostic information directly on console tty.␊ |
50 | * Since it is not interrupt driven, all system activities are␊ |
51 | * suspended.␊ |
52 | *␊ |
53 | */␊ |
54 | ␊ |
55 | /*␊ |
56 | * Printn prints a number n in base b.␊ |
57 | * We don't use recursion to avoid deep kernel stacks.␊ |
58 | */␊ |
59 | static void␊ |
60 | printn(n, b, flag, minwidth, putfn_p, putfn_arg)␊ |
61 | ␉u_long n;␊ |
62 | ␉int b, flag, minwidth;␊ |
63 | ␉int (*putfn_p)();␊ |
64 | ␉void *putfn_arg;␊ |
65 | {␊ |
66 | ␉char prbuf[11];␊ |
67 | ␉register char *cp;␊ |
68 | ␉int width = 0, neg = 0;␊ |
69 | ␊ |
70 | ␉if (b == 10 && (int)n < 0) {␊ |
71 | ␉␉neg = 1;␊ |
72 | ␉␉n = (unsigned)(-(int)n);␊ |
73 | ␉}␊ |
74 | ␉cp = prbuf;␊ |
75 | ␉do {␊ |
76 | *cp++ = "0123456789abcdef0123456789ABCDEF"[(flag & UCASE) + n%b];␊ |
77 | ␉␉n /= b;␊ |
78 | ␉␉width++;␊ |
79 | ␉} while (n);␊ |
80 | ␉␊ |
81 | ␉if (neg) {␊ |
82 | ␉␉(*putfn_p)('-', putfn_arg);␊ |
83 | ␉␉width++;␊ |
84 | ␉}␊ |
85 | ␉while (width++ < minwidth)␊ |
86 | ␉␉(*putfn_p)( (flag & ZERO) ? '0' : ' ', putfn_arg);␊ |
87 | ␉␉␊ |
88 | ␉do␊ |
89 | ␉␉(*putfn_p)(*--cp, putfn_arg);␊ |
90 | ␉while (cp > prbuf);␊ |
91 | }␊ |
92 | ␊ |
93 | void prf(␊ |
94 | ␉char *fmt,␊ |
95 | ␉unsigned int *adx,␊ |
96 | ␉int (*putfn_p)(),␊ |
97 | ␉void *putfn_arg␊ |
98 | )␊ |
99 | {␊ |
100 | ␉int b, c;␊ |
101 | ␉char *s;␊ |
102 | ␉int flag = 0, width = 0;␊ |
103 | int minwidth;␊ |
104 | ␊ |
105 | loop:␊ |
106 | ␉while ((c = *fmt++) != '%') {␊ |
107 | ␉␉if(c == '\0')␊ |
108 | ␉␉␉return;␊ |
109 | ␉␉(*putfn_p)(c, putfn_arg);␊ |
110 | ␉}␊ |
111 | minwidth = 0;␊ |
112 | again:␊ |
113 | ␉c = *fmt++;␊ |
114 | ␉switch (c) {␊ |
115 | ␉case 'l':␊ |
116 | ␉␉goto again;␊ |
117 | ␉case ' ':␊ |
118 | ␉␉flag |= SPACE;␊ |
119 | ␉␉goto again;␊ |
120 | ␉case '0':␊ |
121 | ␉␉if (minwidth == 0) {␊ |
122 | ␉␉ /* this is a flag */␊ |
123 | ␉␉ flag |= ZERO;␊ |
124 | ␉␉ goto again;␊ |
125 | ␉␉} /* fall through */␊ |
126 | ␉case '1':␊ |
127 | ␉case '2':␊ |
128 | ␉case '3':␊ |
129 | ␉case '4':␊ |
130 | ␉case '5':␊ |
131 | ␉case '6':␊ |
132 | ␉case '7':␊ |
133 | ␉case '8':␊ |
134 | ␉case '9':␊ |
135 | ␉␉minwidth *= 10;␊ |
136 | ␉␉minwidth += c - '0';␊ |
137 | ␉␉goto again;␊ |
138 | case 'X':␊ |
139 | flag |= UCASE;␊ |
140 | /* fall through */␊ |
141 | ␉case 'x':␊ |
142 | ␉␉b = 16;␊ |
143 | ␉␉goto number;␊ |
144 | ␉case 'd':␊ |
145 | ␉␉b = 10;␊ |
146 | ␉␉goto number;␊ |
147 | ␉case 'o': case 'O':␊ |
148 | ␉␉b = 8;␊ |
149 | number:␊ |
150 | ␉␉printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg);␊ |
151 | ␉␉break;␊ |
152 | ␉case 's':␊ |
153 | ␉␉s = (char *)*adx;␊ |
154 | ␉␉while ((c = *s++)) {␊ |
155 | ␉␉␉(*putfn_p)(c, putfn_arg);␊ |
156 | ␉␉␉width++;␊ |
157 | ␉␉}␊ |
158 | ␉␉while (width++ < minwidth)␊ |
159 | ␉␉ (*putfn_p)(' ', putfn_arg);␊ |
160 | ␉␉break;␊ |
161 | ␉case 'c':␊ |
162 | ␉␉(*putfn_p)((char)*adx, putfn_arg);␊ |
163 | ␉␉break;␊ |
164 | ␉}␊ |
165 | ␉adx++;␊ |
166 | ␉goto loop;␊ |
167 | }␊ |
168 |