MAPCHAN(M) UNIX System V
Name
mapchan - configure tty device mapping
Syntax
mapchan [-ans] [ -f mapfile ] [ channels ... ]
mapchan [ [ -o ] [ -d ] ] [ channel ]
Description
mapchan configures the mapping of information input and
output. The mapchan utility is intended for users of
applications that employ languages other than English
(character sets other than 7-bit ASCII).
mapchan translates codes sent by peripheral devices, such as
terminals, to the internal character set used by the UNIX
system. mapchan can also map codes in the internal character
set to other codes, for output to peripheral devices (such
as terminals, printers, console screen, etc.). Note that PC
keyboard configuration is accomplished through the mapkey(M)
utility.
mapchan has several uses: to map a channel (-a or -s); to
unmap a channel (-n and optionally -a); or to display the
map on a channel (optionally -o, -d, channels).
mapchan with no options displays the map on the user's
channel. The map displayed is suitable as input for
mapchan.
The options are:
-a when used alone, sets all channels given in the default
file (/etc/default/mapchan) with the specified map.
When used with -n, it refers to all channels given in
the default file. Super-user maps or unmaps all
channels, other users map only channels they own. -a
can not be used with -d, -o, or -s.
-d causes the mapping table currently in use on the given
device, channel, to be displayed in decimal instead of
the default hexadecimal. An ASCII version is displayed
on standard output. This output is suitable as an input
file to mapchan for another channel. Mapped values are
displayed. Identical pairs are not output. -d can not
be used with -a, -f, -n, -o, or -s.
-f causes the current channel or list of channels to be
mapped with mapfile. -f can not be used with -d, -n,
-s, or -o.
-n causes null mapping to be performed. All codes are
input and output as received. Mapping is turned off
for the user's channel or for other channels, if given.
-a used with -n will turn mapping off on all channels
given in the default file. This is the default mapping
for all channels unless otherwise configured. -n can
not be used with -d, -f, -o, or -s.
-o causes the mapping table currently in use on the given
device, channel, to be displayed in octal instead of
the default hexadecimal. An ASCII version is displayed
on standard output. This output is suitable as an input
file to mapchan for another port. Mapped values are
displayed. Identical pairs are not output. -o can not
be used with -a, -d, -f, -n, or -s.
-s sets the user's current channel with the mapfile given
in the default file. -s can not be used with any other
option.
The user must own the channel in order to map it. The
super-user can map any channel. Read or write permission is
required to display the map on a channel.
Each tty device channel (display adapter and video monitor
on computer, parallel port, serial port, etc.) can have a
different map. When UNIX boots, mapping is off for all
channels.
mapchan is usually invoked in the /etc/rc2 scripts. These
scripts are executed when the system enters multi-user mode
and sets up the default mapping for the system. Users can
invoke mapchan when they log in by including a mapchan
command line in their .profile or .login file. In addition,
users can remap their channel at any time by invoking
mapchan from the command line. channels not listed in the
default file are not automatically mapped. channels are not
changed on logout. Whatever mapping was in place for the
last user remains in effect for the next user, unless they
modify their .profile or .login file.
For example, the default file /etc/default/mapchan can
contain:
tty02 ibm
tty1a
tty2a wy60.ger
lp ibm
The default directory containing mapfiles is
/usr/lib/mapchan. The default directory containing channel
files is /dev. Full pathnames may be used for channels or
mapfiles. If a channel has no entry, or the entry field is
blank, no mapping is enabled on that channel. Additional
channels added to the system, (for example, adding a serial
or parallel port) are not automatically entered in the
mapchan default file. If mapping is required, the system
administrator must make the entries.
The format of the mapfiles is documented in the mapchan(F)
manual page.
Using a Mapped channel
The input information is assumed to be 7- or 8-bit codes
sent by the peripheral device. The device may make use of
``dead'' or ``compose'' keys to produce the codes. If the
device does not have dead or compose keys, these keys can be
simulated using mapchan.
One to one mapped characters are displayed when the key is
pressed, and the mapped value is passed to the kernel.
Certain keys are designated as dead keys in the mapfile.
Dead key sequences are two keystrokes that produce a single
mapped value that is passed to the kernel. The dead key is
usually a diacritical character, the second key is usually
the letter being modified. For example, the sequence ' e
could be mapped to the ASCII value 0xE9, and display as '.
One key is designated as the compose key in the mapfile.
Compose key sequences are composed of three keystrokes that
produce a single mapped value that is passed to the kernel.
The compose key is usually a seldom used character or ctrl-
letter combination. The second key is usually the letter
being modified. The third key may be another character
being combined, or a diacritical character. For example, if
`@' is the compose key, the sequence @ c O could be mapped
to the ASCII value 0xA9, and display as O.
Characters are not echoed to the screen during a dead or
compose sequence. The mapped character is echoed and passed
to the kernel once the sequence is correctly completed.
Characters are always put through the input map, even when
part of dead or compose sequences. The character is then
checked for the internal value. The value may also be mapped
on output. This should be kept in mind when preparing map
files.
The following conditions will cause an error during input:
⊕ non-recognized (not defined in the mapfile) dead or
compose sequence
⊕ restarting a compose sequence before completion by
pressing the compose key in the middle of a dead or
compose sequence. This is an error, but a new compose
sequence is initiated.
If the mapfile contains the keyword beep, a bell sounds when
either of the above conditions occurs. In either case, the
characters are not echoed to the screen, or passed to the
kernel.
In order to allow for character sequences sent to control
the terminal (move the cursor, and so on) rather than to
print characters on the screen, mapchan allows character
sequences to be specified as special sequences which are not
passed through the normal mapping procedure. Two sections
may be specified, one for each of the input (keyboard) and
output (screen) controls.
Character Sets
The internal character set used is defined by the mapfiles
used. By default, this is the ISO 8859/1 character set
which is also known as the dpANS X3.4.2 and ISO/TC97/SC2.
It supports most of the Latin alphabet and can represent
most European languages.
Several partial map files are provided as examples. They
must be modified for use with specific peripheral devices.
Consult your hardware manual for the codes needed to display
the desired characters. Two map files are provided for use
with the console device: /usr/lib/mapchan/ibm for systems
with a standard PC character set ROM, and
/usr/lib/mapchan/iso for systems with an optional ISO 8859/1
character set ROM.
Care should be taken that the stty(C) settings are correct
for 8-bit terminals. The /etc/gettydefs file may require
modification to allow logging in with the correct settings.
7-bit U.S. ASCII (ANSI X3.4) should be used if no mapping is
enabled on the channel.
Files
/etc/default/mapchan
/usr/lib/mapchan/*
See Also
ascii(M), keyboard(HW), lp(C), lpadmin(ADM), mapchan(F),
mapkey(M), parallel(HW), screen(HW), serial(HW), setkey(M),
trchan(M), tty(M)
Notes
Some non-U.S. keyboards and display devices do not support
characters commonly used by UNIX command shells and the C
programming language. It is not recommended that these
devices be used for system administration tasks.
Printers can be mapped, output only, and can either be sent
8-bit codes or one-to-many character strings using mapchan.
Line printer spooler interface scripts can be used (setuid
root) to change the output map on the printer when different
maps are required (as in changing print wheels to display a
different character set). See lp(C) and lpadmin(ADM) for
information on installing and administering interface
scripts.
Not all terminals or printers can display all the characters
that can be represented using this utility. Refer to the
device's hardware manual for information on the capabilities
of the peripheral device.
Warnings
Use of mapfiles that specify a different ``internal''
character set per-channel, or a set other than the 8-bit ISO
8859 set supplied by default can cause strange side effects.
It is especially important to retain the 7-bit ASCII portion
of the character set (see ascii(M)). UNIX utilities and
many applications assume these values.
Media transported between machines with different internal
code set mappings may not be portable as no mapping is
performed on block devices, such as tape and floppy drives.
However, trchan with an appropriate mapfile can be used to
``translate'' from one internal character set to another.
Do not set ISTRIP (see stty(C)) when using mapchan. This
option causes the eighth bit to be stripped before mapping
occurs.
Value Added
mapchan is an extension of AT&T System V provided by the
Santa Cruz Operation.
(printed 2/15/90) MAPCHAN(M)