Switching VTs on Interactive UNIX (summary)

Feng Chen feng at mtnsys.wimsey.bc.ca
Sat Jun 15 16:16:24 AEST 1991


In a previous article, I asked if Interactive UNIX could be made to
switch VTs using Alt-F1, Alt-F2, etc.

By far, the most popular solution (thanks, everyone!) was a program by
Larry Campbell.  It's quite short, so I enclose it below.  A respondent
indicated that it runs on ISC 2.0.2 as well, and I can confirm that it
runs on ISC 2.2.

I also received a program called fixkey, by Robert Lin, which remaps
Alt-F1, etc., + some other keys, for use with Crisp.  Send me email if
you'd like a copy.

-----8<----- cut here -----8<----- cut here -----8<----- cut here -----8<-----
/*
 * Article 749 of comp.unix.i386:
 * Path: aloha1!uhccux!humu!nosc!helios.ee.lbl.gov!pasteur!ucbvax!tut.cis.ohio-state.edu!ukma!nrl-cmf!think!redsox!campbell
 * From: campbell at redsox.bsw.com (Larry Campbell)
 * Newsgroups: comp.sys.att,comp.unix.i386,alt.sources
 * Subject: Re: 6386 V.3.2 virtual terminal switch remapping?
 * Summary: Here's a program to do it
 * Message-ID: <781 at redsox.bsw.com>
 * Date: 18 Jun 89 04:15:02 GMT
 * References: <484 at oglvee.UUCP>
 * Reply-To: campbell at redsox.UUCP (Larry Campbell)
 * Organization: The Boston Software Works, Inc.
 * Lines: 52
 * 
 * The manual entry is incomplete;  you have to scrutinize kd.h carefully.
 * I'm glad Jim's posting (Hi, Jim!) prompted me to look this up and write
 * the following program (which I call kset, but you can call Nancy if you
 * like).
 * 
 * This program lets you switch consoles with Alt-F1 through Alt-F8 (instead
 * of the irritating Alt-Sysreq F1 through Alt-Sysreq F8);  modify to taste.
 * I wrote and tested it on Interactive 386/ix v2.0.1, but I assume it will
 * also work on the AT&T SVR3.2 release.
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/at_ansi.h>
#include <sys/kd.h>

extern void exit();
extern void perror();

struct kbentry
    kbetab[] =
	{
	    { K_ALTTAB,	59, SPECIALKEY | (K_VTF + 1) },
	    { K_ALTTAB,	60, SPECIALKEY | (K_VTF + 2) },
	    { K_ALTTAB,	61, SPECIALKEY | (K_VTF + 3) },
	    { K_ALTTAB,	62, SPECIALKEY | (K_VTF + 4) },
	    { K_ALTTAB,	63, SPECIALKEY | (K_VTF + 5) },
	    { K_ALTTAB,	64, SPECIALKEY | (K_VTF + 6) },
	    { K_ALTTAB,	65, SPECIALKEY | (K_VTF + 7) },
	    { K_ALTTAB,	66, SPECIALKEY | (K_VTF + 0) },
	    { 0,         0,                        0 }
	};

main()
{
int i;

for (i = 0; kbetab[i].kb_index; i++)
    {
    if (ioctl(0, KDSKBENT, &kbetab[i]) == -1)
	{
	perror("kset: KDGKBENT ioctl failed");
	exit(1);
	}
    }
return 0;
}

/*
 * Larry Campbell                          The Boston Software Works, Inc.
 * campbell at bsw.com                        120 Fulton Street
 * wjh12!redsox!campbell                   Boston, MA 02146
 */
-----8<----- cut here -----8<----- cut here -----8<----- cut here -----8<-----

-- 
Feng Chen
van-bc!mtnsys!feng		 feng at mtnsys.wimsey.bc.ca



More information about the Comp.unix.sysv386 mailing list