pcvt 3.0, with some performance enhancements by Joerg Wunsch and me.

This commit is contained in:
mycroft 1994-03-29 02:44:39 +00:00
parent 2b5fbfd760
commit 627cafc287
22 changed files with 3619 additions and 0 deletions

View File

@ -0,0 +1,119 @@
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Hellmuth Michaelis
.\" 4. The name authors may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)kcon.1, 3.00, Last Edit-Date: [Mon Jan 10 21:20:55 1994]
.\"
.Dd January 3, 1993
.Dt KCON 1
.Sh NAME
.Nm kcon
.Nd keyboard control and remapping
.Sh SYNOPSIS
.Nm kcon
.Op Fl d Ar delay
.Op Fl l
.Op Fl m Ar map
.Op Fl o
.Op Fl p
.Op Fl r Ar rate
.Op Fl s
.Op Fl t Ns Ar +/-
.Op Fl x
.Sh DESCRIPTION
.Nm kcon
is used for controlling all aspects of keyboard configuration for the 'pcvt'
video driver.
.Pp
The available options are:
.Bl -tag -width flag
.It Fl d Ar delay
Specifies the delay after which the last key entered will be repeated by the
Keyboard. Valid values are 0..3 corresponding to delays of 250, 500, 750 and
1000 milliseconds.
.It Fl l
Displays the current keyboard map in use by the driver.
.It Fl m Ar map
Specifies the map entry to be searched in the keyboard capabilities database
.Nm keycap.
The database is searched for the entry and if found, the mapping
is loaded and is used in the driver from then on.
.It Fl o
Switches display of control codes to octal in the listing of the current map.
To be used in conjunction with the
.Fl l
option.
.It Fl p
Uses 'pure' output when listing - the Escape character is displayed in either
octal or hexadecimal and not as 'ESC'. To be used in conjunction with the
.Fl l
option.
.It Fl r Ar rate
Specifies the character repetition rate. Valid argument values are 0...31
corresponding to rates of 30 charcters/second ... 2 characters/second.
.It Fl s
Displays the current settings of the rate and delay values.
.It Fl t Ar +/-
Specify this option to enable (
.Ar +
) or disable (
.Ar -
) the repetition of keys.
.It Fl x
Switches display of control codes to hexadecimal in the listing of the current map.
To be used in conjunction with the
.Fl l
option. This is the default behaviour.
.Sh FILES
.Bl -tag -width /usr/share/misc/keycap -compact
.It Pa /usr/share/misc/keycap
Keyboard capabilities data base file if nothing else was choosen during installation.
.It Pa /dev/console
Keyboard raw device.
.Sh SEE ALSO
.Xr keycap 3 ,
.Xr keycap 5
.Sh BUGS
.Nm kcon
detects several inconsistencies in the keycap database. In case of errors
.Nm kcon
exits with an error message. If this happens, the keyboard may remain in
an undefined state. To recover from such situation, execute
.Nm kcon -m default
.Sh EXAMPLES
The command
.Dq Li kcon -m gb
loads the entry 'gb' from the keycap file into the keyboard to switch to
a british keyboard behaviour.
The command
.Dq Li kcon -r 0 -d 0
switches the keyboard to emit characters at a rate of 30 characters per second
after a key has been held down for 250 milliseconds.

View File

@ -0,0 +1,87 @@
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Hellmuth Michaelis
.\" 4. The name authors may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)loadfont.1, 3.00, Last Edit-Date: [Mon Jan 10 21:25:01 1994]
.\"
.Dd January 3, 1993
.Dt LOADFONT 1
.Sh NAME
.Nm loadfont
.Nd is used to load fonts into EGA or VGA boards for use by the 'pcvt' video
driver.
.Sh SYNOPSIS
.Nm loadfont
.Op Fl c Ar charsetno
.Op Fl f Ar fontfilename
.Op Fl i
.Sh DESCRIPTION
The
.Nm loadfont
utility is used to load fonts needed for proper operation of the pcvt
VT220 driver on EGA and VGA boards into the font ram of this boards.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl c
Specifies the slot, the font is to load into. EGA boards have four
slots and VGA boards have eight slots available for downloading fonts.
.It Fl f
Specifies the file which contains the font to be downloaded.
.It Fl i
Gives information what type(s) of font do currently reside in which slot.
This is also the default behaviour if no options are specified on the commandline.
.El
.Pp
This utility is used only on EGA and VGA boards, as MDA, HCG and CGA boards
do not have downloadable charactersets available.
.Sh FILES
Unless otherwise specified in the Makefile, the following fontfiles are
available for the pcvt 2.0 distribution:
.nf
/usr/share/misc/vgafonts/vt220l.808: 8x8 IBM II font
/usr/share/misc/vgafonts/vt220h.808: 8x8 Extension font
/usr/share/misc/vgafonts/vt220l.810: 8x10 IBM II font
/usr/share/misc/vgafonts/vt220h.810: 8x10 Extension font
/usr/share/misc/vgafonts/vt220l.814: 8x14 IBM II font
/usr/share/misc/vgafonts/vt220h.814: 8x14 Extension font
/usr/share/misc/vgafonts/vt220l.816: 8x16 IBM II font
/usr/share/misc/vgafonts/vt220h.816: 8x16 Extension font
.fi
.Sh EXAMPLES
The command
.Dq Li loadfont -c0 -f/usr/share/misc/vgafonts/vt220l.816
loads a 8x16 font containing the standard IBM characterset II into font slot
0 on a VGA or EGA board.
.Sh BUGS
No known bugs
.Sh SEE ALSO
.Xr cursor 1 ,
.Xr scon 1 ,
.Xr pcvt 8

View File

@ -0,0 +1,121 @@
.\"
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)keycap.3, 3.00, Last Edit-Date: [Sun Jan 2 13:46:43 1994]
.\"
.Dd January 3, 1993
.Dt KEYCAP 3
.Sh NAME
.Nm kgetent ,
.Nm kgetnum ,
.Nm kgetflag ,
.Nm kgetstr
.Nd routines for accessing the keycap database
.Sh SYNOPSIS
.Fn kgetent "char *bp" "char *name"
.Fn kgetnum "char *id"
.Fn kgetflag "char *id"
.Ft char *
.Fn kgetstr "char *id" "char *area"
.Sh DESCRIPTION
These functions extract and use capabilities from a keyboard capability data
base, usually
.Pa /usr/share/misc/keycap ,
the format of which is described in
.Xr keycap 5 .
.Pp
The
.Fn kgetent
function
extracts the entry for keyboard mapping
.Fa name
into the buffer at
.Fa bp .
The
.Fa bp
argument
should be a character buffer of size
1024 and must be retained through all subsequent calls to
.Fn kgetnum ,
.Fn kgetflag ,
and
.Fn kgetstr .
The
.Fn kgetent
function
returns \-1 if none of the
.Nm keycap
data base files could be opened,
0 if the map name given does not have an entry,
and 1 if all goes well.
.Pp
The
.Fn kgetnum
function
gets the numeric value of capability
.Fa id ,
returning \-1 if is not given for the map.
.Pp
The
.Fn kgetflag
function
returns 1 if the specified capability is present in
the map's entry, 0 if it is not.
.Pp
The
.Fn kgetstr
function
returns the string value of the capability
.Fa id ,
places it in the buffer at
.Fa area ,
and advances the
.Fa area
pointer.
The
.Fn kgetstr
function
returns
.Dv NULL
if the capability was not found.
.Pp
.Sh FILES
.Bl -tag -width /usr/share/misc/keycap -compact
.It Pa /usr/share/misc/keycap
Keyboard capabilities database (if nothing else choosen during installation).
.El
.Sh SEE ALSO
.Xr kcon 1 ,
.Xr keycap 5

View File

@ -0,0 +1,133 @@
.\"
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)keycap.5, 3.00, Last Edit-Date: [Sun Jan 2 13:45:59 1994]
.\"
.Dd January 3, 1993
.Dt KEYCAP 5
.Sh NAME
.Nm keycap
.Nd keyboard mapping data base
.Sh SYNOPSIS
.Nm keycap
.Sh DESCRIPTION
The
.Nm keycap
file
is a data base describing keyboard mappings, used by
.Xr kcon 1 .
.Pp
Entries in
.Nm keycap
consist of a number of `:'-separated fields.
The first entry for each mapping gives the names that are known for the
mapping, separated by `|' characters.
All names but the first and last
should be in lower case and contain no blanks;
the last name may well contain
upper case and blanks for readability.
.Sh CAPABILITIES
.Pp
.Bl -column indent indent
.Sy Name Type Description
.It "de bool Resets Keyboard mapping to compiled-in default"
.It "D<n> bool Disables key <n> completely"
.It "m<n> num specify key numbers for ALT keys
.It "l<n> num specify key numbers for ALTGR keys
.It "h<n> num specify key numbers for SHIFT keys
.It "t<n> num specify key numbers for CONTROL keys
.It "ca<n> num specify key number for the CAPS LOCK key
.It "sh<n> num specify key number for the SHIFT LOCK key
.It "nl<n> num specify key number for the NUM LOCK key
.It "sc<n> num specify key number for the SCROLL LOCK key
.It "K<n> str bind a string to a unshifted (normal) key
.It "S<n> str bind a string to a shifted key
.It "C<n> str bind a string to a control key
.It "A<n> str bind a string to a altgr key
.It "tc str Entry of similar map \- must be last."
.El
Parameter <n> describing the key number can have values from 1 to 128.
A string parameter may have up to 15 characters.
.Pp
.Ss A Sample Entry
The following entry, which describes a test entry, is among the very
easy entries in the
.Nm keycap
file as of this writing.
.Pp
.Bd -literal
tt\||test\||Test entry which swaps y and z:\e
:K22=z:S22=Z:C22=\e032:\e
:K46=y:S46=Y:C46=\e031:
.Ed
.Pp
Entries may continue onto multiple lines by giving a \e as the last
character of a line. Comments may be included on lines beginning with
.Dq # .
.Sh FILES
.Bl -tag -width /usr/share/misc/keycap -compact
.It Pa /usr/share/misc/keycap
File containing keyboard mapping descriptions.
.El
.Sh SEE ALSO
.Xr kcon 1 ,
.Xr keycap 3 ,
.Sh EXAMPLES
The entry
.Dq Li l1#60
sets the keynumber for the ALTGR key to 60.
The entry
.Dq Li K100=hugo
binds the string 'hugo' to the key number 100.
The entry
.Dq Li K100=^D
binds the control character EOT (0x04) to the key number 100.
The entry
.Dq Li K100=\e000
binds the control character NUL (0x00) to the key number 100.

View File

@ -0,0 +1,88 @@
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Hellmuth Michaelis
.\" 4. The name authors may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)ispcvt.1, 3.00, Last Edit-Date: [Mon Jan 10 21:19:00 1994]
.\"
.Dd December 30, 1993
.Dt ISPCVT 1
.Sh NAME
.Nm ispcvt
.Nd verify if current video driver is pcvt driver
.Sh SYNOPSIS
.Nm ispcvt
.Op Fl v
.Op Fl c
.Sh DESCRIPTION
The
.Nm ispcvt
utility allows the user to check wether the current video driver compiled
into the kernel is a pcvt driver. The major and minor release numbers of
the driver are also checked.
Furthermore
.Nm ispcvt
is also able to print out the values of all the
.Dq Ar PCVT_XXXXXX
compile time options, the driver in the current running kernel was
compiled with.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl v
Specifies being verbose. On success the name and revision is reported, on
failure which comparison failed.
.It Fl c
This options prints out the values of all
.Dq Ar PCVT_XXXXXX
#defines which were given to the compiler at the time the currently running
kernel was compiled. Specifying
.Fl v
with the
.Fl c
option gives a verbose listing of the compile-time options.
.Sh RETURN VALUE
.Bl -tag -width Ds
.Pp
.It Sy 0
driver is pcvt and major and minor numbers match
.It Sy 1
ioctl system call failed
.It Sy 2
driver name mismatch
.It Sy 3
name matched, release major number mismatch
.It Sy 4
name & major number matched, release minor number mismatch
.It Sy 5
usage error
.El
.Pp
.Sh BUGS
No known bugs
.Sh SEE ALSO
.Xr pcvt 8

