gettxt.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#include "synonyms.h"
#include <ctype.h>
#include <string.h>
#include <locale.h>
#include <fcntl.h>
#include <pfmt.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include "../i18n/_locale.h"
#include "../i18n/_loc_path.h"
#define MESSAGES "/LC_MESSAGES/"
#define DB_NAME_LEN 15
char *handle_return(const char *);
/* support multiple versions of a package */
static char *saved_locale = NULL;
static const char *not_found = "Message not found!!\n";
static struct db_info {
} *db_info;
static int db_count; /* number of currently accessible data bases */
char *
{
int msgnum; /* message number */
int i;
int new_locale = 0;
int fd;
void *addr;
char *tokp;
char *curloc;
return (handle_return(dflt_str));
}
/* first time called, allocate space */
if (!db_info) {
return (handle_return(dflt_str));
}
/* parse msg_id */
return (handle_return(dflt_str));
return (handle_return(dflt_str));
if (name_len) {
} else {
else {
char *p;
p = (char *)setcat((const char *)0);
else
return (handle_return(dflt_str));
}
}
while (*++tokp)
return (handle_return(dflt_str));
/* Has locale been changed? */
for (i = 0; i < db_count; i++)
break;
} else { /* new locale - clear everything */
if (saved_locale)
/*
* allocate at least 2 bytes, so that we can copy "C"
* without re-allocating the saved_locale.
*/
return (handle_return(dflt_str));
for (i = 0; i < db_count; i++) {
new_locale++;
}
db_count = 0;
}
if (new_locale || i == db_count) {
return (handle_return(dflt_str));
return (handle_return(dflt_str));
}
fd, 0)) == MAP_FAILED) {
if (fd != -1)
return (handle_return(dflt_str));
/* Change locale to C */
return (handle_return(dflt_str));
}
for (i = 0; i < db_count; i++) {
}
db_count = 0;
fd, 0)) != MAP_FAILED) {
} else {
if (fd != -1)
return (handle_return(dflt_str));
}
}
if (fd != -1)
/* save file name, memory address, fd and size */
i = db_count;
db_count++;
}
/* check if msgnum out of domain */
return (handle_return(dflt_str));
/* return pointer to message */
+ msgnum * sizeof (int))));
}
char *
handle_return(const char *dflt_str)
{
}