DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

mapchan(M)


mapchan -- configure tty device mapping

Syntax

mapchan [ -ans ] [ -f mapchan_file ] [ channels ... ]

mapchan [ [ -o ] [ -d ] ] [ channel ]

Description

The mapchan utility configures the mapping of information input and output. mapchan 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 SCO OpenServer(TM) 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. root can map or unmap all channels, other users can map only channels that they own. -a cannot 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 cannot be used with -a, -f, -n, -o, or -s.

-f
causes the current channel or list of channels to be mapped with mapchan_file. -f cannot 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 cannot 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 cannot be used with -a, -d, -f, -n, or -s.

-s
sets the user's current channel with the mapchan_file 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. root 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 operating system boots, mapping is turned 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 directory hierarchy /usr/lib/mapchan/ISO8859-1 contains mapchan files that are specific to the ISO 8859-1 character set. For backward compatibility, mapchan files are also provided in the directory /usr/lib/mapchan.

The default directory containing channel files is /dev. Full pathnames may be used for channels or mapchan_files. 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 mapchan_files 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 mapchan file. 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 mapchan file. Compose key sequences are made up 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 ©.

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

The following conditions will cause an error during input:

If the mapchan file 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.

Creating mapchan files

It may be necessary to modify the mapchan files provided to cater for new items of hardware or software which require character sets other than ISO 8859-1. Typical examples of the way mapchan files are written are given below and on the mapchan(F) manual page.

Input section

A typical example of how the input section is used is on the console. In this case, the input section of the mapping takes the input from mapkey. The mapkey output generates the 8-bit PC code set (IBM 437) characters. If you want to use the IBM character set, no mapping is required with the exception of one character. If you have the ISO 8859-1 set as the internal character set, then you need to map the 8-bit characters.

The exception, when using IBM characters, is the entry for the section symbol, §. The keyboard map does not generate the 8-bit PC code (IBM 437) for this character. This is because it has the same code as <Ctrl>u which System V would treat as a command to clear the line. It is mapped into the code 0xb2. The new mapchan file needs to translate this back to the 8-bit PC code.

The input section will be:

   input
   0xb2 21   # restore the section symbol
A # character denotes a comment.

Output section

The console display understands 8-bit IBM PC (IBM 437) characters. The paragraph, section and cent symbols use codes which have a special meaning to the UNIX console driver. To make them print, they must be translated to graphic escape sequences.

The output section will be:

   output
   20      0x1b '[' '2' '0' 'g'        # paragraph sign
   21      0x1b '[' '2' '1' 'g'        # section sign
   155     0x1b '[' '1' '5' '5' 'g'    # cent sign
If you were simply mapping from an ISO 8859-1 character set to the IBM set, typical characters might be:
   output
   0xc0    'A'     # use A since no A grave available
   0xc4    0x8e    # A umlaut
The mapchan files have been written so that the closest displayable character is used where a character is not available.

Dead key section

The dead key section maps the characters for each dead key. Typical mappings for a dead key for caret characters using ISO 8859-1 might be:
   dead	0xb0    # declare the caret character
   'a'	0xe2    # character for a with caret
   'e'	0xea    # character for e with caret
See mapchan(F) for more information about dead key sequences.

Compose key section

The compose key section has a structure like the dead key section of declaring the compose key then a list of the characters to be mapped. In all cases there are two characters following the compose key. For example, mapping compose keys within the 7-bit range of characters common to ASCII, ISO 8859-1 and IBM character sets:
   compose   0x1f    # compose key is ^_
   '_' '_'   0x1f    # output the compose key value
   '+' '+'   '#'     # two + characters generate a #
See mapchan(F) for more information about compose sequences.

Control section

This section allows for context-sensitive mapping problems, where mapchan might change characters which should not be changed. For example, the screen cursor on a terminal may be positioned by an escape control code (0x1b) followed by a number of other characters. If one of the characters is changed by mapchan, then the escape code sequence will be incorrect; the cursor will appear at the wrong place on the screen. The control section of mapchan enables a specific number of characters which form part of a terminal escape sequence to be ignored by mapchan. Some function keys generate a control sequence which can be handled similarly. The following control section shows some typical sequences:
   CONTROL
   input
   ^A	1       # Function keys: ^A followed by one
                   character
   \E	1       # Function keys: Escape followed by one
                   character
   