View File

@ -0,0 +1,27 @@
.if !exists(${.CURDIR}/../Makefile.inc)
error:
@echo
@echo " You MUST link/copy"
@echo
@echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD"
@echo
@echo " to ../Makefile.inc before you can proceed !"
@echo
.else
PROG = ispcvt
MAN8 = ispcvt.${MAN8EXT}
.include <bsd.prog.mk>
# special bindir, this MUST stand after include <bsd.prog.mk>
BINDIR = /usr/sbin
$(PROG): $(INCDIR)/pcvt_ioctl.h
beforeinstall:
@if [ ! -d $(MANDIR)8 ] ; then \
echo making $(MANDIR)8; mkdir $(MANDIR)8; fi
.endif

View File

@ -0,0 +1,88 @@
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Hellmuth Michaelis
.\" 4. The name authors may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)ispcvt.1, 3.00, Last Edit-Date: [Mon Jan 10 21:19:00 1994]
.\"
.Dd December 30, 1993
.Dt ISPCVT 1
.Sh NAME
.Nm ispcvt
.Nd verify if current video driver is pcvt driver
.Sh SYNOPSIS
.Nm ispcvt
.Op Fl v
.Op Fl c
.Sh DESCRIPTION
The
.Nm ispcvt
utility allows the user to check wether the current video driver compiled
into the kernel is a pcvt driver. The major and minor release numbers of
the driver are also checked.
Furthermore
.Nm ispcvt
is also able to print out the values of all the
.Dq Ar PCVT_XXXXXX
compile time options, the driver in the current running kernel was
compiled with.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl v
Specifies being verbose. On success the name and revision is reported, on
failure which comparison failed.
.It Fl c
This options prints out the values of all
.Dq Ar PCVT_XXXXXX
#defines which were given to the compiler at the time the currently running
kernel was compiled. Specifying
.Fl v
with the
.Fl c
option gives a verbose listing of the compile-time options.
.Sh RETURN VALUE
.Bl -tag -width Ds
.Pp
.It Sy 0
driver is pcvt and major and minor numbers match
.It Sy 1
ioctl system call failed
.It Sy 2
driver name mismatch
.It Sy 3
name matched, release major number mismatch
.It Sy 4
name & major number matched, release minor number mismatch
.It Sy 5
usage error
.El
.Pp
.Sh BUGS
No known bugs
.Sh SEE ALSO
.Xr pcvt 8

View File

@ -0,0 +1,254 @@
/*
* Copyright (c) 1992,1993,1994 Hellmuth Michaelis
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Hellmuth Michaelis
* 4. The name authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
static char *id =
"@(#)ispcvt.c, 3.00, Last Edit-Date: [Sun Feb 20 22:30:58 1994]";
/*---------------------------------------------------------------------------*
*
* history:
*
* -hm upgraded to report pcvt compile time configuration
* -hm PCVT_INHIBIT_NUMLOCK patch from Joerg
* -hm PCVT_META_ESC patch from Joerg
* -hm PCVT_PCBURST
* -hm new ioctl VGAPCVTINFO
*
*---------------------------------------------------------------------------*/
#include <stdio.h>
#include <machine/pcvt_ioctl.h>
main(argc,argv)
int argc;
char *argv[];
{
extern int optind;
extern int opterr;
extern char *optarg;
struct pcvtid pcvtid;
struct pcvtinfo pcvtinfo;
int c;
char *p;
int verbose = 0;
int config = 0;
while( (c = getopt(argc, argv, "vc")) != EOF)
{
switch(c)
{
case 'v':
verbose = 1;
break;
case 'c':
config = 1;
break;
case '?':
default:
usage();
break;
}
}
if(ioctl(0, VGAPCVTID, &pcvtid) == -1)
{
if(verbose)
perror("ispcvt - ioctl VGAPCVTID failed, error");
exit(1);
}
if(!strcmp(pcvtid.name, PCVTIDNAME))
{
if(pcvtid.rmajor == PCVTIDMAJOR)
{
if(pcvtid.rminor != PCVTIDMINOR)
{
if(verbose)
fprintf(stderr,"ispcvt - minor revision: expected %d, got %d\n", PCVTIDMINOR, pcvtid.rminor);
exit(4); /* minor revision mismatch */
}
}
else
{
if(verbose)
fprintf(stderr,"ispcvt - major revision: expected %d, got %d\n", PCVTIDMAJOR, pcvtid.rmajor);
exit(3); /* major revision mismatch */
}
}
else
{
if(verbose)
fprintf(stderr,"ispcvt - name check: expected %s, got %s\n", PCVTIDNAME, pcvtid.name);
exit(2); /* name mismatch */
}
if(verbose)
{
fprintf(stderr,"\nispcvt - success: driver name [%s], revision [%1.1d.%02.2d]\n\n",pcvtid.name,pcvtid.rmajor,pcvtid.rminor);
}
if(config == 0)
exit(0);
if(ioctl(0, VGAPCVTINFO, &pcvtinfo) == -1)
{
if(verbose)
perror("ispcvt - ioctl VGAPCVTINFO failed, error");
exit(1);
}
if(verbose)
{
switch(pcvtinfo.opsys)
{
case CONF_386BSD:
p = "PCVT_386BSD";
break;
case CONF_NETBSD:
p = "PCVT_NETBSD";
break;
case CONF_FREEBSD:
p = "PCVT_FREEBSD";
break;
default:
case CONF_UNKNOWNOPSYS:
p = "UNKNOWN";
break;
}
fprintf(stderr,"Operating System = %s\t", p);
fprintf(stderr,"Release Id = %u\n", pcvtinfo.opsysrel);
fprintf(stderr,"PCVT_NSCREENS = %u\t\t", pcvtinfo.nscreens);
fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast);
fprintf(stderr,"PCVT_UPDATESLOW = %u\t\t", pcvtinfo.updateslow);
fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf);
fprintf(stderr,"PCVT_PCBURST = %u\n", pcvtinfo.pcburst);
/* config booleans */
fprintf(stderr,"PCVT_VT220KEYB = %s\t\t",
((u_int)pcvtinfo.compile_opts & (u_int)CONF_VT220KEYB) ? "ON" : "OFF");
fprintf(stderr,"PCVT_SCREENSAVER = %s\n",
(pcvtinfo.compile_opts & CONF_SCREENSAVER) ? "ON" : "OFF");
fprintf(stderr,"PCVT_PRETTYSCRNS = %s\t\t",
(pcvtinfo.compile_opts & CONF_PRETTYSCRNS) ? "ON" : "OFF");
fprintf(stderr,"PCVT_CTRL_ALT_DEL = %s\n",
(pcvtinfo.compile_opts & CONF_CTRL_ALT_DEL) ? "ON" : "OFF");
fprintf(stderr,"PCVT_USEKBDSEC = %s\t\t",
(pcvtinfo.compile_opts & CONF_USEKBDSEC) ? "ON" : "OFF");
fprintf(stderr,"PCVT_24LINESDEF = %s\n",
(pcvtinfo.compile_opts & CONF_24LINESDEF) ? "ON" : "OFF");
fprintf(stderr,"PCVT_EMU_MOUSE = %s\t\t",
(pcvtinfo.compile_opts & CONF_EMU_MOUSE) ? "ON" : "OFF");
fprintf(stderr,"PCVT_SHOWKEYS = %s\n",
(pcvtinfo.compile_opts & CONF_SHOWKEYS) ? "ON" : "OFF");
fprintf(stderr,"PCVT_KEYBDID = %s\t\t",
(pcvtinfo.compile_opts & CONF_KEYBDID) ? "ON" : "OFF");
fprintf(stderr,"PCVT_SIGWINCH = %s\n",
(pcvtinfo.compile_opts & CONF_SIGWINCH) ? "ON" : "OFF");
fprintf(stderr,"PCVT_NULLCHARS = %s\t\t",
(pcvtinfo.compile_opts & CONF_NULLCHARS) ? "ON" : "OFF");
fprintf(stderr,"PCVT_BACKUP_FONTS = %s\n",
(pcvtinfo.compile_opts & CONF_BACKUP_FONTS) ? "ON" : "OFF");
fprintf(stderr,"PCVT_FORCE8BIT = %s\t\t",
(pcvtinfo.compile_opts & CONF_FORCE8BIT) ? "ON" : "OFF");
fprintf(stderr,"PCVT_NEEDPG = %s\n",
(pcvtinfo.compile_opts & CONF_NEEDPG) ? "ON" : "OFF");
fprintf(stderr,"PCVT_SETCOLOR = %s\t\t",
(pcvtinfo.compile_opts & CONF_SETCOLOR) ? "ON" : "OFF");
fprintf(stderr,"PCVT_132GENERIC = %s\n",
(pcvtinfo.compile_opts & CONF_132GENERIC) ? "ON" : "OFF");
fprintf(stderr,"PCVT_PALFLICKER = %s\t\t",
(pcvtinfo.compile_opts & CONF_PALFLICKER) ? "ON" : "OFF");
fprintf(stderr,"PCVT_WAITRETRACE = %s\n",
(pcvtinfo.compile_opts & CONF_WAITRETRACE) ? "ON" : "OFF");
fprintf(stderr,"PCVT_XSERVER = %s\t\t",
(pcvtinfo.compile_opts & CONF_XSERVER) ? "ON" : "OFF");
fprintf(stderr,"PCVT_USL_VT_COMPAT = %s\n",
(pcvtinfo.compile_opts & CONF_USL_VT_COMPAT) ? "ON" : "OFF");
fprintf(stderr,"PCVT_FAKE_SYSCONS10 = %s\t\t",
(pcvtinfo.compile_opts & CONF_FAKE_SYSCONS10) ? "ON" : "OFF");
fprintf(stderr,"PCVT_INHIBIT_NUMLOCK = %s\n",
(pcvtinfo.compile_opts & CONF_INHIBIT_NUMLOCK) ? "ON" : "OFF");
fprintf(stderr,"PCVT_META_ESC = %s\n\n",
(pcvtinfo.compile_opts & CONF_META_ESC) ? "ON" : "OFF");
}
else /* !verbose */
{
fprintf(stderr,"BSD Version = %u\n", pcvtinfo.opsys);
fprintf(stderr,"PCVT_NSCREENS = %u\n", pcvtinfo.nscreens);
fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast);
fprintf(stderr,"PCVT_UPDATESLOW = %u\n", pcvtinfo.updateslow);
fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf);
fprintf(stderr,"Compile options = 0x%08X\n", pcvtinfo.compile_opts);
}
}
usage()
{
fprintf(stderr,"\nispcvt - verify current video driver is the pcvt-driver\n");
fprintf(stderr,"usage: ispcvt [-v] [-c]\n");
fprintf(stderr," -v be verbose\n");
fprintf(stderr," -c print compile time configuration\n\n");
exit(5);
}

