[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Commands Reference, Volume 5

setmaps Command

Purpose

Sets terminal maps or code set maps.

Syntax

Uses setmaps with no Input or Output Map File Designation

setmaps-v ] [ -c -h ]

Selects a File from Default Directory as the Code Set Map File

setmaps-v ] -s -i MapName

Selects a Designated File as the Code Set Map File

setmaps-v ] -s -I File1

Selects a File from Default Directory as the Input or Output Terminal Map File

setmaps-v ] [ -D ] [ -k KeyName ] [ -d DirectoryPath ] { -i -o } MapName

Selects Files from Default Directory as the Input or Output Terminal Map Files

setmaps-v ] [ -D ] [ -d DirectoryPath ] -t MapName

Selects a Designated File as the Input or Output Terminal Map File

setmaps-v ] [ -D ] [ -k KeyName ] { -I -O } File1

Loads the Default Terminal Map File for Later Use

setmaps-v ] [ -D ] [ -k KeyName ] [ -r ] -l File2

Loads a Designated Terminal Map File for Later Use

setmaps-v ] [ -D ] [ -k KeyName ] [ -r ] -L File1

Description

Note: If this command is run without root user authority, the code set map is not loaded, only debugged.

The setmaps command handles terminal and code set maps. The -s flag must be used for code set maps. The operating system uses input and output terminal maps to convert internal data representations to the ASCII characters supported by asynchronous terminals. If you enter the setmaps command with no flags, it displays the names of the current input and output terminal maps.

A terminal map is a text file containing a list of rules that associate a pattern string with a replacement string. This file normally resides in the /usr/lib/nls/termmap directory. The operating system uses an input map file to map input from the keyboard to an application and an output map file to map output from an application to the display.

Terminal mapping works as follows:

  1. The system collects characters in a buffer until a pattern specified by a rule in the map file matches a substring in the buffer.
  2. The system then constructs and returns the replacement string specified by the rule.

This processing continues with the remaining characters in the buffer.

The rules of a terminal map can test and change the state of the pattern processor. The state is identified by a single-byte character, conventionally a digit (0 through 9). The state is reset to 0, the initial state, whenever the system loads a new map or flushes the terminal input or output buffer (such as when it processes a KILL or INTR character or when a program issues an ioctl system call). A terminal map can use states to detect multibyte escape sequences, among other tasks. You can test for state x by specifying @x in a pattern. You can set the state to x by including @x in the replacement string.

The setmaps command, when using the -s flag, assigns a code set map to the standard input device. The operating system uses code set maps to determine the number of bytes of memory a character requires and the number of display columns it requires.

Flags

-c Clears all mappings on this terminal.
-d DirectoryPath Causes the DirectoryPath variable to be used as the path to the directory that contains the MapName variable. Specifying this flag and variable overrides the /usr/lib/nls/termmap directory.
-D Produces a debug program printout of the specified map on the standard output device before loading the map. When using this to run the debug program on new maps, do not run with root user authority until the map is fully debugged to prevent the map from actually being loaded.
-h Prints the usage information of the setmaps command (used with the -v flag for advanced users).
-i MapName Selects the /usr/lib/nls/termmap/MapName.in file as the input map. When used with the -s flag, this flag selects the /usr/lib/nls/csmap/MapName file as the terminal code set map file.
-I File1 Selects the contents of the File1 variable as the input map. The file specified by the File1 variable can be either a full path name or a path name relative to the current working directory. When used with the -s flag, this flag selects the contents of the File1 variable as the terminal code page map file.
-k KeyName Associates the contents of the KeyName variable with the map being selected. This key name overrides the default key, which is normally set to the value of the MapName variable.
-l File2 Loads the /usr/lib/nls/termmap/File2 file for later use. The File2 variable includes the full path name and suffix (if any) of the map file.
Note: You must have root user authority to specify this flag.
-L File1 Loads the specified map for later use. The File1 variable includes the full path name and suffix (if any) of the map file.
Note: You must have root user authority to specify this flag.
-o MapName Selects the /usr/lib/nls/termmap/MapName.out file as the terminal output map.
-O File1 Selects the contents of the File1 variable as the terminal output map. The File1 variable includes the full path name and suffix (if any) of the map file.
-r Forces reloading of the specified map, even if it is already loaded. Terminals using the old map continue to do so until they are logged off or until their maps are explicitly reset. If you do not specify this flag, a map is loaded only if it has not already been loaded into the kernel.
Note: You must have root user authority to specify this flag.
-s Treats any map as a code set map.
-t MapName Selects the /usr/lib/nls/termmap/MapName.in file as the terminal input map and the /usr/lib/nls/termmap/MapName.out file as the terminal output map.
-v Selects verbose output.

All maps loaded must have unique names. Use the -k flag to eliminate naming conflicts. Only the -i, -o, and -t flags implicitly add a suffix. Other flags specifying map names should include a suffix if appropriate. If a requested map name is already loaded in the kernel, that map is used even if the path information provided on the command line implies a different map.

To reset the code set map to its original state, the /usr/lib/nls/csmap/sbcs code set map should be used.

Examples

  1. To display the current map settings for this terminal, enter:
    setmaps
  2. To clear all mapping for the current terminal, enter:
    setmaps -c
  3. To set up mapping (both input and output maps) for an ibm3161-C terminal, enter:
    setmaps -t ibm3161-C
  4. To load the vt220 input map into the kernel as the fred map, enter:
    setmaps -k fred -i vt220
  5. To gather debug output for a new map called bob in a file called bob.dump, enter:
    setmaps -D -L /tmp/bob > bob.dump
  6. To set up a code set map conforming to the IBM-932 code page for this terminal, enter:
    setmaps -s -i IBM-932
  7. To set up a code set map conforming to the IBM-943 code page for this terminal, enter:
    setmaps -s -i IBM-943
  8. To set up a code set map from the file myEUC for this terminal, enter:
    setmaps -s -I myEUC

Files

/usr/bin/setmaps Contains the setmaps command.
/usr/lib/nls/termmap/*.in Contains input map files.
/usr/lib/nls/termmap/*.out Contains output map files.
/usr/lib/nls/csmap/sbcs Contains code set map for a single-byte code page.
/usr/lib/nls/csmap/IBM-943 Contains code set map for the IBM-943 code page.
/usr/lib/nls/csmap/IBM-eucJP Contains code set map for the IBM-eucJP code page.

Related Information

The stty command.

The setmaps file format, termios.h file.

The setcsmap subroutine.

National Language Support Overview in AIX Version 4.3 System Management Concepts: Operating System and Devices


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]