gettext_real.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License, Version 1.0 only
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * (the "License"). You may not use this file except in compliance
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
#include <libintl.h>
#include <thread.h>
#include <synch.h>
#include <limits.h>
#include <unistd.h>
#include "libc.h"
#include "_loc_path.h"
#include "msgfmt.h"
#include "gettext.h"
#include "nlspath_checks.h"
static int process_nlspath(const char *, const char *,
static char *replace_nls_option(char *, const char *, char *,
static void mini_strcpy(char *, const char *);
int plural)
char *language;
unsigned int hash_locale;
#ifdef GETTEXT_DEBUG
return (NULL);
if (!cur_locale) {
return (result);
if (language) {
if (!domain) {
} else if (!*domain) {
return (result);
return (result);
int ret;
return (result);
} else if (ret == 0) {
if (!cur_domain_binding) {
return (result);
mp->n = n;
if (nlspath) {
#ifdef GETTEXT_DEBUG
while (*cur_binding) {
cur_binding++;
cur_binding++;
return (result);
#ifdef GETTEXT_DEBUG
if (result) {
return (result);
if (language) {
char *ret_msg;
return (ret_msg);
#ifdef GETTEXT_DEBUG
return (result);
if (result) {
return (result);
return (result);
#define ALLFREE \
while (tp) {
if (pathname)
if (ppaths)
if (lang)
if (!cacheline)
unsigned int hashid;
int cacheline = 0;
#ifdef GETTEXT_DEBUG
if (cur_nls &&
while (cnp) {
while (nnp) {
if (cacheline) {
if (!nnp) {
if (!cnp) {
if (!nnp) {
nlspath_len++;
locale_len++;
domain_len++;
if (cur_msgloc) {
s1 = s;
s2 = s;
* specified as "language_territory.codeset". NLSPATH consists
if (!pnlstmp) {
if (!nlstmp) {
if (s == NULL) {
if (*pathname) {
if (!pnlstmp) {
path_len);
if (!nlstmp) {
if (ppaths_len != 0) {
if (!ppaths) {
while (pnlstmp) {
if (cacheline) {
#ifdef GETTEXT_DEBUG
char *limit;
t = pathname;
if (t < limit) {
if (name) {
u = (char *)name;
while (*u && (t < limit))
if (locale) {
u = locale;
while (*u && (t < limit))
if (lang) {
u = lang;
(t < limit))
if (territory) {
u = territory;
(t < limit))
if (codeset) {
u = codeset;
while (*u && (t < limit))
if (t < limit)
return (NULL);
int type)
char **binding_addr;
#ifdef GETTEXT_DEBUG
if (!domain) {
return (NULL);
return (NULL);
while (bind) {
if (!binding) {
return (*binding_addr);
if (*binding_addr) {
return (NULL);
#ifdef GETTEXT_DEBUG
printlist();
return (*binding_addr);
if (binding) {
return (NULL);
return (NULL);
return (NULL);
if (prev) {
#ifdef GETTEXT_DEBUG
printlist();
return (*binding_addr);
return ((char *)defaultbind);
return (NULL);
#ifdef GETTEXT_DEBUG
return (result);
return (NULL);
return (NULL);
return (result);
int val;
char *msg_id_str;
#ifdef GETTEXT_DEBUG
* If the ascending order is desired, change "msgfmt.c"
if ((val == 0) &&
} else if (val < 0) {
return ((char *)key_string);
return ((char *)key_string);
char *result;
case T_ILL_MO:
return (NULL);
case T_SUN_MO:
if (!exp)
return (result);
return (result);
case T_GNU_MO:
return (result);
return (result);
return (NULL);
char *result;
#ifdef GETTEXT_DEBUG
if (ret) {
return (result);
return (NULL);
return (result);
return (NULL);
return (result);
return (result);
return (result);
const char *p = (const char *)src;
char *q = dst;
static size_t
const char *p = (const char *)str;
return (len);