mapchan [-o] [-d] [channel]
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). Note that PC keyboard configuration is accomplished through the mapkey(1M) utility. Every I/O device has a channel associated with it through which information coming from and going to the device has to pass. Mapping, when applied to an input channel, modifies whatever is coming from the device before it is given to the system, and modifies whatever is coming from the system before it is given to the device.
A method of sharing maps is implemented for channels that require the same map. Each additional, unique map allocates an additional buffer. The maximum number of map buffers available on a system is configured in the kernel, and is adjustable via the NEMAP parameter. Map buffers that are no longer in use are returned for use by other maps.
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 will be in version 2.0 format, irrespective of the mapfile used, and is suitable as input for mapchan.
The options are :
The user must own the channel in order to map it. The privileged 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.
It is recommended that no mapping be enabled on the channel that is used to create or modify the mapping files. This prevents mapping causing any confusion of the actual values being entered. It is also recommended that numeric rather than character representations be used in most cases, as these are not likely to be subject to mapping. Use comments to identify the characters represented. Refer to the ascii(5) manual page and to the device's hardware documentation for the values to assign.
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 .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:
vt00 vt01 vt02 vt03
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. There are 2 formats for mapfiles; version 1.0 supports 8-bit encoding, and version 2.0 supports multibyte encoding such as UTF-8. See mapchan(4) for further information.
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.
Certain keys are designated as dead keys in the mapfile version 1.0. See mapchan(4) for details. One key is designated as the compose key in the version 1.0 mapfile. See mapchan(4) for details. Every character is first put through the input map and if it is part of a compose or dead sequence then the internal values are looked up in the dead and compose tables.
A non-recognized (that is, not defined in the mapfile) sequence of two or more bytes will cause an error during input.
If the mapfile contains the keyword beep, a bell sounds when an error occurs. In this case, the characters are not echoed to the screen, or passed to the kernel.
Several sample mapfiles are provided as examples in /usr/lib/mapchan. For example:
Care should be taken that the stty settings are correct for 8-bit terminals. See stty(1). The /etc/ttydefs file may require modifications to allow logging with the correct settings. See ttydefs(4).
mapchan automatically invokes mapchan.conv.awk to convert version 1.0 mapfiles into version 2.0 mapfiles. This script is not for direct user use.
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.
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, iconv(1) with an appropriate mapfile can be used to translate from one internal character set to another.
Do not set ISTRIP when using mapchan. This option causes the eighth bit to be stripped before mapping occurs. See stty(1).