output \Ea 4 # cursor control: Escape a and 4 other characters \EG 1 # set attributes: Escape G and one character

Character sets

The internal character set used is defined by the mapchan files 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 mapchan 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 mapchan files are provided for use with the console device: /usr/lib/mapchan/ISO8859-1/ibm for systems with a standard PC character set ROM (IBM 437), and /usr/lib/mapchan/ISO8859-1/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 US ASCII (ANSI X3.4) should be used if no mapping is enabled on the channel.

See ``Terminal mapchan files'' and ``Printer mapchan files'' for more information.

Terminal mapchan files

The following mapchan files are provided in /usr/lib/mapchan/ISO8859-1 to permit the use of international character sets on the corresponding terminals:

ascii
Any 7-bit US ASCII terminal

ascii.spa
Any 7-bit ASCII device to approximate 8-bit Spanish

cons.850
Console-IBM PC Multilingual code page 850

cons.858
Console-IBM PC Multilingual code page 858

cons.bra
Console-PC Standard ROM (emulates Portuguese)

cons.grk
Console-PC Greek ROM

NOTE: This file does not conform to the ISO 8859-1 standard.


cons.ibm
Console-PC standard ROM

cons.iso
Console-ISO 8859-1 ROM

cons.iso15
Console-ISO 8859-15 ROM

cons.nor
Console-PC Nordic ROM

cons.por
Console-PC Portuguese ROM

cons.spa
Console-PC Spanish ROM

dec
DEC multinational character set

digi.abicomp
Portuguese Digibyte terminal in Abicomp mode

digi.brascii
Portuguese Digibyte terminal in Brascii mode

hp.ansi.7.bel
HP with Belgian ANSI keyboard

hp.ansi.7.can
HP with Canadian English/French ANSI keyboard

hp.ansi.7.dan
HP with Danish ANSI keyboard

hp.ansi.7.fra
HP with French ANSI keyboard

hp.ansi.7.fin
HP with Finnish ANSI keyboard

hp.ansi.7.ger
HP with German ANSI keyboard

hp.ansi.7.grd
HP with German (DIN) ANSI keyboard

hp.ansi.7.ita
HP with Italian ANSI keyboard

hp.ansi.7.ndl
HP with Dutch ANSI keyboard

hp.ansi.7.nor
HP with Norwegian ANSI keyboard

hp.ansi.7.por
HP with Portuguese ANSI keyboard

hp.ansi.7.spa
HP with Spanish ANSI keyboard

hp.ansi.7.swe
HP with Swedish ANSI keyboard

hp.ansi.7.swi
HP with Swiss German/French ANSI keyboard

hp.ansi.7.ukd
HP with UK English ANSI keyboard

hp.ansi.7.usa
HP with US English ANSI keyboard

hp.ansi.8
HP with 8-bit DEC multinational character set

hp.ascii.7.bel
HP with Belgian ASCII keyboard

hp.ascii.7.can
HP with Canadian English/French ASCII keyboard

hp.ascii.7.dan
HP with Danish ASCII keyboard

hp.ascii.7.esp
HP with European Spanish ASCII keyboard

hp.ascii.7.fra
HP with French ASCII keyboard

hp.ascii.7.fin
HP with Finnish ASCII keyboard

hp.ascii.7.ger
HP with German ASCII keyboard

hp.ascii.7.ita
HP with Italian ASCII keyboard

hp.ascii.7.lsp
HP with Latin Spanish ASCII keyboard

hp.ascii.7.ndl
HP with Dutch ASCII keyboard

hp.ascii.7.nor
HP with Norwegian ASCII keyboard

hp.ascii.7.swe
HP with Swedish ASCII keyboard

hp.ascii.7.swi
HP with Swiss German/French ASCII keyboard

