mapchan(1M) UNIX System V mapchan(1M)
NAME
mapchan - Configure tty device mapping.
SYNOPSIS
mapchan [-ans] [-f mapfile] [channels . . .]
mapchan [-o] [-d] [channel]
DESCRIPTION
mapchan configures the mapping of information input and output of the
UNIX system. 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(1)
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. Superuser
maps or unmaps all channels, other users map only channels they
own. The -a option can not be used with the -d, -o, or -s options.
-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. The -d option can not be used with -a, -f, -n, -o or -s
options.
-f Causes the current channel or list of channels to be mapped with
mapfile. The -f option can not be used with -d, -n, -s, or -o
options.
-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 for all channels given in the default file. This is the
default mapping for all channels unless otherwise configured. The
-n option can not be used with -d, -f, -o, or -s options.
10/89 Page 1
mapchan(1M) UNIX System V mapchan(1M)
-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. The -o option can not be used with -a, -d, -f, -n, or -s
options.
-s Sets the user's current channel with the mapfile given in the
default file. The -s option 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 the
UNIX system boots, mapping is off for all channels.
mapchan is usually invoked in the /etc/rc2 file. This file is executed
when the system enters the multiuser 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 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 obtain:
tty1
tty2 ibm
tty3 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(4) 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.
Page 2 10/89
mapchan(1M) UNIX System V mapchan(1M)
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 displayed as e'.
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
displayed as c.
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 mind
when preparing map files.
The following conditions will cause an error during input:
1) non-recognized (not defined in the mapfile) dead or compose
sequence.
2) 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 characters 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
dpANS X3.4.2 and ISO/TC97/SC2. It supports most of the Latin alphabet
and can represent most European languages.
10/89 Page 3
mapchan(1M) UNIX System V mapchan(1M)
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 settings [see stty(1M)] are correct
for 8-bit terminals. The /etc/gettydefs file may require modifications
to allow logging 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/*
NOTES
Some non-U.S keyboards and display devices do not support characters
commonly used by 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 lpadmin(1M) and lp(7) 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.
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(5)]. System
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(1)] when using mapchan. This option causes
the eighth bit to be stripped before mapping occurs.
Page 4 10/89
mapchan(1M) UNIX System V mapchan(1M)
SEE ALSO
ascii(5), keyboard(7), lp(7), lpadmin(1M), mapchan(4), mapkey(1M).
stty(1M) in the User's Reference Manual.
10/89 Page 5