2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer as
12 * the first lines of this file unmodified.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #include "opt_syscons.h"
35 #include <sys/param.h>
36 #include <sys/systm.h>
37 #include <sys/kernel.h>
38 #include <sys/consio.h>
40 #include <dev/syscons/syscons.h>
42 SET_DECLARE(scterm_set, sc_term_sw_t);
44 /* exported subroutines */
47 sc_move_cursor(scr_stat *scp, int x, int y)
59 scp->cursor_pos = scp->ypos*scp->xsize + scp->xpos;
63 sc_clear_screen(scr_stat *scp)
65 (*scp->tsw->te_clear)(scp);
66 scp->cursor_oldpos = scp->cursor_pos;
67 sc_remove_cutmarking(scp);
70 /* terminal emulator manager routines */
72 static LIST_HEAD(, sc_term_sw) sc_term_list =
73 LIST_HEAD_INITIALIZER(sc_term_list);
76 sc_term_add(sc_term_sw_t *sw)
78 LIST_INSERT_HEAD(&sc_term_list, sw, link);
83 sc_term_remove(sc_term_sw_t *sw)
85 LIST_REMOVE(sw, link);
90 *sc_term_match(char *name)
95 if (!LIST_EMPTY(&sc_term_list)) {
96 LIST_FOREACH(p, &sc_term_list, link) {
97 if ((strcmp(name, p->te_name) == 0)
98 || (strcmp(name, "*") == 0)) {
103 SET_FOREACH(list, scterm_set) {
105 if ((strcmp(name, p->te_name) == 0)
106 || (strcmp(name, "*") == 0)) {
116 *sc_term_match_by_number(int index)
122 LIST_FOREACH(p, &sc_term_list, link) {