/*
* 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 (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "sun_msgfmt.h"
static const char *mandatory_fields[] = {
"Project-Id-Version",
"PO-Revision-Date",
"Last-Translator",
"Language-Team",
"Content-Type",
"Content-Transfer-Encoding",
};
static const char *mandatory_fields_new[] = {
"POT-Creation-Date",
"Plural-Forms",
};
extern int verbose;
extern void invoke_gnu_msgfmt(void);
static size_t
{
char *p = *mbuf;
char *q, *tmp;
if (*bufhead) {
}
if (*fsize == 0) {
/* eof */
return (0);
}
q = p;
while (((*fsize) != 0) && (*p++ != '\n')) {
(*fsize)--;
}
len = p - q;
if (len == 0) {
return (0);
}
*mbuf = p;
return (len);
}
void
{
int i;
char c, mc;
char *linebuf;
unsigned int n;
int quotefound = 0;
const char *field;
loop:
(ln_size == 0)) {
goto no_gnu;
}
p = linebuf;
while ((*p == '#') || (*p == '\n')) {
(ln_size == 0)) {
goto no_gnu;
}
p = linebuf;
}
goto loop;
/* error */
goto no_gnu;
}
p += 5;
if ((*p != ' ') && (*p != '\t') &&
(*p != '\n') && (*p != '\0')) {
/* no space after msgid */
goto no_gnu;
}
/* skip spaces */
while ((*p == ' ') || (*p == '\t'))
p++;
/* check if this entry is an empty string */
if ((*p != '\"') || (*(p + 1) != '\"')) {
/* this is not an empty string */
goto no_gnu;
}
p += 2;
while (*p && ((*p == ' ') || (*p == '\t'))) {
p++;
}
if ((*p != '\n') && (*p != '\0')) {
/* other characters than '\n' and '\0' found */
goto no_gnu;
}
for (; ; ) {
(ln_size == 0)) {
goto no_gnu;
}
p = linebuf;
/* skip leading spaces */
while ((*p == ' ') || (*p == '\t'))
p++;
if (*p != '\"') {
break;
}
/* not a valid entry */
goto no_gnu;
}
if (*(p + 1) != '\"') {
/* not an empty string */
goto no_gnu;
}
p += 2;
while ((*p == ' ') || (*p == '\t'))
p++;
if ((*p != '\n') && (*p != '\0')) {
/* other characters than '\n' and '\0' found */
goto no_gnu;
}
}
/*
* msgid for the header entry found
* Now p points to "msgstr"
*/
p += 6;
if ((*p != ' ') && (*p != '\t') &&
(*p != '\n') && (*p != '\0')) {
/* no space after msgid */
goto no_gnu;
}
/* skip spaces */
while ((*p == ' ') || (*p == '\t'))
p++;
if (*p != '\"') {
/* no quote */
goto no_gnu;
}
index = 0;
for (; ; ) {
if (*p != '\"') {
/* msgstr entry ends */
break;
}
if (*p++ != '\"') {
/* no beginning quote */
goto no_gnu;
}
while (*p) {
switch (mc = *p++) {
case '\n':
if (!quotefound) {
/* error */
goto no_gnu;
}
break;
case '\"':
quotefound = 1;
break;
case '\\':
if (!*p)
break;
switch (c = *p++) {
case 'b':
break;
case 'f':
break;
case 'n':
break;
case 'r':
break;
case 't':
break;
case 'v':
break;
case 'a':
break;
case '\"':
case '\\':
case '\'':
case '?':
break;
default:
if (isdigit((unsigned char)c)) {
unsigned int x;
unsigned char *up =
(unsigned char *)p;
n = c - '0';
x = *up++ - '0';
n = 8 * n + x;
x = *up++ - '0';
n = 8 * n + x;
}
}
p = (char *)up;
}
break;
}
break;
default:
break;
}
if (quotefound) {
while (*p && ((*p == ' ') || (*p == '\t'))) {
p++;
}
if ((*p != '\n') && (*p != '\0')) {
goto no_gnu;
}
quotefound = 0;
break;
}
}
(ln_size == 0)) {
goto no_gnu;
}
p = linebuf;
/* skip spaces */
while ((*p == ' ') || (*p == '\t'))
p++;
}
continue;
/* one of mandatory fields found */
if (verbose)
/* NOTREACHED */
}
continue;
/* one of mandatory fields found */
if (verbose)
/* NOTREACHED */
}
if (buf)
}