View File

@ -0,0 +1,26 @@
.if !exists(${.CURDIR}/../Makefile.inc)
error:
@echo
@echo " You MUST link/copy"
@echo
@echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD"
@echo
@echo " to ../Makefile.inc before you can proceed !"
@echo
.else
PROG = kcon
DEVICE = /dev/ttyv0
CFLAGS += -I${.CURDIR}/../keycap -DKEYB_DEVICE=\"${DEVICE}\"
# the -Lfoo could be omitted if libkeycap.a were installed before
# making those programs here
LDADD = -L${.CURDIR}/../keycap -L${.CURDIR}/../keycap/obj -lkeycap
.include <bsd.prog.mk>
$(PROG): $(INCDIR)/pcvt_ioctl.h
.endif

View File

@ -0,0 +1,119 @@
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Hellmuth Michaelis
.\" 4. The name authors may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)kcon.1, 3.00, Last Edit-Date: [Mon Jan 10 21:20:55 1994]
.\"
.Dd January 3, 1993
.Dt KCON 1
.Sh NAME
.Nm kcon
.Nd keyboard control and remapping
.Sh SYNOPSIS
.Nm kcon
.Op Fl d Ar delay
.Op Fl l
.Op Fl m Ar map
.Op Fl o
.Op Fl p
.Op Fl r Ar rate
.Op Fl s
.Op Fl t Ns Ar +/-
.Op Fl x
.Sh DESCRIPTION
.Nm kcon
is used for controlling all aspects of keyboard configuration for the 'pcvt'
video driver.
.Pp
The available options are:
.Bl -tag -width flag
.It Fl d Ar delay
Specifies the delay after which the last key entered will be repeated by the
Keyboard. Valid values are 0..3 corresponding to delays of 250, 500, 750 and
1000 milliseconds.
.It Fl l
Displays the current keyboard map in use by the driver.
.It Fl m Ar map
Specifies the map entry to be searched in the keyboard capabilities database
.Nm keycap.
The database is searched for the entry and if found, the mapping
is loaded and is used in the driver from then on.
.It Fl o
Switches display of control codes to octal in the listing of the current map.
To be used in conjunction with the
.Fl l
option.
.It Fl p
Uses 'pure' output when listing - the Escape character is displayed in either
octal or hexadecimal and not as 'ESC'. To be used in conjunction with the
.Fl l
option.
.It Fl r Ar rate
Specifies the character repetition rate. Valid argument values are 0...31
corresponding to rates of 30 charcters/second ... 2 characters/second.
.It Fl s
Displays the current settings of the rate and delay values.
.It Fl t Ar +/-
Specify this option to enable (
.Ar +
) or disable (
.Ar -
) the repetition of keys.
.It Fl x
Switches display of control codes to hexadecimal in the listing of the current map.
To be used in conjunction with the
.Fl l
option. This is the default behaviour.
.Sh FILES
.Bl -tag -width /usr/share/misc/keycap -compact
.It Pa /usr/share/misc/keycap
Keyboard capabilities data base file if nothing else was choosen during installation.
.It Pa /dev/console
Keyboard raw device.
.Sh SEE ALSO
.Xr keycap 3 ,
.Xr keycap 5
.Sh BUGS
.Nm kcon
detects several inconsistencies in the keycap database. In case of errors
.Nm kcon
exits with an error message. If this happens, the keyboard may remain in
an undefined state. To recover from such situation, execute
.Nm kcon -m default
.Sh EXAMPLES
The command
.Dq Li kcon -m gb
loads the entry 'gb' from the keycap file into the keyboard to switch to
a british keyboard behaviour.
The command
.Dq Li kcon -r 0 -d 0
switches the keyboard to emit characters at a rate of 30 characters per second
after a key has been held down for 250 milliseconds.

View File

@ -0,0 +1,738 @@
/*
* Copyright (c) 1992,1993,1994 Hellmuth Michaelis
*
* Copyright (c) 1992,1993 Holger Veit.
*
* All rights reserved.
*
* This code is derived from software contributed to 386BSD by
* Holger Veit
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by
* Hellmuth Michaelis and Holger Veit
* 4. The name authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
static char *id =
"@(#)kcon.c, 3.00, Last Edit-Date: [Mon Jan 10 21:23:24 1994]";
/*---------------------------------------------------------------------------*
*
* kcon.c Keyboard control and remapping
* ----------------------------------------------
*
* based on "keymap" which was written by
* Holger Veit (veit@du9ds3.uni-duisburg.de)
*
* -hm a first rewrite
* -hm rewrite for pcvt 2.0 distribution
* -hm adding show current typematic values
* -hm hex/octal/esc output choices
* -hm remapping debugging
* -hm garbage output for remapped keys bugfix
*
*---------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <machine/pcvt_ioctl.h>
#include "keycap.h"
int df = 0;
int lf = 0;
int mf = 0;
int of = 0;
int pf = 0;
int rf = 0;
int tf = 0;
int xf = 0;
int sf = 0;
/*---------------------------------------------------------------------------*
* main entry
*---------------------------------------------------------------------------*/
main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind;
int c = 0;
int errf = 0;
int rate = -1;
int delay = -1;
char *map;
int kbfd;
while((c = getopt(argc, argv, "d:lm:opr:st:x")) != EOF)
{
switch(c)
{
case 'd':
df = 1;
delay = atoi(optarg);
break;
case 'l':
lf = 1;
break;
case 'm':
mf = 1;
map = argv[optind-1];
break;
case 'o':
if(xf)
errf = 1;
else
of = 1;
break;
case 'p':
pf = 1;
break;
case 'r':
rf = 1;
rate = atoi(optarg);
break;
case 's':
sf = 1;
break;
case 't':
if(*optarg == '+')
tf = 1;
else if(*optarg == '-')
tf = -1;
else
errf = 1;
break;
case 'x':
if(of)
errf = 1;
else
xf = 1;
break;
default:
usage();
}
}
if((df == 0 && lf == 0 && tf == 0 && sf == 0 &&
rf == 0 && mf == 0 ) || errf)
{
usage();
}
if((kbfd = open(KEYB_DEVICE, 0)) < 0)
{
perror("kcon: keyboard open failiure");
exit(1);
}
if(sf)
{
showtypeamatic(kbfd);
exit(0);
}
if(lf)
{
listcurrent(kbfd);
exit(0);
}
if(tf)
{
setrepeat(kbfd, tf);
}
if(df || rf)
{
if(delay > 3)
{
fprintf(stderr,"Delay value (%d) out of range, possible values are 0..3!\n",delay);
exit(1);
}
if(rate > 31)
{
fprintf(stderr,"Rate value (%d) out of range, possible values are 0..31!\n",rate);
exit(1);
}
settypeam(kbfd, delay, rate);
}
if(mf)
{
remapkeys(kbfd, map);
}
close(kbfd);
exit(0);
}
/*---------------------------------------------------------------------------*
* display usage info & exit
*---------------------------------------------------------------------------*/
usage()
{
fprintf(stderr, "\nkcon: keyboard control and remapping utility for pcvt video driver\n");
fprintf(stderr, "usage: [-d delay] [-l] [-m map] [-o] [-p] [-r rate] [-t +/-] [-x]\n");
fprintf(stderr, " -d delay until a key is repeated (range: 0...3 => 250...1000ms)\n");
fprintf(stderr, " -l produce listing of current keyboard mapping\n");
fprintf(stderr, " -m set keyboard remapping from a keycap entry\n");
fprintf(stderr, " -o set octal output for listing\n");
fprintf(stderr, " -p pure, don't display escape as 'ESC' for listing\n");
fprintf(stderr, " -r chars/second repeat value (range: 0...31 => 30...2 chars/sec)\n");
fprintf(stderr, " -s show, display the current keyboard typematic values\n");
fprintf(stderr, " -t switch repeat on(+) or off(-)\n");
fprintf(stderr, " -x set hexadecimal output for listing\n\n");
exit(1);
}
/*---------------------------------------------------------------------------*
* convert control char in string to printable values
*---------------------------------------------------------------------------*/
char *showcntrl(s)
u_char *s;
{
static char res_str[80];
static char conv_buf[80];
int i;
res_str[0] = '\0';
for(i = 0; s[i]; i++)
{
if(((s[i] > 0x20) && (s[i] <= 0x7e)) || ((s[i] >= 0xa0) && (s[i] <= 0xff)))
{
conv_buf[0] = s[i];
conv_buf[1] = '\0';
}
else if((s[i] == 0x1b) && (pf == 0))
{
strcpy(conv_buf,"ESC ");
}
else if(of)
{
sprintf(conv_buf,"\\%03.3o ", s[i]);
}
else
{
sprintf(conv_buf,"0x%02.2X ", s[i]);
}
strcat(res_str, conv_buf);
}
return(res_str);
}
/*---------------------------------------------------------------------------*
* list the current keyboard mapping
*---------------------------------------------------------------------------*/
listcurrent(kbfd)
int kbfd;
{
static char *keytypetab[] = {
"NONE ",
"SHIFT ",
"ALT/META ",
"NUMLOCK ",
"CONTROL ",
"CAPSLOCK ",
"ASCII ",
"SCROLL ",
"FUNCTION ",
"KEYPAD ",
"BREAK ",
"ALTGR ",
"SHIFTLOCK",
"CURSOR ",
"RETURN "
};
struct kbd_ovlkey keyboardmap[KBDMAXKEYS];
struct kbd_ovlkey *kbmapp;
int keytype;
int altgr_defined;
int i;
altgr_defined = 0;
kbmapp = keyboardmap;
for (i = 0; i < KBDMAXKEYS; i++)
{
kbmapp->keynum = i;
if(ioctl(kbfd, KBDGCKEY, kbmapp) < 0)
{
perror("kcon: ioctl KBDGCKEY failed");
exit(1);
}
if((kbmapp->type & KBD_MASK) == KBD_ALTGR)
altgr_defined = i;
kbmapp++;
}
if(altgr_defined)
{
printf("S Key KeyType Normal Shift Control Altgr \n");
printf("- --- --------- --------------- --------------- --------------- ---------------\n");
}
else
{
printf("S Key KeyType Normal Shift Control \n");
printf("- --- --------- --------------- --------------- ---------------\n");
}
kbmapp = &keyboardmap[1];
for(i = 1; i < KBDMAXKEYS; i++)
{
keytype = kbmapp->type;
if(keytype)
{
if(keytype & KBD_OVERLOAD)
printf("! %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]);
else
printf("- %3.3d %9.9s ", i, keytypetab[keytype & KBD_MASK]);
switch(keytype & KBD_MASK)
{
case KBD_NUM:
case KBD_ASCII:
case KBD_FUNC:
case KBD_KP:
case KBD_CURSOR:
case KBD_RETURN: /* ??? */
if(kbmapp->subu == KBD_SUBT_STR)
printf("%-15s ",showcntrl(kbmapp->unshift));
else
printf("Function() ");
if(kbmapp->subs == KBD_SUBT_STR)
printf("%-15s ",showcntrl(kbmapp->shift));
else
printf("Function() ");
if(kbmapp->subc == KBD_SUBT_STR)
printf("%-15s ",showcntrl(kbmapp->ctrl));
else
printf("Function() ");
if(altgr_defined)
{
if(kbmapp->suba == KBD_SUBT_STR)
printf("%-15s ",showcntrl(kbmapp->altgr));
else
printf("Function() ");
}
break;
}
putchar('\n');
}
kbmapp++;
}
}
/*---------------------------------------------------------------------------*
* show delay and rate values for keyboard
*---------------------------------------------------------------------------*/
showtypeamatic(kbfd)
int kbfd;
{
static char *delaytab[] = {
"250",
"500",
"750",
"1000"
};
static char *ratetab[] = {
"30.0",
"26.7",
"24.0",
"21.8",
"20.0",
"18.5",
"17.1",
"16.0",
"15.0",
"13.3",
"12.0",
"10.9",
"10.0",
"9.2",
"8.6",
"8.0",
"7.5",
"6.7",
"6.0",
"5.5",
"5.0",
"4.6",
"4.3",
"4.0",
"3.7",
"3.3",
"3.0",
"2.7",
"2.5",
"2.3",
"2.1",
"2.0"
};
int cur_typemat_val;
int delay, rate;
if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0)
{
perror("kcon: ioctl KBDGTPMAT failed");
exit(1);
}
delay = ((cur_typemat_val & 0x60) >> 5);
rate = cur_typemat_val & 0x1f;
printf("\nDisplaying the current keyboard typematic values:\n\n");
printf("The delay-until-repeat time is [ %s ] milliseconds\n",delaytab[delay]);
printf("The repeat-rate is [ %s ] characters per second\n\n",ratetab[rate]);
}
/*---------------------------------------------------------------------------*
* set repeat feature on/off
*---------------------------------------------------------------------------*/
setrepeat(kbfd, tf)
int kbfd;
int tf;
{
int srepsw_val;
if(tf == 1)
srepsw_val = KBD_REPEATON;
else
srepsw_val = KBD_REPEATOFF;
if(ioctl(kbfd, KBDSREPSW, &srepsw_val) < 0)
{
perror("kcon: ioctl KBDREPSW failed");
exit(1);
}
}
/*---------------------------------------------------------------------------*
* set delay and rate values for keyboard
*---------------------------------------------------------------------------*/
settypeam(kbfd, delay, rate)
int kbfd;
int delay;
int rate;
{
int cur_typemat_val;
int new_typemat_val;
if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0)
{
perror("kcon: ioctl KBDGTPMAT failed");
exit(1);
}
if(delay == -1)
delay = (cur_typemat_val & 0x60);
else
delay = ((delay << 5) & 0x60);
if(rate == -1)
rate = (cur_typemat_val & 0x1f);
else
rate &= 0x1f;
new_typemat_val = delay | rate;
if((ioctl(kbfd, KBDSTPMAT, &new_typemat_val)) < 0)
{
perror("kcon: ioctl KBDSTPMAT failed");
exit(1);
}
}
/*---------------------------------------------------------------------------*
* remap keyboard from keycap entry
*---------------------------------------------------------------------------*/
remapkeys(kbfd, map)
int kbfd;
char *map;
{
char cap_entry[1024];
int ret;
char keyflag[128];
int i;
/* try to find the entry */
ret = kgetent(cap_entry, map);
if(ret == -1)
{
fprintf(stderr, "kcon: keycap database not found or not accessible!\n");
exit(1);
}
else if(ret == 0)
{
fprintf(stderr, "kcon: keycap entry [%s] not found in database!\n", map);
exit(1);
}
/* set default mapping */
if((ioctl(kbfd, KBDDEFAULT)) < 0)
{
perror("kcon: ioctl KBDDEFAULT failed");
exit(1);
}
/* DE flag present? */
if(kgetflag("de"))
return;
for(i = 0; i < KBDMAXKEYS; i++)
keyflag[i] = 0;
set_lock(keyflag, kbfd);
set_shift(keyflag, kbfd);
set_char(keyflag, kbfd);
}
/*---------------------------------------------------------------------------*
* care for lock keys
*---------------------------------------------------------------------------*/
set_lock(keyflag, kbfd)
char keyflag[];
int kbfd;
{
int i, j;
char cap[16];
struct kbd_ovlkey entry;
struct {
char *ch;
u_short typ;
} lock[] =
{
"ca", KBD_CAPS,
"sh", KBD_SHFTLOCK,
"nl", KBD_NUMLOCK,
"sc", KBD_SCROLL
};
for(i = 0; i < 4; i++)
{
int n;
sprintf(cap, "%s", lock[i].ch);
n = kgetnum(cap);
if(n > 0)
{
if (keyflag[n])
{
fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n);
exit(1);
}
keyflag[n] = 1;
entry.keynum = n;
entry.type = lock[i].typ;
if((ioctl(kbfd, KBDSCKEY, &entry)) < 0)
{
perror("kcon: ioctl KBDSCKEY failed");
exit(1);
}
}
}
}
/*---------------------------------------------------------------------------*
* care for shifting keys
*---------------------------------------------------------------------------*/
set_shift(keyflag, kbfd)
char keyflag[];
int kbfd;
{
int i, j;
char cap[16];
struct kbd_ovlkey entry;
struct {
char ch;
u_short typ;
} shift[] =
{
'm', KBD_META,
'l', KBD_ALTGR,
'h', KBD_SHIFT,
't', KBD_CTL
};
for(i = 0; i < 4; i++)
{
for(j = 1; j < 10; j++)
{
int n;
sprintf(cap, "%c%d", shift[i].ch,j);
n = kgetnum(cap);
if (n >= 0)
{
if (keyflag[n])
{
fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",n);
exit(1);
}
keyflag[n] = 1;
entry.keynum = n;
entry.type = shift[i].typ;
if((ioctl(kbfd, KBDSCKEY, &entry)) < 0)
{
perror("kcon: ioctl KBDSCKEY failed");
exit(1);
}
}
}
}
}
/*---------------------------------------------------------------------------*
* care for normal keys
*---------------------------------------------------------------------------*/
set_char(keyflag, kbfd)
char keyflag[];
int kbfd;
{
int i, j;
char cap[16];
int setflag;
char *addr_str;
char *new_str;
struct kbd_ovlkey entry;
struct {
char *addr;
char ch;
} standard[] = {
0, 'D',
&entry.unshift[0], 'K',
&entry.shift[0], 'S',
&entry.ctrl[0], 'C',
&entry.altgr[0], 'A'
};
for(i = 1; i < KBDMAXKEYS; i++)
{
setflag = 0;
entry.keynum = i;
if((ioctl(kbfd, KBDGOKEY, &entry)) < 0)
{
perror("kcon: ioctl KBDGOKEY failed");
exit(1);
}
entry.type = KBD_ASCII;
for(j = 0; j < 5; j++)
{
sprintf(cap, "%c%d", standard[j].ch,i);
if((j == 0) && (kgetflag(cap)))
{
/* delete a key */
entry.type = KBD_NONE;
setflag = 1;
goto setit;
}
else
{
addr_str = standard[j].addr;
if(new_str = kgetstr(cap, &addr_str))
{
if(strlen(new_str) > KBDMAXOVLKEYSIZE)
{
fprintf(stderr, "kcon: database entry string [%s] longer than max [%d]!\n",new_str,KBDMAXOVLKEYSIZE);
exit(1);
}
setflag = 1;
}
}
}
setit: if (setflag)
{
if (keyflag[i])
{
fprintf(stderr,"kcon: duplicate key definition for key [%d]!\n",i);
exit(1);
}
keyflag[i] = 1;
if((ioctl(kbfd, KBDSCKEY, &entry)) < 0)
{
perror("kcon: ioctl KBDSCKEY failed");
exit(1);
}
}
}
}
/*------------------- EOF ------------------------------------------------*/

