1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  *
3*0Sstevel@tonic-gate  * Portions Copyright %G% Sun Microsystems, Inc.
4*0Sstevel@tonic-gate  * All Rights Reserved
5*0Sstevel@tonic-gate  *
6*0Sstevel@tonic-gate  */
7*0Sstevel@tonic-gate 
8*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
9*0Sstevel@tonic-gate 
10*0Sstevel@tonic-gate /*
11*0Sstevel@tonic-gate  *  Copyright (c) 1995 Regents of the University of Michigan.
12*0Sstevel@tonic-gate  *  All rights reserved.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  *  charset.c
15*0Sstevel@tonic-gate  */
16*0Sstevel@tonic-gate 
17*0Sstevel@tonic-gate #if defined( DOS ) || defined( _WIN32 )
18*0Sstevel@tonic-gate /*
19*0Sstevel@tonic-gate  * This MUST precede "#ifdef STR_TRANSLATION"
20*0Sstevel@tonic-gate  * because STR_TRANSLATION and friends are defined in msdos.h.
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate #include "msdos.h"
23*0Sstevel@tonic-gate #endif /* DOS */
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate #ifdef STR_TRANSLATION
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef lint
28*0Sstevel@tonic-gate static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
29*0Sstevel@tonic-gate #endif
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #include <stdio.h>
32*0Sstevel@tonic-gate #include <string.h>
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #ifdef MACOS
35*0Sstevel@tonic-gate #include <stdlib.h>
36*0Sstevel@tonic-gate #include "macos.h"
37*0Sstevel@tonic-gate #endif /* MACOS */
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate #if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 ) && !defined(VMS)
40*0Sstevel@tonic-gate #include <sys/time.h>
41*0Sstevel@tonic-gate #include <sys/types.h>
42*0Sstevel@tonic-gate #include <sys/socket.h>
43*0Sstevel@tonic-gate #include <sys/param.h>
44*0Sstevel@tonic-gate #endif
45*0Sstevel@tonic-gate #include "lber.h"
46*0Sstevel@tonic-gate #include "ldap.h"
47*0Sstevel@tonic-gate #include "ldap-private.h"
48*0Sstevel@tonic-gate #include "ldap-int.h"
49*0Sstevel@tonic-gate 
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate void
52*0Sstevel@tonic-gate ldap_set_string_translators( LDAP *ld, BERTranslateProc encode_proc,
53*0Sstevel@tonic-gate 	BERTranslateProc decode_proc )
54*0Sstevel@tonic-gate {
55*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
56*0Sstevel@tonic-gate 	LOCK_LDAP(ld);
57*0Sstevel@tonic-gate #endif
58*0Sstevel@tonic-gate 	ld->ld_lber_encode_translate_proc = encode_proc;
59*0Sstevel@tonic-gate 	ld->ld_lber_decode_translate_proc = decode_proc;
60*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
61*0Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
62*0Sstevel@tonic-gate #endif
63*0Sstevel@tonic-gate }
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate void
67*0Sstevel@tonic-gate ldap_enable_translation( LDAP *ld, LDAPMessage *entry, int enable )
68*0Sstevel@tonic-gate {
69*0Sstevel@tonic-gate 	char	*optionsp;
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
72*0Sstevel@tonic-gate 	LOCK_LDAP(ld);
73*0Sstevel@tonic-gate #endif
74*0Sstevel@tonic-gate 	optionsp = ( entry == NULLMSG ) ? &ld->ld_lberoptions :
75*0Sstevel@tonic-gate 	    &entry->lm_ber->ber_options;
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate 	if ( enable ) {
78*0Sstevel@tonic-gate 		*optionsp |= LBER_TRANSLATE_STRINGS;
79*0Sstevel@tonic-gate 	} else {
80*0Sstevel@tonic-gate 		*optionsp &= ~LBER_TRANSLATE_STRINGS;
81*0Sstevel@tonic-gate 	}
82*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
83*0Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
84*0Sstevel@tonic-gate #endif
85*0Sstevel@tonic-gate }
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate int
89*0Sstevel@tonic-gate ldap_translate_from_t61( LDAP *ld, char **bufp, unsigned int *lenp,
90*0Sstevel@tonic-gate     int free_input )
91*0Sstevel@tonic-gate {
92*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
93*0Sstevel@tonic-gate 	BERTranslateProc decode_proc;
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate 	LOCK_LDAP(ld);
96*0Sstevel@tonic-gate #endif
97*0Sstevel@tonic-gate 	if ( ld->ld_lber_decode_translate_proc == NULL ) {
98*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
99*0Sstevel@tonic-gate 		UNLOCK_LDAP(ld);
100*0Sstevel@tonic-gate #endif
101*0Sstevel@tonic-gate 		return( LDAP_SUCCESS );
102*0Sstevel@tonic-gate 	}
103*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
104*0Sstevel@tonic-gate 	decode_proc = ld->ld_lber_decode_translate_proc;
105*0Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate 	return( (*decode_proc)( bufp, lenp, free_input ));
108*0Sstevel@tonic-gate #else
109*0Sstevel@tonic-gate 	return( (*ld->ld_lber_decode_translate_proc)( bufp, lenp, free_input ));
110*0Sstevel@tonic-gate #endif
111*0Sstevel@tonic-gate }
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate int
115*0Sstevel@tonic-gate ldap_translate_to_t61( LDAP *ld, char **bufp, unsigned int *lenp,
116*0Sstevel@tonic-gate     int free_input )
117*0Sstevel@tonic-gate {
118*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
119*0Sstevel@tonic-gate 	BERTranslateProc encode_proc;
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate 	LOCK_LDAP(ld);
122*0Sstevel@tonic-gate #endif
123*0Sstevel@tonic-gate 	if ( ld->ld_lber_encode_translate_proc == NULL ) {
124*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
125*0Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
126*0Sstevel@tonic-gate #endif
127*0Sstevel@tonic-gate 		return( LDAP_SUCCESS );
128*0Sstevel@tonic-gate 	}
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
131*0Sstevel@tonic-gate 	encode_proc = ld->ld_lber_encode_translate_proc;
132*0Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
133*0Sstevel@tonic-gate 	return( (*encode_proc)( bufp, lenp, free_input ));
134*0Sstevel@tonic-gate #else
135*0Sstevel@tonic-gate 	return( (*ld->ld_lber_encode_translate_proc)( bufp, lenp, free_input ));
136*0Sstevel@tonic-gate #endif
137*0Sstevel@tonic-gate }
138*0Sstevel@tonic-gate 
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate /*
141*0Sstevel@tonic-gate  ** Character translation routine notes:
142*0Sstevel@tonic-gate  *
143*0Sstevel@tonic-gate  * On entry:  bufp points to a "string" to be converted (not necessarily
144*0Sstevel@tonic-gate  *  zero-terminated) and buflenp points to the length of the buffer.
145*0Sstevel@tonic-gate  *
146*0Sstevel@tonic-gate  * On exit:  bufp should point to a malloc'd result.  If free_input is
147*0Sstevel@tonic-gate  *  non-zero then the original bufp will be freed.  *buflenp should be
148*0Sstevel@tonic-gate  *  set to the new length.  Zero bytes in the input buffer must be left
149*0Sstevel@tonic-gate  *  as zero bytes.
150*0Sstevel@tonic-gate  *
151*0Sstevel@tonic-gate  * Return values: any ldap error code (LDAP_SUCCESS if all goes well).
152*0Sstevel@tonic-gate  */
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate 
155*0Sstevel@tonic-gate #ifdef LDAP_CHARSET_8859
156*0Sstevel@tonic-gate 
157*0Sstevel@tonic-gate #if LDAP_CHARSET_8859 == 88591
158*0Sstevel@tonic-gate #define ISO_8859 1
159*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88592
160*0Sstevel@tonic-gate #define ISO_8859 2
161*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88593
162*0Sstevel@tonic-gate #define ISO_8859 3
163*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88594
164*0Sstevel@tonic-gate #define ISO_8859 4
165*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88595
166*0Sstevel@tonic-gate #define ISO_8859 5
167*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88596
168*0Sstevel@tonic-gate #define ISO_8859 6
169*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88597
170*0Sstevel@tonic-gate #define ISO_8859 7
171*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88598
172*0Sstevel@tonic-gate #define ISO_8859 8
173*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88599
174*0Sstevel@tonic-gate #define ISO_8859 9
175*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 885910
176*0Sstevel@tonic-gate #define ISO_8859 10
177*0Sstevel@tonic-gate #else
178*0Sstevel@tonic-gate #define ISO_8859 0
179*0Sstevel@tonic-gate #endif
180*0Sstevel@tonic-gate 
181*0Sstevel@tonic-gate /*
182*0Sstevel@tonic-gate  * the following ISO_8859 to/afrom T.61 character set translation code is
183*0Sstevel@tonic-gate  * based on the code found in Enrique Silvestre Mora's iso-t61.c, found
184*0Sstevel@tonic-gate  * as part of this package:
185*0Sstevel@tonic-gate  *   ftp://pereiii.uji.es/pub/uji-ftp/unix/ldap/iso-t61.translation.tar.Z
186*0Sstevel@tonic-gate  * Enrique is now (10/95) at this address: enrique.silvestre@uv.es
187*0Sstevel@tonic-gate  *
188*0Sstevel@tonic-gate  * changes made by mcs@umich.edu 12 October 1995:
189*0Sstevel@tonic-gate  *   Change calling conventions of iso8859_t61() and t61_iso8859() to
190*0Sstevel@tonic-gate  *	match libldap conventions; rename to ldap_8859_to_t61() and
191*0Sstevel@tonic-gate  *	ldap_t61_to_8859().
192*0Sstevel@tonic-gate  *   Change conversion routines to deal with non-zero terminated strings.
193*0Sstevel@tonic-gate  *   ANSI-ize functions and include prototypes.
194*0Sstevel@tonic-gate  */
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate /* iso-t61.c - ISO-T61 translation routines (version: 0.2.1, July-1994) */
197*0Sstevel@tonic-gate /*
198*0Sstevel@tonic-gate  * Copyright (c) 1994 Enrique Silvestre Mora, Universitat Jaume I, Spain.
199*0Sstevel@tonic-gate  * All rights reserved.
200*0Sstevel@tonic-gate  *
201*0Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
202*0Sstevel@tonic-gate  * provided that this notice is preserved and that due credit is given
203*0Sstevel@tonic-gate  * to the Universitat Jaume I. The name of the University
204*0Sstevel@tonic-gate  * may not be used to endorse or promote products derived from this
205*0Sstevel@tonic-gate  * software without specific prior written permission. This software
206*0Sstevel@tonic-gate  * is provided ``as is'' without express or implied warranty.
207*0Sstevel@tonic-gate */
208*0Sstevel@tonic-gate 
209*0Sstevel@tonic-gate 
210*0Sstevel@tonic-gate #include <stdio.h>
211*0Sstevel@tonic-gate #include <stdlib.h>
212*0Sstevel@tonic-gate #include <string.h>
213*0Sstevel@tonic-gate 
214*0Sstevel@tonic-gate /* Character set used: ISO 8859-1, ISO 8859-2, ISO 8859-3, ... */
215*0Sstevel@tonic-gate /* #define  ISO_8859      1 */
216*0Sstevel@tonic-gate 
217*0Sstevel@tonic-gate #ifndef ISO_8859
218*0Sstevel@tonic-gate #  define ISO_8859     0
219*0Sstevel@tonic-gate #endif
220*0Sstevel@tonic-gate 
221*0Sstevel@tonic-gate typedef unsigned char  Byte;
222*0Sstevel@tonic-gate typedef struct { Byte  a, b; } Couple;
223*0Sstevel@tonic-gate 
224*0Sstevel@tonic-gate #ifdef NEEDPROTOS
225*0Sstevel@tonic-gate static Byte *c_to_hh( Byte *o, Byte c );
226*0Sstevel@tonic-gate static Byte *c_to_cc( Byte *o, Couple *cc, Byte c );
227*0Sstevel@tonic-gate static int hh_to_c( Byte *h );
228*0Sstevel@tonic-gate static Byte *cc_to_t61( Byte *o, Byte *s );
229*0Sstevel@tonic-gate #else /* NEEDPROTOS */
230*0Sstevel@tonic-gate static Byte *c_to_hh();
231*0Sstevel@tonic-gate static Byte *c_to_cc();
232*0Sstevel@tonic-gate static int hh_to_c();
233*0Sstevel@tonic-gate static Byte *cc_to_t61();
234*0Sstevel@tonic-gate #endif /* NEEDPROTOS */
235*0Sstevel@tonic-gate 
236*0Sstevel@tonic-gate /*
237*0Sstevel@tonic-gate    Character choosed as base in diacritics alone: NO-BREAK SPACE.
238*0Sstevel@tonic-gate    (The standard say it must be a blank space, 0x20.)
239*0Sstevel@tonic-gate */
240*0Sstevel@tonic-gate #define  ALONE  0xA0
241*0Sstevel@tonic-gate 
242*0Sstevel@tonic-gate static Couple diacritic[16] = {
243*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 9)
244*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
245*0Sstevel@tonic-gate 	{'~',0},     {0xaf,0},    {'(',ALONE}, {'.',ALONE},
246*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
247*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE}, {'<',ALONE},
248*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
249*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
250*0Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {0xa2,0},    {0xff,0},
251*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
252*0Sstevel@tonic-gate 	{0,0},       {0xbd,0},    {0xb2,0},    {0xb7,0}
253*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
254*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
255*0Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {0xa2,0},    {0xff,0},
256*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
257*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE}, {'<',ALONE}
258*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
259*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
260*0Sstevel@tonic-gate 	{'~',0},     {0xaf,0},    {'(',ALONE}, {0xff,0},
261*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
262*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {0xb2,0},    {0xb7,0}
263*0Sstevel@tonic-gate #else
264*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {'\'',ALONE}, {'^',0},
265*0Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {'(',ALONE},  {'.',ALONE},
266*0Sstevel@tonic-gate 	{':',ALONE}, {0,0},       {'0',ALONE},  {',',ALONE},
267*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE},  {'<',ALONE}
268*0Sstevel@tonic-gate #endif
269*0Sstevel@tonic-gate };
270*0Sstevel@tonic-gate 
271*0Sstevel@tonic-gate /*
272*0Sstevel@tonic-gate    --- T.61 (T.51) letters with diacritics: conversion to ISO 8859-n -----
273*0Sstevel@tonic-gate        A,   C,   D,   E,   G,   H,   I,   J,   K,
274*0Sstevel@tonic-gate        L,   N,   O,   R,   S,   T,   U,   W,   Y,   Z.
275*0Sstevel@tonic-gate    -----------------------------------------------------------------------
276*0Sstevel@tonic-gate */
277*0Sstevel@tonic-gate static int letter_w_diacritic[16][38] = {
278*0Sstevel@tonic-gate #if (ISO_8859 == 1)
279*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
280*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
281*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
282*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
283*0Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
284*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
285*0Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   0xec,0,   0,
286*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
287*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
288*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   0xdd,-1,
289*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
290*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   0xfd,-1,
291*0Sstevel@tonic-gate 	0xc2,-1,  0,   0xca,-1,  -1,  0xce,-1,  0,
292*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
293*0Sstevel@tonic-gate 	0xe2,-1,  0,   0xea,-1,  -1,  0xee,-1,  0,
294*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
295*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   -1,  0,   0,
296*0Sstevel@tonic-gate 	0,   0xd1,0xd5,0,   0,   0,   -1,  0,   0,   0,
297*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   -1,  0,   0,
298*0Sstevel@tonic-gate 	0,   0xf1,0xf5,0,   0,   0,   -1,  0,   0,   0,
299*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
300*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
301*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
302*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
303*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
304*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
305*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
306*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
307*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
308*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
309*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
310*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
311*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
312*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
313*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
314*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   0xff,0,
315*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
316*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
317*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
318*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
319*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
320*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
321*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
322*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
323*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
324*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
325*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
326*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
327*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
328*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
329*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
330*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
331*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
332*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
333*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
334*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
335*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
336*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
337*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
338*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
339*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
340*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
341*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
342*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
343*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
344*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
345*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
346*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
347*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
348*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
349*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
350*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
351*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
352*0Sstevel@tonic-gate 	0xc1,0xc6,0,   0xc9,0,   0,   0xcd,0,   0,
353*0Sstevel@tonic-gate 	0xc5,0xd1,0xd3,0xc0,0xa6,0,   0xda,0,   0xdd,0xac,
354*0Sstevel@tonic-gate 	0xe1,0xe6,0,   0xe9,0,   0,   0xed,0,   0,
355*0Sstevel@tonic-gate 	0xe5,0xf1,0xf3,0xe0,0xb6,0,   0xfa,0,   0xfd,0xbc,
356*0Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
357*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   -1,  -1,  -1,  0,
358*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
359*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   -1,  -1,  -1,  0,
360*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
361*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
362*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
363*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
364*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
365*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
366*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
367*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
368*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   -1,  0,   0,   0,   0,
369*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
370*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   -1,  0,   0,   0,   0,
371*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
372*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
373*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xaf,
374*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
375*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xbf,
376*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   -1,  0,   0,
377*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
378*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
379*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
380*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
381*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
382*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
383*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
384*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
385*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
386*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
387*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
388*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
389*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,0xde,0,   0,   0,   0,
390*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
391*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,0xfe,0,   0,   0,   0,
392*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
393*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
394*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
395*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
396*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
397*0Sstevel@tonic-gate 	0,   0,   0xd5,0,   0,   0,   0xdb,0,   0,   0,
398*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
399*0Sstevel@tonic-gate 	0,   0,   0xf5,0,   0,   0,   0xfb,0,   0,   0,
400*0Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   -1,  0,   0,
401*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
402*0Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   -1,  0,   0,
403*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
404*0Sstevel@tonic-gate 	0,   0xc8,0xcf,0xcc,0,   0,   0,   0,   0,
405*0Sstevel@tonic-gate 	0xa5,0xd2,0,   0xd8,0xa9,0xab,0,   0,   0,   0xae,
406*0Sstevel@tonic-gate 	0,   0xe8,0xef,0xec,0,   0,   0,   0,   0,
407*0Sstevel@tonic-gate 	0xb5,0xf2,0,   0xf8,0xb9,0xbb,0,   0,   0,   0xbe
408*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
409*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
410*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
411*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
412*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
413*0Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
414*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
415*0Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   0xec,0,   0,
416*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
417*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
418*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   -1,  -1,
419*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
420*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   -1,  -1,
421*0Sstevel@tonic-gate 	0xc2,0xc6,0,   0xca,0xd8,0xa6,0xce,0xac,0,
422*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   0xde,0,   0xdb,-1,  -1,  0,
423*0Sstevel@tonic-gate 	0xe2,0xe6,0,   0xea,0xf8,0xb6,0xee,0xbc,0,
424*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   0xfe,0,   0xfb,-1,  -1,  0,
425*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
426*0Sstevel@tonic-gate 	0,   0xd1,-1,  0,   0,   0,   -1,  0,   0,   0,
427*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
428*0Sstevel@tonic-gate 	0,   0xf1,-1,  0,   0,   0,   -1,  0,   0,   0,
429*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
430*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
431*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
432*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
433*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xab,0,   0,   0,   0,
434*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xdd,0,   0,   0,
435*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xbb,0,   0,   0,   0,
436*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xfd,0,   0,   0,
437*0Sstevel@tonic-gate 	0,   0xc5,0,   -1,  0xd5,0,   0xa9,0,   0,
438*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xaf,
439*0Sstevel@tonic-gate 	0,   0xe5,0,   -1,  0xf5,0,   0,   0,   0,
440*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xbf,
441*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
442*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
443*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
444*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
445*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
446*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
447*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
448*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
449*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
450*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
451*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
452*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
453*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
454*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,-1,  0,   0,   0,   0,
455*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
456*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,-1,  0,   0,   0,   0,
457*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
458*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
459*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
460*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
461*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
462*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
463*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
464*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
465*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
466*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
467*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
468*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
469*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
470*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
471*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
472*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
473*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
474*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
475*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
476*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
477*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
478*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
479*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
480*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
481*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
482*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
483*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   0xda,0,   -1,  -1,
484*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
485*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   0xfa,0,   -1,  -1,
486*0Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
487*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
488*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
489*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
490*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   0xa5,0,   0,
491*0Sstevel@tonic-gate 	0,   -1,  0xd5,0,   0,   0,   0xdd,0,   0,   0,
492*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   0xb5,0,   0,
493*0Sstevel@tonic-gate 	0,   -1,  0xf5,0,   0,   0,   0xfd,0,   0,   0,
494*0Sstevel@tonic-gate 	0xc0,0,   0,   0xaa,0,   0,   0xcf,0,   0,
495*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xde,0,   0,   0,
496*0Sstevel@tonic-gate 	0xe0,0,   0,   0xba,0,   0,   0xef,0,   0,
497*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xfe,0,   0,   0,
498*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
499*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
500*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
501*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
502*0Sstevel@tonic-gate 	0,   -1,  0,   0xcc,-1,  0,   -1,  0,   0,
503*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
504*0Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
505*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
506*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   -1,  0,   0,
507*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
508*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
509*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
510*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
511*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
512*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
513*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
514*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
515*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
516*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
517*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
518*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xab,0,   0,   0,   0xd3,
519*0Sstevel@tonic-gate 	0xa6,0xd1,0,   0xa3,-1,  -1,  0,   0,   0,   0,
520*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xbb,0,   0,   0,   0xf3,
521*0Sstevel@tonic-gate 	0xb6,0xf1,0,   0xb3,-1,  -1,  0,   0,   0,   0,
522*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
523*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
524*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
525*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
526*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
527*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
528*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
529*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
530*0Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   0xc7,0,   0,
531*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
532*0Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   0xe7,0,   0,
533*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
534*0Sstevel@tonic-gate 	0,   0xc8,-1,  -1,  0,   0,   0,   0,   0,
535*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xa9,-1,  0,   0,   0,   0xae,
536*0Sstevel@tonic-gate 	0,   0xe8,-1,  -1,  0,   0,   0,   0,   0,
537*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xb9,-1,  0,   0,   0,   0xbe
538*0Sstevel@tonic-gate #elif (ISO_8859 == 9)
539*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
540*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
541*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
542*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
543*0Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
544*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
545*0Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   -1,  0,   0,
546*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
547*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
548*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   -1,  -1,
549*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
550*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   -1,  -1,
551*0Sstevel@tonic-gate 	0xc2,-1,  0,   0xca,-1,  -1,  0xce,-1,  0,
552*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
553*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
554*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
555*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   -1,  0,   0,
556*0Sstevel@tonic-gate 	0,   0xd1,0xd5,0,   0,   0,   -1,  0,   0,   0,
557*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   -1,  0,   0,
558*0Sstevel@tonic-gate 	0,   0xf1,0xf5,0,   0,   0,   -1,  0,   0,   0,
559*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
560*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
561*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   0xef,0,   0,
562*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
563*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xd0,0,   0,   0,   0,
564*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
565*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xf0,0,   0,   0,   0,
566*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
567*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0xdd,0,   0,
568*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
569*0Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
570*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
571*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
572*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
573*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
574*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   0xff,0,
575*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
576*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
577*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
578*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
579*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
580*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
581*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
582*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
583*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
584*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xde,-1,  0,   0,   0,   0,
585*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
586*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xfe,-1,  0,   0,   0,   0,
587*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
588*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
589*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
590*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
591*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
592*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
593*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
594*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
595*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
596*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
597*0Sstevel@tonic-gate 	-1,  0,   0,   0xea,0,   0,   -1,  0,   0,
598*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
599*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
600*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
601*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
602*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
603*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
604*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
605*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
606*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
607*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
608*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
609*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
610*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
611*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
612*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
613*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   0xdd,-1,
614*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
615*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   0xfd,-1,
616*0Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
617*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
618*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
619*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
620*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   0xa5,0,   0,
621*0Sstevel@tonic-gate 	0,   -1,  0xd5,0,   0,   0,   0xd7,0,   0,   0,
622*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   0xb5,0,   0,
623*0Sstevel@tonic-gate 	0,   -1,  0xf5,0,   0,   0,   0xf7,0,   0,   0,
624*0Sstevel@tonic-gate 	0xc0,0,   0,   0xa2,0,   0,   0xa4,0,   0,
625*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xae,0,   0,   0,
626*0Sstevel@tonic-gate 	0xe0,0,   0,   0xb2,0,   0,   0xb4,0,   0,
627*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xbe,0,   0,   0,
628*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
629*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
630*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
631*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
632*0Sstevel@tonic-gate 	0,   -1,  0,   0xcc,-1,  0,   -1,  0,   0,
633*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
634*0Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
635*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
636*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
637*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
638*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
639*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
640*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
641*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
642*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
643*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
644*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
645*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
646*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
647*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
648*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xa3,0,   0,   0,   0xa6,
649*0Sstevel@tonic-gate 	0xa8,0xd1,0,   -1,  -1,  -1,  0,   0,   0,   0,
650*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xb3,0,   0,   0,   0xb6,
651*0Sstevel@tonic-gate 	0xb8,0xf1,0,   -1,  -1,  -1,  0,   0,   0,   0,
652*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
653*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
654*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
655*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
656*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
657*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
658*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
659*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
660*0Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   0xc7,0,   0,
661*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
662*0Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   0xe7,0,   0,
663*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
664*0Sstevel@tonic-gate 	0,   0xc8,-1,  -1,  0,   0,   0,   0,   0,
665*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,-1,  0,   0,   0,   0xac,
666*0Sstevel@tonic-gate 	0,   0xe8,-1,  -1,  0,   0,   0,   0,   0,
667*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,-1,  0,   0,   0,   0xbc
668*0Sstevel@tonic-gate #else
669*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
670*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
671*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
672*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
673*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
674*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
675*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
676*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
677*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0,   0,   -1,  0,   0,
678*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   -1,  0,   -1,  -1,
679*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0,   0,   -1,  0,   0,
680*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   -1,  0,   -1,  -1,
681*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  -1,  -1,  0,
682*0Sstevel@tonic-gate 	0,   0,   -1,  0,   -1,  0,   -1,  -1,  -1,  0,
683*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  -1,  -1,  0,
684*0Sstevel@tonic-gate 	0,   0,   -1,  0,   -1,  0,   -1,  -1,  -1,  0,
685*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
686*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
687*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
688*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
689*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
690*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
691*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
692*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
693*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
694*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
695*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
696*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
697*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
698*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
699*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
700*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
701*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
702*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   -1,  0,
703*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
704*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   -1,  0,
705*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
706*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
707*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
708*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
709*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
710*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
711*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
712*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
713*0Sstevel@tonic-gate 	0,   -1,  0,   0,   -1,  0,   0,   0,   -1,
714*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
715*0Sstevel@tonic-gate 	0,   -1,  0,   0,   -1,  0,   0,   0,   -1,
716*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
717*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
718*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
719*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
720*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
721*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
722*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
723*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
724*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
725*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
726*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
727*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
728*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
729*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
730*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
731*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
732*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
733*0Sstevel@tonic-gate #endif
734*0Sstevel@tonic-gate };
735*0Sstevel@tonic-gate 
736*0Sstevel@tonic-gate /*
737*0Sstevel@tonic-gate --- T.61 characters [0xA0 .. 0xBF] -----------------
738*0Sstevel@tonic-gate */
739*0Sstevel@tonic-gate static Couple trans_t61a_iso8859[32] = {
740*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 9)
741*0Sstevel@tonic-gate 	{'N','S'}, {0xa1,0},  {0xa2,0},  {0xa3,0},
742*0Sstevel@tonic-gate 	{'D','O'}, {0xa5,0},  {'C','u'}, {0xa7,0},
743*0Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {0xab,0},
744*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
745*0Sstevel@tonic-gate 	{0xb0,0},  {0xb1,0},  {0xb2,0},  {0xb3,0},
746*0Sstevel@tonic-gate 	{0xd7,0},  {0xb5,0},  {0xb6,0},  {0xb7,0},
747*0Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {0xbb,0},
748*0Sstevel@tonic-gate 	{0xbc,0},  {0xbd,0},  {0xbe,0},  {0xbf,0}
749*0Sstevel@tonic-gate #elif (ISO_8859 == 2) || (ISO_8859 == 4)
750*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
751*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
752*0Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {'<','<'},
753*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
754*0Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {'2','S'}, {'3','S'},
755*0Sstevel@tonic-gate 	{0xd7,0},  {'M','y'}, {'P','I'}, {'.','M'},
756*0Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {'>','>'},
757*0Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'},
758*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
759*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {0xa3,0},
760*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
761*0Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {'<','<'},
762*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
763*0Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {0xb2,0},  {0xb3,0},
764*0Sstevel@tonic-gate 	{0xd7,0},  {0xb5,0},  {'P','I'}, {0xb7,0},
765*0Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {'>','>'},
766*0Sstevel@tonic-gate 	{'1','4'}, {0xbd,0},  {'3','4'}, {'?','I'}
767*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
768*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
769*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
770*0Sstevel@tonic-gate 	{'C','u'}, {'\'','6'},{'"','6'}, {'<','<'},
771*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
772*0Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {'2','S'}, {'3','S'},
773*0Sstevel@tonic-gate 	{'*','X'}, {'M','y'}, {'P','I'}, {0xb7,0},
774*0Sstevel@tonic-gate 	{'-',':'}, {'\'','9'},{'"','9'}, {'>','>'},
775*0Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'}
776*0Sstevel@tonic-gate #else
777*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
778*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {'S','E'},
779*0Sstevel@tonic-gate 	{'X','O'}, {'\'','6'},{'"','6'}, {'<','<'},
780*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
781*0Sstevel@tonic-gate 	{'D','G'}, {'+','-'}, {'2','S'}, {'3','S'},
782*0Sstevel@tonic-gate 	{'*','X'}, {'M','y'}, {'P','I'}, {'.','M'},
783*0Sstevel@tonic-gate 	{'-',':'}, {'\'','9'},{'"','9'}, {'>','>'},
784*0Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'}
785*0Sstevel@tonic-gate #endif
786*0Sstevel@tonic-gate };
787*0Sstevel@tonic-gate 
788*0Sstevel@tonic-gate /*
789*0Sstevel@tonic-gate --- T.61 characters [0xE0 .. 0xFF] -----------------
790*0Sstevel@tonic-gate */
791*0Sstevel@tonic-gate static Couple trans_t61b_iso8859[48] = {
792*0Sstevel@tonic-gate #if (ISO_8859 == 1)
793*0Sstevel@tonic-gate 	{'-','M'}, {0xb9,0},  {0xae,0},  {0xa9,0},
794*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {0xac,0},  {0xa6,0},
795*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
796*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
797*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xd0,0},  {0xaa,0},
798*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
799*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {0xba,0},
800*0Sstevel@tonic-gate 	{0xde,0},  {'T','/'}, {'N','G'}, {'\'','n'},
801*0Sstevel@tonic-gate 	{'k','k'}, {0xe6,0},  {'d','/'}, {0xf0,0},
802*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
803*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
804*0Sstevel@tonic-gate 	{0xfe,0},  {'t','/'}, {'n','g'}, {'-','-'}
805*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
806*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
807*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
808*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
809*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
810*0Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {0xd0,0},  {'-','a'},
811*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
812*0Sstevel@tonic-gate 	{0xa3,0},  {'O','/'}, {'O','E'}, {'-','o'},
813*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
814*0Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {0xf0,0},  {'d','-'},
815*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
816*0Sstevel@tonic-gate 	{0xb3,0},  {'o','/'}, {'o','e'}, {0xdf,0},
817*0Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
818*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
819*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
820*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
821*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
822*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
823*0Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {'D','/'}, {'-','a'},
824*0Sstevel@tonic-gate 	{0xa1,0},  {0,0},     {'I','J'}, {'L','.'},
825*0Sstevel@tonic-gate 	{'L','/'}, {'O','/'}, {'O','E'}, {'-','o'},
826*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
827*0Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {'d','/'}, {'d','-'},
828*0Sstevel@tonic-gate 	{0xb1,0},  {0xb9,0},  {'i','j'}, {'l','.'},
829*0Sstevel@tonic-gate 	{'l','/'}, {'o','/'}, {'o','e'}, {0xdf,0},
830*0Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
831*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
832*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
833*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
834*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
835*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
836*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xd0,0},  {'-','a'},
837*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
838*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {'-','o'},
839*0Sstevel@tonic-gate 	{'T','H'}, {0xac,0},  {0xbd,0},  {'\'','n'},
840*0Sstevel@tonic-gate 	{0xa2,0},  {0xe6,0},  {0xf0,0},  {'d','-'},
841*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
842*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
843*0Sstevel@tonic-gate 	{'t','h'}, {0xbc,0},  {0xbf,0},  {'-','-'}
844*0Sstevel@tonic-gate #elif (ISO_8859 == 9)
845*0Sstevel@tonic-gate 	{'-','M'}, {0xb9,0},  {0xae,0},  {0xa9,0},
846*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {0xac,0},  {0xa6,0},
847*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
848*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
849*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {'D','/'}, {0xaa,0},
850*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
851*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {0xba,0},
852*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
853*0Sstevel@tonic-gate 	{'k','k'}, {0xe6,0},  {'d','/'}, {'d','-'},
854*0Sstevel@tonic-gate 	{'h','/'}, {0xfd,0},  {'i','j'}, {'l','.'},
855*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
856*0Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
857*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
858*0Sstevel@tonic-gate 	{0xbd,0},  {'1','S'}, {'R','g'}, {'C','o'},
859*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
860*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
861*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
862*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xa9,0},  {'-','a'},
863*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
864*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {'-','o'},
865*0Sstevel@tonic-gate 	{0xde,0},  {0xab,0},  {0xaf,0},  {'\'','n'},
866*0Sstevel@tonic-gate 	{0xff,0},  {0xe6,0},  {0xb9,0},  {0xf0,0},
867*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
868*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
869*0Sstevel@tonic-gate 	{0xfe,0},  {0xbb,0},  {0xbf,0},  {'-','-'}
870*0Sstevel@tonic-gate #else
871*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
872*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
873*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
874*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
875*0Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {'D','/'}, {'-','a'},
876*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
877*0Sstevel@tonic-gate 	{'L','/'}, {'O','/'}, {'O','E'}, {'-','o'},
878*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
879*0Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {'d','/'}, {'d','-'},
880*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
881*0Sstevel@tonic-gate 	{'l','/'}, {'o','/'}, {'o','e'}, {'s','s'},
882*0Sstevel@tonic-gate 	{'t','h'}, {'t','-'}, {'n','g'}, {'-','-'}
883*0Sstevel@tonic-gate #endif
884*0Sstevel@tonic-gate };
885*0Sstevel@tonic-gate 
886*0Sstevel@tonic-gate /*
887*0Sstevel@tonic-gate --- ISO 8859-n characters <0xA0 .. 0xFF> -------------------
888*0Sstevel@tonic-gate */
889*0Sstevel@tonic-gate #if (ISO_8859 == 1)
890*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
891*0Sstevel@tonic-gate 	{0xa0,0},     {0xa1,0},     {0xa2,0},     {0xa3,0},
892*0Sstevel@tonic-gate 	{0xa8,0},     {0xa5,0},     {0xd7,0},     {0xa7,0},
893*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xd3,0},     {0xe3,0},     {0xab,0},
894*0Sstevel@tonic-gate 	{0xd6,0},     {0xff,0},     {0xd2,0},     {0xc5,ALONE},
895*0Sstevel@tonic-gate 	{0xb0,0},     {0xb1,0},     {0xb2,0},     {0xb3,0},
896*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xb6,0},     {0xb7,0},
897*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xd1,0},     {0xeb,0},     {0xbb,0},
898*0Sstevel@tonic-gate 	{0xbc,0},     {0xbd,0},     {0xbe,0},     {0xbf,0},
899*0Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
900*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xcb,'C'},
901*0Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
902*0Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
903*0Sstevel@tonic-gate 	{0xe2,0},     {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
904*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
905*0Sstevel@tonic-gate 	{0xe9,0},     {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
906*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xec,0},     {0xfb,0},
907*0Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
908*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xcb,'c'},
909*0Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xc3,'e'},   {0xc8,'e'},
910*0Sstevel@tonic-gate 	{0xc1,'i'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
911*0Sstevel@tonic-gate 	{0xf3,0},     {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
912*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
913*0Sstevel@tonic-gate 	{0xf9,0},     {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
914*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xfc,0},     {0xc8,'y'}
915*0Sstevel@tonic-gate };
916*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
917*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
918*0Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xc6,ALONE}, {0xe8,0},
919*0Sstevel@tonic-gate 	{0xa8,0},     {0xcf,'L'},   {0xc2,'S'},   {0xa7,0},
920*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xcf,'S'},   {0xcb,'S'},   {0xcf,'T'},
921*0Sstevel@tonic-gate 	{0xc2,'Z'},   {0xff,0},     {0xcf,'Z'},   {0xc7,'Z'},
922*0Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xce,ALONE}, {0xf8,0},
923*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xcf,'l'},   {0xc2,'s'},   {0xcf,ALONE},
924*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xcf,'s'},   {0xcb,'s'},   {0xcf,'t'},
925*0Sstevel@tonic-gate 	{0xc2,'z'},   {0xcd,ALONE}, {0xcf,'z'},   {0xc7,'z'},
926*0Sstevel@tonic-gate 	{0xc2,'R'},   {0xc2,'A'},   {0xc3,'A'},   {0xc6,'A'},
927*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xc2,'L'},   {0xc2,'C'},   {0xcb,'C'},
928*0Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
929*0Sstevel@tonic-gate 	{0xcf,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xcf,'D'},
930*0Sstevel@tonic-gate 	{0xe2,0},     {0xc2,'N'},   {0xcf,'N'},   {0xc2,'O'},
931*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xcd,'O'},   {0xc8,'O'},   {0xb4,0},
932*0Sstevel@tonic-gate 	{0xcf,'R'},   {0xca,'U'},   {0xc2,'U'},   {0xcd,'U'},
933*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xcb,'T'},   {0xfb,0},
934*0Sstevel@tonic-gate 	{0xc2,'r'},   {0xc2,'a'},   {0xc3,'a'},   {0xc6,'a'},
935*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xc2,'l'},   {0xc2,'c'},   {0xcb,'c'},
936*0Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
937*0Sstevel@tonic-gate 	{0xcf,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xcf,'d'},
938*0Sstevel@tonic-gate 	{0xf2,0},     {0xc2,'n'},   {0xcf,'n'},   {0xc2,'o'},
939*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xcd,'o'},   {0xc8,'o'},   {0xb8,0},
940*0Sstevel@tonic-gate 	{0xcf,'r'},   {0xca,'u'},   {0xc2,'u'},   {0xcd,'u'},
941*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xcb,'t'},   {0xc7,ALONE}
942*0Sstevel@tonic-gate };
943*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
944*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
945*0Sstevel@tonic-gate 	{0xa0,0},     {0xe4,0},     {0xc6,ALONE}, {0xa3,0},
946*0Sstevel@tonic-gate 	{0xa8,0},     {0,0},        {0xc3,'H'},   {0xa7,0},
947*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xc7,'I'},   {0xcb,'S'},   {0xc6,'G'},
948*0Sstevel@tonic-gate 	{0xc3,'J'},   {0xff,0},     {0,0},        {0xc7,'Z'},
949*0Sstevel@tonic-gate 	{0xb0,0},     {0xf4,0},     {0xb2,0},     {0xb3,0},
950*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xc3,'h'},   {0xb7,0},
951*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xf5,0},     {0xcb,'s'},   {0xc6,'g'},
952*0Sstevel@tonic-gate 	{0xc3,'j'},   {0xbd,0},     {0,0},        {0xc7,'z'},
953*0Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0,0},
954*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xc7,'C'},   {0xc3,'C'},   {0xcb,'C'},
955*0Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
956*0Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
957*0Sstevel@tonic-gate 	{0,0},        {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
958*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc7,'G'},   {0xc8,'O'},   {0xb4,0},
959*0Sstevel@tonic-gate 	{0xc3,'G'},   {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
960*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc6,'U'},   {0xc3,'S'},   {0xfb,0},
961*0Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0,0},
962*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xc7,'c'},   {0xc3,'c'},   {0xcb,'c'},
963*0Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xc3,'e'},   {0xc8,'e'},
964*0Sstevel@tonic-gate 	{0xc1,'i'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
965*0Sstevel@tonic-gate 	{0,0},        {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
966*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc7,'g'},   {0xc8,'o'},   {0xb8,0},
967*0Sstevel@tonic-gate 	{0xc3,'g'},   {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
968*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc6,'u'},   {0xc3,'s'},   {0xc7,ALONE}
969*0Sstevel@tonic-gate };
970*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
971*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
972*0Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xf0,0},     {0xcb,'R'},
973*0Sstevel@tonic-gate 	{0xa8,0},     {0xc4,'I'},   {0xcb,'L'},   {0xa7,0},
974*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xcf,'S'},   {0xc5,'E'},   {0xcb,'G'},
975*0Sstevel@tonic-gate 	{0xed,0},     {0xff,0},     {0xcf,'Z'},   {0xc5,ALONE},
976*0Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xce,ALONE}, {0xcb,'r'},
977*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xc4,'i'},   {0xcb,'l'},   {0xcf,ALONE},
978*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xcf,'s'},   {0xc5,'e'},   {0xcb,'g'},
979*0Sstevel@tonic-gate 	{0xfd,0},     {0xee,0},     {0xcf,'z'},   {0xfe,0},
980*0Sstevel@tonic-gate 	{0xc5,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
981*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xce,'I'},
982*0Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
983*0Sstevel@tonic-gate 	{0xc7,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xc5,'I'},
984*0Sstevel@tonic-gate 	{0xe2,0},     {0xcb,'N'},   {0xc5,'O'},   {0xcb,'K'},
985*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
986*0Sstevel@tonic-gate 	{0xe9,0},     {0xce,'U'},   {0xc2,'U'},   {0xc3,'U'},
987*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc4,'U'},   {0xc5,'U'},   {0xfb,0},
988*0Sstevel@tonic-gate 	{0xc5,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
989*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xce,'i'},
990*0Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
991*0Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc5,'i'},
992*0Sstevel@tonic-gate 	{0xf2,0},     {0xcb,'n'},   {0xc5,'o'},   {0xcb,'k'},
993*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
994*0Sstevel@tonic-gate 	{0xf9,0},     {0xce,'u'},   {0xc2,'u'},   {0xc3,'u'},
995*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc4,'u'},   {0xc5,'u'},   {0xc7,ALONE}
996*0Sstevel@tonic-gate };
997*0Sstevel@tonic-gate #elif (ISO_8859 == 9)
998*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
999*0Sstevel@tonic-gate 	{0xa0,0},     {0xa1,0},     {0xa2,0},     {0xa3,0},
1000*0Sstevel@tonic-gate 	{0xa8,0},     {0xa5,0},     {0xd7,0},     {0xa7,0},
1001*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xd3,0},     {0xe3,0},     {0xab,0},
1002*0Sstevel@tonic-gate 	{0xd6,0},     {0xff,0},     {0xd2,0},     {0xc5,ALONE},
1003*0Sstevel@tonic-gate 	{0xb0,0},     {0xb1,0},     {0xb2,0},     {0xb3,0},
1004*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xb6,0},     {0xb7,0},
1005*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xd1,0},     {0xeb,0},     {0xbb,0},
1006*0Sstevel@tonic-gate 	{0xbc,0},     {0xbd,0},     {0xbe,0},     {0xbf,0},
1007*0Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
1008*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xcb,'C'},
1009*0Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
1010*0Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
1011*0Sstevel@tonic-gate 	{0xc6,'G'},   {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
1012*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
1013*0Sstevel@tonic-gate 	{0xe9,0},     {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
1014*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc7,'I'},   {0xcb,'S'},   {0xfb,0},
1015*0Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
1016*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xcb,'c'},
1017*0Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
1018*0Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc5,'i'},
1019*0Sstevel@tonic-gate 	{0xc6,'g'},   {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
1020*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
1021*0Sstevel@tonic-gate 	{0xf9,0},     {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
1022*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xf5,0},     {0xcb,'s'},   {0xc8,'y'}
1023*0Sstevel@tonic-gate };
1024*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
1025*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
1026*0Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xc5,'E'},   {0xcb,'G'},
1027*0Sstevel@tonic-gate 	{0xc5,'I'},   {0xc4,'I'},   {0xcb,'K'},   {0xa7,0},
1028*0Sstevel@tonic-gate 	{0xcb,'L'},   {0xe2,0},     {0xcf,'S'},   {0xed,0},
1029*0Sstevel@tonic-gate 	{0xcf,'Z'},   {0xff,0},     {0xc5,'U'},   {0xee,0},
1030*0Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xc5,'e'},   {0xcb,'g'},
1031*0Sstevel@tonic-gate 	{0xc5,'i'},   {0xc4,'i'},   {0xcb,'k'},   {0xb7,0},
1032*0Sstevel@tonic-gate 	{0xcb,'l'},   {0xf2,0},     {0xcf,'s'},   {0xfd,0},
1033*0Sstevel@tonic-gate 	{0xcf,'z'},   {0xd0,0},     {0xc5,'u'},   {0xfe,0},
1034*0Sstevel@tonic-gate 	{0xc5,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
1035*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xce,'I'},
1036*0Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
1037*0Sstevel@tonic-gate 	{0xc7,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
1038*0Sstevel@tonic-gate 	{0,0},        {0xcb,'N'},   {0xc5,'O'},   {0xc2,'O'},
1039*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xc4,'U'},
1040*0Sstevel@tonic-gate 	{0xe9,0},     {0xce,'U'},   {0xc2,'U'},   {0xc3,'U'},
1041*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xec,0},     {0xfb,0},
1042*0Sstevel@tonic-gate 	{0xc5,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
1043*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xce,'i'},
1044*0Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
1045*0Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
1046*0Sstevel@tonic-gate 	{0xf3,0},     {0xcb,'n'},   {0xc5,'o'},   {0xc2,'o'},
1047*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xc4,'u'},
1048*0Sstevel@tonic-gate 	{0xf9,0},     {0xce,'u'},   {0xc2,'u'},   {0xc3,'u'},
1049*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xfc,0},     {0xf0,0}
1050*0Sstevel@tonic-gate };
1051*0Sstevel@tonic-gate #endif
1052*0Sstevel@tonic-gate 
1053*0Sstevel@tonic-gate 
1054*0Sstevel@tonic-gate static Byte *
1055*0Sstevel@tonic-gate c_to_hh( Byte *o, Byte c )
1056*0Sstevel@tonic-gate {
1057*0Sstevel@tonic-gate   Byte n;
1058*0Sstevel@tonic-gate 
1059*0Sstevel@tonic-gate   *o++ = '{'; *o++ = 'x';
1060*0Sstevel@tonic-gate   n = c >> 4;
1061*0Sstevel@tonic-gate   *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1062*0Sstevel@tonic-gate   n = c & 0x0F;
1063*0Sstevel@tonic-gate   *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1064*0Sstevel@tonic-gate   *o++ = '}';
1065*0Sstevel@tonic-gate   return o;
1066*0Sstevel@tonic-gate }
1067*0Sstevel@tonic-gate 
1068*0Sstevel@tonic-gate 
1069*0Sstevel@tonic-gate static Byte *
1070*0Sstevel@tonic-gate c_to_cc( Byte *o, Couple *cc, Byte c )
1071*0Sstevel@tonic-gate {
1072*0Sstevel@tonic-gate   if ( (*cc).a != 0 ) {
1073*0Sstevel@tonic-gate     if ( (*cc).b == 0 )
1074*0Sstevel@tonic-gate       *o++ = (*cc).a;
1075*0Sstevel@tonic-gate     else {
1076*0Sstevel@tonic-gate       *o++ = '{';
1077*0Sstevel@tonic-gate       *o++ = (*cc).a;
1078*0Sstevel@tonic-gate       *o++ = (*cc).b;
1079*0Sstevel@tonic-gate       *o++ = '}';
1080*0Sstevel@tonic-gate     }
1081*0Sstevel@tonic-gate     return o;
1082*0Sstevel@tonic-gate   }
1083*0Sstevel@tonic-gate   else
1084*0Sstevel@tonic-gate     return c_to_hh( o, c );
1085*0Sstevel@tonic-gate }
1086*0Sstevel@tonic-gate 
1087*0Sstevel@tonic-gate /* --- routine to convert from T.61 to ISO 8859-n --- */
1088*0Sstevel@tonic-gate 
1089*0Sstevel@tonic-gate int
1090*0Sstevel@tonic-gate ldap_t61_to_8859( char **bufp, unsigned int *buflenp, int free_input )
1091*0Sstevel@tonic-gate {
1092*0Sstevel@tonic-gate   Byte		*s, *oo, *o;
1093*0Sstevel@tonic-gate   unsigned int  n;
1094*0Sstevel@tonic-gate   int           c;
1095*0Sstevel@tonic-gate   unsigned int len;
1096*0Sstevel@tonic-gate   Couple        *cc;
1097*0Sstevel@tonic-gate 
1098*0Sstevel@tonic-gate   Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 111, "ldap_t61_to_8859 input length: %ld\n"),
1099*0Sstevel@tonic-gate 	*buflenp, 0, 0 );
1100*0Sstevel@tonic-gate 
1101*0Sstevel@tonic-gate   len = *buflenp;
1102*0Sstevel@tonic-gate   s = (Byte *) *bufp;
1103*0Sstevel@tonic-gate 
1104*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) {
1105*0Sstevel@tonic-gate         return( 1 );
1106*0Sstevel@tonic-gate   }
1107*0Sstevel@tonic-gate 
1108*0Sstevel@tonic-gate   while ( (char *)s - *(char **)bufp < len ) {
1109*0Sstevel@tonic-gate     switch ( *s >> 4 ) {
1110*0Sstevel@tonic-gate 
1111*0Sstevel@tonic-gate     case 0xA: case 0xB:
1112*0Sstevel@tonic-gate       o = c_to_cc( o, &trans_t61a_iso8859[ *s - 0xA0 ], *s );
1113*0Sstevel@tonic-gate       s++;
1114*0Sstevel@tonic-gate       break;
1115*0Sstevel@tonic-gate 
1116*0Sstevel@tonic-gate     case 0xD: case 0xE: case 0xF:
1117*0Sstevel@tonic-gate       o = c_to_cc( o, &trans_t61b_iso8859[ *s - 0xD0 ], *s );
1118*0Sstevel@tonic-gate       s++;
1119*0Sstevel@tonic-gate       break;
1120*0Sstevel@tonic-gate 
1121*0Sstevel@tonic-gate     case 0xC:
1122*0Sstevel@tonic-gate       if ( (*s == 0xC0) || (*s == 0xC9) || (*s == 0xCC) ) {
1123*0Sstevel@tonic-gate         o = c_to_hh( o, *s++ );
1124*0Sstevel@tonic-gate         break;
1125*0Sstevel@tonic-gate       }
1126*0Sstevel@tonic-gate 
1127*0Sstevel@tonic-gate       n = (*s++) - 0xC0;
1128*0Sstevel@tonic-gate       switch ( *s ) {
1129*0Sstevel@tonic-gate 
1130*0Sstevel@tonic-gate       case 'A':  c = letter_w_diacritic[n][0]; break;
1131*0Sstevel@tonic-gate       case 'C':  c = letter_w_diacritic[n][1]; break;
1132*0Sstevel@tonic-gate       case 'D':  c = letter_w_diacritic[n][2]; break;
1133*0Sstevel@tonic-gate       case 'E':  c = letter_w_diacritic[n][3]; break;
1134*0Sstevel@tonic-gate       case 'G':  c = letter_w_diacritic[n][4]; break;
1135*0Sstevel@tonic-gate       case 'H':  c = letter_w_diacritic[n][5]; break;
1136*0Sstevel@tonic-gate       case 'I':  c = letter_w_diacritic[n][6]; break;
1137*0Sstevel@tonic-gate       case 'J':  c = letter_w_diacritic[n][7]; break;
1138*0Sstevel@tonic-gate       case 'K':  c = letter_w_diacritic[n][8]; break;
1139*0Sstevel@tonic-gate       case 'L':  c = letter_w_diacritic[n][9]; break;
1140*0Sstevel@tonic-gate       case 'N':  c = letter_w_diacritic[n][10]; break;
1141*0Sstevel@tonic-gate       case 'O':  c = letter_w_diacritic[n][11]; break;
1142*0Sstevel@tonic-gate       case 'R':  c = letter_w_diacritic[n][12]; break;
1143*0Sstevel@tonic-gate       case 'S':  c = letter_w_diacritic[n][13]; break;
1144*0Sstevel@tonic-gate       case 'T':  c = letter_w_diacritic[n][14]; break;
1145*0Sstevel@tonic-gate       case 'U':  c = letter_w_diacritic[n][15]; break;
1146*0Sstevel@tonic-gate       case 'W':  c = letter_w_diacritic[n][16]; break;
1147*0Sstevel@tonic-gate       case 'Y':  c = letter_w_diacritic[n][17]; break;
1148*0Sstevel@tonic-gate       case 'Z':  c = letter_w_diacritic[n][18]; break;
1149*0Sstevel@tonic-gate 
1150*0Sstevel@tonic-gate       case 'a':  c = letter_w_diacritic[n][19]; break;
1151*0Sstevel@tonic-gate       case 'c':  c = letter_w_diacritic[n][20]; break;
1152*0Sstevel@tonic-gate       case 'd':  c = letter_w_diacritic[n][21]; break;
1153*0Sstevel@tonic-gate       case 'e':  c = letter_w_diacritic[n][22]; break;
1154*0Sstevel@tonic-gate       case 'g':  c = letter_w_diacritic[n][23]; break;
1155*0Sstevel@tonic-gate       case 'h':  c = letter_w_diacritic[n][24]; break;
1156*0Sstevel@tonic-gate       case 'i':  c = letter_w_diacritic[n][25]; break;
1157*0Sstevel@tonic-gate       case 'j':  c = letter_w_diacritic[n][26]; break;
1158*0Sstevel@tonic-gate       case 'k':  c = letter_w_diacritic[n][27]; break;
1159*0Sstevel@tonic-gate       case 'l':  c = letter_w_diacritic[n][28]; break;
1160*0Sstevel@tonic-gate       case 'n':  c = letter_w_diacritic[n][29]; break;
1161*0Sstevel@tonic-gate       case 'o':  c = letter_w_diacritic[n][30]; break;
1162*0Sstevel@tonic-gate       case 'r':  c = letter_w_diacritic[n][31]; break;
1163*0Sstevel@tonic-gate       case 's':  c = letter_w_diacritic[n][32]; break;
1164*0Sstevel@tonic-gate       case 't':  c = letter_w_diacritic[n][33]; break;
1165*0Sstevel@tonic-gate       case 'u':  c = letter_w_diacritic[n][34]; break;
1166*0Sstevel@tonic-gate       case 'w':  c = letter_w_diacritic[n][35]; break;
1167*0Sstevel@tonic-gate       case 'y':  c = letter_w_diacritic[n][36]; break;
1168*0Sstevel@tonic-gate       case 'z':  c = letter_w_diacritic[n][37]; break;
1169*0Sstevel@tonic-gate 
1170*0Sstevel@tonic-gate       case ALONE:  c = (( !diacritic[n].b ) ? diacritic[n].a : -1);
1171*0Sstevel@tonic-gate                    break;
1172*0Sstevel@tonic-gate 
1173*0Sstevel@tonic-gate       default:   c = 0;
1174*0Sstevel@tonic-gate       }
1175*0Sstevel@tonic-gate 
1176*0Sstevel@tonic-gate       if ( c > 0 ) {
1177*0Sstevel@tonic-gate         *o++ = c;  s++;
1178*0Sstevel@tonic-gate       } else {
1179*0Sstevel@tonic-gate         *o++ = '{';
1180*0Sstevel@tonic-gate         if ( c == -1 ) {
1181*0Sstevel@tonic-gate           *o++ = ( ( *s == ALONE ) ? ' ' : *s );
1182*0Sstevel@tonic-gate           s++;
1183*0Sstevel@tonic-gate         } else {
1184*0Sstevel@tonic-gate           *o++ = '"';
1185*0Sstevel@tonic-gate         }
1186*0Sstevel@tonic-gate         *o++ = diacritic[n].a;
1187*0Sstevel@tonic-gate         *o++ = '}';
1188*0Sstevel@tonic-gate       }
1189*0Sstevel@tonic-gate       break;
1190*0Sstevel@tonic-gate 
1191*0Sstevel@tonic-gate #if (ISO_8859 == 0)
1192*0Sstevel@tonic-gate     case 0x8: case 0x9:
1193*0Sstevel@tonic-gate       *o++ = 0x1B; /* <ESC> */
1194*0Sstevel@tonic-gate       *o++ = *s++ - 0x40;
1195*0Sstevel@tonic-gate       break;
1196*0Sstevel@tonic-gate #endif
1197*0Sstevel@tonic-gate 
1198*0Sstevel@tonic-gate       default:
1199*0Sstevel@tonic-gate         *o++ = *s++;
1200*0Sstevel@tonic-gate     }
1201*0Sstevel@tonic-gate   }
1202*0Sstevel@tonic-gate 
1203*0Sstevel@tonic-gate   len = o - oo;
1204*0Sstevel@tonic-gate   o = oo;
1205*0Sstevel@tonic-gate 
1206*0Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, len )) == NULL ) {
1207*0Sstevel@tonic-gate     free( o );
1208*0Sstevel@tonic-gate     return( 1 );
1209*0Sstevel@tonic-gate   }
1210*0Sstevel@tonic-gate 
1211*0Sstevel@tonic-gate   if ( free_input ) {
1212*0Sstevel@tonic-gate     free( *bufp );
1213*0Sstevel@tonic-gate   }
1214*0Sstevel@tonic-gate   *bufp = (char *) oo;
1215*0Sstevel@tonic-gate   *buflenp = len;
1216*0Sstevel@tonic-gate   return( 0 );
1217*0Sstevel@tonic-gate }
1218*0Sstevel@tonic-gate 
1219*0Sstevel@tonic-gate 
1220*0Sstevel@tonic-gate static int
1221*0Sstevel@tonic-gate hh_to_c( Byte *h )
1222*0Sstevel@tonic-gate {
1223*0Sstevel@tonic-gate   Byte c;
1224*0Sstevel@tonic-gate 
1225*0Sstevel@tonic-gate   if ( (*h >= '0') && (*h <= '9') )      c = *h++ - '0';
1226*0Sstevel@tonic-gate   else if ( (*h >= 'A') && (*h <= 'F') ) c = *h++ - 'A' + 10;
1227*0Sstevel@tonic-gate   else if ( (*h >= 'a') && (*h <= 'f') ) c = *h++ - 'a' + 10;
1228*0Sstevel@tonic-gate   else return -1;
1229*0Sstevel@tonic-gate 
1230*0Sstevel@tonic-gate   c <<= 4;
1231*0Sstevel@tonic-gate 
1232*0Sstevel@tonic-gate   if ( (*h >= '0') && (*h <= '9') )      c |= *h - '0';
1233*0Sstevel@tonic-gate   else if ( (*h >= 'A') && (*h <= 'F') ) c |= *h - 'A' + 10;
1234*0Sstevel@tonic-gate   else if ( (*h >= 'a') && (*h <= 'f') ) c |= *h - 'a' + 10;
1235*0Sstevel@tonic-gate   else return -1;
1236*0Sstevel@tonic-gate 
1237*0Sstevel@tonic-gate   return c;
1238*0Sstevel@tonic-gate }
1239*0Sstevel@tonic-gate 
1240*0Sstevel@tonic-gate 
1241*0Sstevel@tonic-gate static Byte *
1242*0Sstevel@tonic-gate cc_to_t61( Byte *o, Byte *s )
1243*0Sstevel@tonic-gate {
1244*0Sstevel@tonic-gate   int n, c = 0;
1245*0Sstevel@tonic-gate 
1246*0Sstevel@tonic-gate   switch ( *(s + 1) ) {
1247*0Sstevel@tonic-gate 
1248*0Sstevel@tonic-gate   case '`':  c = -1;   break;    /* <grave-accent> */
1249*0Sstevel@tonic-gate 
1250*0Sstevel@tonic-gate   case '!':
1251*0Sstevel@tonic-gate     switch ( *s ) {
1252*0Sstevel@tonic-gate     case '!':  c = 0x7C;  break;  /* <vertical-line> */
1253*0Sstevel@tonic-gate     case '(':  c = 0x7B;  break;  /* <left-curly-bracket> */
1254*0Sstevel@tonic-gate     case '-':  c = 0xAD;  break;  /* <upwards-arrow> */
1255*0Sstevel@tonic-gate     default:   c = -1;            /* <grave-accent> */
1256*0Sstevel@tonic-gate     }
1257*0Sstevel@tonic-gate     break;
1258*0Sstevel@tonic-gate 
1259*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1260*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
1261*0Sstevel@tonic-gate   case 0xB4:
1262*0Sstevel@tonic-gate #endif
1263*0Sstevel@tonic-gate   case '\'': c = -2;  break;    /* <acute-accent> */
1264*0Sstevel@tonic-gate 
1265*0Sstevel@tonic-gate   case '^':  c = -3;  break;    /* <circumflex-acent> */
1266*0Sstevel@tonic-gate 
1267*0Sstevel@tonic-gate   case '>':
1268*0Sstevel@tonic-gate     switch ( *s ) {
1269*0Sstevel@tonic-gate     case ')':  c = 0x5D;  break;  /* <right-square-bracket> */
1270*0Sstevel@tonic-gate     case '>':  c = 0xBB;  break;  /* <right-angle-quotation> */
1271*0Sstevel@tonic-gate     case '-':  c = 0xAE;  break;  /* <rightwards-arrow> */
1272*0Sstevel@tonic-gate     default:   c = -3;            /* <circumflex-acent> */
1273*0Sstevel@tonic-gate     }
1274*0Sstevel@tonic-gate     break;
1275*0Sstevel@tonic-gate 
1276*0Sstevel@tonic-gate   case '~':
1277*0Sstevel@tonic-gate   case '?':  c = -4;  break;        /* <tilde> */
1278*0Sstevel@tonic-gate 
1279*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 4) || (ISO_8859 == 9)
1280*0Sstevel@tonic-gate   case 0xAF:  c = -5;  break;       /* <macron> */
1281*0Sstevel@tonic-gate #endif
1282*0Sstevel@tonic-gate 
1283*0Sstevel@tonic-gate   case '-':
1284*0Sstevel@tonic-gate     switch ( *s ) {
1285*0Sstevel@tonic-gate     case '-':  c = 0xFF; break; /* <soft-hyphen> */
1286*0Sstevel@tonic-gate     case '<':  c = 0xAC; break; /* <leftwards arrow> */
1287*0Sstevel@tonic-gate     case '+':  c = 0xB1; break; /* <plus-minus> */
1288*0Sstevel@tonic-gate     case 'd':  c = 0xF3; break; /* <eth> */
1289*0Sstevel@tonic-gate     default:   c = -5;          /* <macron> */
1290*0Sstevel@tonic-gate     }
1291*0Sstevel@tonic-gate     break;
1292*0Sstevel@tonic-gate 
1293*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 3)
1294*0Sstevel@tonic-gate   case 0xA2:  c = -6;  break;            /* <breve> */
1295*0Sstevel@tonic-gate #endif
1296*0Sstevel@tonic-gate 
1297*0Sstevel@tonic-gate   case '(':
1298*0Sstevel@tonic-gate     if ( *s == '<' ) c = 0x5B;  /* <left-square-bracket> */
1299*0Sstevel@tonic-gate     else             c = -6;    /* <breve> */
1300*0Sstevel@tonic-gate     break;
1301*0Sstevel@tonic-gate 
1302*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 3) || (ISO_8859 == 4)
1303*0Sstevel@tonic-gate   case 0xFF:  c = -7;  break;    /* <dot-accent> */
1304*0Sstevel@tonic-gate #endif
1305*0Sstevel@tonic-gate 
1306*0Sstevel@tonic-gate   case '.':
1307*0Sstevel@tonic-gate     switch ( *s ) {
1308*0Sstevel@tonic-gate     case 'i':  c = 0xF5; break; /* <dotless-i> */
1309*0Sstevel@tonic-gate     case 'L':  c = 0xE7; break; /* <L-middle-dot> */
1310*0Sstevel@tonic-gate     case 'l':  c = 0xF7; break; /* <l-middle-dot> */
1311*0Sstevel@tonic-gate     default:   c = -7;          /* <dot-accent> */
1312*0Sstevel@tonic-gate     }
1313*0Sstevel@tonic-gate     break;
1314*0Sstevel@tonic-gate 
1315*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1316*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
1317*0Sstevel@tonic-gate   case 0xA8:  c = -8; break; /* <diaeresis> */
1318*0Sstevel@tonic-gate #endif
1319*0Sstevel@tonic-gate 
1320*0Sstevel@tonic-gate   case ':':
1321*0Sstevel@tonic-gate     if ( *s == '-')  c = 0xB8; /* <division-sign> */
1322*0Sstevel@tonic-gate     else             c = -8;   /* <diaeresis> */
1323*0Sstevel@tonic-gate     break;
1324*0Sstevel@tonic-gate 
1325*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1326*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10)
1327*0Sstevel@tonic-gate   case 0xB0:
1328*0Sstevel@tonic-gate #endif
1329*0Sstevel@tonic-gate   case '0':  c = -10;  break;  /* <ring-above> */
1330*0Sstevel@tonic-gate 
1331*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1332*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
1333*0Sstevel@tonic-gate   case 0xB8:
1334*0Sstevel@tonic-gate #endif
1335*0Sstevel@tonic-gate   case ',':  c = -11; break; /* <cedilla> */
1336*0Sstevel@tonic-gate 
1337*0Sstevel@tonic-gate #if (ISO_8859 == 2)
1338*0Sstevel@tonic-gate   case 0xBD:
1339*0Sstevel@tonic-gate #endif
1340*0Sstevel@tonic-gate   case '"':  c = -13; break; /* <double-acute-accent> */
1341*0Sstevel@tonic-gate 
1342*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 4)
1343*0Sstevel@tonic-gate   case 0xB2:
1344*0Sstevel@tonic-gate #endif
1345*0Sstevel@tonic-gate   case ';':  c = -14; break; /* <ogonek> */
1346*0Sstevel@tonic-gate 
1347*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 4)
1348*0Sstevel@tonic-gate   case 0xB7:  c = -15;  break;  /* <caron> */
1349*0Sstevel@tonic-gate #endif
1350*0Sstevel@tonic-gate 
1351*0Sstevel@tonic-gate   case ')':
1352*0Sstevel@tonic-gate     if ( *s == '!' )  c = 0x7D;  /* <left-curly-bracket> */
1353*0Sstevel@tonic-gate     break;
1354*0Sstevel@tonic-gate 
1355*0Sstevel@tonic-gate   case '<':
1356*0Sstevel@tonic-gate     if ( *s == '<' )  c = 0xAB;  /* <left-angle-quotation> */
1357*0Sstevel@tonic-gate     else              c = -15;   /* <caron> */
1358*0Sstevel@tonic-gate     break;
1359*0Sstevel@tonic-gate 
1360*0Sstevel@tonic-gate   case '/':
1361*0Sstevel@tonic-gate     switch ( *s ) {
1362*0Sstevel@tonic-gate     case '/':  c = 0x5C; break; /* <reverse-solidus> */
1363*0Sstevel@tonic-gate     case 'D':  c = 0xE2; break; /* <D-stroke> */
1364*0Sstevel@tonic-gate     case 'd':  c = 0xF2; break; /* <d-stroke> */
1365*0Sstevel@tonic-gate     case 'H':  c = 0xE4; break; /* <H-stroke> */
1366*0Sstevel@tonic-gate     case 'h':  c = 0xF4; break; /* <h-stroke> */
1367*0Sstevel@tonic-gate     case 'L':  c = 0xE8; break; /* <L-stroke> */
1368*0Sstevel@tonic-gate     case 'l':  c = 0xF8; break; /* <l-stroke> */
1369*0Sstevel@tonic-gate     case 'O':  c = 0xE9; break; /* <O-stroke> */
1370*0Sstevel@tonic-gate     case 'o':  c = 0xF9; break; /* <o-stroke> */
1371*0Sstevel@tonic-gate     case 'T':  c = 0xED; break; /* <T-stroke> */
1372*0Sstevel@tonic-gate     case 't':  c = 0xFD; break; /* <t-stroke> */
1373*0Sstevel@tonic-gate     }
1374*0Sstevel@tonic-gate     break;
1375*0Sstevel@tonic-gate 
1376*0Sstevel@tonic-gate   case '2':
1377*0Sstevel@tonic-gate     if ( *s == '1' )  c = 0xBD;    /* <one-half> */
1378*0Sstevel@tonic-gate     break;
1379*0Sstevel@tonic-gate 
1380*0Sstevel@tonic-gate   case '4':
1381*0Sstevel@tonic-gate     switch ( *s ) {
1382*0Sstevel@tonic-gate     case '1':  c = 0xBC; break; /* <one-quarter> */
1383*0Sstevel@tonic-gate     case '3':  c = 0xBE; break; /* <three-quarters> */
1384*0Sstevel@tonic-gate     }
1385*0Sstevel@tonic-gate     break;
1386*0Sstevel@tonic-gate 
1387*0Sstevel@tonic-gate   case '6':
1388*0Sstevel@tonic-gate     switch ( *s ) {
1389*0Sstevel@tonic-gate     case '\'': c = 0xA9; break; /* <left-single-quotation> */
1390*0Sstevel@tonic-gate     case '"':  c = 0xAA; break; /* <left-double-quotation> */
1391*0Sstevel@tonic-gate     }
1392*0Sstevel@tonic-gate     break;
1393*0Sstevel@tonic-gate 
1394*0Sstevel@tonic-gate   case '8':
1395*0Sstevel@tonic-gate     switch ( *s ) {
1396*0Sstevel@tonic-gate     case '1':  c = 0xDC; break; /* <one-eighth> */
1397*0Sstevel@tonic-gate     case '3':  c = 0xDD; break; /* <three-eighths> */
1398*0Sstevel@tonic-gate     case '5':  c = 0xDE; break; /* <five-eighths> */
1399*0Sstevel@tonic-gate     case '7':  c = 0xDF; break; /* <seven-eighths> */
1400*0Sstevel@tonic-gate     case 'M':  c = 0xD5; break; /* <eighth-note> */
1401*0Sstevel@tonic-gate     }
1402*0Sstevel@tonic-gate     break;
1403*0Sstevel@tonic-gate 
1404*0Sstevel@tonic-gate   case '9':
1405*0Sstevel@tonic-gate     switch ( *s ) {
1406*0Sstevel@tonic-gate     case '\'': c = 0xB9; break; /* <right-single-quotation> */
1407*0Sstevel@tonic-gate     case '"':  c = 0xBA; break; /* <right-double-quotation> */
1408*0Sstevel@tonic-gate     }
1409*0Sstevel@tonic-gate     break;
1410*0Sstevel@tonic-gate 
1411*0Sstevel@tonic-gate   case 'A':
1412*0Sstevel@tonic-gate     if ( *s == 'A' )  c = -10;  /* <ring-above> + <A> */
1413*0Sstevel@tonic-gate     break;
1414*0Sstevel@tonic-gate 
1415*0Sstevel@tonic-gate   case 'a':
1416*0Sstevel@tonic-gate     switch ( *s ) {
1417*0Sstevel@tonic-gate     case '-':  c = 0xE3; break; /* <femenine-ordinal-a> */
1418*0Sstevel@tonic-gate     case 'a':  c = -10;  break; /* <ring-above> + <a> */
1419*0Sstevel@tonic-gate     }
1420*0Sstevel@tonic-gate     break;
1421*0Sstevel@tonic-gate 
1422*0Sstevel@tonic-gate   case 'B':
1423*0Sstevel@tonic-gate     if ( *s == 'B' )  c = 0xD7; /* <broken-bar> */
1424*0Sstevel@tonic-gate     break;
1425*0Sstevel@tonic-gate 
1426*0Sstevel@tonic-gate   case 'b':
1427*0Sstevel@tonic-gate     if ( *s == 'N' )  c = 0xA6;  /* <number-sign> */
1428*0Sstevel@tonic-gate     break;
1429*0Sstevel@tonic-gate 
1430*0Sstevel@tonic-gate   case 'd':
1431*0Sstevel@tonic-gate     if ( *s == 'P' )  c = 0xA3;  /* <pound-sign> */
1432*0Sstevel@tonic-gate     break;
1433*0Sstevel@tonic-gate 
1434*0Sstevel@tonic-gate   case 'E':
1435*0Sstevel@tonic-gate     switch ( *s ) {
1436*0Sstevel@tonic-gate     case 'S':  c = 0xA7; break; /* <section-sign> */
1437*0Sstevel@tonic-gate     case 'A':  c = 0xE1; break; /* <AE> */
1438*0Sstevel@tonic-gate     case 'O':  c = 0xEA; break; /* <OE> */
1439*0Sstevel@tonic-gate     }
1440*0Sstevel@tonic-gate     break;
1441*0Sstevel@tonic-gate 
1442*0Sstevel@tonic-gate   case 'e':
1443*0Sstevel@tonic-gate     switch ( *s ) {
1444*0Sstevel@tonic-gate     case 'a':  c = 0xF1; break; /* <ae> */
1445*0Sstevel@tonic-gate     case 'o':  c = 0xFA; break; /* <oe> */
1446*0Sstevel@tonic-gate     case 'Y':  c = 0xA5;  break;  /* <yen-sign> */
1447*0Sstevel@tonic-gate     }
1448*0Sstevel@tonic-gate     break;
1449*0Sstevel@tonic-gate 
1450*0Sstevel@tonic-gate   case 'G':
1451*0Sstevel@tonic-gate     switch ( *s ) {
1452*0Sstevel@tonic-gate     case 'D':  c = 0xB0; break; /* <degree-sign> */
1453*0Sstevel@tonic-gate     case 'N':  c = 0xEE; break; /* <Eng> */
1454*0Sstevel@tonic-gate     }
1455*0Sstevel@tonic-gate     break;
1456*0Sstevel@tonic-gate 
1457*0Sstevel@tonic-gate   case 'g':
1458*0Sstevel@tonic-gate     switch ( *s ) {
1459*0Sstevel@tonic-gate     case 'R':  c = 0xD2; break;  /* <registered-sign> */
1460*0Sstevel@tonic-gate     case 'n':  c = 0xFE; break; /* <eng> */
1461*0Sstevel@tonic-gate     }
1462*0Sstevel@tonic-gate     break;
1463*0Sstevel@tonic-gate 
1464*0Sstevel@tonic-gate   case 'H':
1465*0Sstevel@tonic-gate     if ( *s == 'T' )  c = 0xEC;  /* <Thorn> */
1466*0Sstevel@tonic-gate     break;
1467*0Sstevel@tonic-gate 
1468*0Sstevel@tonic-gate   case 'h':
1469*0Sstevel@tonic-gate     if ( *s == 't' )  c = 0xFC; /* <thorn> */
1470*0Sstevel@tonic-gate     break;
1471*0Sstevel@tonic-gate 
1472*0Sstevel@tonic-gate   case 'I':
1473*0Sstevel@tonic-gate     switch ( *s ) {
1474*0Sstevel@tonic-gate     case 'P':  c = 0xB6; break;  /* <pilcrow-sign> */
1475*0Sstevel@tonic-gate     case '!':  c = 0xA1; break; /* <inverted-exclamation> */
1476*0Sstevel@tonic-gate     case '?':  c = 0xBF; break; /* <inverted-question> */
1477*0Sstevel@tonic-gate     }
1478*0Sstevel@tonic-gate     break;
1479*0Sstevel@tonic-gate 
1480*0Sstevel@tonic-gate   case 'J':
1481*0Sstevel@tonic-gate     if ( *s == 'I' )  c = 0xE6; /* <IJ> */
1482*0Sstevel@tonic-gate     break;
1483*0Sstevel@tonic-gate 
1484*0Sstevel@tonic-gate   case 'j':
1485*0Sstevel@tonic-gate     if ( *s == 'i' )  c = 0xF6;  /* <ij> */
1486*0Sstevel@tonic-gate     break;
1487*0Sstevel@tonic-gate 
1488*0Sstevel@tonic-gate   case 'k':
1489*0Sstevel@tonic-gate     if ( *s == 'k' )  c = 0xF0; /* <kra> */
1490*0Sstevel@tonic-gate     break;
1491*0Sstevel@tonic-gate 
1492*0Sstevel@tonic-gate   case 'M':
1493*0Sstevel@tonic-gate     switch ( *s ) {
1494*0Sstevel@tonic-gate     case '.':  c = 0xB7; break; /* <middle-dot> */
1495*0Sstevel@tonic-gate     case '-':  c = 0xD0; break; /* <em-dash> */
1496*0Sstevel@tonic-gate     case 'T':  c = 0xD4; break; /* <trade-mark-sign> */
1497*0Sstevel@tonic-gate     }
1498*0Sstevel@tonic-gate     break;
1499*0Sstevel@tonic-gate 
1500*0Sstevel@tonic-gate   case 'm':
1501*0Sstevel@tonic-gate     switch ( *s ) {
1502*0Sstevel@tonic-gate     case '\'':                  /* <macron> RFC 1345 */
1503*0Sstevel@tonic-gate     case ' ':  c = -5;   break; /* <macron> */
1504*0Sstevel@tonic-gate     case 'O':  c = 0xE0; break; /* <Ohm sign> */
1505*0Sstevel@tonic-gate     }
1506*0Sstevel@tonic-gate     break;
1507*0Sstevel@tonic-gate 
1508*0Sstevel@tonic-gate   case 'n':
1509*0Sstevel@tonic-gate     if ( *s == '\'' )  c = 0xEF; /* <n-preceded-by-apostrophe> */
1510*0Sstevel@tonic-gate     break;
1511*0Sstevel@tonic-gate 
1512*0Sstevel@tonic-gate   case 'O':
1513*0Sstevel@tonic-gate     switch ( *s ) {
1514*0Sstevel@tonic-gate     case 'D':  c = 0xA4; break; /* <dollar-sign> */
1515*0Sstevel@tonic-gate     case 'N':  c = 0xD6; break; /* <not-sign> */
1516*0Sstevel@tonic-gate     }
1517*0Sstevel@tonic-gate     break;
1518*0Sstevel@tonic-gate 
1519*0Sstevel@tonic-gate   case 'o':
1520*0Sstevel@tonic-gate     switch ( *s ) {
1521*0Sstevel@tonic-gate     case 'C':  c = 0xD3; break; /* <copyright-sign> */
1522*0Sstevel@tonic-gate     case '-':  c = 0xEB; break; /* <masculine-ordinal-o> */
1523*0Sstevel@tonic-gate     }
1524*0Sstevel@tonic-gate     break;
1525*0Sstevel@tonic-gate 
1526*0Sstevel@tonic-gate   case 'S':
1527*0Sstevel@tonic-gate     switch ( *s ) {
1528*0Sstevel@tonic-gate     case '1':  c = 0xD1; break; /* <superscript-1> */
1529*0Sstevel@tonic-gate     case '2':  c = 0xB2; break; /* <superscript-2> */
1530*0Sstevel@tonic-gate     case '3':  c = 0xB3; break; /* <superscript-3> */
1531*0Sstevel@tonic-gate     case 'N':  c = 0xA0; break; /* <no-break-space> */
1532*0Sstevel@tonic-gate     }
1533*0Sstevel@tonic-gate     break;
1534*0Sstevel@tonic-gate 
1535*0Sstevel@tonic-gate   case 's':
1536*0Sstevel@tonic-gate     if ( *s == 's' )  c = 0xFB; /* <sharp-s> */
1537*0Sstevel@tonic-gate     break;
1538*0Sstevel@tonic-gate 
1539*0Sstevel@tonic-gate   case 't':
1540*0Sstevel@tonic-gate     if ( *s == 'C' )  c = 0xA2; /* <cent-sign> */
1541*0Sstevel@tonic-gate     break;
1542*0Sstevel@tonic-gate 
1543*0Sstevel@tonic-gate   case 'u':
1544*0Sstevel@tonic-gate     if ( *s == 'C' )  c = 0xA8; /* <currency-sign> */
1545*0Sstevel@tonic-gate     break;
1546*0Sstevel@tonic-gate 
1547*0Sstevel@tonic-gate   case 'v':
1548*0Sstevel@tonic-gate     if ( *s == '-' )  c = 0xAF; /* <downwards-arrow> */
1549*0Sstevel@tonic-gate     break;
1550*0Sstevel@tonic-gate 
1551*0Sstevel@tonic-gate   case 'X':
1552*0Sstevel@tonic-gate     if ( *s == '*' )  c = 0xB4; /* <multiplication-sign> */
1553*0Sstevel@tonic-gate     break;
1554*0Sstevel@tonic-gate 
1555*0Sstevel@tonic-gate   case 'y':
1556*0Sstevel@tonic-gate     if ( *s == 'M' )  c = 0xB5; /* <micro-sign> */
1557*0Sstevel@tonic-gate     break;
1558*0Sstevel@tonic-gate   }
1559*0Sstevel@tonic-gate 
1560*0Sstevel@tonic-gate   if ( c > 0 ) {
1561*0Sstevel@tonic-gate     *o++ = c;
1562*0Sstevel@tonic-gate     return o;
1563*0Sstevel@tonic-gate   } else if ( !c )
1564*0Sstevel@tonic-gate     return NULL;
1565*0Sstevel@tonic-gate 
1566*0Sstevel@tonic-gate   /* else: c < 0 */
1567*0Sstevel@tonic-gate   n = -c;
1568*0Sstevel@tonic-gate   switch ( *s ) {
1569*0Sstevel@tonic-gate 
1570*0Sstevel@tonic-gate   case 'A':  c = letter_w_diacritic[n][0]; break;
1571*0Sstevel@tonic-gate   case 'C':  c = letter_w_diacritic[n][1]; break;
1572*0Sstevel@tonic-gate   case 'D':  c = letter_w_diacritic[n][2]; break;
1573*0Sstevel@tonic-gate   case 'E':  c = letter_w_diacritic[n][3]; break;
1574*0Sstevel@tonic-gate   case 'G':  c = letter_w_diacritic[n][4]; break;
1575*0Sstevel@tonic-gate   case 'H':  c = letter_w_diacritic[n][5]; break;
1576*0Sstevel@tonic-gate   case 'I':  c = letter_w_diacritic[n][6]; break;
1577*0Sstevel@tonic-gate   case 'J':  c = letter_w_diacritic[n][7]; break;
1578*0Sstevel@tonic-gate   case 'K':  c = letter_w_diacritic[n][8]; break;
1579*0Sstevel@tonic-gate   case 'L':  c = letter_w_diacritic[n][9]; break;
1580*0Sstevel@tonic-gate   case 'N':  c = letter_w_diacritic[n][10]; break;
1581*0Sstevel@tonic-gate   case 'O':  c = letter_w_diacritic[n][11]; break;
1582*0Sstevel@tonic-gate   case 'R':  c = letter_w_diacritic[n][12]; break;
1583*0Sstevel@tonic-gate   case 'S':  c = letter_w_diacritic[n][13]; break;
1584*0Sstevel@tonic-gate   case 'T':  c = letter_w_diacritic[n][14]; break;
1585*0Sstevel@tonic-gate   case 'U':  c = letter_w_diacritic[n][15]; break;
1586*0Sstevel@tonic-gate   case 'W':  c = letter_w_diacritic[n][16]; break;
1587*0Sstevel@tonic-gate   case 'Y':  c = letter_w_diacritic[n][17]; break;
1588*0Sstevel@tonic-gate   case 'Z':  c = letter_w_diacritic[n][18]; break;
1589*0Sstevel@tonic-gate 
1590*0Sstevel@tonic-gate   case 'a':  c = letter_w_diacritic[n][19]; break;
1591*0Sstevel@tonic-gate   case 'c':  c = letter_w_diacritic[n][20]; break;
1592*0Sstevel@tonic-gate   case 'd':  c = letter_w_diacritic[n][21]; break;
1593*0Sstevel@tonic-gate   case 'e':  c = letter_w_diacritic[n][22]; break;
1594*0Sstevel@tonic-gate   case 'g':  c = letter_w_diacritic[n][23]; break;
1595*0Sstevel@tonic-gate   case 'h':  c = letter_w_diacritic[n][24]; break;
1596*0Sstevel@tonic-gate   case 'i':  c = letter_w_diacritic[n][25]; break;
1597*0Sstevel@tonic-gate   case 'j':  c = letter_w_diacritic[n][26]; break;
1598*0Sstevel@tonic-gate   case 'k':  c = letter_w_diacritic[n][27]; break;
1599*0Sstevel@tonic-gate   case 'l':  c = letter_w_diacritic[n][28]; break;
1600*0Sstevel@tonic-gate   case 'n':  c = letter_w_diacritic[n][29]; break;
1601*0Sstevel@tonic-gate   case 'o':  c = letter_w_diacritic[n][30]; break;
1602*0Sstevel@tonic-gate   case 'r':  c = letter_w_diacritic[n][31]; break;
1603*0Sstevel@tonic-gate   case 's':  c = letter_w_diacritic[n][32]; break;
1604*0Sstevel@tonic-gate   case 't':  c = letter_w_diacritic[n][33]; break;
1605*0Sstevel@tonic-gate   case 'u':  c = letter_w_diacritic[n][34]; break;
1606*0Sstevel@tonic-gate   case 'w':  c = letter_w_diacritic[n][35]; break;
1607*0Sstevel@tonic-gate   case 'y':  c = letter_w_diacritic[n][36]; break;
1608*0Sstevel@tonic-gate   case 'z':  c = letter_w_diacritic[n][37]; break;
1609*0Sstevel@tonic-gate 
1610*0Sstevel@tonic-gate   case '\'':
1611*0Sstevel@tonic-gate   case ' ':  c = -1; break;
1612*0Sstevel@tonic-gate 
1613*0Sstevel@tonic-gate   default:   c = 0;
1614*0Sstevel@tonic-gate   }
1615*0Sstevel@tonic-gate 
1616*0Sstevel@tonic-gate   if ( !c )
1617*0Sstevel@tonic-gate     return NULL;
1618*0Sstevel@tonic-gate 
1619*0Sstevel@tonic-gate   *o++ = n + 0xC0;
1620*0Sstevel@tonic-gate   *o++ = ( ( (*s == ' ') || (*s == '\'') ) ? ALONE : *s );
1621*0Sstevel@tonic-gate   return o;
1622*0Sstevel@tonic-gate }
1623*0Sstevel@tonic-gate 
1624*0Sstevel@tonic-gate 
1625*0Sstevel@tonic-gate /* --- routine to convert from ISO 8859-n to T.61 --- */
1626*0Sstevel@tonic-gate 
1627*0Sstevel@tonic-gate int
1628*0Sstevel@tonic-gate ldap_8859_to_t61( char **bufp, unsigned int *buflenp, int free_input )
1629*0Sstevel@tonic-gate {
1630*0Sstevel@tonic-gate   Byte		*s, *oo, *o, *aux;
1631*0Sstevel@tonic-gate   int		c;
1632*0Sstevel@tonic-gate   unsigned int len;
1633*0Sstevel@tonic-gate   Couple	*cc;
1634*0Sstevel@tonic-gate 
1635*0Sstevel@tonic-gate   Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 112, "ldap_8859_to_t61 input length: %ld\n"),
1636*0Sstevel@tonic-gate 	*buflenp, 0, 0 );
1637*0Sstevel@tonic-gate 
1638*0Sstevel@tonic-gate   len = *buflenp;
1639*0Sstevel@tonic-gate   s = (Byte *) *bufp;
1640*0Sstevel@tonic-gate 
1641*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) {
1642*0Sstevel@tonic-gate         return( 1 );
1643*0Sstevel@tonic-gate   }
1644*0Sstevel@tonic-gate 
1645*0Sstevel@tonic-gate   while ( (char *)s - *(char **)bufp < len ) {
1646*0Sstevel@tonic-gate     switch( *s >> 5 ) {
1647*0Sstevel@tonic-gate 
1648*0Sstevel@tonic-gate     case 2:
1649*0Sstevel@tonic-gate       switch ( *s ) {
1650*0Sstevel@tonic-gate 
1651*0Sstevel@tonic-gate       case '^':  *o++ = 0xC3; *o++ = ALONE; s++; break;
1652*0Sstevel@tonic-gate 
1653*0Sstevel@tonic-gate       case '\\':
1654*0Sstevel@tonic-gate         s++;
1655*0Sstevel@tonic-gate         if ( (c = hh_to_c( s )) != -1 ) {
1656*0Sstevel@tonic-gate           *o++ = c;
1657*0Sstevel@tonic-gate           s += 2;
1658*0Sstevel@tonic-gate         } else
1659*0Sstevel@tonic-gate           *o++ = '\\';
1660*0Sstevel@tonic-gate         break;
1661*0Sstevel@tonic-gate 
1662*0Sstevel@tonic-gate       default:  *o++ = *s++;
1663*0Sstevel@tonic-gate       }
1664*0Sstevel@tonic-gate       break;
1665*0Sstevel@tonic-gate 
1666*0Sstevel@tonic-gate     case 3:
1667*0Sstevel@tonic-gate       switch ( *s ) {
1668*0Sstevel@tonic-gate 
1669*0Sstevel@tonic-gate       case '`':  *o++ = 0xC1; *o++ = ALONE; s++; break;
1670*0Sstevel@tonic-gate       case '~':  *o++ = 0xC4; *o++ = ALONE; s++; break;
1671*0Sstevel@tonic-gate 
1672*0Sstevel@tonic-gate       case '{':
1673*0Sstevel@tonic-gate         s++;
1674*0Sstevel@tonic-gate         if ( *(s + 2) == '}' ) {
1675*0Sstevel@tonic-gate           if ( (aux = cc_to_t61( o, s )) != NULL ) {
1676*0Sstevel@tonic-gate             o = aux;
1677*0Sstevel@tonic-gate             s += 3;
1678*0Sstevel@tonic-gate           } else {
1679*0Sstevel@tonic-gate             *o++ = '{';
1680*0Sstevel@tonic-gate           }
1681*0Sstevel@tonic-gate         } else if ( (*(s + 3) == '}') && ( (*s == 'x') || (*s == 'X') ) &&
1682*0Sstevel@tonic-gate                     ( (c = hh_to_c( s + 1 )) != -1 ) ) {
1683*0Sstevel@tonic-gate           *o++ = c;
1684*0Sstevel@tonic-gate           s += 4;
1685*0Sstevel@tonic-gate         } else {
1686*0Sstevel@tonic-gate           *o++ = '{';
1687*0Sstevel@tonic-gate         }
1688*0Sstevel@tonic-gate         break;
1689*0Sstevel@tonic-gate 
1690*0Sstevel@tonic-gate       default:
1691*0Sstevel@tonic-gate         *o++ = *s++;
1692*0Sstevel@tonic-gate       }
1693*0Sstevel@tonic-gate       break;
1694*0Sstevel@tonic-gate 
1695*0Sstevel@tonic-gate #if (ISO_8859 == 0)
1696*0Sstevel@tonic-gate     case 4: case 5: case 6: case 7:
1697*0Sstevel@tonic-gate       s++;
1698*0Sstevel@tonic-gate       break;
1699*0Sstevel@tonic-gate #else
1700*0Sstevel@tonic-gate     case 5: case 6: case 7:
1701*0Sstevel@tonic-gate # if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1702*0Sstevel@tonic-gate      (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10)
1703*0Sstevel@tonic-gate       if ( (*(cc = &trans_iso8859_t61[ *s - 0xA0 ])).a ) {
1704*0Sstevel@tonic-gate 	*o++ = (*cc).a;
1705*0Sstevel@tonic-gate 	if ( (*cc).b )  *o++ = (*cc).b;
1706*0Sstevel@tonic-gate       }
1707*0Sstevel@tonic-gate # endif
1708*0Sstevel@tonic-gate       s++;
1709*0Sstevel@tonic-gate       break;
1710*0Sstevel@tonic-gate #endif
1711*0Sstevel@tonic-gate 
1712*0Sstevel@tonic-gate     default:
1713*0Sstevel@tonic-gate       *o++ = *s++;
1714*0Sstevel@tonic-gate     }
1715*0Sstevel@tonic-gate   }
1716*0Sstevel@tonic-gate 
1717*0Sstevel@tonic-gate   len = o - oo;
1718*0Sstevel@tonic-gate   o = oo;
1719*0Sstevel@tonic-gate 
1720*0Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, len )) == NULL ) {
1721*0Sstevel@tonic-gate     free( o );
1722*0Sstevel@tonic-gate     return( 1 );
1723*0Sstevel@tonic-gate   }
1724*0Sstevel@tonic-gate 
1725*0Sstevel@tonic-gate   if ( free_input ) {
1726*0Sstevel@tonic-gate     free( *bufp );
1727*0Sstevel@tonic-gate   }
1728*0Sstevel@tonic-gate   *bufp = (char *) oo;
1729*0Sstevel@tonic-gate   *buflenp = len;
1730*0Sstevel@tonic-gate   return( 0 );
1731*0Sstevel@tonic-gate }
1732*0Sstevel@tonic-gate 
1733*0Sstevel@tonic-gate 
1734*0Sstevel@tonic-gate #ifdef NOT_NEEDED_IN_LIBLDAP	/* mcs@umich.edu 12 Oct 1995 */
1735*0Sstevel@tonic-gate /* --- routine to convert "escaped" (\hh) characters to 8bits --- */
1736*0Sstevel@tonic-gate 
1737*0Sstevel@tonic-gate void convert_escaped_to_8bit( s )
1738*0Sstevel@tonic-gate char	*s;
1739*0Sstevel@tonic-gate {
1740*0Sstevel@tonic-gate   char	*o = s;
1741*0Sstevel@tonic-gate   int	c;
1742*0Sstevel@tonic-gate 
1743*0Sstevel@tonic-gate   while ( *s ) {
1744*0Sstevel@tonic-gate     if ( *s == '\\' ) {
1745*0Sstevel@tonic-gate       if ( (c = hh_to_c( ++s )) != -1 ) {
1746*0Sstevel@tonic-gate 	*o++ = c;
1747*0Sstevel@tonic-gate 	s += 2;
1748*0Sstevel@tonic-gate       } else
1749*0Sstevel@tonic-gate         *o++ = '\\';
1750*0Sstevel@tonic-gate     } else
1751*0Sstevel@tonic-gate       *o++ = *s++;
1752*0Sstevel@tonic-gate   }
1753*0Sstevel@tonic-gate   *o = '\0';
1754*0Sstevel@tonic-gate }
1755*0Sstevel@tonic-gate 
1756*0Sstevel@tonic-gate /* --- routine to convert 8bits characters to the "escaped" (\hh) form --- */
1757*0Sstevel@tonic-gate 
1758*0Sstevel@tonic-gate char *convert_8bit_to_escaped( s )
1759*0Sstevel@tonic-gate Byte  *s;
1760*0Sstevel@tonic-gate {
1761*0Sstevel@tonic-gate   Byte	*o, *oo;
1762*0Sstevel@tonic-gate   Byte	n;
1763*0Sstevel@tonic-gate 
1764*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) {
1765*0Sstevel@tonic-gate         return( NULL );
1766*0Sstevel@tonic-gate   }
1767*0Sstevel@tonic-gate 
1768*0Sstevel@tonic-gate   while ( *s ) {
1769*0Sstevel@tonic-gate     if ( *s < 0x80 )
1770*0Sstevel@tonic-gate       *o++ = *s++;
1771*0Sstevel@tonic-gate     else {
1772*0Sstevel@tonic-gate       *o++ = '\\';
1773*0Sstevel@tonic-gate       n = *s >> 4;
1774*0Sstevel@tonic-gate       *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1775*0Sstevel@tonic-gate       n = *s++ & 0x0F;
1776*0Sstevel@tonic-gate       *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1777*0Sstevel@tonic-gate     }
1778*0Sstevel@tonic-gate   }
1779*0Sstevel@tonic-gate   *o = '\0';
1780*0Sstevel@tonic-gate 
1781*0Sstevel@tonic-gate   o = oo;
1782*0Sstevel@tonic-gate 
1783*0Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) {
1784*0Sstevel@tonic-gate     free( o );
1785*0Sstevel@tonic-gate     return( NULL );
1786*0Sstevel@tonic-gate   }
1787*0Sstevel@tonic-gate 
1788*0Sstevel@tonic-gate   return( (char *)oo );
1789*0Sstevel@tonic-gate }
1790*0Sstevel@tonic-gate 
1791*0Sstevel@tonic-gate /* --- routine to convert from T.61 to printable characters --- */
1792*0Sstevel@tonic-gate 
1793*0Sstevel@tonic-gate /*
1794*0Sstevel@tonic-gate    printable characters [RFC 1488]: 'A'..'Z', 'a'..'z', '0'..'9',
1795*0Sstevel@tonic-gate        '\'', '(', ')', '+', ',', '-', '.', '/', ':', '?, ' '.
1796*0Sstevel@tonic-gate 
1797*0Sstevel@tonic-gate    that conversion is language dependent.
1798*0Sstevel@tonic-gate */
1799*0Sstevel@tonic-gate 
1800*0Sstevel@tonic-gate static Couple last_t61_printabled[32] = {
1801*0Sstevel@tonic-gate 	{0,0},     {'A','E'}, {'D',0},   {0,0},
1802*0Sstevel@tonic-gate 	{'H',0},   {0,0},     {'I','J'}, {'L',0},
1803*0Sstevel@tonic-gate 	{'L',0},   {'O',0},   {'O','E'}, {0,0},
1804*0Sstevel@tonic-gate 	{'T','H'}, {'T',0},   {'N','G'}, {'n',0},
1805*0Sstevel@tonic-gate 	{'k',0},   {'a','e'}, {'d',0},   {'d',0},
1806*0Sstevel@tonic-gate 	{'h',0},   {'i',0},   {'i','j'}, {'l',0},
1807*0Sstevel@tonic-gate 	{'l',0},   {'o',0},   {'o','e'}, {'s','s'},
1808*0Sstevel@tonic-gate 	{'t','h'}, {'t',0},   {'n','g'}, {0,0}
1809*0Sstevel@tonic-gate };
1810*0Sstevel@tonic-gate 
1811*0Sstevel@tonic-gate char *t61_printable( s )
1812*0Sstevel@tonic-gate Byte  *s;
1813*0Sstevel@tonic-gate {
1814*0Sstevel@tonic-gate   Byte   *o, *oo;
1815*0Sstevel@tonic-gate   Byte   n;
1816*0Sstevel@tonic-gate   Couple *cc;
1817*0Sstevel@tonic-gate 
1818*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) {
1819*0Sstevel@tonic-gate         return( NULL );
1820*0Sstevel@tonic-gate   }
1821*0Sstevel@tonic-gate 
1822*0Sstevel@tonic-gate   while ( *s ) {
1823*0Sstevel@tonic-gate     if ( ( (*s >= 'A') && (*s <= 'Z') ) ||
1824*0Sstevel@tonic-gate          ( (*s >= 'a') && (*s <= 'z') ) ||
1825*0Sstevel@tonic-gate          ( (*s >= '0') && (*s <= '9') ) ||
1826*0Sstevel@tonic-gate          ( (*s >= '\'') && (*s <= ')') ) ||
1827*0Sstevel@tonic-gate          ( (*s >= '+') && (*s <= '/') ) ||
1828*0Sstevel@tonic-gate          ( *s == '?' ) || ( *s == ' ' ) )
1829*0Sstevel@tonic-gate       *o++ = *s++;
1830*0Sstevel@tonic-gate     else {
1831*0Sstevel@tonic-gate       if ( *s >= 0xE0 ) {
1832*0Sstevel@tonic-gate 	if ( (*(cc = &last_t61_printabled[ *s - 0xE0 ])).a ) {
1833*0Sstevel@tonic-gate           *o++ = (*cc).a;
1834*0Sstevel@tonic-gate           if ( (*cc).b )  *o++ = (*cc).b;
1835*0Sstevel@tonic-gate         }
1836*0Sstevel@tonic-gate       }
1837*0Sstevel@tonic-gate       else if ( (*s >> 4) == 0xC ) {
1838*0Sstevel@tonic-gate         switch ( *s ) {
1839*0Sstevel@tonic-gate 	case 0xCA:			/* ring */
1840*0Sstevel@tonic-gate 	  switch ( *(s + 1) ) {
1841*0Sstevel@tonic-gate 	  case 'A':  *o++ = 'A'; *o++ = 'A'; s++; break; /* Swedish */
1842*0Sstevel@tonic-gate 	  case 'a':  *o++ = 'a'; *o++ = 'a'; s++; break; /* Swedish */
1843*0Sstevel@tonic-gate 	  }
1844*0Sstevel@tonic-gate 	  break;
1845*0Sstevel@tonic-gate 
1846*0Sstevel@tonic-gate 	case 0xC8:			/* diaeresis */
1847*0Sstevel@tonic-gate 	  switch ( *(s + 1) ) {
1848*0Sstevel@tonic-gate 	  case 'Y':  *o++ = 'I'; *o++ = 'J'; s++; break; /* Dutch */
1849*0Sstevel@tonic-gate 	  case 'y':  *o++ = 'i'; *o++ = 'j'; s++; break; /* Dutch */
1850*0Sstevel@tonic-gate           }
1851*0Sstevel@tonic-gate 	  break;
1852*0Sstevel@tonic-gate         }
1853*0Sstevel@tonic-gate       }
1854*0Sstevel@tonic-gate       s++;
1855*0Sstevel@tonic-gate     }
1856*0Sstevel@tonic-gate   }
1857*0Sstevel@tonic-gate   *o = '\0';
1858*0Sstevel@tonic-gate 
1859*0Sstevel@tonic-gate   o = oo;
1860*0Sstevel@tonic-gate 
1861*0Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) {
1862*0Sstevel@tonic-gate     free( o );
1863*0Sstevel@tonic-gate     return( NULL );
1864*0Sstevel@tonic-gate   }
1865*0Sstevel@tonic-gate 
1866*0Sstevel@tonic-gate   return( (char *)oo );
1867*0Sstevel@tonic-gate }
1868*0Sstevel@tonic-gate #endif /* NOT_NEEDED_IN_LIBLDAP */	/* mcs@umich.edu 12 Oct 1995 */
1869*0Sstevel@tonic-gate 
1870*0Sstevel@tonic-gate #endif /* LDAP_CHARSET_8859 */
1871*0Sstevel@tonic-gate #endif /* STR_TRANSLATION */
1872