Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP id AA6789 ; Fri, 15 Jan 93 10:33:44 EST Xref: sserve comp.unix.bsd:9967 alt.sources:4989 Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!darwin.sura.net!newsserver.jvnc.net!yale.edu!ira.uka.de!Germany.EU.net!hcshh!hm From: hm@hcshh.hcs.de (Hellmuth Michaelis) Newsgroups: comp.unix.bsd,alt.sources Subject: [386BSD] pcvt 2.00 - VT220 console driver (part 07/11) Summary: 386BSD 0.1 VT220 console device driver source code Keywords: 386BSD console driver VT220 Message-ID: <1623@hcshh.hcs.de> Date: 15 Jan 93 13:02:46 GMT Followup-To: comp.unix.bsd Organization: HCS GmbH, Hamburg, Europe Lines: 2577 Submitted-by: hm@hcshh.hcs.de (Hellmuth Michaelis) Archive-name: pcvt-2.00/part07 ---- Cut Here and unpack ---- #!/bin/sh # This is part 07 of pcvt-2.00 if touch 2>&1 | fgrep '[-amc]' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= Support/keycap/keycap.src ============== if test X"$1" != X"-c" -a -f 'Support/keycap/keycap.src'; then echo "File already exists: skipping 'Support/keycap/keycap.src'" else echo "x - extracting Support/keycap/keycap.src (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/keycap/keycap.src && X#--------------------------------------------------------------------------- X# X# keyboard mappings for vt220 emulator pcvt 2.0 X# --------------------------------------------- X# X# DEC MCS and/or ISO-Latin-1 Characterset used X# X# MF II Keyboards fully supported X# AT Keyboards lack a ALTGR Key, so they cannot be handled by X# the current driver implementation .... sorry X# X# If you design a new entry for national keyboards, please X# send it to hm@hcshh.hcs.de, thank you ! X# X# last edit-date: [Tue Jan 12 16:00:29 1993] X# X#--------------------------------------------------------------------------- X Xdf|default|default entry:\ X :de: X Xtt|test|Test entry which swaps y and z:\ X :K22=z:S22=Z:C22=\032:\ X :K46=y:S46=Y:C46=\031: X Xbe|belgium|Belgian mapping:\ X :de: X Xca|frenchcanada|French Canadian mapping:\ X :de: X Xch|switzerland|Swiss mapping:\ X :de: X X# more programmer-like than an original German kbd, you needn't X# have gum-fingers to get `{}' and the like:-) X# maps: ae -> [, oe -> \, ue -> ], Ae -> {, Oe -> |, Ue -> } X# umlaute are available as AltGr- and Control-Mappings X# also maps Pause -> ^Z X# X# (from Joerg Wunsch) X# Xde-prog:programmer's mapping for german keyboard:\ X :K27=]:S27=}:A27=\374:C27=\334:\ X :K40=\\:S40=|:A40=\366:C40=\326:\ X :K41=[:S41={:A41=\344:C41=\304:\ X :K126=\032:\ X :tc=de: X Xde|germany|German mapping for MF II-Keyboard:\ X :K1=\136:S1=\260:\ X :S3=\042:S4=\247:S7=&:S8=/:S9=(:S10=):S11=\075:\ X :A3=\262:A4=\263:A8={:A9=[:A10=]:A11=}:A12=\134:\ X :K12=\337:S12=?:C12=\034:\ X :K13=':S13=`:\ X :A17=\100:\ X :K22=z:S22=Z:C22=\032:\ X :K27=\374:S27=\334:\ X :K28=+:S28=*:A28=\176:\ X :K29=\043:S29=':A29=\174:\ X :K40=\366:S40=\326:\ X :K41=\344:S41=\304:\ X :A45=\174:\ X :K46=y:S46=Y:C46=\031:\ X :A52=\265:\ X :S53=;:S54=\072:\ X :K55=-:S55=_:\ X :l1#62: X Xde-at|germany-at|German mapping for AT-Keyboard:\ X :K1=<:S1=>:\ X :S3=\042:\ X :S4=\247:\ X :S7=&:\ X :S8=/:\ X :S9=(:\ X :S10=):\ X :S11=\075:\ X :K12=\337:S12=?:C12=\034:\ X :K13=':S13=`:\ X :K14=#:S14=\136:\ X :K22=z:S22=Z:C22=\032:\ X :K27=\374:S27=\334:\ X :K28=+:S28=*:\ X :K29=\043:S29=':\ X :K40=\366:S40=\326:\ X :K41=\344:S41=\304:\ X :K46=y:S46=Y:C46=\031:\ X :S53=;:S54=\072:\ X :K55=-:S55=_:\ X Xdk|denmark|Danish mapping:\ X :de: X Xfi|finland|Finish mapping:\ X :de: X Xfr|france|French mapping:\ X :de: X Xgb|greatbritain|British mapping:\ X :de: X Xit|italy|Italian mapping:\ X :de: X Xnl|netherlands|Dutch mapping:\ X :de: X Xno|norway|Norwegian mapping:\ X :de: X Xpt|portugal|Portugese mapping:\ X :de: X Xsp|spain|Spainish mapping:\ X :de: X Xsw|sweden|Swedish mapping:\ X :de: X Xus|usa|United States mapping:\ X :de: SHAR_EOF $TOUCH -am 0112160093 Support/keycap/keycap.src && chmod 0640 Support/keycap/keycap.src || echo "restore of Support/keycap/keycap.src failed" set `wc -c Support/keycap/keycap.src`;Wc_c=$1 if test "$Wc_c" != "2558"; then echo original size 2558, current size $Wc_c fi fi # ============= Support/keycap/keycap-file.5 ============== if test X"$1" != X"-c" -a -f 'Support/keycap/keycap-file.5'; then echo "File already exists: skipping 'Support/keycap/keycap-file.5'" else echo "x - extracting Support/keycap/keycap-file.5 (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/keycap/keycap-file.5 && X.\" Copyright (c) 1992, 1993 Hellmuth Michaelis X.\" X.\" All rights reserved. X.\" X.\" This driver is contributed to the 386BSD operating system. X.\" X.\" Redistribution and use in source and binary forms, with or without X.\" modification, are permitted provided that the following conditions X.\" are met: X.\" 1. Redistributions of source code must retain the above copyright X.\" notice, this list of conditions and the following disclaimer. X.\" 2. Redistributions in binary form must reproduce the above copyright X.\" notice, this list of conditions and the following disclaimer in the X.\" documentation and/or other materials provided with the distribution. X.\" 3. All advertising materials mentioning features or use of this software X.\" must display the following acknowledgement: X.\" This product includes software contributed to 386BSD and developed X.\" by Hellmuth Michaelis X.\" 4. Neither the name of the developers nor the names "386BSD" and "pcvt" X.\" may be used to endorse or promote products derived from this software X.\" without specific prior written permission. X.\" X.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR X.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, X.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X.\" X.\" @(#)keycap.5 2.00 (contributed to 386BSD) X.\" Last Edit-Date: [Sun Jan 3 15:24:46 1993] X.\" X.Dd January 3, 1993 X.Dt KEYCAP 5 X.Os 386BSD X.Sh NAME X.Nm keycap X.Nd keyboard mapping data base X.Sh SYNOPSIS X.Nm keycap X.Sh DESCRIPTION XThe X.Nm keycap Xfile Xis a data base describing keyboard mappings, used by X.Xr kcon 1 . X.Pp XEntries in X.Nm keycap Xconsist of a number of `:'-separated fields. XThe first entry for each mapping gives the names that are known for the Xmapping, separated by `|' characters. XAll names but the first and last Xshould be in lower case and contain no blanks; Xthe last name may well contain Xupper case and blanks for readability. X.Sh CAPABILITIES X.Pp X.Bl -column indent indent X.Sy Name Type Description X.It "de bool Resets Keyboard mapping to compiled-in default" X.It "D<n> bool Disables key <n> completely" X X.It "m<n> num specify key numbers for ALT keys X.It "l<n> num specify key numbers for ALTGR keys X.It "h<n> num specify key numbers for SHIFT keys X.It "t<n> num specify key numbers for CONTROL keys X.It "ca<n> num specify key number for the CAPS LOCK key X.It "sh<n> num specify key number for the SHIFT LOCK key X.It "nl<n> num specify key number for the NUM LOCK key X.It "sc<n> num specify key number for the SCROLL LOCK key X X.It "K<n> str bind a string to a unshifted (normal) key X.It "S<n> str bind a string to a shifted key X.It "C<n> str bind a string to a control key X.It "A<n> str bind a string to a altgr key X X.It "tc str Entry of similar map \- must be last." X.El X XParameter <n> describing the key number can have values from 1 to 128. X XA string parameter may have up to 15 characters. X X.Pp X.Ss A Sample Entry XThe following entry, which describes a test entry, is among the very Xeasy entries in the X.Nm keycap Xfile as of this writing. X.Pp X.Bd -literal Xtt\||test\||Test entry which swaps y and z:\e X :K22=z:S22=Z:C22=\e032:\e X :K46=y:S46=Y:C46=\e031: X X.Ed X.Pp XEntries may continue onto multiple lines by giving a \e as the last Xcharacter of a line. Comments may be included on lines beginning with X.Dq # . X.Sh FILES X.Bl -tag -width /usr/share/misc/keycap -compact X.It Pa /usr/share/misc/keycap XFile containing keyboard mapping descriptions. X.El X.Sh SEE ALSO X.Xr kcon 1 , X.Xr keycap 3 , X.Sh EXAMPLES XThe entry X.Dq Li l1#60 Xsets the keynumber for the ALTGR key to 60. X XThe entry X.Dq Li K100=hugo Xbinds the string 'hugo' to the key number 100. X XThe entry X.Dq Li K100=^D Xbinds the control character EOT (0x04) to the key number 100. X XThe entry X.Dq Li K100=\e000 Xbinds the control character NUL (0x00) to the key number 100. X X X X SHAR_EOF $TOUCH -am 0112125693 Support/keycap/keycap-file.5 && chmod 0640 Support/keycap/keycap-file.5 || echo "restore of Support/keycap/keycap-file.5 failed" set `wc -c Support/keycap/keycap-file.5`;Wc_c=$1 if test "$Wc_c" != "4426"; then echo original size 4426, current size $Wc_c fi fi # ============= Support/Makefile.inc ============== if test X"$1" != X"-c" -a -f 'Support/Makefile.inc'; then echo "File already exists: skipping 'Support/Makefile.inc'" else echo "x - extracting Support/Makefile.inc (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/Makefile.inc && XBINDIR= /usr/local/bin XMANDIR= /usr/local/man/cat XFONTDIR= /usr/share/misc/vgafonts XLIBDIR= /usr/local/lib XLIBMODE= 644 SHAR_EOF $TOUCH -am 0113140493 Support/Makefile.inc && chmod 0660 Support/Makefile.inc || echo "restore of Support/Makefile.inc failed" set `wc -c Support/Makefile.inc`;Wc_c=$1 if test "$Wc_c" != "120"; then echo original size 120, current size $Wc_c fi fi # ============= Support/loadfont/loadfont.1 ============== if test ! -d 'Support/loadfont'; then echo "x - creating directory Support/loadfont" mkdir 'Support/loadfont' fi if test X"$1" != X"-c" -a -f 'Support/loadfont/loadfont.1'; then echo "File already exists: skipping 'Support/loadfont/loadfont.1'" else echo "x - extracting Support/loadfont/loadfont.1 (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/loadfont/loadfont.1 && X.\" Copyright (c) 1992, 1993 Hellmuth Michaelis X.\" X.\" All rights reserved. X.\" X.\" This driver is contributed to the 386BSD operating system. X.\" X.\" Redistribution and use in source and binary forms, with or without X.\" modification, are permitted provided that the following conditions X.\" are met: X.\" 1. Redistributions of source code must retain the above copyright X.\" notice, this list of conditions and the following disclaimer. X.\" 2. Redistributions in binary form must reproduce the above copyright X.\" notice, this list of conditions and the following disclaimer in the X.\" documentation and/or other materials provided with the distribution. X.\" 3. All advertising materials mentioning features or use of this software X.\" must display the following acknowledgement: X.\" This product includes software contributed to 386BSD and developed X.\" by Hellmuth Michaelis X.\" 4. Neither the name of the developers nor the names "386BSD" and "pcvt" X.\" may be used to endorse or promote products derived from this software X.\" without specific prior written permission. X.\" X.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR X.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, X.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X.\" X.\" @(#)loadfont.1 2.00 (contributed to 386BSD) X.\" Last Edit-Date: [Sun Jan 3 15:45:02 1993] X.\" X.Dd January 3, 1993 X.Dt LOADFONT 1 X.Os 386BSD 0.1 X.Sh NAME X.Nm loadfont X.Nd is used to load fonts into EGA or VGA boards. X.Sh SYNOPSIS X.Nm loadfont X.Op Fl c Ar charsetno X.Op Fl f Ar fontfilename X.Op Fl i X.Sh DESCRIPTION XThe X.Nm loadfont Xutility is used to load fonts needed for proper operation of the pcvt 2.0 Xvt220 driver on EGA and VGA boards into the font ram of this boards. X.Pp XThe options are as follows: X.Bl -tag -width Ds X.It Fl c XSpecifies the slot, the font is to load into. EGA boards have four Xslots and VGA boards have eight slots available for downloading fonts. X.It Fl f XSpecifies the file which contains the font to be downloaded. X.It Fl i XGives information what type(s) of font do currently reside in which slot. XThis is also the default behaviour if no options are specified on the commandline. X.El X.Pp XThis utility is used only on EGA and VGA boards, as MDA, HCG and CGA boards Xdo not have downloadable charactersets available. X.Sh FILES XUnless otherwise specified in the Makefile, the following fontfiles are Xavailable for the pcvt 2.0 distribution: X X.nf X/usr/share/misc/vgafonts/vt220l.808: 8x8 IBM II font X/usr/share/misc/vgafonts/vt220h.808: 8x8 Extension font X/usr/share/misc/vgafonts/vt220l.810: 8x10 IBM II font X/usr/share/misc/vgafonts/vt220h.810: 8x10 Extension font X/usr/share/misc/vgafonts/vt220l.814: 8x14 IBM II font X/usr/share/misc/vgafonts/vt220h.814: 8x14 Extension font X/usr/share/misc/vgafonts/vt220l.816: 8x16 IBM II font X/usr/share/misc/vgafonts/vt220h.816: 8x16 Extension font X.fi X.Sh EXAMPLES XThe command X.Dq Li loadfont -c0 -f/usr/share/misc/vgafonts/vt220l.816 Xloads a 8x16 font containing the standard IBM characterset II into font slot X0 on a VGA or EGA board. X.Sh BUGS XNo known bugs X.Sh SEE ALSO X.Xr cursor 1 , X.Xr scon 1 , X.Xr pcvt 8 SHAR_EOF $TOUCH -am 0113140693 Support/loadfont/loadfont.1 && chmod 0640 Support/loadfont/loadfont.1 || echo "restore of Support/loadfont/loadfont.1 failed" set `wc -c Support/loadfont/loadfont.1`;Wc_c=$1 if test "$Wc_c" != "3759"; then echo original size 3759, current size $Wc_c fi fi # ============= Support/loadfont/loadfont.c ============== if test X"$1" != X"-c" -a -f 'Support/loadfont/loadfont.c'; then echo "File already exists: skipping 'Support/loadfont/loadfont.c'" else echo "x - extracting Support/loadfont/loadfont.c (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/loadfont/loadfont.c && X/* X * Copyright (c) 1992, 1993 Brian Dunford-Shore and Hellmuth Michaelis X * X * All rights reserved. X * X * This program is contributed to the 386BSD operating system. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software contributed to 386BSD and developed X * by Brian Dunford-Shore and Hellmuth Michaelis X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt" X * may be used to endorse or promote products derived from this software X * without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * @(#)loadfont.c 1.00 (contributed to 386BSD) X * Last Edit-Date: [Sun Jan 3 15:48:03 1993] X */ X X#include <stdio.h> X#include <sys/pcvt_ioctl.h> /* ioctl's */ X#include <sys/types.h> X#include <sys/stat.h> X X#define FONT8X8 2048 /* filesize for 8x8 font */ X#define HEIGHT8X8 8 /* 8 scan lines char cell height */ X#define CSCAN8X8 0x07 /* 8 scan lines / char - 1 */ X#define SSCAN8X8 143 /* 400 scan lines on screen - 256 - 1 */ X#define SROWS8X8 50 /* 50 character lines on screen */ X X#define FONT8X10 2560 /* filesize for 8x10 font */ X#define HEIGHT8X10 10 /* 10 scan lines char cell height */ X#define CSCAN8X10 0x49 /* 10 scan lines / char - 1 | line cmp bit 9 */ X#define SSCAN8X10 143 /* 400 scan lines on screen - 256 - 1 */ X#define SROWS8X10 40 /* 50 character lines on screen */ X X#define FONT8X14 3584 /* filesize for 8x14 font */ X#define HEIGHT8X14 14 /* 14 scan lines char cell height */ X#define CSCAN8X14 0x4d /* 14 scan lines / char - 1 | line cmp bit 9 */ X#define SSCAN8X14 135 /* 392 scan lines on screen - 256 - 1 */ X#define SROWS8X14 28 /* 28 character lines on screen */ X X#define FONT8X16 4096 /* filesize for 8x16 font */ X#define HEIGHT8X16 16 /* 16 scan lines char cell height */ X#define CSCAN8X16 0x4f /* 16 scan lines / char - 1 | line cmp bit 9 */ X#define SSCAN8X16 143 /* 400 scan lines on screen - 256 - 1 */ X#define SROWS8X16 25 /* 25 character lines on screen */ X Xstruct screeninfo screeninfo; X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X extern int optind; X extern int opterr; X extern char *optarg; X X FILE *in; X struct stat sbuf, *sbp; X unsigned char *fonttab; X int ret; X int chr_height; X int chr_scan; X int scr_scan; X int scr_rows; X int c; X int chr_set = -1; X char *filename; X int fflag = -1; X int info = -1; X X while( (c = getopt(argc, argv, "c:f:i")) != EOF) X { X switch(c) X { X case 'c': X chr_set = atoi(optarg); X break; X X case 'f': X filename = optarg; X fflag = 1; X break; X X case 'i': X info = 1; X break; X X case '?': X default: X usage(); X break; X } X } X X if(chr_set == -1 || fflag == -1) X info = 1; X X if(info == 1) X { X int i; X X if(ioctl(0, VGAGETSCREEN, &screeninfo) == -1) X { X perror("ioctl VGAGETSCREEN failed"); X exit(1); X } X X switch(screeninfo.adaptor_type) X { X case UNKNOWN_ADAPTOR: X case MDA_ADAPTOR: X case HGC_ADAPTOR: X case CGA_ADAPTOR: X printf("Adaptor does not support Downloadable Fonts!\n"); X break; X case EGA_ADAPTOR: X printheader(); X for(i = 0;i < 4;i++) X { X printvgafontattr(i); X } X break; X case VGA_ADAPTOR: X printheader(); X for(i = 0;i < 8;i++) X { X printvgafontattr(i); X } X } X printf("\n"); X exit(0); X } X X if(chr_set < 0 || chr_set > 7) X usage(); X X sbp = &sbuf; X X if((in = fopen(filename, "r")) == NULL) X { X char buffer[80]; X sprintf(buffer, "cannot open file %s for reading", filename); X perror(buffer); X exit(1); X } X X if((fstat(fileno(in), sbp)) != 0) X { X char buffer[80]; X sprintf(buffer, "cannot fstat file %s", filename); X perror(buffer); X exit(1); X } X X switch(sbp->st_size) X { X case FONT8X8: X chr_height = HEIGHT8X8; X chr_scan = CSCAN8X8; X scr_scan = SSCAN8X8; X scr_rows = SIZ_50x80; X break; X X case FONT8X10: X chr_height = HEIGHT8X10; X chr_scan = CSCAN8X10; X scr_scan = SSCAN8X10; X scr_rows = SIZ_40x80; X break; X X case FONT8X14: X chr_height = HEIGHT8X14; X chr_scan = CSCAN8X14; X scr_scan = SSCAN8X14; X scr_rows = SIZ_28x80; X break; X X case FONT8X16: X chr_height = HEIGHT8X16; X chr_scan = CSCAN8X16; X scr_scan = SSCAN8X16; X scr_rows = SIZ_25x80; X break; X X default: X fprintf(stderr,"error, file %s is no valid font file, size=%d\n",argv[1],sbp->st_size); X exit(1); X } X X if((fonttab = (unsigned char *)malloc((size_t)sbp->st_size)) == NULL) X { X fprintf(stderr,"error, malloc failed\n"); X exit(1); X } X X if((ret = fread(fonttab, sizeof(*fonttab), sbp->st_size, in)) != sbp->st_size) X { X fprintf(stderr,"error reading file %s, size = %d, read = is no valid font file, size=%d\n",argv[1],sbp->st_size, ret); X exit(1); X } X X loadfont(chr_set, chr_height, fonttab); X setfont(chr_set, 1, chr_scan, scr_scan, scr_rows); X X exit(0); X} X Xsetfont(charset, fontloaded, charscan, scrscan, scrrow) Xint charset, fontloaded, charscan, scrscan, scrrow; X{ X struct vgafontattr vfattr; X X vfattr.character_set = charset; X vfattr.font_loaded = fontloaded; X vfattr.character_scanlines = charscan; X vfattr.screen_scanlines = scrscan; X vfattr.screen_size = scrrow; X X if(ioctl(1, VGASETFONTATTR, &vfattr) == -1) X { X perror("loadfont - ioctl VGASETFONTATTR failed, error"); X exit(1); X } X} X Xloadfont(fontset,charscanlines,font_table) Xint fontset; Xint charscanlines; Xunsigned char *font_table; X{ X int i, j; X struct vgaloadchar vlc; X X vlc.character_set = fontset; X vlc.character_scanlines = charscanlines; X X for(i = 0; i < 256; i++) X { X vlc.character = i; X for (j = 0; j < charscanlines; j++) X { X vlc.char_table[j] = font_table[j]; X } X font_table += charscanlines; X if(ioctl(1, VGALOADCHAR, &vlc) == -1) X { X perror("loadfont - ioctl VGALOADCHAR failed, error"); X exit(1); X } X } X} X Xprintvgafontattr(charset) Xint charset; X{ X struct vgafontattr vfattr; X static int sizetab[] = { 25, 28, 35, 40, 43, 50 }; X X vfattr.character_set = charset; X X if(ioctl(1, VGAGETFONTATTR, &vfattr) == -1) X { X perror("loadfont - ioctl VGAGETFONTATTR failed, error"); X exit(1); X } X printf(" %d ",charset); X if(vfattr.font_loaded) X { X X printf("Loaded "); X printf(" %2.2d ", sizetab[vfattr.screen_size]); X printf(" %2.2d ", (((int)vfattr.character_scanlines) & 0xf) + 1); X printf(" (0x%2.2X) ", (int)vfattr.character_scanlines); X printf(" %3.3d ", ((int)vfattr.screen_scanlines+0x101)); X } X else X { X printf("Empty "); X } X printf("\n"); X} X Xprintheader() X{ X printf("\nEGA/VGA Charactersets Status Info:\n\n"); X printf("Set Status Lines CharScanLines ScreenScanLines\n"); X printf("--- ------ ----- ------------- ---------------\n"); X} X Xusage() X{ X fprintf(stderr,"\nloadfont - load a font into ega/vga font ram\n"); X fprintf(stderr,"usage: loadfont -c<cset> -f<filename> -i\n"); X fprintf(stderr," -c <cset> characterset to load (ega 0..3, vga 0..7)\n"); X fprintf(stderr," -f <name> filename containing binary font data\n"); X fprintf(stderr," -i print status and types of loaded fonts (default)\n"); X exit(1); X} SHAR_EOF $TOUCH -am 0113140693 Support/loadfont/loadfont.c && chmod 0640 Support/loadfont/loadfont.c || echo "restore of Support/loadfont/loadfont.c failed" set `wc -c Support/loadfont/loadfont.c`;Wc_c=$1 if test "$Wc_c" != "8382"; then echo original size 8382, current size $Wc_c fi fi # ============= Support/loadfont/Makefile ============== if test X"$1" != X"-c" -a -f 'Support/loadfont/Makefile'; then echo "File already exists: skipping 'Support/loadfont/Makefile'" else echo "x - extracting Support/loadfont/Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/loadfont/Makefile && XPROG= loadfont X X.include <bsd.prog.mk> X Xloadfont.c: /usr/include/sys/pcvt_ioctl.h X X/usr/include/sys/pcvt_ioctl.h: ../../pcvt_ioctl.h X cp ../../pcvt_ioctl.h /usr/include/sys SHAR_EOF $TOUCH -am 0113151493 Support/loadfont/Makefile && chmod 0660 Support/loadfont/Makefile || echo "restore of Support/loadfont/Makefile failed" set `wc -c Support/loadfont/Makefile`;Wc_c=$1 if test "$Wc_c" != "173"; then echo original size 173, current size $Wc_c fi fi # ============= Support/scon/scon.1 ============== if test ! -d 'Support/scon'; then echo "x - creating directory Support/scon" mkdir 'Support/scon' fi if test X"$1" != X"-c" -a -f 'Support/scon/scon.1'; then echo "File already exists: skipping 'Support/scon/scon.1'" else echo "x - extracting Support/scon/scon.1 (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/scon/scon.1 && X.\" Copyright (c) 1992, 1993 Hellmuth Michaelis and Joerg Wunsch X.\" X.\" All rights reserved. X.\" X.\" This driver is contributed to the 386BSD operating system. X.\" X.\" Redistribution and use in source and binary forms, with or without X.\" modification, are permitted provided that the following conditions X.\" are met: X.\" 1. Redistributions of source code must retain the above copyright X.\" notice, this list of conditions and the following disclaimer. X.\" 2. Redistributions in binary form must reproduce the above copyright X.\" notice, this list of conditions and the following disclaimer in the X.\" documentation and/or other materials provided with the distribution. X.\" 3. All advertising materials mentioning features or use of this software X.\" must display the following acknowledgement: X.\" This product includes software contributed to 386BSD and developed X.\" by Hellmuth Michaelis and Joerg Wunsch X.\" 4. Neither the name of the developers nor the names "386BSD" and "pcvt" X.\" may be used to endorse or promote products derived from this software X.\" without specific prior written permission. X.\" X.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR X.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, X.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X.\" X.\" @(#)scon.1 2.00 (contributed to 386BSD) X.\" Last Edit-Date: [Tue Jan 12 22:39:53 1993] X.\" X.Dd January 12, 1993 X.Dt SCON 1 X.Os 386BSD 0.1 X.Sh NAME X.Nm scon X.Nd controls screen modes for pcvt 2.0 X.Sh SYNOPSIS X.Nm scon X.Op Fl l X.Op Fl v X.Op Fl h X.Op Fl c Ar screenno X.Op Fl d Ar device X.Op Fl V X.Op Fl H X.Op Fl s Ar lines X.br X.Nm scon X.Op Fl v X.Op Fl d Ar device X.Fl p Ar entry,red,green,blue X.br X.Nm scon X.Op Fl v X.Op Fl d Ar device X.Fl p Ar default X.br X.Nm scon X.Op Fl v X.Op Fl d Ar device X.Fl p Ar list X.Nm scon X.Op Fl v X.Fl t Ar timeout X.Sh DESCRIPTION XThe X.Nm scon Xutility controls several aspects of the runtime behaviour of the pcvt 2.0 vt220 Xdriver. X.Pp XThe options are as follows: X.Bl -tag -width Ds X.It Fl l XLists the current configuration of the runtime changable options of the driver. X.It Fl v XSpecify verbose operation of the program. X.It Fl h XPrints a usage/help text. X.It Fl c XSpecify the screen number the current (displayed) screen should be switched Xto. X.It Fl d XSpecify the device filename (i.e. /dev/pc2) further operations specified on Xthe command line should be applied to. X.It Fl V XSwitch the specified/current screen into a pure VT220 mode without recognizing Xany HP escape sequences and without displaying function key labels. X.It Fl H XSwitch the specified/current screen into a mixed HP/VT220 mode. That is, that Xin addition to the full VT220 emulation, the HP function key labels and the Xescape sequences for handling the labels are available to the user. X.It Fl s XSpecify the number of character lines on the screen. Possible parameters are X25, 28, 35, 40, 43 or 50. To use all this screen sizes, the fonts required Xfor proper operation of a desired size have to be downloaded to the EGA/VGA Xfont ram. This option is available only for EGA and VGA boards. X.It Fl p XModify VGA palette X.Pq DAC . XThe X.Fl p Xis mutually exclusive with X.Fl s , X.Fl H , Xand X.Fl V . XNaturally, option X.Fl p Xis available only for VGA boards. Three flavors are available. X XIf used with argument X.Dq Ar default , Xthis flag will restore the default palette X.Po Xas installed by VGA ROM BIOS after hardware reset X.Pc . X XIf used with argument X.Dq Ar list , Xthe current VGA DAC palette entries are listed. Each entry contains Xthe table index, values for red, green, and blue, and if there's a Xknown name for this entry, the color name. Trailing empty table Xslots (RGB values all zero) are omitted. X XOtherwise, four comma-separated arguments are expected. The first Xdenotes the number of palette entry to be modified. This may be either Xa number between 0 and 255, or the usual name of an associated color X.Pq case-insensitive . XThe following values for red, green and blue are restricted to 0 through 63 Xdue to VGA DAC conventions. XNote that the first delimiter within such an argument may be a colon X.Dq \&: Xinstead of a comma X.Dq \&, Xfor better readability, but this violates common command argument Xconventions. XMultiple X.Fl p Xoptions may be specified if unambiguous. X.It Fl t XSpecifying X.Fl t Xwill activate the screen saver. The behaviour depends on X.Ar timeout : Xif X.Ar timeout Xis given as 0, the screen saver is turned off. Otherwise, X.Ar timeout Xis taken as a number of seconds to wait until activating the Xscreen saver. XNOTE: the X.Fl t Xoption is only available if screen saver support has been compiled into Xthe driver ! X.El X.Pp XWhen switching between HP and VT mode, the screen is cleared, the scrolling Xregion is reset and the cursor is placed in the home position. X.Sh EXAMPLES XThe command X.Dq Li scon Fl H s Ar 28 Xplaces the current screen into HP mode and sets the screen size to 28x80. X XInvoking X.Do X.Li scon Fl p X.Ar lightgray,0,15,0 X.Fl p X.Ar 0:45,45,45 X.Dc Xwill result in green on gray output for normal text. XNote that normal text color is light gray, and not white as one might expect. X.Sh BUGS Xthe X.Fl c Xand X.Fl d Xoptions collide somehow, this will change in a future release. X.Sh SEE ALSO X.Xr loadfont 1 , X.Xr cursor 1 , X.Xr pcvt 8 SHAR_EOF $TOUCH -am 0113140793 Support/scon/scon.1 && chmod 0640 Support/scon/scon.1 || echo "restore of Support/scon/scon.1 failed" set `wc -c Support/scon/scon.1`;Wc_c=$1 if test "$Wc_c" != "5863"; then echo original size 5863, current size $Wc_c fi fi # ============= Support/scon/scon.c ============== if test X"$1" != X"-c" -a -f 'Support/scon/scon.c'; then echo "File already exists: skipping 'Support/scon/scon.c'" else echo "x - extracting Support/scon/scon.c (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/scon/scon.c && X/* X * Copyright (c) 1992, 1993 Hellmuth Michaelis and Joerg Wunsch X * X * All rights reserved. X * X * This program is contributed to the 386BSD operating system. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software contributed to 386BSD and developed X * by Hellmuth Michaelis and Joerg Wunsch X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt" X * may be used to endorse or promote products derived from this software X * without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * @(#)scon.c 1.10 (contributed to 386BSD) X * Last Edit-Date: [Tue Jan 12 15:48:43 1993] X */ X X#include <stdio.h> X#include <fcntl.h> X#include <sys/pcvt_ioctl.h> X Xint lflag = -1; Xint current = -1; Xint pflag = -1; Xint hflag = -1; Xint res = -1; Xchar *device; Xint dflag = -1; Xint vflag = 0; Xint Pflag = 0; Xint tflag = 0; Xunsigned timeout; Xstruct screeninfo screeninfo; X X#define NVGAPEL 256 X Xstruct rgb { X unsigned r, g, b; X int dothis; X}; X Xstatic struct rgb palette[NVGAPEL] = { X { 0x00, 0x00, 0x00, 0}, /* 0 - black */ X { 0x00, 0x00, 0x2a, 0}, /* 1 - blue */ X { 0x00, 0x2a, 0x00, 0}, /* 2 - green */ X { 0x00, 0x2a, 0x2a, 0}, /* 3 - cyan */ X { 0x2a, 0x00, 0x00, 0}, /* 4 - red */ X { 0x2a, 0x00, 0x2a, 0}, /* 5 - magenta */ X { 0x2a, 0x2a, 0x00, 0}, /* 6 */ X { 0x2a, 0x2a, 0x2a, 0}, /* 7 - lightgray */ X { 0x00, 0x00, 0x15, 0}, /* 8 */ X { 0x00, 0x00, 0x3f, 0}, /* 9 */ X { 0x00, 0x2a, 0x15, 0}, /* 10 */ X { 0x00, 0x2a, 0x3f, 0}, /* 11 */ X { 0x2a, 0x00, 0x15, 0}, /* 12 */ X { 0x2a, 0x00, 0x3f, 0}, /* 13 */ X { 0x2a, 0x2a, 0x15, 0}, /* 14 */ X { 0x2a, 0x2a, 0x3f, 0}, /* 15 */ X { 0x00, 0x15, 0x00, 0}, /* 16 */ X { 0x00, 0x15, 0x2a, 0}, /* 17 */ X { 0x00, 0x3f, 0x00, 0}, /* 18 */ X { 0x00, 0x3f, 0x2a, 0}, /* 19 */ X { 0x2a, 0x15, 0x00, 0}, /* 20 - brown */ X { 0x2a, 0x15, 0x2a, 0}, /* 21 */ X { 0x2a, 0x3f, 0x00, 0}, /* 22 */ X { 0x2a, 0x3f, 0x2a, 0}, /* 23 */ X { 0x00, 0x15, 0x15, 0}, /* 24 */ X { 0x00, 0x15, 0x3f, 0}, /* 25 */ X { 0x00, 0x3f, 0x15, 0}, /* 26 */ X { 0x00, 0x3f, 0x3f, 0}, /* 27 */ X { 0x2a, 0x15, 0x15, 0}, /* 28 */ X { 0x2a, 0x15, 0x3f, 0}, /* 29 */ X { 0x2a, 0x3f, 0x15, 0}, /* 30 */ X { 0x2a, 0x3f, 0x3f, 0}, /* 31 */ X { 0x15, 0x00, 0x00, 0}, /* 32 */ X { 0x15, 0x00, 0x2a, 0}, /* 33 */ X { 0x15, 0x2a, 0x00, 0}, /* 34 */ X { 0x15, 0x2a, 0x2a, 0}, /* 35 */ X { 0x3f, 0x00, 0x00, 0}, /* 36 */ X { 0x3f, 0x00, 0x2a, 0}, /* 37 */ X { 0x3f, 0x2a, 0x00, 0}, /* 38 */ X { 0x3f, 0x2a, 0x2a, 0}, /* 39 */ X { 0x15, 0x00, 0x15, 0}, /* 40 */ X { 0x15, 0x00, 0x3f, 0}, /* 41 */ X { 0x15, 0x2a, 0x15, 0}, /* 42 */ X { 0x15, 0x2a, 0x3f, 0}, /* 43 */ X { 0x3f, 0x00, 0x15, 0}, /* 44 */ X { 0x3f, 0x00, 0x3f, 0}, /* 45 */ X { 0x3f, 0x2a, 0x15, 0}, /* 46 */ X { 0x3f, 0x2a, 0x3f, 0}, /* 47 */ X { 0x15, 0x15, 0x00, 0}, /* 48 */ X { 0x15, 0x15, 0x2a, 0}, /* 49 */ X { 0x15, 0x3f, 0x00, 0}, /* 50 */ X { 0x15, 0x3f, 0x2a, 0}, /* 51 */ X { 0x3f, 0x15, 0x00, 0}, /* 52 */ X { 0x3f, 0x15, 0x2a, 0}, /* 53 */ X { 0x3f, 0x3f, 0x00, 0}, /* 54 */ X { 0x3f, 0x3f, 0x2a, 0}, /* 55 */ X { 0x15, 0x15, 0x15, 0}, /* 56 - darkgray */ X { 0x15, 0x15, 0x3f, 0}, /* 57 - lightblue */ X { 0x15, 0x3f, 0x15, 0}, /* 58 - lightgreen */ X { 0x15, 0x3f, 0x3f, 0}, /* 59 - lightcyan */ X { 0x3f, 0x15, 0x15, 0}, /* 60 - lightred */ X { 0x3f, 0x15, 0x3f, 0}, /* 61 - lightmagenta */ X { 0x3f, 0x3f, 0x15, 0}, /* 62 - yellow */ X { 0x3f, 0x3f, 0x3f, 0}, /* 63 - white */ X { 0x00, 0x00, 0x00, 0} /* 64 ... - empty */ X}; X Xstatic struct colname { X const char *name; X unsigned idx; X} colnames[] = { X {"black", 0}, X {"blue", 1}, X {"green", 2}, X {"cyan", 3}, X {"red", 4}, X {"magenta", 5}, X {"brown", 20}, X {"lightgray", 7}, X {"lightgrey", 7}, X {"darkgray", 56}, X {"darkgrey", 56}, X {"lightblue", 57}, X {"lightgreen", 58}, X {"lightcyan", 59}, X {"lightred", 60}, X {"lightmagenta", 61}, X {"yellow", 62}, X {"white", 63}, X /* must be terminator: */ {(const char *)NULL, 0} X}; X X Xstatic void parsepopt(char *arg, unsigned *idx, X unsigned *r, unsigned *g, unsigned *b); Xstatic void printpalette(int fd); X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X extern int optind; X extern int opterr; X extern char *optarg; X X int c; X int fd; X X while( (c = getopt(argc, argv, "c:d:hHVls:t:vp:")) != EOF) X { X switch(c) X { X case 'l': X lflag = 1; X break; X X case 'c': X current = atoi(optarg); X break; X X case 'd': X device = optarg; X dflag = 1; X break; X X case 'V': X pflag = 1; X break; X X case 'H': X hflag = 1; X break; X X case 's': X if (!strncmp(optarg, "25", 2)) X res = SIZ_25x80; X else if(!strncmp(optarg, "28", 2)) X res = SIZ_28x80; X else if(!strncmp(optarg, "35", 2)) X res = SIZ_35x80; X else if(!strncmp(optarg, "40", 2)) X res = SIZ_40x80; X else if(!strncmp(optarg, "43", 2)) X res = SIZ_43x80; X else if(!strncmp(optarg, "50", 2)) X res = SIZ_50x80; X break; X X case 'v': X vflag++; X break; X X case 'p': X if(!strcmp(optarg, "list")) X { X if(Pflag) X { X fprintf(stderr, X "-p list is mutual exclusive " X "with other -p options\n"); X return 2; X } X Pflag = 3; X } X else if(!strcmp(optarg, "default")) X { X if(Pflag) X { X fprintf(stderr, X "multiple -p default not " X "allowed\n"); X return 2; X } X Pflag = 2; X } else { X unsigned idx, r, g, b; X X if(Pflag > 1) X { X fprintf(stderr, X "-p default and -p i,r,g,b " X "ambiguous\n"); X return 2; X } X Pflag = 1; X parsepopt(optarg, &idx, &r, &g, &b); X if(idx >= NVGAPEL) X { X fprintf(stderr, X "index %u in -p option " X "out of range\n", idx); X return 2; X } X palette[idx].r = r; X palette[idx].g = g; X palette[idx].b = b; X palette[idx].dothis = 1; X } X break; X X case 't': X tflag++; X timeout = atoi(optarg); X break; X X case 'h': X case '?': X default: X usage(); X break; X } X } X X if((pflag == 1) && (hflag == 1)) X usage(); X X if(dflag == -1 && lflag == -1 && current == -1 && pflag == -1 && X hflag == -1 && res == -1 && Pflag == 0 && tflag == 0) X { X lflag = 1; X } X X if(dflag == -1) X { X if(vflag) X printf("using current device\n"); X fd = 1; X } X else X { X if((fd = open(device, O_RDWR)) == -1) X { X char buffer[80]; X strcpy(buffer,"ERROR opening "); X strcat(buffer,device); X perror(buffer); X exit(1); X } X if(vflag) X printf("using device %s\n",device); X } X X if(lflag == 1) /* list information */ X { X if(vflag) X printf("processing option -l, listing screen info\n"); X printinfo(fd); X exit(0); X } X X if(tflag) /* set screen saver timeout */ X { X if(vflag) X { X printf( X "processing option -t, setting screen saver timeout: " X ); X if(timeout) X printf("new timeout = %d s\n", timeout); X else X printf("turned off\n"); X } X X if(ioctl(fd, VGASCREENSAVER, &timeout) < 0) X { X perror("ioctl(VGASCREENSAVER)"); X fprintf(stderr, "Check the driver, the screensaver is probably not compiled in!\n"); X exit(2); X } X goto success; X } X X if(Pflag == 3) X { X /* listing VGA palette */ X if(vflag) X printf("processing option -p list, " X "listing VGA palette\n"); X X printpalette(fd); X goto success; X } X X if(Pflag) X { X unsigned int idx; X X /* setting VGA palette */ X if(vflag) X printf("processing option -p, setting VGA palette%s\n", X Pflag == 2? " to default": ""); X X for(idx = 0; idx < NVGAPEL; idx++) X if(Pflag == 2 || palette[idx].dothis) X { X struct vgapel p; X p.idx = idx; X p.r = palette[idx].r; X p.g = palette[idx].g; X p.b = palette[idx].b; X if(ioctl(fd, VGAWRITEPEL, (caddr_t)&p) < 0) X { X perror("ioctl(fd, VGAWRITEPEL)"); X return 2; X } X } X goto success; X } X X screeninfo.screen_no = -1; /* We are using fd */ X screeninfo.current_screen = current; X screeninfo.pure_vt_mode = -1; X screeninfo.screen_size = res; X X if(current != -1) /* set current screen */ X { X if(vflag) X printf("processing option -c, setting current screen to %d\n",current); X X X if(ioctl(1, VGASETSCREEN, &screeninfo) == -1) X { X perror("ioctl VGASETSCREEN failed"); X exit(1); X } X exit(0); X } X X if(pflag == 1) X { X if(vflag) X printf("processing option -V, setting emulation to pure VT220\n"); X screeninfo.pure_vt_mode = M_PUREVT; X } X else if(hflag == 1) X { X if(vflag) X printf("processing option -H, setting emulation to VT220 + HP Labels\n"); X screeninfo.pure_vt_mode = M_HPVT; X } X else X { X if(vflag) X printf("no change in terminal emulation\n"); X } X X if(vflag) X { X if(res == -1) X printf("no change in screen resolution\n"); X else if(res == SIZ_25x80) X printf("change screen resolution to 25 x 80\n"); X else if(res == SIZ_28x80) X printf("change screen resolution to 28 x 80\n"); X else if(res == SIZ_35x80) X printf("change screen resolution to 35 x 80\n"); X else if(res == SIZ_40x80) X printf("change screen resolution to 40 x 80\n"); X else if(res == SIZ_43x80) X printf("change screen resolution to 43 x 80\n"); X else if(res == SIZ_50x80) X printf("change screen resolution to 50 x 80\n"); X } X X if(ioctl(fd, VGASETSCREEN, &screeninfo) == -1) X { X perror("ioctl VGASETSCREEN failed"); X exit(1); X } Xsuccess: X if(vflag) X printf("successful execution of ioctl VGASETSCREEN!\n"); X exit(0); X} X Xusage() X{ X fprintf(stderr,"\nscon - virtual screen control for pcvt video driver\n"); X fprintf(stderr,"usage: scon -l -v -h -c[n] -d[dev] -V -H -s[n] -p{default|list|i,r,g,b} -t[sec]\n"); X fprintf(stderr," -l list current parameters for a virtual screen\n"); X fprintf(stderr," -v verbose mode\n"); X fprintf(stderr," -h display help (this message)\n"); X fprintf(stderr," -c <screen no> switch current virtual screen to <screen no>\n"); X fprintf(stderr," -d <device> set parameters(-V|-H|-s) for virtual device\n"); X fprintf(stderr," -V set pure VT220 emulation for a virtual screen\n"); X fprintf(stderr," -H set VT220/HP emulation mode for a virtual screen\n"); X fprintf(stderr," -s <lines> set 25, 28, 35, 40, 43 or 50 lines for a virtual screen\n"); X fprintf(stderr," -p default set default VGA palette\n"); X fprintf(stderr," -p list list current VGA palette\n"); X fprintf(stderr," -p <i,r,g,b> set VGA palette entry i to r/g/b\n"); X fprintf(stderr," -p <name,r,g,b> set VGA palette entry for color name to r/g/b\n"); X fprintf(stderr," -t <timeout> set screen saver timeout [seconds]\n"); X exit(1); X} X Xprintinfo(fd) Xint fd; X{ X if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) X { X perror("ioctl VGAGETSCREEN failed"); X exit(1); X } X X printf( "\nVideo Adaptor Type = "); X X switch(screeninfo.adaptor_type) X { X default: X case UNKNOWN_ADAPTOR: X printf("UNKNOWN Video Adaptor\n"); X break; X X case MDA_ADAPTOR: X printf("MDA - Monochrome Display Adaptor\n"); X break; X X case HGC_ADAPTOR: X printf("HGC - Hercules Graphics Card\n"); X break; X X case CGA_ADAPTOR: X printf("CGA - Color Graphics Adaptor\n"); X break; X X case EGA_ADAPTOR: X printf("EGA - Enhanced Graphics Adaptor\n"); X break; X X case VGA_ADAPTOR: X printf("VGA - Video Graphics Adaptor/Array\n"); X break; X } X printf( "Number of Downloadable Fonts = %d\n",screeninfo.totalfonts); X printf( "Number of Virtual Screens = %d\n",screeninfo.totalscreens); X printf( "Info Request Screen Number = %d\n",screeninfo.screen_no); X printf( "Current Displayed Screen = %d\n",screeninfo.current_screen); X X if(screeninfo.pure_vt_mode == M_PUREVT) X printf( "Terminal Emulation Mode = VT220\n"); X else X printf( "Terminal Emulation Mode = VT220 with HP Features\n"); X X printf( "Screen Size = "); X X switch(screeninfo.screen_size) X { X case SIZ_25x80: X printf( "25 x 80\n"); X break; X X case SIZ_28x80: X printf( "28 x 80\n"); X break; X X case SIZ_35x80: X printf( "35 x 80\n"); X break; X X case SIZ_40x80: X printf( "40 x 80\n"); X break; X X case SIZ_43x80: X printf( "43 x 80\n"); X break; X X case SIZ_50x80: X printf( "50 x 80\n"); X break; X X default: X printf( "UNKNOWN\n"); X break; X } X printf("\n"); X} X Xstatic const char *findname(unsigned idx) X{ X /* try to find a name for palette entry idx */ X /* if multiple names exist, returns first matching */ X register struct colname *cnp; X X for(cnp = colnames; cnp->name; cnp++) X if(cnp->idx == idx) X return cnp->name; X X /* not found */ X return (const char *)NULL; X} X Xstatic void printpalette(int fd) X{ X register unsigned idx, last; X X for(idx = 0; idx < NVGAPEL; idx++) X { X struct vgapel p; X p.idx = idx; X if(ioctl(fd, VGAREADPEL, &p) < 0) X { X perror("ioctl(VGAREADPEL)"); X exit(2); X } X palette[idx].r = p.r; X palette[idx].g = p.g; X palette[idx].b = p.b; X } X X /* find last non-empty entry */ X for(last = NVGAPEL - 1; last; last--) X if(palette[last].r || palette[last].g || palette[last].b) X break; X X if(last != NVGAPEL - 1) X last++; X X /* now, everything's collected. print out table */ X printf("VGA palette status\n"); X printf("index red green blue name\n"); X for(idx = 0; idx < last; idx++) X { X const char *cp; X printf("%5d %5d %5d %5d", X idx, palette[idx].r, palette[idx].g, palette[idx].b); X if(cp = findname(idx)) X printf(" %s\n", cp); X else X putchar('\n'); X } X putchar('\n'); X} X X Xstatic void parsepopt(char *arg, unsigned *idx, X unsigned *r, unsigned *g, unsigned *b) X{ X char firstarg[21]; X register unsigned i; X X if(sscanf(arg, "%20[a-zA-Z0-9]%*[,:]%u,%u,%u", firstarg, r, g, b) < 4 X || strlen(firstarg) == 0) { X fprintf(stderr, "too few args in -p i,r,g,b\n"); X exit(2); X } X X if(firstarg[0] >= '0' && firstarg[0] <= '9') { X *idx = strtoul(firstarg, NULL, 10); X return; X } X X for(i = 0; colnames[i].name; i++) X if(strcasecmp(colnames[i].name, firstarg) == 0) { X *idx = colnames[i].idx; X return; X } X fprintf(stderr, "arg ``%s'' in -p option not recognized\n", X firstarg); X exit(2); X} SHAR_EOF $TOUCH -am 0113140793 Support/scon/scon.c && chmod 0640 Support/scon/scon.c || echo "restore of Support/scon/scon.c failed" set `wc -c Support/scon/scon.c`;Wc_c=$1 if test "$Wc_c" != "15668"; then echo original size 15668, current size $Wc_c fi fi # ============= Support/scon/Makefile ============== if test X"$1" != X"-c" -a -f 'Support/scon/Makefile'; then echo "File already exists: skipping 'Support/scon/Makefile'" else echo "x - extracting Support/scon/Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/scon/Makefile && XPROG= scon X X.include <bsd.prog.mk> X Xscon.c: /usr/include/sys/pcvt_ioctl.h X X/usr/include/sys/pcvt_ioctl.h: ../../pcvt_ioctl.h X cp ../../pcvt_ioctl.h /usr/include/sys SHAR_EOF $TOUCH -am 0113151493 Support/scon/Makefile && chmod 0660 Support/scon/Makefile || echo "restore of Support/scon/Makefile failed" set `wc -c Support/scon/Makefile`;Wc_c=$1 if test "$Wc_c" != "165"; then echo original size 165, current size $Wc_c fi fi # ============= Support/kcon/kcon.1 ============== if test ! -d 'Support/kcon'; then echo "x - creating directory Support/kcon" mkdir 'Support/kcon' fi if test X"$1" != X"-c" -a -f 'Support/kcon/kcon.1'; then echo "File already exists: skipping 'Support/kcon/kcon.1'" else echo "x - extracting Support/kcon/kcon.1 (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/kcon/kcon.1 && X.\" Copyright (c) 1992, 1993 Hellmuth Michaelis X.\" X.\" All rights reserved. X.\" X.\" This driver is contributed to the 386BSD operating system. X.\" X.\" Redistribution and use in source and binary forms, with or without X.\" modification, are permitted provided that the following conditions X.\" are met: X.\" 1. Redistributions of source code must retain the above copyright X.\" notice, this list of conditions and the following disclaimer. X.\" 2. Redistributions in binary form must reproduce the above copyright X.\" notice, this list of conditions and the following disclaimer in the X.\" documentation and/or other materials provided with the distribution. X.\" 3. All advertising materials mentioning features or use of this software X.\" must display the following acknowledgement: X.\" This product includes software contributed to 386BSD and developed X.\" by Hellmuth Michaelis X.\" 4. Neither the name of the developers nor the names "386BSD" and "pcvt" X.\" may be used to endorse or promote products derived from this software X.\" without specific prior written permission. X.\" X.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR X.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, X.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X.\" X.\" @(#)kcon.1 2.00 (contributed to 386BSD) X.\" Last Edit-Date: [Sun Jan 3 15:35:48 1993] X.\" X.Dd January 3, 1993 X.Dt KCON 1 X.Os 386BSD 0.1 X.Sh NAME X.Nm kcon X.Nd keyboard control and remapping X.Sh SYNOPSIS X.Nm kcon X.Op Fl d Ar delay X.Op Fl l X.Op Fl m Ar map X.Op Fl o X.Op Fl p X.Op Fl r Ar rate X.Op Fl s X.Op Fl t Ns Ar +/- X.Op Fl x X.Sh DESCRIPTION X.Nm kcon Xis used for controlling all aspects of keyboard configuration for the 386BSD 0.1 XVT220 emulator driver 'pcvt' release 2.0. X.Pp XThe available options are: X.Bl -tag -width flag X.It Fl d Ar delay XSpecifies the delay after which the last key entered will be repeated by the XKeyboard. Valid values are 0..3 corresponding to delays of 250, 500, 750 and X1000 milliseconds. X.It Fl l XDisplays the current keyboard map in use by the driver. X.It Fl m Ar map XSpecifies the map entry to be searched in the keyboard capabilities database X.Nm keycap. XThe database is searched for the entry and if found, the mapping Xis loaded and is used in the driver from then on. X.It Fl o XSwitches display of control codes to octal in the listing of the current map. XTo be used in conjunction with the X.Fl l Xoption. X.It Fl p XUses 'pure' output when listing - the Escape character is displayed in either Xoctal or hexadecimal and not as 'ESC'. To be used in conjunction with the X.Fl l Xoption. X.It Fl r Ar rate XSpecifies the character repetition rate. Valid argument values are 0...31 Xcorresponding to rates of 30 charcters/second ... 2 characters/second. X.It Fl s XDisplays the current settings of the rate and delay values. X.It Fl t Ar +/- XSpecify this option to enable ( X.Ar + X) or disable ( X.Ar - X) the repetition of keys. X.It Fl x XSwitches display of control codes to hexadecimal in the listing of the current map. XTo be used in conjunction with the X.Fl l Xoption. This is the default behaviour. X.Sh FILES X.Bl -tag -width /usr/share/misc/keycap -compact X.It Pa /usr/share/misc/keycap XKeyboard capabilities data base file if nothing else was choosen during installation. X.It Pa /dev/console XKeyboard raw device. X.Sh SEE ALSO X.Xr keycap 3 , X.Xr keycap 5 X.Sh BUGS X.Nm kcon Xdetects several inconsistencies in the keycap database. In case of errors X.Nm kcon Xexits with an error message. If this happens, the keyboard may remain in Xan undefined state. To recover from such situation, execute X.Nm kcon -m default X.Sh EXAMPLES XThe command X.Dq Li kcon -m gb Xloads the entry 'gb' from the keycap file into the keyboard to switch to Xa british keyboard behaviour. X XThe command X.Dq Li kcon -r 0 -d 0 Xswitches the keyboard to emit characters at a rate of 30 characters per second Xafter a key has been held down for 250 milliseconds. X X SHAR_EOF $TOUCH -am 0113140993 Support/kcon/kcon.1 && chmod 0640 Support/kcon/kcon.1 || echo "restore of Support/kcon/kcon.1 failed" set `wc -c Support/kcon/kcon.1`;Wc_c=$1 if test "$Wc_c" != "4522"; then echo original size 4522, current size $Wc_c fi fi # ============= Support/kcon/kcon.c ============== if test X"$1" != X"-c" -a -f 'Support/kcon/kcon.c'; then echo "File already exists: skipping 'Support/kcon/kcon.c'" else echo "x - extracting Support/kcon/kcon.c (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/kcon/kcon.c && X/* X * Copyright (c) 1992, 1993 Hellmuth Michaelis and Holger Veit. X * X * All rights reserved. X * X * This code is derived from software contributed to 386BSD by X * Holger Veit X * X * This program is contributed to the 386BSD operating system. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * 3. All advertising materials mentioning features or use of this software X * must display the following acknowledgement: X * This product includes software contributed to 386BSD and developed X * by Hellmuth Michaelis and Holger Veit X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt" X * may be used to endorse or promote products derived from this software X * without specific prior written permission. X * X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. X */ X X/* X * @(#)kcon.c 2.00 (contributed to 386BSD) X * Last Edit-Date: [Sun Jan 3 15:43:31 1993] X */ X X/*---------------------------------------------------------------------------* X * X * kcon.c Keyboard control and remapping X * ---------------------------------------------- X * X * based on "keymap" which was written by X * Holger Veit (veit@du9ds3.uni-duisburg.de) X * X * -hm a first rewrite X * -hm rewrite for pcvt 2.0 distribution X * -hm adding show current typematic values X * -hm hex/octal/esc output choices X * -hm remapping debugging X * X *---------------------------------------------------------------------------*/ X X#include <stdio.h> X#include <string.h> X#include <sys/types.h> X#include <sys/ioctl.h> X#include <sys/pcvt_ioctl.h> X X#include "keycap.h" X Xint df = 0; Xint lf = 0; Xint mf = 0; Xint of = 0; Xint pf = 0; Xint rf = 0; Xint tf = 0; Xint xf = 0; Xint sf = 0; X X/*---------------------------------------------------------------------------* X * main entry X *---------------------------------------------------------------------------*/ Xmain(argc, argv) Xint argc; Xchar *argv[]; X{ X extern char *optarg; X extern int optind; X X int c = 0; X X int errf = 0; X X int rate = -1; X int delay = -1; X char *map; X int kbfd; X X while((c = getopt(argc, argv, "d:lm:opr:st:x")) != EOF) X { X switch(c) X { X case 'd': X df = 1; X delay = atoi(optarg); X break; X X case 'l': X lf = 1; X break; X X case 'm': X mf = 1; X map = argv[optind-1]; X break; X X case 'o': X if(xf) X errf = 1; X else X of = 1; X break; X X case 'p': X pf = 1; X break; X X case 'r': X rf = 1; X rate = atoi(optarg); X break; X X case 's': X sf = 1; X break; X X case 't': X if(*optarg == '+') X tf = 1; X else if(*optarg == '-') X tf = -1; X else X errf = 1; X break; X X case 'x': X if(of) X errf = 1; X else X xf = 1; X break; X X default: X usage(); X } X } X X if((df == 0 && lf == 0 && tf == 0 && sf == 0 && X rf == 0 && mf == 0 ) || errf) X { X usage(); X } X X if((kbfd = open(KEYB_DEVICE, 0)) < 0) X { X perror("kcon: keyboard open failiure"); X exit(1); X } X X if(sf) X { X showtypeamatic(kbfd); X exit(0); X } X X if(lf) X { X listcurrent(kbfd); X exit(0); X } X X if(tf) X { X setrepeat(kbfd, tf); X } X X if(df || rf) X { X if(delay > 3) X { X fprintf(stderr,"Delay value (%d) out of range, possible values are 0..3!\n",delay); X exit(1); X } X if(rate > 31) X { X fprintf(stderr,"Rate value (%d) out of range, possible values are 0..31!\n",rate); X exit(1); X } X settypeam(kbfd, delay, rate); X } X X if(mf) X { X remapkeys(kbfd, map); X } X X close(kbfd); X exit(0); X} X X/*---------------------------------------------------------------------------* X * display usage info & exit X *---------------------------------------------------------------------------*/ Xusage() X{ X fprintf(stderr, "\nkcon: keyboard control and remapping utility for vt220 driver pcvt 2.0\n"); X fprintf(stderr, "usage: [-d delay] [-l] [-m map] [-o] [-p] [-r rate] [-t +/-] [-x]\n"); X fprintf(stderr, " -d delay until a key is repeated (range: 0...3 => 250...1000ms)\n"); X fprintf(stderr, " -l produce listing of current keyboard mapping\n"); X fprintf(stderr, " -m set keyboard remapping from a keycap entry\n"); X fprintf(stderr, " -o set octal output for listing\n"); X fprintf(stderr, " -p pure, don't display escape as 'ESC' for listing\n"); X fprintf(stderr, " -r chars/second repeat value (range: 0...31 => 30...2 chars/sec)\n"); X fprintf(stderr, " -s show, display the current keyboard typematic values\n"); X fprintf(stderr, " -t switch repeat on(+) or off(-)\n"); X fprintf(stderr, " -x set hexadecimal output for listing\n\n"); X exit(1); X} X X/*---------------------------------------------------------------------------* X * convert control char in string to printable values X *---------------------------------------------------------------------------*/ Xchar *showcntrl(s) Xu_char *s; X{ X static char res_str[80]; X static char conv_buf[80]; X int i; X X res_str[0] = '\0'; X X for(i = 0; s[i]; i++) X { X if(((s[i] > 0x20) && (s[i] <= 0x7e)) || ((s[i] >= 0xa0) && (s[i] <= 0xff))) X { X conv_buf[0] = s[i]; X conv_buf[1] = '\0'; X } X else if((s[i] == 0x1b) && (pf == 0)) X { X strcpy(conv_buf,"ESC "); X } X else if(of) X { X sprintf(conv_buf,"\\%03.3o ", s[i]); X } X else X { X sprintf(conv_buf,"0x%02.2X ", s[i]); X } X strcat(res_str, conv_buf); X } X return(res_str); X} X X/*---------------------------------------------------------------------------* X * list the current keyboard mapping X *---------------------------------------------------------------------------*/ Xlistcurrent(kbfd) Xint kbfd; X{ X static char *keytypetab[] = { X "NONE ", X "SHIFT ", X "ALT/META ", X "NUMLOCK ", X "CONTROL ", X "CAPSLOCK ", X "ASCII ", X "SCROLL ", X "FUNCTION ", X "KEYPAD ", X "BREAK ", X "ALTGR ", X "SHIFTLOCK", X "CURSOR ", X "RETURN " X }; X X struct kbd_ovlkey keyboardmap[KBDMAXKEYS]; X struct kbd_ovlkey *kbmapp; X int keytype; X int altgr_defined; X int i; X X altgr_defined = 0; X kbmapp = keyboardmap; X X for (i = 0; i < KBDMAXKEYS; i++) X { X kbmapp->keynum = i; X X if(ioctl(kbfd, KBDGCKEY, kbmapp) < 0) X { X perror("kcon: ioctl KBDGCKEY failed"); X exit(1); X } X X if((kbmapp->type & KBD_MASK) == KBD_ALTGR) X altgr_defined = i; X X kbmapp++; X } X X if(altgr_defined) X { X printf("S Key KeyType Normal Shift Control Altgr \n"); X printf("- --- --------- --------------- --------------- --------------- ---------------\n"); X } X else X { X printf("S Key KeyType Normal Shift Control \n"); X printf("- --- --------- --------------- --------------- ---------------\n"); X } X X kbmapp = &keyboardmap[1]; X X for(i = 1; i < KBDMAXKEYS; i++) X { X keytype = kbmapp->type; X X if(keytype) X { X if(keytype & KBD_OVERLOAD) X printf("! %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]); X else X printf("- %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]); X X if(kbmapp->subu == KBD_SUBT_STR) X printf("%-15s ",showcntrl(kbmapp->unshift)); X else X printf("Function() "); X X if(kbmapp->subs == KBD_SUBT_STR) X printf("%-15s ",showcntrl(kbmapp->shift)); X else X printf("Function() "); X X if(kbmapp->subc == KBD_SUBT_STR) X printf("%-15s ",showcntrl(kbmapp->ctrl)); X else X printf("Function() "); X X if(altgr_defined) X { X if(kbmapp->suba == KBD_SUBT_STR) X printf("%-15s ",showcntrl(kbmapp->altgr)); X else X printf("Function() "); X } X putchar('\n'); X } X kbmapp++; X } X} X X/*---------------------------------------------------------------------------* X * show delay and rate values for keyboard X *---------------------------------------------------------------------------*/ Xshowtypeamatic(kbfd) Xint kbfd; X{ X static char *delaytab[] = { X "250", X "500", X "750", X "1000" X }; X X static char *ratetab[] = { X "30.0", X "26.7", X "24.0", X "21.8", X "20.0", X "18.5", X "17.1", X "16.0", X "15.0", X "13.3", X "12.0", X "10.9", X "10.0", X "9.2", X "8.6", X "8.0", X "7.5", X "6.7", X "6.0", X "5.5", X "5.0", X "4.6", X "4.3", X "4.0", X "3.7", X "3.3", X "3.0", X "2.7", X "2.5", X "2.3", X "2.1", X "2.0" X }; X X int cur_typemat_val; X int delay, rate; X X if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) X { X perror("kcon: ioctl KBDGTPMAT failed"); X exit(1); X } X X delay = ((cur_typemat_val & 0x60) >> 5); X rate = cur_typemat_val & 0x1f; X X printf("\nDisplaying the current keyboard typematic values:\n\n"); X printf("The delay-until-repeat time is [ %s ] milliseconds\n",delaytab[delay]); X printf("The repeat-rate is [ %s ] characters per second\n\n",ratetab[rate]); X} X X/*---------------------------------------------------------------------------* X * set repeat feature on/off X *---------------------------------------------------------------------------*/ Xsetrepeat(kbfd, tf) Xint kbfd; Xint tf; X{ X int srepsw_val; X X if(tf == 1) X srepsw_val = KBD_REPEATON; X else X srepsw_val = KBD_REPEATOFF; X X if(ioctl(kbfd, KBDSREPSW, &srepsw_val) < 0) X { X perror("kcon: ioctl KBDREPSW failed"); X exit(1); X } X} X X/*---------------------------------------------------------------------------* X * set delay and rate values for keyboard X *---------------------------------------------------------------------------*/ Xsettypeam(kbfd, delay, rate) Xint kbfd; Xint delay; Xint rate; X{ X int cur_typemat_val; X int new_typemat_val; X X if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) X { X perror("kcon: ioctl KBDGTPMAT failed"); X exit(1); X } X X if(delay == -1) X delay = (cur_typemat_val & 0x60); X else X delay = ((delay << 5) & 0x60); X X if(rate == -1) X rate = (cur_typemat_val & 0x1f); X else X rate &= 0x1f; X X new_typemat_val = delay | rate; X X if((ioctl(kbfd, KBDSTPMAT, &new_typemat_val)) < 0) X { X perror("kcon: ioctl KBDSTPMAT failed"); X exit(1); X } X} X X/*---------------------------------------------------------------------------* X * remap keyboard from keycap entry X *---------------------------------------------------------------------------*/ Xremapkeys(kbfd, map) Xint kbfd; Xchar *map; X{ X char cap_entry[1024]; X int ret; X char keyflag[128]; X int i; X X /* try to find the entry */ X X ret = kgetent(cap_entry, map); X X if(ret == -1) X { X fprintf(stderr, "kcon: keycap database not found or not accessible!\n"); X exit(1); X } X else if(ret == 0) X { X fprintf(stderr, "kcon: keycap entry [%s] not found in database!\n", map); X exit(1); X } X X /* set default mapping */ X X if((ioctl(kbfd, KBDDEFAULT)) < 0) X { X perror("kcon: ioctl KBDDEFAULT failed"); X exit(1); X } X X /* DE flag present? */ X X if(kgetflag("de")) X return; X X for(i = 0; i < KBDMAXKEYS; i++) X keyflag[i] = 0; X X set_lock(keyflag, kbfd); X X set_shift(keyflag, kbfd); X X set_char(keyflag, kbfd); X} X X/*---------------------------------------------------------------------------* X * care for lock keys X *---------------------------------------------------------------------------*/ Xset_lock(keyflag, kbfd) Xchar keyflag[]; Xint kbfd; X{ X int i, j; X char cap[16]; X struct kbd_ovlkey entry; X X struct { X char *ch; X u_short typ; X } lock[] = X { X "ca", KBD_CAPS, X "sh", KBD_SHFTLOCK, X "nl", KBD_NUMLOCK, X "sc", KBD_SCROLL X }; X X X for(i = 0; i < 4; i++) X { X int n; X X sprintf(cap, "%s", lock[i].ch); X X n = kgetnum(cap); X X if(n > 0) X { X if (keyflag[n]) X { X fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n); X exit(1); X } X keyflag[n] = 1; X X entry.keynum = n; X entry.type = lock[i].typ; X X if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) X { X perror("kcon: ioctl KBDSCKEY failed"); X exit(1); X } X } X } X} X X/*---------------------------------------------------------------------------* X * care for shifting keys X *---------------------------------------------------------------------------*/ Xset_shift(keyflag, kbfd) Xchar keyflag[]; Xint kbfd; X{ X int i, j; X char cap[16]; X struct kbd_ovlkey entry; X X struct { X char ch; X u_short typ; X } shift[] = X { X 'm', KBD_META, X 'l', KBD_ALTGR, X 'h', KBD_SHIFT, X 't', KBD_CTL X }; X X for(i = 0; i < 4; i++) X { X for(j = 1; j < 10; j++) X { X int n; X X sprintf(cap, "%c%d", shift[i].ch,j); X X n = kgetnum(cap); X X if (n >= 0) X { X if (keyflag[n]) X { X fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n); X exit(1); X } X keyflag[n] = 1; X X entry.keynum = n; X entry.type = shift[i].typ; X if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) X { X perror("kcon: ioctl KBDSCKEY failed"); X exit(1); X } X } X } X } X} X X/*---------------------------------------------------------------------------* X * care for normal keys X *---------------------------------------------------------------------------*/ Xset_char(keyflag, kbfd) Xchar keyflag[]; Xint kbfd; X{ X int i, j; X char cap[16]; X int setflag; X char *addr_str; X char *new_str; X struct kbd_ovlkey entry; X X struct { X char *addr; X char ch; X } standard[] = { X 0, 'D', X &entry.unshift[0], 'K', X &entry.shift[0], 'S', X &entry.ctrl[0], 'C', X &entry.altgr[0], 'A' X }; X X for(i = 1; i < KBDMAXKEYS; i++) X { X setflag = 0; X X entry.keynum = i; X X if((ioctl(kbfd, KBDGOKEY, &entry)) < 0) X { X perror("kcon: ioctl KBDGOKEY failed"); X exit(1); X } X X entry.type = KBD_ASCII; X X for(j = 0; j < 5; j++) X { X sprintf(cap, "%c%d", standard[j].ch,i); X X if((j == 0) && (kgetflag(cap))) X { X /* delete a key */ X X entry.type = KBD_NONE; X setflag = 1; X goto setit; X X } X else X { X addr_str = standard[j].addr; X if(new_str = kgetstr(cap, &addr_str)) X { X if(strlen(new_str) > KBDMAXOVLKEYSIZE) X { X fprintf(stderr, "kcon: database entry string [%s] longer than max [%d]!\n",new_str,KBDMAXOVLKEYSIZE); X exit(1); X } X setflag = 1; X } X } X } X Xsetit: if (setflag) X { X if (keyflag[i]) X { X fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",i); X exit(1); X } X keyflag[i] = 1; X X if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) X { X perror("kcon: ioctl KBDSCKEY failed"); X exit(1); X } X } X } X} X X/*------------------- EOF ------------------------------------------------*/ SHAR_EOF $TOUCH -am 0113140993 Support/kcon/kcon.c && chmod 0640 Support/kcon/kcon.c || echo "restore of Support/kcon/kcon.c failed" set `wc -c Support/kcon/kcon.c`;Wc_c=$1 if test "$Wc_c" != "15057"; then echo original size 15057, current size $Wc_c fi fi # ============= Support/kcon/Makefile ============== if test X"$1" != X"-c" -a -f 'Support/kcon/Makefile'; then echo "File already exists: skipping 'Support/kcon/Makefile'" else echo "x - extracting Support/kcon/Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > Support/kcon/Makefile && XPROG= kcon XDEVICE= /dev/console XCFLAGS+= -I${.CURDIR}/../keycap -DKEYB_DEVICE=\"${DEVICE}\" X X# the -Lfoo could be omitted if libkeycap.a were installed before X# making those programs here XLDADD= -L${.CURDIR}/../keycap -lkeycap X X.include <bsd.prog.mk> X Xkcon.c: /usr/include/sys/pcvt_ioctl.h X X/usr/include/sys/pcvt_ioctl.h: ../../pcvt_ioctl.h X cp ../../pcvt_ioctl.h /usr/include/sys SHAR_EOF $TOUCH -am 0113151493 Support/kcon/Makefile && chmod 0660 Support/kcon/Makefile || echo "restore of Support/kcon/Makefile failed" set `wc -c Support/kcon/Makefile`;Wc_c=$1 if test "$Wc_c" != "381"; then echo original size 381, current size $Wc_c fi fi echo "End of part 7, continue with part 8" exit 0 -- hellmuth michaelis HCS Hanseatischer Computerservice GmbH hamburg, europe hm@hcshh.hcs.de tel: +49/40/55903-170 fax: +49/40/5591486