View File

@ -0,0 +1,32 @@
.if !exists(${.CURDIR}/../Makefile.inc)
error:
@echo
@echo " You MUST link/copy"
@echo
@echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD"
@echo
@echo " to ../Makefile.inc before you can proceed !"
@echo
.else
LIB = keycap
CAPDIR = /usr/share/misc
CAPPATH = $(CAPDIR)/keycap.pcvt
KEYCAPSRC= keycap.src
CFLAGS += -DKEYCAP_PATH=\"$(CAPPATH)\"
SRCS = keycap.c
MAN3 = keycap.${MAN3EXT}
MAN5 = man5/keycap.${MAN5EXT}
#CLEANFILES+= keycap.0 man5/keycap.0
beforeinstall:
@if [ ! -d ${LIBDIR} ]; then mkdir ${LIBDIR};fi
@echo "Saving old keycap database"
-mv -f ${CAPPATH} ${CAPPATH}.BAK
install -c -m ${LIBMODE} -o ${LIBOWN} -g ${LIBGRP} \
${.CURDIR}/${KEYCAPSRC} ${CAPPATH}
.include <bsd.lib.mk>
.endif

View File

@ -0,0 +1,121 @@
.\"
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)keycap.3, 3.00, Last Edit-Date: [Sun Jan 2 13:46:43 1994]
.\"
.Dd January 3, 1993
.Dt KEYCAP 3
.Sh NAME
.Nm kgetent ,
.Nm kgetnum ,
.Nm kgetflag ,
.Nm kgetstr
.Nd routines for accessing the keycap database
.Sh SYNOPSIS
.Fn kgetent "char *bp" "char *name"
.Fn kgetnum "char *id"
.Fn kgetflag "char *id"
.Ft char *
.Fn kgetstr "char *id" "char *area"
.Sh DESCRIPTION
These functions extract and use capabilities from a keyboard capability data
base, usually
.Pa /usr/share/misc/keycap ,
the format of which is described in
.Xr keycap 5 .
.Pp
The
.Fn kgetent
function
extracts the entry for keyboard mapping
.Fa name
into the buffer at
.Fa bp .
The
.Fa bp
argument
should be a character buffer of size
1024 and must be retained through all subsequent calls to
.Fn kgetnum ,
.Fn kgetflag ,
and
.Fn kgetstr .
The
.Fn kgetent
function
returns \-1 if none of the
.Nm keycap
data base files could be opened,
0 if the map name given does not have an entry,
and 1 if all goes well.
.Pp
The
.Fn kgetnum
function
gets the numeric value of capability
.Fa id ,
returning \-1 if is not given for the map.
.Pp
The
.Fn kgetflag
function
returns 1 if the specified capability is present in
the map's entry, 0 if it is not.
.Pp
The
.Fn kgetstr
function
returns the string value of the capability
.Fa id ,
places it in the buffer at
.Fa area ,
and advances the
.Fa area
pointer.
The
.Fn kgetstr
function
returns
.Dv NULL
if the capability was not found.
.Pp
.Sh FILES
.Bl -tag -width /usr/share/misc/keycap -compact
.It Pa /usr/share/misc/keycap
Keyboard capabilities database (if nothing else choosen during installation).
.El
.Sh SEE ALSO
.Xr kcon 1 ,
.Xr keycap 5

View File

