Start fixing some bugs in attribute handling.

This change just does cleanups missed in r56043 17 years ago.  The
default attributes were still stored in structs for the purpose of
changing them and passing around pointers to the defaults, but r56043
added another layer that made the defaults invariant and only used for
initialization and reset.  Just use the defaults directly.  This was
already done for the kernel defaults.  The defaults for reverse
attributes aren't actually used, but are ignored in layers that no
longer support them.
This commit is contained in:
Bruce Evans 2017-03-10 11:44:09 +00:00
parent 93612a52c7
commit 8f2cc27067

View file

@ -91,16 +91,6 @@ __FBSDID("$FreeBSD$");
/* NULL-safe version of "tty_opened()" */
#define tty_opened_ns(tp) ((tp) != NULL && tty_opened(tp))
typedef struct default_attr {
int std_color; /* normal hardware color */
int rev_color; /* reverse hardware color */
} default_attr;
static default_attr user_default = {
SC_NORM_ATTR,
SC_NORM_REV_ATTR,
};
static u_char sc_kattrtab[MAXCPU];
static int sc_console_unit = -1;
@ -3162,9 +3152,7 @@ scinit(int unit, int flags)
if (sc_init_emulator(scp, SC_DFLT_TERM))
sc_init_emulator(scp, "*");
(*scp->tsw->te_default_attr)(scp,
user_default.std_color,
user_default.rev_color);
(*scp->tsw->te_default_attr)(scp, SC_NORM_ATTR, SC_NORM_REV_ATTR);
} else {
/* assert(sc_malloc) */
sc->dev = malloc(sizeof(struct tty *)*sc->vtys, M_DEVBUF,
@ -3578,8 +3566,7 @@ sc_init_emulator(scr_stat *scp, char *name)
scp->rndr = rndr;
scp->rndr->init(scp);
/* XXX */
(*sw->te_default_attr)(scp, user_default.std_color, user_default.rev_color);
(*sw->te_default_attr)(scp, SC_NORM_ATTR, SC_NORM_REV_ATTR);
sc_clear_screen(scp);
return 0;