Deleted Added
full compact
console.c (40214) console.c (40775)
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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 *
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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 * $Id: console.c,v 1.2 1998/09/26 01:29:13 msmith Exp $
26 * $Id: console.c,v 1.3 1998/10/11 10:19:11 peter Exp $
27 */
28
29#include <stand.h>
30#include <string.h>
31
32#include "bootstrap.h"
33/*
34 * Core console support

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

145 * XXX Note that the console system design allows for some extension
146 * here (eg. multiple consoles, input/output only, etc.)
147 */
148static int
149cons_set(struct env_var *ev, int flags, void *value)
150{
151 int cons, active;
152
27 */
28
29#include <stand.h>
30#include <string.h>
31
32#include "bootstrap.h"
33/*
34 * Core console support

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

145 * XXX Note that the console system design allows for some extension
146 * here (eg. multiple consoles, input/output only, etc.)
147 */
148static int
149cons_set(struct env_var *ev, int flags, void *value)
150{
151 int cons, active;
152
153 if ((active = cons_find(value)) == -1) {
154 printf("no such console '%s'\n", (char *)value);
153 if ((value == NULL) || ((active = cons_find(value)) == -1)) {
154 if (value != NULL)
155 printf("no such console '%s'\n", (char *)value);
156 printf("Available consoles:\n");
157 for (cons = 0; consoles[cons] != NULL; cons++)
158 printf(" %s\n", consoles[cons]->c_name);
155 return(CMD_ERROR);
156 }
157
158 /* disable all current consoles */
159 for (cons = 0; consoles[cons] != NULL; cons++)
160 consoles[cons]->c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT);
161
162 /* enable selected console */
163 consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
164 consoles[active]->c_init(0);
165
166 env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
167 return(CMD_OK);
168}
159 return(CMD_ERROR);
160 }
161
162 /* disable all current consoles */
163 for (cons = 0; consoles[cons] != NULL; cons++)
164 consoles[cons]->c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT);
165
166 /* enable selected console */
167 consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
168 consoles[active]->c_init(0);
169
170 env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
171 return(CMD_OK);
172}