gnu_handle.c revision ccfce1d8e7219e7616d8df1e8cfca8f97febf5b8
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "gnu_msgfmt.h"
static int next_entry_is_fuzzy = 0;
static int next_entry_is_c_format = 0;
int cur_po_index = 0;
static size_t
{
char *p, *sp, *q;
p = addr;
while (q > p) {
if (*p == '#') {
/*
* Line beginning with '#' is a comment
*/
p++;
while ((q > p) && (*p++ != '\n'))
;
continue;
}
/* skip leading spaces */
while ((q > p) &&
((*p == ' ') || (*p == '\t')))
p++;
if (q <= p)
break;
sp = p;
while ((q > p) && (*p != ' ') &&
(*p != '\t') && (*p != '\n'))
p++;
if (q <= p) {
/* invalid entry */
break;
}
if (*p == '\n') {
/* invalid entry */
p++;
continue;
}
/*
* didn't match
*/
/* skip remaining chars in this line */
p++;
while ((q > p) && (*p++ != '\n'))
;
continue;
}
/* matching entry found */
/* skip spaces */
while ((q > p) &&
((*p == ' ') || (*p == '\t')))
p++;
if (q <= p)
break;
sp = p;
while ((q > p) && (*p != ' ') &&
(*p != '\t') && (*p != '\n'))
p++;
if (can_len == 0) {
while ((q > p) && (*p++ != '\n'))
;
continue;
}
return (can_len);
}
return (0);
}
/*
* Checks if the specified charset is equivalent to UTF-8.
* If it's equivalent to UTF-8, returns 1; Otherwise, returns 0.
*/
static int
check_utf8(const char *charset)
{
int fd;
return (1);
if (fd == -1) {
/* no alias file found */
return (0);
}
return (0);
}
if (addr == MAP_FAILED) {
return (0);
}
p = (char *)addr;
if (charset_len) {
} else {
}
p = (char *)addr;
if (utf8_len) {
} else {
}
if (charset_len == 0 && utf8_len == 0) {
/*
* Entry for neither charset nor utf8 found
*/
return (0);
}
return (1);
else
return (0);
}
static void
{
/*
* No conversion
*/
return;
}
if (check_utf8(charset)) {
/*
* Charset is UTF-8.
* No conversion is required.
*/
return;
}
/*
* No such a conversion
*/
return;
}
}
void
clear_state(void)
{
next_entry_is_fuzzy = 0;
}
void
handle_domain(char *domainname)
{
if (outfile) {
/*
* outfile has been specified by -o option
* ignore all domain directives
*/
if (verbose_flag) {
}
return;
}
if (strict_flag) {
/*
* add ".mo" to the domain
*/
char *tmp;
domainname = tmp;
}
}
void
catalog_init(const char *filename)
{
struct catalog *p;
if (!catalog_head) {
p->msg_size = DEF_MSG_NUM;
p->nmsg = 0;
catalog_head = p;
} else {
p = catalog_head;
for (; ; ) {
/* already registered */
break;
}
if (p->next) {
p = p->next;
continue;
}
/*
* this domain hasn't been registered
*/
sizeof (struct messages));
sizeof (unsigned int));
p = tmp;
break;
}
}
cur_catalog = p;
}
void
handle_comment(char *comment)
{
char *p;
p = comment;
if (*p != ',') {
/*
* This comment is just informative only.
*/
return;
}
/*
* Checks "fuzzy", "c-format", and "no-c-format"
*/
p++;
next_entry_is_fuzzy = 1;
}
}
}
void
{
unsigned int hash_val;
/*
* output file hasn't been specified, nor
* no domain directive found
*/
char *default_domain;
}
/*
* cur_catalog should be valid, at this point
*/
if (dupmsg) {
/* totally same entry */
if (verbose_flag) {
}
return;
}
/* duplicate msgid */
if (verbose_flag) {
po_error++;
}
/* ignore this etnry */
return;
}
if (next_entry_is_fuzzy) {
/* fuzzy entry */
cur_catalog->fnum++;
if (!fuzzy_flag) {
/* ignore this entry */
return;
}
}
/* this entry is not translated */
cur_catalog->unum++;
return;
}
/* Checks if this is the header entry */
/*
* Header entry
*/
cur_catalog->header++;
/*
* Need to extract the charset information
*/
/* no charset information */
} else {
charset += CHARSET_LEN;
if (p != NULL) {
/* p points to a space, tab or new line char */
} else {
/* not found */
}
}
cur_catalog->nplurals = 0;
} else {
unsigned int num;
nplurals += NPLURALS_LEN;
p = nplurals;
num = 0;
while (isdigit((unsigned char)*p)) {
}
}
}
if (verbose_flag)
cur_catalog->nmsg++;
/* no vacancy in message array */
sizeof (unsigned int));
for (n = 0; n < cur_catalog->nmsg; n++) {
}
}
}
void
{
char *filename;
if (!inputdir) {
} else {
}
/* NOTREACHED */
}
cur_line = 1;
if (!outfile)
}
void
po_fini(void)
{
cur_po_index++;
(void) iconv_close(cd);
}