@ -0,0 +1,133 @@
.\"
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)keycap.5, 3.00, Last Edit-Date: [Sun Jan 2 13:45:59 1994]
.\"
.Dd January 3, 1993
.Dt KEYCAP 5
.Sh NAME
.Nm keycap
.Nd keyboard mapping data base
.Sh SYNOPSIS
.Nm keycap
.Sh DESCRIPTION
The
.Nm keycap
file
is a data base describing keyboard mappings, used by
.Xr kcon 1 .
.Pp
Entries in
.Nm keycap
consist of a number of `:'-separated fields.
The first entry for each mapping gives the names that are known for the
mapping, separated by `|' characters.
All names but the first and last
should be in lower case and contain no blanks;
the last name may well contain
upper case and blanks for readability.
.Sh CAPABILITIES
.Pp
.Bl -column indent indent
.Sy Name Type Description
.It "de bool Resets Keyboard mapping to compiled-in default"
.It "D<n> bool Disables key <n> completely"
.It "m<n> num specify key numbers for ALT keys
.It "l<n> num specify key numbers for ALTGR keys
.It "h<n> num specify key numbers for SHIFT keys
.It "t<n> num specify key numbers for CONTROL keys
.It "ca<n> num specify key number for the CAPS LOCK key
.It "sh<n> num specify key number for the SHIFT LOCK key
.It "nl<n> num specify key number for the NUM LOCK key
.It "sc<n> num specify key number for the SCROLL LOCK key
.It "K<n> str bind a string to a unshifted (normal) key
.It "S<n> str bind a string to a shifted key
.It "C<n> str bind a string to a control key
.It "A<n> str bind a string to a altgr key
.It "tc str Entry of similar map \- must be last."
.El
Parameter <n> describing the key number can have values from 1 to 128.
A string parameter may have up to 15 characters.
.Pp
.Ss A Sample Entry
The following entry, which describes a test entry, is among the very
easy entries in the
.Nm keycap
file as of this writing.
.Pp
.Bd -literal
tt\||test\||Test entry which swaps y and z:\e
:K22=z:S22=Z:C22=\e032:\e
:K46=y:S46=Y:C46=\e031:
.Ed
.Pp
Entries may continue onto multiple lines by giving a \e as the last
character of a line. Comments may be included on lines beginning with
.Dq # .
.Sh FILES
.Bl -tag -width /usr/share/misc/keycap -compact
.It Pa /usr/share/misc/keycap
File containing keyboard mapping descriptions.
.El
.Sh SEE ALSO
.Xr kcon 1 ,
.Xr keycap 3 ,
.Sh EXAMPLES
The entry
.Dq Li l1#60
sets the keynumber for the ALTGR key to 60.
The entry
.Dq Li K100=hugo
binds the string 'hugo' to the key number 100.
The entry
.Dq Li K100=^D
binds the control character EOT (0x04) to the key number 100.
The entry
.Dq Li K100=\e000
binds the control character NUL (0x00) to the key number 100.

View File

@ -0,0 +1,377 @@
/*-
* Copyright (c) 1992, 1993 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Holger Veit
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
static char *id =
"@(#)keycap.c, 3.00, Last Edit-Date: [Sun Jan 2 14:00:27 1994]";
/*---------------------------------------------------------------------------*
*
* keycap.c Keyboard capabilities database handling
* -------------------------------------------------------
*
* converted from printcap by Holger Veit (veit@du9ds3.uni-duisburg.de)
*
* BUG: Should use a "last" pointer in tbuf, so that searching
* for capabilities alphabetically would not be a n**2/2
* process when large numbers of capabilities are given.
*
* Note: If we add a last pointer now we will screw up the
* tc capability. We really should compile termcap.
*
* modified by Hellmuth Michaelis (hm@hcshh.hcs.de) to fit into the
* vt220 driver pcvt 2.0 distribution
*
* -hm header conversion & cosmetic changes for pcvt 2.0 distribution
* -hm debugging remapping
* -hm cleaning up from termcap ....
* -hm split off header file keycap.h
*
*---------------------------------------------------------------------------*/
#include <stdio.h>
#include <ctype.h>
#include "keycap.h"
#define KEYCAP_BUFSIZ 1024
#define MAXHOP 32 /* max number of tc= indirections */
char *getenv();
static FILE *pfp = NULL; /* keycap data base file pointer */
static char *tbuf;
static int hopcount; /* detect infinite loops in keycap, init 0 */
static int knchktc();
static int knamatch();
static char *kdecode();
/*---------------------------------------------------------------------------*
* match a name
*---------------------------------------------------------------------------*/
static char *nmatch(id,cstr)
char *id,*cstr;
{
register n = strlen(id);
register char *c = cstr+n;
if (strncmp(id,cstr,n)==0 &&
(*c==':' || *c=='|' || *c=='=' || *c=='#') || *c=='@')
return c;
return 0;
}
/*---------------------------------------------------------------------------*
* Get an entry for keyboard name in buffer bp from the keycap file.
* Parse is very rudimentary, we just notice escaped newlines.
*---------------------------------------------------------------------------*/
kgetent(bp, name)
char *bp, *name;
{
register char *cp;
register int c;
register int i = 0, cnt = 0;
char ibuf[KEYCAP_BUFSIZ];
char *cp2;
int tf;
tbuf = bp;
tf = 0;
tf = open(KEYCAP_PATH, 0);
if (tf < 0)
return (-1);
for (;;) {
cp = bp;
for (;;) {
if (i == cnt) {
cnt = read(tf, ibuf, KEYCAP_BUFSIZ);
if (cnt <= 0) {
close(tf);
return (0);
}
i = 0;
}
c = ibuf[i++];
if (c == '\n') {
if (cp > bp && cp[-1] == '\\'){
cp--;
continue;
}
break;
}
if (cp >= bp+KEYCAP_BUFSIZ) {
write(2,"Keycap entry too long\n", 23);
break;
} else
*cp++ = c;
}
*cp = 0;
/*
* The real work for the match.
*/
if (knamatch(name)) {
close(tf);
return(knchktc());
}
}
}
/*---------------------------------------------------------------------------*
* knchktc: check the last entry, see if it's tc=xxx. If so, recursively
* find xxx and append that entry (minus the names) to take the place of
* the tc=xxx entry. Note that this works because of the left to right scan.
*---------------------------------------------------------------------------*/
static int knchktc()
{
register char *p, *q;
char tcname[16]; /* name of similar keyboard */
char tcbuf[KEYCAP_BUFSIZ];
char *holdtbuf = tbuf;
int l;
p = tbuf + strlen(tbuf) - 2; /* before the last colon */
while (*--p != ':')
if (p<tbuf) {
write(2, "Bad keycap entry\n", 18);
return (0);
}
p++;
/* p now points to beginning of last field */
if (p[0] != 't' || p[1] != 'c')
return(1);
strcpy(tcname,p+3);
q = tcname;
while (q && *q != ':')
q++;
*q = 0;
if (++hopcount > MAXHOP) {
write(2, "Infinite tc= loop\n", 18);
return (0);
}
if (kgetent(tcbuf, tcname) != 1)
return(0);
for (q=tcbuf; *q != ':'; q++)
;
l = p - holdtbuf + strlen(q);
if (l > KEYCAP_BUFSIZ) {
write(2, "Keycap entry too long\n", 23);
q[KEYCAP_BUFSIZ - (p-tbuf)] = 0;
}
strcpy(p, q+1);
tbuf = holdtbuf;
return(1);
}
/*---------------------------------------------------------------------------*
* knamatch deals with name matching. The first field of the keycap entry
* is a sequence of names separated by |'s, so we compare against each such
* name. The normal : terminator after the last name (before the first field)
* stops us.
*---------------------------------------------------------------------------*/
static int knamatch(np)
char *np;
{
register char *Np, *Bp;
Bp = tbuf;
if (*Bp == '#' || *Bp == 0)
return(0);
for (;;) {
for (Np = np; *Np && *Bp == *Np; Bp++, Np++)
continue;
if (*Np == 0 && (*Bp == '|' || *Bp == ':' || *Bp == 0))
return (1);
while (*Bp && *Bp != ':' && *Bp != '|')
Bp++;
if (*Bp == 0 || *Bp == ':')
return (0);
Bp++;
}
}
/*---------------------------------------------------------------------------*
* Skip to the next field. Notice that this is very dumb, not knowing about
* \: escapes or any such. If necessary, :'s can be put into the keycap file
* in octal.
*---------------------------------------------------------------------------*/
static char *kskip(bp)
char *bp;
{
while (*bp && *bp != ':')
bp++;
if (*bp == ':')
bp++;
return (bp);
}
/*---------------------------------------------------------------------------*
* Return the (numeric) option id. Numeric options look like 'li#80' i.e.
* the option string is separated from the numeric value by a # character.
* If the option is not found we return -1. Note that we handle octal
* numbers beginning with 0.
*---------------------------------------------------------------------------*/
int kgetnum(id)
char *id;
{
register int i, base;
register char *bp = tbuf,*xp;
for (;;) {
bp = kskip(bp);
if (*bp == 0)
return (-1);
if ((xp=nmatch(id,bp)) == 0)
continue;
bp = xp; /* we have an entry */
if (*bp == '@')
return(-1);
if (*bp != '#')
continue;
bp++;
base = 10;
if (*bp == '0')
base = 8;
i = 0;
while (isdigit(*bp))
i *= base, i += *bp++ - '0';
return (i);
}
}
/*---------------------------------------------------------------------------*
* Handle a flag option. Flag options are given "naked", i.e. followed by
* a : or the end of the buffer. Return 1 if we find the option, or 0 if
* it is not given.
*---------------------------------------------------------------------------*/
int kgetflag(id)
char *id;
{
register char *bp = tbuf,*xp;
for (;;) {
bp = kskip(bp);
if (!*bp)
return (0);
if ((xp=nmatch(id,bp)) != 0) {
bp = xp;
if (!*bp || *bp == ':')
return (1);
else if (*bp == '@')
return(0);
}
}
}
/*---------------------------------------------------------------------------*
* Get a string valued option. These are given as 'cl=^Z'. Much decoding
* is done on the strings, and the strings are placed in area, which is a
* ref parameter which is updated. No checking on area overflow.
*---------------------------------------------------------------------------*/
char *kgetstr(id, area)
char *id;
char **area;
{
register char *bp = tbuf,*xp;
for (;;) {
bp = kskip(bp);
if (!*bp)
return (0);
if ((xp = nmatch(id,bp)) == 0)
continue;
bp = xp;
if (*bp == '@')
return(0);
if (*bp != '=')
continue;
bp++;
return (kdecode(bp, area));
}
}
/*---------------------------------------------------------------------------*
* kdecode does the grung work to decode the string capability escapes.
*---------------------------------------------------------------------------*/
static char *kdecode(str, area)
char *str;
char **area;
{
register char *cp;
register int c;
register char *dp;
int i;
cp = *area;
while ((c = *str++) && c != ':') {
switch (c) {
case '^':
c = *str++ & 037;
break;
case '\\':
dp = "E\033^^\\\\::n\nr\rt\tb\bf\f";
c = *str++;
nextc:
if (*dp++ == c) {
c = *dp++;
break;
}
dp++;
if (*dp)
goto nextc;
if (isdigit(c)) {
c -= '0', i = 2;
do
c <<= 3, c |= *str++ - '0';
while (--i && isdigit(*str));
}
break;
}
*cp++ = c;
}
*cp++ = 0;
str = *area;
*area = cp;
return (str);
}
/*-------------------------------- EOF --------------------------------------*/

View File

@ -0,0 +1,49 @@
/*-
* Copyright (c) 1992, 1993 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Holger Veit
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)keycap.h, 3.00, Last Edit-Date: [Sun Jan 2 13:48:53 1994]
*/
#ifndef _KEYCAP_H_
#define _KEYCAP_H_
int kgetent( char*, char* );
int kgetnum( char* );
int kgetflag( char* );
char *kgetstr( char*, char** );
#endif /* _KEYCAP_H_ */
/*-------------------------------- EOF -------------------------------------*/

View File

