DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

chrtbl(M)


chrtbl -- create a ctype locale table

Syntax

chrtbl [ specfile ]

Description

The utility chrtbl is provided to allow new LC_CTYPE locales to be defined; it reads a specification file, containing definitions of the attributes of characters in a particular character set, and produces a binary table file, to be read by setlocale(S), which determines the behavior of the ctype(S) routines.

The information supplied in the specification file consists of lines in the following format:

char type conv

The three fields, which are separated by space or tab characters, have the following meanings and syntax:


char
This is the character which is being defined. It may be specified in one of six different ways (the following examples all specify the ASCII character ``A''):

65 decimal
0101 octal
0x41 hexadecimal
'A' quoted character
'\101' quoted octal
'\x41' quoted hexadecimal


type
This specifies the classification of the character, as reported by the ctype routines. There are 7 basic classifications:

C iscntrl
D sdigit
L islower
P ispunct
S isspace
U isupper
X isxdigit

Other ctype macros use combinations of these 7 basic classifications. Zero, one or more of these classification letters can be specified, in any order, although only certain combinations are logically reasonable, as follows:

C control character
CS spacing control character
U uppercase alphabetic
UX uppercase alphabetic hex digit
UL dual case character
L lowercase alphabetic
LX lowercase alphabetic hex digit
DX decimal and hex digit
S spacing character
P punctuation (all other printing chars)
blank undefined (all classifications false)


conv
This optional field specifies the corresponding uppercase character for a lowercase character, or the corresponding lowercase character for an uppercase character. Dual case characters should have their own values repeated in this field.

The syntax is as for the char field.

All characters following a hash (#) are treated as a comment and ignored up to the end of the line, unless the hash is within a quoted character.

The initial LC_CTYPE table used is that for the ascii(M) character set, with the entries for the higher 128 characters (0x80 - 0xff) set to zero (that is, all classifications false). Thus an empty specification file will result in a table for US ASCII. Any specifications found in the input to chrtbl will overwrite the specifications for that character only, thus additions and modifications to the ASCII table can be made without respecifying those characters which are unchanged.

The binary table output is placed in a file named ctype, within the current directory. This file should be copied or linked to the correct place in the setlocale file tree (see locale(M)). To prevent accidental corruption of the output data, the file is created with no write permission; if the chrtbl utility is run in a directory containing a write-protected ``ctype'' file, the utility will ask if the existing file should be replaced; any response other than ``yes'' or ``y'' will cause chrtbl to terminate without overwriting the existing file.

If the specfile argument is missing, the specification information is read from the standard input.

Specification file format

The chrtbl specification file has the following format (the order of the specifications is not significant):
   #
   # chrtbl file for TVI 7-bit Spanish character set
   # Note that only non-ASCII characters need be specified
   #
   ´@'	P		# inverted ?
   ´['	L	']'	# n tilde
   ´\\'	P		# inverted !
   ´]'	U	'['	# N tilde
   ´~'	P		# degree sign

Exit values

Any error conditions encountered will cause the program to exit with a non-zero return code; successful completion is indicated with a zero return code.

Diagnostics

If the input table file cannot be opened for reading, processing will terminate with the error message, ``Cannot open specification file''.

Any lines in the specification file which are syntactically incorrect will cause an error message to be issued to the standard error output, specifying the line number on which the error was detected. The line will be ignored, and processing will continue.

If the output file, ``ctype'', cannot be opened for writing, processing will terminate with the error message, ``Cannot create table file.''

Files

/usr/include/ctype.h

See also

ascii(M), chrconv(M), ctype(S), locale(M), setlocale(S)

Standards conformance

chrtbl is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005