/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* catopen intercept
* the ast catalogs are checked first
* the ast mc* and native cat* routines do all the work
* catalogs found by mcfind() are converted from utf to ucs
*
* nl_catd is cast to void*
* this is either an Mc_t* (Mc_t.set != 0)
* or a Cc_t* where Cc_t.cat is the native nl_catd
*/
#include <ast.h>
#include <mc.h>
#include <nl_types.h>
#include <iconv.h>
#ifndef DEBUG_trace
#define DEBUG_trace 0
#endif
#if DEBUG_trace
#endif
#if _lib_catopen
typedef struct
{
} Cc_t;
#else
#endif
{
char* s;
/*
* first try the ast catalogs
*/
#if DEBUG_trace
sfprintf(sfstderr, "AHA#%d:%s %s LC_MESSAGES=%s:%s\n", __LINE__, __FILE__, name, _ast_setlocale(LC_MESSAGES, 0), setlocale(LC_MESSAGES, 0));
#endif
{
#if DEBUG_trace
#endif
if (mc)
return (_ast_nl_catd)mc;
}
#if _lib_catopen
{
nl_catd d;
/*
* now the native catalogs
*/
if (s && (d = catopen(s, flag)) != (nl_catd)(-1) || !(s = 0) && (d = catopen(name, flag)) != (nl_catd)(-1))
{
{
catclose(d);
return (_ast_nl_catd)(-1);
}
{
{
catclose(d);
return (_ast_nl_catd)(-1);
}
}
else
#if DEBUG_trace
#endif
return (_ast_nl_catd)cc;
}
}
#endif
/*
* loser
*/
return (_ast_nl_catd)(-1);
}
char*
{
return (char*)msg;
#if _lib_catopen
{
char* s;
size_t n;
{
s = (char*)msg;
n = strlen(s);
return s;
}
return (char*)msg;
}
#endif
}
int
{
return -1;
#if _lib_catopen
{
}
#endif
}