mapchan(1M)


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). 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 :


-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. A privileged user can map or unmap all channels, other users can 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.

-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 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.

Mapped characters in mapfile version 1.0

If you are using the mapfile version 1.0, you must use mapped characters. See mapchan(4) for more details.

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.

Mapped characters in mapfile version 2.0

With version 2.0 mapfiles, that support ISO 10646/1, each character in the input sequence is looked up directly in the input map. If a character value is not given it is assumed to map directly. A sequence (2 or more bytes) is not echoed until it is correctly completed. If no match is found then the sequence is considered invalid and produces an error.

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.

Character sets

The internal character set used is defined by the mapfiles used. mapchan supports 8-bit character sets such as ISO 8859/1, ISO 8859/2, ISO 8859/7 and ISO 8859/9. mapchan also supports multi-byte character sets such as ISO 10646/1. To utilize multi-byte character sets, use mapfile version 2.0. UnixWare interprets certain bytes as having special meaning, such as ``/'', ``.'', ``$''. No other bytes are interpreted by the operating system.

Several sample mapfiles are provided as examples in /usr/lib/mapchan. For example:


/usr/lib/mapchan/hp.roman8
For devices that use the HP ROMAN.8 character set, such as HP printers

/usr/lib/mapchan/dec
For 8-bit terminals using DEC multinational character set DEC VT220
These files should be modified for use with specific peripheral devices. Consult your hardware manual for the codes needed to display the desired characters. See mapchan(4) for examples of the two mapfile formats.

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).

Files

/etc/default/mapchan
/usr/lib/mapchan/*
/bin/mapchan.conv.awk

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.

Notices

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.

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).

References

ascii(5), iconv(1), keyboard(7), lp(7), lpadmin(1M), mapchan(4), mapkey(1M), stty(1)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004