hp.ascii.7.ukd
HP with UK English ASCII keyboard

hp.ascii.7.usa
HP with US English ASCII keyboard

hp.roman.8
HP with 8-bit ROMAN character set

ibm
Any device with a standard PC character set (IBM 437)

ibm.spa
Any device with an IBM character set to approximate 8-bit Spanish

iso
Any device with an ISO 8859-1 character set

qvt.fra
Qume QVT101 with French keyboard

qvt.ger
Qume QVT101 with German keyboard

tvi.fra
TVI924 with French keyboard

tvi.ger
TVI924 with German keyboard

tvi.nor
TVI924 with Norwegian/Danish keyboard

tvi.por
TVI924 with Portuguese keyboard

tvi.spa
TVI924 with Spanish keyboard

tvi.swe
TVI924 with Swedish/Finnish keyboard

tvi.ukd
TVI924 with UK keyboard

tvi.usa
TVI924 with US ASCII keyboard

tispc.abicomp
Sigma TisPC Portuguese 8-bit ANSI keyboard

wy60.fra.ans
Wyse60 French NRC with ANSI keyboard

wy60.fra.asc
Wyse60 French NRC with ASCII keyboard

w60.ibmfra.ans
Wyse60 French 8-bit ANSI keyboard

w60.ibmfra.asc
Wyse60 French 8-bit ASCII keyboard

wy60.ger
Wyse60 German keyboard (ANSI or ASCII)

wy60.ibm.ger
Wyse60 German 8-bit keyboard (ANSI or ASCII)

wy60.spa
Wyse60 Spanish 8-bit ANSI keyboard

wy60.lat.asc
Wyse60 Latin American Spanish ASCII keyboard

wy60.spa.asc
Wyse60 Spanish ASCII keyboard

wy60.spa.sk
Wyse60 with Spanish keyboard

wx200.iso
Siemens WX200 8-bit ANSI keyboard

The following nrc.* files are not designed for specific terminal makes. They may need some additions to account for the features of a particular terminal. As a guide, see how the qvt.* files differ from the corresponding nrc.* files.

nrc.can
Canadian 7-bit NRC terminals

nrc.chw
Swiss 7-bit NRC terminals

nrc.fra
French 7-bit NRC terminals

nrc.ger
German 7-bit NRC terminals

nrc.ita
Italian 7-bit NRC terminals

nrc.nor
Norwegian 7-bit NRC terminals

nrc.spa
Spanish 7-bit NRC terminals

nrc.swe
Swedish 7-bit NRC terminals

nrc.ukd
UK English 7-bit NRC terminals

Printer mapchan files

A serial or parallel printer can be used with any suitable mapchan file. A suitable file is one that maps from the internal character set to the character set used by the printer on output.

The following mapchan files in /usr/lib/mapchan/ISO8859-1 are supplied for use with specific printers:


hp.roman8
Hewlett-Packard LaserJet Printer ROMAN-8 set

ibm
Any printer using the IBM PC character set

Diagnostics

mapchan informs of the following errors when processing a mapchan file:
If characters are displayed as the 7-bit value instead of the 8-bit value, use stty -a to verify that -istrip is set. Make sure input is mapping to the internal character set, output is mapping from the internal character set to the device display character set. dead and compose sequences are input mapping and should be going to the internal character set. (The internal character set is normally ISO 8859-1 unless you have installed additional alternative character sets (such as ISO 8859-2) on your system.)

Warning

Using mapchan files that specify a different ``internal'' character set per-channel, or a set other than the 8-bit ISO 8859-1 code 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)). Some utilities and 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, you can use trchan(M) with an appropriate mapchan file 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.

Limitations

Some non-US keyboards and display devices do no 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.

Files

/etc/default/mapchan
/usr/lib/mapchan/codeset/*

See also

ascii(M), keyboard(HW), lp(C), lpadmin(ADM), mapchan(F), mapkey(M), parallel(HW), screen(HW), serial(HW), setkey(C), trchan(M), tty(M)

Standards conformance

mapchan is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003