running setcolor script on bootup
david nugent
david at csource.oz.au
Sat Jul 14 01:55:48 AEST 1990
In <1990Jul11.123256.939 at nstar.uucp> larry at nstar.uucp (Larry Snyder) writes:
>I am running 386/ix 2.2 and have a script that controls the
>colors on my various console windows and enables scrolling -
>yet placing this script in /etc/rc.d doesn't work since the
>consoles are not initiated as of yet - where could I put this
>script so that it executes right after the various consoles
>are initialized?
Something like the following can be placed in /etc/rc.d/<whatever>
TERM=AT386;export TERM
setcolor -s On
setcolor -f lgreen,black >/dev/vt01
setcolor -f lgreen,black >/dev/vt02
.
. etc.
.
setcolor -f yellow,black >/dev/console
The hardware scrolling option is global and stays active in all
virtual terminals once it's enabled in any of them. With colors,
setcolor just outputs ANSI sequences, but (which is a little silly)
tests only the controlling TTY for an AT386 tty type.
I complicate the picture a bit, since I prefer 43 line EGA mode
on all virtual terminals. This requires a small program to open
them one by one and do an ioctl() to set 43 line mode, then use
setcolor to adjust the cursor size.
v43all
setcolor -c 6,7 >/dev/vt01
.
. etc.
.
v43all goes something like this:
/* ------------------------------- cut here ----------------------------- */
/*
** v43all.c
** Program to run at boot time on ISC 386/ix
** to flip all virtual terminals into 43line EGA mode
**
** David Nugent, donated to public domain
*/
# include <stdio.h>
# include <fcntl.h>
# include <sys/types.h>
# include <sys/at_ansi.h>
# include <sys/kd.h>
# include <errno.h>
int main (int argc, char *argv[])
{
int vt;
int fd;
char *dev, vtdev[256];
dev = vtdev;
for (vt = 0; vt++ < 8; )
{
if (vt < 8)
{
sprintf (vtdev, "/dev/vt%02u", vt);
}
else
dev = "/dev/console";
fd = open (dev, O_WRONLY);
if (fd == -1)
{
fprintf (stderr, "Error %d opening %s\n", errno, dev);
continue;
}
switch (ioctl (fd, CONS_CURRENT, 0))
{
case -1:
case KD_MONO:
case KD_HERCULES:
case KD_CGA:
fputs ("Incompatible monitor type\n", stderr);
break;
case KD_EGA:
case KD_VGA:
ioctl (fd, SW_ENHC80x43, 0);
break;
}
}
return 0;
}
/* ------------------------------- cut here ----------------------------- */
After initially experimenting with this under ISC 2.0.1 & 2.0.2,
I'm certainly happy that ISC have fixed the problem where it didn't
preserve modes across virtual terminals. Now when you flip vt's
the screen mode changes accordingly (as it should). I'm also glad
they've put in the ^[= sequences which makes setcolor possible.
david
--
_______________________________________________________________________________
Unique Computing Pty Ltd Melbourne Australia - Communications Specialists
david at csource.oz.au 3:632/348 at fidonet 28:4100/1 at signet
More information about the Comp.unix.i386
mailing list