@ -0,0 +1,532 @@
# Copyright (c) 1992, 1993, 1994 Hellmuth Michaelis, Joerg Wunsch and
# Holger Veit.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Hellmuth Michaelis,
# Joerg Wunsch and Holger Veit.
# 4. The names of the Authors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)keycap.src, 3.00, Last Edit-Date: [Sun Jan 2 13:50:08 1994]
#
#---------------------------------------------------------------------------
#
# keyboard mappings for vt220 emulator pcvt 3.00
# ----------------------------------------------
#
# DEC MCS and/or ISO-Latin-1 Characterset used
#
# MF II Keyboards fully supported
# AT Keyboards lack a ALTGR Key, so they cannot be handled by
# the current driver implementation .... sorry
#
# If you design a new entry for national keyboards, please
# send it to hm@hcshh.hcs.de, thank you !
#
# Many entries are taken from the 386BSD patchkit 0.2.4 codrv
#
#---------------------------------------------------------------------------
df|default|default entry:\
:de:
tt|test|Test entry which swaps y and z:\
:K22=z:S22=Z:C22=\032:\
:K46=y:S46=Y:C46=\031:
# from codrv, untested
be|belgium|Belgian mapping:\
:K1=\262:S1=\263:\
:K2=&:S2=1:A2=|:\
:K3=\351:S3=2:A3=@:\
:K4=":S4=3:A4=#:\
:K5=':S5=4:\
:K6=(:S6=5:\
:K7=\247:S7=6:A7=\136:\
:K8=\350:S8=7:\
:K9=!:S9=8:\
:K10=\347:S10=9:A10={:\
:K11=\340:S11=0:A11=}:\
:K12=):S12=\260:\
:K13=-:S13=_:\
:K17=a:S17=A:C17=^A:\
:K18=z:S18=Z:C18=^z:\
:K27=\136:S27=\250:A27=[:p1#27:\
:K28=$:S28=*:A28=]:\
:K31=q:S31=Q:C31=^q:\
:K40=m:S40=M:C40=^m:\
:K41=\371:S41=%:A41=':p2#41:\
:K42=\265:S42=\243:A42=\264:p3#42:\
:K45=<:S45=>:A45=\\:\
:K46=w:S46=W:C46=^w:\
:K52=,:S52=\077:\
:K53=;:S53=.:\
:K54=\072:S54=/:\
:K55==:S55=+:A55=~:\
:l1#62:a0:
# from codrv, untested
ca|canadafr|Canadian French mapping:\
:K1=#:S1=|:A1=\\:\
:A2=\261:S3=":A3=@:S4=/:A4=\243:A5=\242:\
:A6=\244:S7=\077:A7=\254:S8=&:A8=\246:S9=*:A9=\262:\
:S10=(:A10=\263:S11=):A11=\274:\
:K12=-:S12=_:A12=\275:\
:K13==:S13=+:A13=\276:\
:A25=\247:A26=\266:\
:K27=\136:S27=\136:A27=[:\
:K28=\270:S28=\250:A28=]:p1#28:\
:A40=~:K41=`:S41=`:A41={:\
:K42=<:S42=>:A42=}:\
:K45=\253:S45=\273:A45=\260:\
:A49=\253:A50=\273:A51=\260:\
:A52=\265:K53=,:S53=,:A53=-:\
:K54=\351:S54=\311:A54=':\
:l1#62:a0:
# from codrv, untested
c1|swissde|Swiss German mapping:\
:K1=\247:S1=\260:p1#1:\
:S2=+:A2=|:S3=":A3=@:S4=*:A4=#:S5=\347:S7=&:A7=\254:\
:S8=/:A8=\246:S9=(:A9=\242:S10=):S11==:\
:K12=`:S12=\077:A12=':p2#12:\
:K13=^:S13=\\:A13=~:p3#13:\
:K22=z:S22=Z:C22=\032:\
:S27=\350:K27=\374:A27=[:\
:K28=\250:S28=!:A28=]:\
:S40=\351:K40=\366:\
:S41=\340:K41=\344:A41={:\
:K42=$:S42=\243:A42=}:\
:K45=<:S45=>:A45=\\:\
:K46=y:S46=Y:C46=\031:
:S53=;:S54=\072:K55=-:S55=_:\
:l1#62:a0:
# from codrv, untested
c2|swissfr|Swiss French mapping:\
:K27=\350:S27=\374:A27=[:\
:K40=\351:S40=\366:\
:K41=\340:S41=\344:A41={:\
:tc=swissde:
# more programmer-like than an original German kbd, you needn't
# have gum-fingers to get `{}' and the like:-)
# maps: ae -> [, oe -> \, ue -> ], Ae -> {, Oe -> |, Ue -> }
# umlaute are available as AltGr- and Control-Mappings
# also maps Pause -> ^Z
#
# (from Joerg Wunsch)
#
# l1/m1 bindings: left Alt is AltGr
# Emacs functions:
# C79/C89: ctrl-{leftarrow,rightarrow} {backward,forward} word
# A79/A89: {backward,forward} sexp
# C83/C84: ctrl-{uparrow,downarrow} {backward,forward} window
#
de-prog|germany-prog|programmer's mapping for german keyboard:\
:K27=]:S27=}:A27=\374:C27=\334:\
:K40=\\:S40=|:A40=\366:C40=\326:\
:K41=[:S41={:A41=\344:C41=\304:\
:K126=\032:C126=\003:\
:tc=de:
# :l1#60:l2#62:\
# :C79=^[B:K79=^[[D:S79=^[OD:A79=^[^B:\
# :C89=^[F:K89=^[[C:S89=^[OC:A89=^[^F:\
# :C83=^U-1^XO:K83=^[[A:S84=^[OA:\
# :C84=^XO:K84=^[[B:S84=^[OB:\
de|germany|German mapping for MF II-Keyboard:\
:K1=\136:S1=\260:\
:S3=\042:S4=\247:S7=&:S8=/:S9=(:S10=):S11=\075:\
:A3=\262:A4=\263:A8={:A9=[:A10=]:A11=}:A12=\134:\
:K12=\337:S12=?:C12=\034:\
:K13=':S13=`:\
:A17=\100:\
:K22=z:S22=Z:C22=\032:\
:K27=\374:S27=\334:\
:K28=+:S28=*:A28=\176:\
:K29=\043:S29=':A29=\174:\
:K40=\366:S40=\326:\
:K41=\344:S41=\304:\
:A45=\174:\
:K46=y:S46=Y:C46=\031:\
:A52=\265:\
:S53=;:S54=\072:\
:K55=-:S55=_:\
:l1#62:
de-at|germany-at|German mapping for AT-Keyboard:\
:K1=<:S1=>:\
:S3=\042:\
:S4=\247:\
:S7=&:\
:S8=/:\
:S9=(:\
:S10=):\
:S11=\075:\
:K12=\337:S12=?:C12=\034:\
:K13=':S13=`:\
:K14=#:S14=\136:\
:K22=z:S22=Z:C22=\032:\
:K27=\374:S27=\334:\
:K28=+:S28=*:\
:K29=\043:S29=':\
:K40=\366:S40=\326:\
:K41=\344:S41=\304:\
:K46=y:S46=Y:C46=\031:\
:S53=;:S54=\072:\
:K55=-:S55=_:\
# from codrv, untested
# Includes improvements by Thomas Hiller (hiller@fzi.de)
# and Andreas Israel (ai@hrz.tu-chemnitz.de)
de-hi|germany-hiller|yet another German mapping:\
:K1=\136:S1=\260:C1=|:\
:S3=\042:S4=#:S7=&:S8=/:S9=(:S10=):S11=\075:\
:A8={:A9=[:A10=]:A11=}:A17=@:A28=~:\
:K12=\337:S12=\077:C12=\036:A12=\\:\
:K13=':S13=`:C13=\134:p1#13:\
:K22=z:S22=Z:C22=\032:\
:K27=\374:S27=\334:C27=\035:\
:K28=+:S28=*:C28=\000:\
:K29=<:S29=>:C29=\134:\
:K40=\366:S40=\326:C40=\034:\
:K41=\344:S41=\304:C41=\033:\
:K46=y:S46=Y:C46=\031:\
:S53=;:S54=\072:\
:K55=-:S55=_:\
:l1#62:a0:
# from codrv, untested
# Contribution by Thomas Hiller (hiller@fzi.de)
# "K42 may not work on 102 keys kbds, K29 seems to work"
d1|de-102|german with mf2:\
:K29=#:\
:K42=#:\
:K45=<:S45=>:A45=|:\
:tc=germany:
# from codrv, untested
hv|holgi|Holgi's special MF1 keyboard mapping:\
:K1=<:S1=>:C1=|:\
:K29=#:S29=\136:A29=\\:C29=~:\
:tc=germany:
# from codrv, untested
# Contributed by Andreas Israel (ai@hrz.tu-chemnitz.de)
de-ai|nixmf2|ct22|nix|nix7|German Nixdorf MF2:\
:A28=~:\
:K29=#:S29=':\
:K45=<:S45=>:A45=|:\
:tc=germany:
# from codrv, untested
dk|denmark|Danish mapping:\
:K1=\275:S1=\247:\
:S3=":A3=@:\
:A4=\243:\
:S5=\244:A5=$:\
:S7=&:S8=/:A8={:S9=(:A9=[:S10=):A10=]:S11==:A11=}:\
:K12=+:S12=\077:\
:K13=':S13=`:A13=|:p1#13:\
:K27=\345:S27=\305:\
:K28=\250:S28=\136:A28=~:p2#28:\
:K40=\346:S40=\306:\
:K41=\370:S41=\330:\
:K42=:S42=*:\
:K45=<:S45=>:A45=\\:\
:S53=;:S54=\072:\
:K55=-:S55=_:\
:l1#62:a0:
# from codrv, untested
# Finnish keyboard map with 7-bit versions of the national
# chars. The Latin1 chars are available with Alt-7, Alt-8, etc
# (where normally you would have the 7-bit ones).
# Makes C/C++ programming more comfortable, since the 7-bit chars
# (|\{[}]) are needed much more often than the Latin1 chars.
# -- Petri.Wessman@hut.fi
fi|finland|finland7b|finland-ascii|Finnish ASCII mapping:\
:l1#60:l2#62:\
:A8=\344:A9=\304:A10=\305:A11=\345:A12=\326:A13=\366:\
:K40=|:S40=\\:K41={:S41=[:K27=}:S27=]:\
:S1=\275:K1=\247:\
:S3=":A3=@:\
:A4=\243:\
:S5=$:A5=$:\
:S7=&:S8=/:S9=(:S10=):S11==:\
:K12=+:S12=\077:\
:K13=':S13=`:\
:K28=~:S28=\136:A28=~:\
:K29=':S29=*:\
:K45=<:S45=>:A45=|:\
:S53=;:S54=\072:\
:K55=-:S55=_:\
:a0:
# from codrv, untested
# Finnish keyboard map with the Latin1 national chars in
# their "right" place. --Petri.Wessman@hut.fi
f8|finland8b|finland-latin1|Finnish Latin1 mapping:\
:A8={:A9=[:A10=]:A11=}:A12=\\:\
:K40=\366:S40=\326:K41=\344:S41=\304:K27=\345:S27=\305:\
:tc=finland:
fr|france|French mapping:\
:de:
# from codrv, untested
f1|france120|French 120 mapping:\
:tc=belgium:
# from codrv, untested
f2|france189|French 189 mapping:\
:S1=:A1=':p3#1:\
:A2=:A3=~:A5={:A6=[:A7=|:A8=`:\
:S9=_:A9=\\:A10=\136:A11=@:A12=]:A13=}:\
:A27=:A28=\244:A41=:A42=:\
:A45=:!:S45=\247:\
:tc=belgium:
# From: Andy Duplain, duplain@rtf.bt.co.uk
gb|greatbritain|British mapping for MF-2 keyboard:\
:S1=|:S3=":C3=2:C12=-:S41=@:K42=#:S42=~:C42=#:K45=\\:S45=|:C45=\\:
# from codrv, untested
# This entry has been corrected by Mike Trim (mtrim@crucible.demon.co.uk)
# (hv's comment: For the keys # and ~ you might also check the following
# line
# :K42=#:S42=~:\
# Also I think I was wrong with the ALTGR key. If you need one, add this:
# :l1#62:
g1|greatbritain166|British 166 mapping:\
:K1=`:S1=\254:A1=|:\
:S3=":S4=\243:\
:K41=':S41=@:\
:K29=#:S29=~:\
:K45=\\:S45=|:
# from codrv, untested
g2|greatbritain168|British 168 mapping:\
:K1=\\:S1=|:\
:S3=":S4=\243:S7=&:S8=:S9=(:S10=):A10=\261:\
:S11=#:A11=\260:S12=:K13=\254:S13=-:\
:K27=@:S27=`:\
:K28=[:S28={:A28=~:\
:K40=;:S40=+:\
:K41=\072:S41=*:A41=\136:\
:K42=]:S42=}:\
:K45=|:S45=_:\
:A52=\265:\
:l1#62:a0:
# from codrv, untested
is:iceland:Island mapping:\
:K1=\260:S1=\250:p1#1:\
:S2=":S7=&:S8=/:A8={:S9=(:A9=[:S10=):A10=]:S11==:A11=}:\
:K12=\\:S12=\326:\
:K13=':S13=`:A13=|:\
:A17=@:K27=\360:S27=\320:\
:K28=':S28=\077:A28=~:\
:K40=\346:S40=\306:\
:K41=':S41=':A41=\136:p2#41:\
:K42=+:S42=*:A42=`:p3#42:\
:K45=<:S45=>:A45=|:\
:S53=;:S54=\072:\
:K54=\376:S54=\336:\
:K104=,:104=,:\
:l1#62:a0:
# from codrv, untested
i1|italy141|Italian 141 mapping:\
:K1=\\:S1=|:\
:S3=":S4=\243:S7=&:S8=/:S9=(:S10=):S11==:\
:K12=':S12=\077:\
:K13=\354:S13=\136:\
:K27=\350:S27=\351:\A27=[:\
:K28=+:S28=*:A28=]:\
:K40=\362:S40=\347:A40=@:\
:K41=\340:S41=\260:A41=#:\
:K42=\371:S42=\247:\
:K45=<:S45=>:\
:S53=;:S54=\072:\
:K55=-:S55=_:\
:l1#62:a0:
# from codrv, untested
i2|italy142|Italian 142 mapping:\
:A8={:A9=[:A10=]:A11=}:\
:A17=@:A27=:A28=~:A40=:A41=:\
:tc=italy141:a0:
# from codrv, untested
nl|netherlands|Dutch mapping:\
:K1=@:S1=\247:A1=\254:\
:A2=\271:S3=":A3=\262:S4=#:A4=\263:A5=\274:A6=\275:S7=&:\
:A7=\276:S8=_:A8=\243:S9=(:A9={:S10=):A10=}:S11=':\
:K12=/:S12=\077:A12=\\:\
:K13=\260:S13=~:A13=\270:p1#13:\
:K20=\266:K27=\250:S27=^:p2#27:\
:K28=*:S28=|:\
:K40=+:S40=\261:\
:K41=':S41=`:\
:K42=<:S42=>:\
:K45=[:S45=]:A45=|:\
:S53=;:S54=\072:K55=-:S55=_:\
:K104=,:S104=,:\
:l1#62:a0:
# from codrv, untested
no|norway|Norwegian mapping:\
:K1=|:\
:K13=\\:S13=`:A13=':p1#13:\
:K41=\346:S41=\306:\
:K40=\370:S40=\330:\
:A45=:\
:tc=denmark:
# from codrv, untested
pt|portugal|Portugesian mapping:\
:K1=\\:S1=|:\
:S3=":A3=@:A4=\243:A5=\247:S7=&:S8=/:A8={:S9=(:A9=[:\
:S10=):A10=]:S11=}:A11==:\
:K12=':S12=\077:\
:K13=\253:S13=\273:\
:K40=\347:S40=\307:\
:K41=\272:S41=\252:\
:K42=~:S42=^:p1#42:\
:K45=<:S45=>:\
:S53=;:S54=\072:K55=-:S55=_:\
:l1#62:a0:
# from codrv, untested
es|spain|Spainish mapping:\
:K1=\272:S1=\252:A1=\\:\
:A2=|:S3=":A3=@:S4=:A4=#:S7=&:A7=\254:S8=/:S9=(:S10=):S11==:\
:K12=':S12=\077:p1#12:\
:K13=\277:S13=\241:\
:K27=`:S27=^:A27=[:p2#27:\
:K28=+:S28=*:A28=]:\
:K40=\361:S41=\321:\
:K41=/:S41=\250:A41={:p3#41:\
:K42=\347:S42=\307:A42=}:\
:K45=<:S45=>:\
:S53=;:S54=\072:\
:K55=-:S55=_:\
:K104=,:S104=,:\
:l1#62:a0:
# from codrv, untested
# Contributed by Mats O Jansson, moj@stacken.kth.se
# "Here is my map, rather large, but i want ALTGR normaly to be dead.
# Only seven bit national characters have been placed where national characters
# is on the keyboard."
# We can help this man, just use the 'a0' capability -hv-
s1|sweden1|Swedish mapping:\
:l1#62:a0:\
:D1:\
:K12=+:K13=':K29=':\
:S2=!:S3=":S4=#:S5=$:S6=%:S7=&:S8=/:\
:S9=(:S10=):S11=\075:S12=\077:S13=`:S29=*:\
:C2=:C3=\000:C4=\033:C5=\034:C6=\035:C7=:C8=:C9=:\
:C10=:C11=:C12=:C13=:C29=:\
:A3=\100:A5=$:A8={:\
:A9=[:A10=]:A11=}:A12=\134:\
:K27=]:K28=:\
:S27=}:S28=\136:\
:C27=\035:C28=:\
:A28=\176:\
:K40=\134:K41=[:\
:S40=|:S41={:\
:C40=\034:C41=\033:\
:K45=<:K53=,:K54=.:K55=-:\
:S45=>:S53=;:S54=\072:S55=_:\
:C45=\034:C53=:C54=:C55=:\
:A45=|:\
:C61=\000:
# from codrv, untested
# Contributed by Mats O Jansson, moj@stacken.kth.se
# "Here is my map, rather large, but i want ALTGR normaly to be dead.
# Only seven bit national characters have been placed where national
# characters is on the keyboard."
# We can help this man, just use the 'a0' capability -hv-
# Corrected by Paul Pries, 5322@msg.abc.se (Some national shifts were
# wrong).
sa|sweden1a|Swedish 7bit mapping ISO 646:\
:l1#62:a0:\
:D1:\
:K12=+:K13=':K29=':\
:S2=!:S3=":S4=#:S5=$:S6=%:S7=&:S8=/:\
:S9=(:S10=):S11=\075:S12=\077:S13=`:S29=*:\
:C2=:C3=\000:C4=\033:C5=\034:C6=\035:C7=:C8=:C9=:\
:C10=:C11=:C12=:C13=:C29=:\
:A3=\100:A5=$:A8={:\
:A9=[:A10=]:A11=}:A12=\134:\
:K27=}:K28=:\
:S27=]:S28=\136:\
:C27=\035:C28=:\
:A28=\176:\
:S40=\134:S41=[:\
:K40=|:K41={:\
:C40=\034:C41=\033:\
:K45=<:K53=,:K54=.:K55=-:\
:S45=>:S53=;:S54=\072:S55=_:\
:C45=\034:C53=:C54=:C55=:\
:A45=|:\
:C61=\000:
# from codrv, untested
# Swedish keyboard map with national characters.
# Paul Pries, 5322@msg.abc.se
s2|sweden2|Swedish 8bit mapping ISO 8859-1:\
:l1#62:\
:K1=\247:S1=:\
:K12=+:K13=':K29=':\
:S2=!:S3=":S4=#:S5=$:S6=%:S7=&:S8=/:\
:S9=(:S10=):S11=\075:S12=\077:S13=`:S29=*:\
:C2=:C3=\000:C4=\033:C5=\034:C6=\035:C7=:C8=:C9=:\
:C10=:C11=:C12=:C13=:C29=:\
:A3=\100:A4=\234:A5=$:A8={:\
:A9=[:A10=]:A11=}:A12=\134:\
:K27=\206:K28=:\
:S27=\217:S28=\136:\
:C27=\035:C28=:\
:A28=\176:\
:S40=\231:S41=\216:\
:K40=\224:K41=\204:\
:C40=\034:C41=\033:\
:K45=<:K53=,:K54=.:K55=-:\
:S45=>:S53=;:S54=\072:S55=_:\
:C45=\034:C53=:C54=:C55=:\
:A45=|:\
:C61=\000:
us|usa|United States mapping:\
:de:
# EOF

View File

@ -0,0 +1,133 @@
.\"
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)keycap.5, 3.00, Last Edit-Date: [Sun Jan 2 13:45:59 1994]
.\"
.Dd January 3, 1993
.Dt KEYCAP 5
.Sh NAME
.Nm keycap
.Nd keyboard mapping data base
.Sh SYNOPSIS
.Nm keycap
.Sh DESCRIPTION
The
.Nm keycap
file
is a data base describing keyboard mappings, used by
.Xr kcon 1 .
.Pp
Entries in
.Nm keycap
consist of a number of `:'-separated fields.
The first entry for each mapping gives the names that are known for the
mapping, separated by `|' characters.
All names but the first and last
should be in lower case and contain no blanks;
the last name may well contain
upper case and blanks for readability.
.Sh CAPABILITIES
.Pp
.Bl -column indent indent
.Sy Name Type Description
.It "de bool Resets Keyboard mapping to compiled-in default"
.It "D<n> bool Disables key <n> completely"
.It "m<n> num specify key numbers for ALT keys
.It "l<n> num specify key numbers for ALTGR keys
.It "h<n> num specify key numbers for SHIFT keys
.It "t<n> num specify key numbers for CONTROL keys
.It "ca<n> num specify key number for the CAPS LOCK key
.It "sh<n> num specify key number for the SHIFT LOCK key
.It "nl<n> num specify key number for the NUM LOCK key
.It "sc<n> num specify key number for the SCROLL LOCK key
.It "K<n> str bind a string to a unshifted (normal) key
.It "S<n> str bind a string to a shifted key
.It "C<n> str bind a string to a control key
.It "A<n> str bind a string to a altgr key
.It "tc str Entry of similar map \- must be last."
.El
Parameter <n> describing the key number can have values from 1 to 128.
A string parameter may have up to 15 characters.
.Pp
.Ss A Sample Entry
The following entry, which describes a test entry, is among the very
easy entries in the
.Nm keycap
file as of this writing.
.Pp
.Bd -literal
tt\||test\||Test entry which swaps y and z:\e
:K22=z:S22=Z:C22=\e032:\e
:K46=y:S46=Y:C46=\e031:
.Ed
.Pp
Entries may continue onto multiple lines by giving a \e as the last
character of a line. Comments may be included on lines beginning with
.Dq # .
.Sh FILES
.Bl -tag -width /usr/share/misc/keycap -compact
.It Pa /usr/share/misc/keycap
File containing keyboard mapping descriptions.
.El
.Sh SEE ALSO
.Xr kcon 1 ,
.Xr keycap 3 ,
.Sh EXAMPLES
The entry
.Dq Li l1#60
sets the keynumber for the ALTGR key to 60.
The entry
.Dq Li K100=hugo
binds the string 'hugo' to the key number 100.
The entry
.Dq Li K100=^D
binds the control character EOT (0x04) to the key number 100.
The entry
.Dq Li K100=\e000
binds the control character NUL (0x00) to the key number 100.

View File

@ -0,0 +1,19 @@
.if !exists(${.CURDIR}/../Makefile.inc)
error:
@echo
@echo " You MUST link/copy"
@echo
@echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD"
@echo
@echo " to ../Makefile.inc before you can proceed !"
@echo
.else
PROG = loadfont
.include <bsd.prog.mk>
$(PROG): $(INCDIR)/pcvt_ioctl.h
.endif

View File

@ -0,0 +1,87 @@
.\" Copyright (c) 1992,1993,1994 Hellmuth Michaelis
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Hellmuth Michaelis
.\" 4. The name authors may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)loadfont.1, 3.00, Last Edit-Date: [Mon Jan 10 21:25:01 1994]
.\"
.Dd January 3, 1993
.Dt LOADFONT 1
.Sh NAME
.Nm loadfont
.Nd is used to load fonts into EGA or VGA boards for use by the 'pcvt' video
driver.
.Sh SYNOPSIS
.Nm loadfont
.Op Fl c Ar charsetno
.Op Fl f Ar fontfilename
.Op Fl i
.Sh DESCRIPTION
The
.Nm loadfont
utility is used to load fonts needed for proper operation of the pcvt
VT220 driver on EGA and VGA boards into the font ram of this boards.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl c
Specifies the slot, the font is to load into. EGA boards have four
slots and VGA boards have eight slots available for downloading fonts.
.It Fl f
Specifies the file which contains the font to be downloaded.
.It Fl i
Gives information what type(s) of font do currently reside in which slot.
This is also the default behaviour if no options are specified on the commandline.
.El
.Pp
This utility is used only on EGA and VGA boards, as MDA, HCG and CGA boards
do not have downloadable charactersets available.
.Sh FILES
Unless otherwise specified in the Makefile, the following fontfiles are
available for the pcvt 2.0 distribution:
.nf
/usr/share/misc/vgafonts/vt220l.808: 8x8 IBM II font
/usr/share/misc/vgafonts/vt220h.808: 8x8 Extension font
/usr/share/misc/vgafonts/vt220l.810: 8x10 IBM II font
/usr/share/misc/vgafonts/vt220h.810: 8x10 Extension font
/usr/share/misc/vgafonts/vt220l.814: 8x14 IBM II font
/usr/share/misc/vgafonts/vt220h.814: 8x14 Extension font
/usr/share/misc/vgafonts/vt220l.816: 8x16 IBM II font
/usr/share/misc/vgafonts/vt220h.816: 8x16 Extension font
.fi
.Sh EXAMPLES
The command
.Dq Li loadfont -c0 -f/usr/share/misc/vgafonts/vt220l.816
loads a 8x16 font containing the standard IBM characterset II into font slot
0 on a VGA or EGA board.
.Sh BUGS
No known bugs
.Sh SEE ALSO
.Xr cursor 1 ,
.Xr scon 1 ,
.Xr pcvt 8

View File

@ -0,0 +1,317 @@
/*
* Copyright (c) 1992,1993,1994 Hellmuth Michaelis and Brian Dunford-Shore
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by
* Hellmuth Michaelis and Brian Dunford-Shore
* 4. The name authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
static char *id =
"@(#)loadfont.c, 3.00, Last Edit-Date: [Mon Jan 10 21:26:09 1994]";
/*---------------------------------------------------------------------------*
*
* load a font into vga character font memory
*
* -hm removing explicit HGC support (same as MDA ..)
* -hm new pcvt_ioctl.h SIZ_xxROWS
*
*---------------------------------------------------------------------------*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <machine/pcvt_ioctl.h>
#define FONT8X8 2048 /* filesize for 8x8 font */
#define HEIGHT8X8 8 /* 8 scan lines char cell height */
#define SSCAN8X8 143 /* 400 scan lines on screen - 256 - 1 */
#define SROWS8X8 50 /* 50 character lines on screen */
#define FONT8X10 2560 /* filesize for 8x10 font */
#define HEIGHT8X10 10 /* 10 scan lines char cell height */
#define SSCAN8X10 143 /* 400 scan lines on screen - 256 - 1 */
#define SROWS8X10 40 /* 50 character lines on screen */
#define FONT8X14 3584 /* filesize for 8x14 font */
#define HEIGHT8X14 14 /* 14 scan lines char cell height */
#define SSCAN8X14 135 /* 392 scan lines on screen - 256 - 1 */
#define SROWS8X14 28 /* 28 character lines on screen */
#define FONT8X16 4096 /* filesize for 8x16 font */
#define HEIGHT8X16 16 /* 16 scan lines char cell height */
#define SSCAN8X16 143 /* 400 scan lines on screen - 256 - 1 */
#define SROWS8X16 25 /* 25 character lines on screen */
struct screeninfo screeninfo;
main(argc,argv)
int argc;
char *argv[];
{
extern int optind;
extern int opterr;
extern char *optarg;
FILE *in;
struct stat sbuf, *sbp;
unsigned char *fonttab;
int ret;
int chr_height;
int scr_scan;
int scr_rows;
int c;
int chr_set = -1;
char *filename;
int fflag = -1;
int info = -1;
while( (c = getopt(argc, argv, "c:f:i")) != EOF)
{
switch(c)
{
case 'c':
chr_set = atoi(optarg);
break;
case 'f':
filename = optarg;
fflag = 1;
break;
case 'i':
info = 1;
break;
case '?':
default:
usage();
break;
}
}
if(chr_set == -1 || fflag == -1)
info = 1;
if(info == 1)
{
int i;
if(ioctl(0, VGAGETSCREEN, &screeninfo) == -1)
{
perror("ioctl VGAGETSCREEN failed");
exit(1);
}
switch(screeninfo.adaptor_type)
{
case UNKNOWN_ADAPTOR:
case MDA_ADAPTOR:
case CGA_ADAPTOR:
printf("Adaptor does not support Downloadable Fonts!\n");
break;
case EGA_ADAPTOR:
printheader();
for(i = 0;i < 4;i++)
{
printvgafontattr(i);
}
break;
case VGA_ADAPTOR:
printheader();
for(i = 0;i < 8;i++)
{
printvgafontattr(i);
}
}
printf("\n");
exit(0);
}
if(chr_set < 0 || chr_set > 7)
usage();
sbp = &sbuf;
if((in = fopen(filename, "r")) == NULL)
{
char buffer[80];
sprintf(buffer, "cannot open file %s for reading", filename);
perror(buffer);
exit(1);
}
if((fstat(fileno(in), sbp)) != 0)
{
char buffer[80];
sprintf(buffer, "cannot fstat file %s", filename);
perror(buffer);
exit(1);
}
switch(sbp->st_size)
{
case FONT8X8:
chr_height = HEIGHT8X8;
scr_scan = SSCAN8X8;
scr_rows = SIZ_50ROWS;
break;
case FONT8X10:
chr_height = HEIGHT8X10;
scr_scan = SSCAN8X10;
scr_rows = SIZ_40ROWS;
break;
case FONT8X14:
chr_height = HEIGHT8X14;
scr_scan = SSCAN8X14;
scr_rows = SIZ_28ROWS;
break;
case FONT8X16:
chr_height = HEIGHT8X16;
scr_scan = SSCAN8X16;
scr_rows = SIZ_25ROWS;
break;
default:
fprintf(stderr,"error, file %s is no valid font file, size=%d\n",argv[1],sbp->st_size);
exit(1);
}
if((fonttab = (unsigned char *)malloc((size_t)sbp->st_size)) == NULL)
{
fprintf(stderr,"error, malloc failed\n");
exit(1);
}
if((ret = fread(fonttab, sizeof(*fonttab), sbp->st_size, in)) != sbp->st_size)
{
fprintf(stderr,"error reading file %s, size = %d, read = is no valid font file, size=%d\n",argv[1],sbp->st_size, ret);
exit(1);
}
loadfont(chr_set, chr_height, fonttab);
setfont(chr_set, 1, chr_height - 1, scr_scan, scr_rows);
exit(0);
}
setfont(charset, fontloaded, charscan, scrscan, scrrow)
int charset, fontloaded, charscan, scrscan, scrrow;
{
struct vgafontattr vfattr;
vfattr.character_set = charset;
vfattr.font_loaded = fontloaded;
vfattr.character_scanlines = charscan;
vfattr.screen_scanlines = scrscan;
vfattr.screen_size = scrrow;
if(ioctl(1, VGASETFONTATTR, &vfattr) == -1)
{
perror("loadfont - ioctl VGASETFONTATTR failed, error");
exit(1);
}
}
loadfont(fontset,charscanlines,font_table)
int fontset;
int charscanlines;
unsigned char *font_table;
{
int i, j;
struct vgaloadchar vlc;
vlc.character_set = fontset;
vlc.character_scanlines = charscanlines;
for(i = 0; i < 256; i++)
{
vlc.character = i;
for (j = 0; j < charscanlines; j++)
{
vlc.char_table[j] = font_table[j];
}
font_table += charscanlines;
if(ioctl(1, VGALOADCHAR, &vlc) == -1)
{
perror("loadfont - ioctl VGALOADCHAR failed, error");
exit(1);
}
}
}
printvgafontattr(charset)
int charset;
{
struct vgafontattr vfattr;
static int sizetab[] = { 25, 28, 35, 40, 43, 50 };
vfattr.character_set = charset;
if(ioctl(1, VGAGETFONTATTR, &vfattr) == -1)
{
perror("loadfont - ioctl VGAGETFONTATTR failed, error");
exit(1);
}
printf(" %d ",charset);
if(vfattr.font_loaded)
{
printf("Loaded ");
printf(" %2.2d ", sizetab[vfattr.screen_size]);
printf(" %2.2d ",
(((int)vfattr.character_scanlines) & 0x1f) + 1);
printf(" %3.3d",
((int)vfattr.screen_scanlines+0x101));
}
else
{
printf("Empty");
}
printf("\n");
}
printheader()
{
printf("\nEGA/VGA Charactersets Status Info:\n\n");
printf("Set Status Lines CharScanLines ScreenScanLines\n");
printf("--- ------ ----- ------------- ---------------\n");
}
usage()
{
fprintf(stderr,"\nloadfont - load font into ega/vga font ram for pcvt video driver\n");
fprintf(stderr,"usage: loadfont -c<cset> -f<filename> -i\n");
fprintf(stderr," -c <cset> characterset to load (ega 0..3, vga 0..7)\n");
fprintf(stderr," -f <name> filename containing binary font data\n");
fprintf(stderr," -i print status and types of loaded fonts (default)\n");
exit(1);
}

View File

@ -0,0 +1,19 @@
.if !exists(${.CURDIR}/../Makefile.inc)
error:
@echo
@echo " You MUST link/copy"
@echo
@echo " ../Makefile.inc.NetBSD or ../Makefile.inc.FreeBSD"
@echo
@echo " to ../Makefile.inc before you can proceed !"
@echo
.else
PROG= mcon
.include <bsd.prog.mk>
$(PROG): $(INCDIR)/pcvt_ioctl.h
.endif