/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lint.h"
#include "mtlib.h"
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <euc.h>
#include <widec.h>
#include <wctype.h>
#include <limits.h>
#include <synch.h>
#include <thread.h>
#include <libintl.h>
#include "libc.h"
#include <locale.h>
#include <dlfcn.h>
#include "_loc_path.h"
static int wdchkind_C(wchar_t);
static int initialized = 0;
static int
_wdinitialize(void)
{
char *loc;
initialized = 1;
if (modhandle)
/* pathname too long */
goto C_fallback;
}
"_wdbindf_");
}
return (-1);
}
/*
* wdinit() initializes other word-analyzing routines according to the
* current locale. Programmers are supposed to call this routine every
* time the locale for the LC_CTYPE category is changed. It returns 0
* when every initialization completes successfully, or -1 otherwise.
*/
/* XXX: wdinit() is not exported from libc. Should it be? */
int
wdinit()
{
int res;
res = _wdinitialize();
return (res);
}
/*
* wdchkind() returns a non-negative integral value unique to the kind
* of the character represented by given argument.
*/
int
{
int i;
if (!initialized)
(void) _wdinitialize();
return (i);
}
static int
{
case 1:
return (2);
case 2:
return (3);
case 3:
return (4);
case 0:
}
return (0);
}
/*
* wdbindf() returns an integral value (0 - 7) indicating binding
* strength of two characters represented by the first two arguments.
* It returns -1 when either of the two character is not printable.
*/
/*ARGSUSED*/
int
{
int i;
if (!initialized)
(void) _wdinitialize();
return (-1);
}
return (i);
}
/*ARGSUSED*/
static int
{
return (4);
return (6);
}
/*
* wddelim() returns a pointer to a null-terminated word delimiter
* string in wchar_t type that is thought most appropriate to join
* a text line ending with the first argument and a line beginning
* with the second argument, with. When either of the two character
* is not printable it returns a pointer to a null wide character.
*/
/*ARGSUSED*/
wchar_t *
{
wchar_t *i;
if (!initialized)
(void) _wdinitialize();
return ((wchar_t *)L"");
}
return (i);
}
/*ARGSUSED*/
static wchar_t *
{
return ((wchar_t *)L" ");
}
/*
* mcfiller returns a printable ASCII character suggested for use in
* filling space resulted by a multicolumn character at the right margin.
*/
mcfiller(void)
{
if (!initialized)
(void) _wdinitialize();
if (mcfllr) {
fillerchar = (*mcfllr)();
if (!fillerchar)
if (iswprint(fillerchar)) {
return (fillerchar);
}
}
return ((wchar_t)'~');
}
/*
* mcwrap returns an integral value indicating if a multicolumn character
* on the right margin should be wrapped around on a terminal screen.
*/
/* XXX: mcwrap() is not exported from libc. Should it be? */
int
mcwrap(void)
{
if (!initialized)
(void) _wdinitialize();
if (mcwrp)
if ((*mcwrp)() == 0) {
return (0);
}
return (1);
}