Deleted Added
full compact
boot.c (193192) boot.c (199210)
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/boot/common/boot.c 193192 2009-06-01 01:02:30Z rodrigc $");
28__FBSDID("$FreeBSD: head/sys/boot/common/boot.c 199210 2009-11-12 01:30:17Z attilio $");
29
30/*
31 * Loading modules, booting the system
32 */
33
34#include <stand.h>
35#include <string.h>
36

--- 120 unchanged lines hidden (view full) ---

157
158int
159autoboot(int timeout, char *prompt)
160{
161 time_t when, otime, ntime;
162 int c, yes;
163 char *argv[2], *cp, *ep;
164 char *kernelname;
29
30/*
31 * Loading modules, booting the system
32 */
33
34#include <stand.h>
35#include <string.h>
36

--- 120 unchanged lines hidden (view full) ---

157
158int
159autoboot(int timeout, char *prompt)
160{
161 time_t when, otime, ntime;
162 int c, yes;
163 char *argv[2], *cp, *ep;
164 char *kernelname;
165#ifdef BOOT_PROMPT_123
166 const char *seq = "123", *p = seq;
167#endif
165
166 autoboot_tried = 1;
167
168 if (timeout == -1) {
169 timeout = 10;
170 /* try to get a delay from the environment */
171 if ((cp = getenv("autoboot_delay"))) {
172 timeout = strtol(cp, &ep, 0);

--- 14 unchanged lines hidden (view full) ---

187 }
188
189 if (timeout >= 0) {
190 otime = time(NULL);
191 when = otime + timeout; /* when to boot */
192
193 yes = 0;
194
168
169 autoboot_tried = 1;
170
171 if (timeout == -1) {
172 timeout = 10;
173 /* try to get a delay from the environment */
174 if ((cp = getenv("autoboot_delay"))) {
175 timeout = strtol(cp, &ep, 0);

--- 14 unchanged lines hidden (view full) ---

190 }
191
192 if (timeout >= 0) {
193 otime = time(NULL);
194 when = otime + timeout; /* when to boot */
195
196 yes = 0;
197
198#ifdef BOOT_PROMPT_123
199 printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or "
200 "1 2 3 sequence for command prompt." : prompt);
201#else
195 printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or any other key for command prompt." : prompt);
202 printf("%s\n", (prompt == NULL) ? "Hit [Enter] to boot immediately, or any other key for command prompt." : prompt);
203#endif
196
197 for (;;) {
198 if (ischar()) {
199 c = getchar();
204
205 for (;;) {
206 if (ischar()) {
207 c = getchar();
208#ifdef BOOT_PROMPT_123
209 if ((c == '\r') || (c == '\n')) {
210 yes = 1;
211 break;
212 } else if (c != *p++)
213 p = seq;
214 if (*p == 0)
215 break;
216#else
200 if ((c == '\r') || (c == '\n'))
201 yes = 1;
202 break;
217 if ((c == '\r') || (c == '\n'))
218 yes = 1;
219 break;
220#endif
203 }
204 ntime = time(NULL);
205 if (ntime >= when) {
206 yes = 1;
207 break;
208 }
209
210 if (ntime != otime) {

--- 166 unchanged lines hidden ---
221 }
222 ntime = time(NULL);
223 if (ntime >= when) {
224 yes = 1;
225 break;
226 }
227
228 if (ntime != otime) {

--- 166 unchanged lines hidden ---