#ifndef _SUN_MSGFMT_H
#define _SUN_MSGFMT_H
#include <string.h>
#include <locale.h>
#include <stdio.h>
#include <wchar.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <signal.h>
#include <malloc.h>
#include <libintl.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include "../../lib/libc/inc/msgfmt.h"
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DOMAIN_TOKEN L"domain"
#define DOMAIN_LEN 6
#define MSGID_TOKEN L"msgid"
#define MSGID_LEN 5
#define MSGSTR_TOKEN L"msgstr"
#define MSGSTR_LEN 6
#ifdef DEBUG_MMAP
#define MAX_VALUE_LEN 3
#define LINE_SIZE 1
#else
#define MAX_VALUE_LEN 512
#define LINE_SIZE 512
#endif
#define CK_NXT_CH(a, l) \
((a[(l) - 1] == L' ') || (a[(l) - 1] == L'\t') || \
(a[(l) - 1] == L'\n') || (a[(l) - 1] == L'\0'))
struct msg_chain {
char *msgid;
char *msgstr;
int msgid_offset;
int msgstr_offset;
struct msg_chain *next;
};
struct domain_struct {
char *domain;
struct msg_chain *first_elem;
struct msg_chain *current_elem;
struct domain_struct *next;
};
#define ERR_EXEC_FAILED \
"failed to execute %s.\n"
#define ERR_USAGE \
"Usage: msgfmt [-D dir | --directory=dir] [-f | --use-fuzzy]\n" \
" [-g] [-o outfile | --output-file=outfile]\n" \
" [-s] [--strict] [-v] [--verbose] files ...\n"
#define ERR_GNU_ON_SUN \
"-g and -s are mutually exclusive.\n"
#define ERR_STAT_FAILED \
"stat failed for %s.\n"
#define ERR_MMAP_FAILED \
"mmap failed for %s.\n"
#define ERR_MUNMAP_FAILED \
"munmap failed for %s.\n"
#define ERR_NOSPC \
"Error, No space after directive at line number %d.\n"
#define ERR_EXITING \
"Exiting...\n"
#define WARN_NO_MSGSTR \
"Consecutive MSGID tokens " \
"encountered at line number: %d, ignored.\n"
#define WARN_NO_MSGID \
"Consecutive MSGSTR tokens " \
"encountered at line number: %d, ignored.\n"
#define WARN_SYNTAX_ERR \
"Syntax at line number: %d, " \
"line ignored\n"
#define WARN_MISSING_QUOTE \
"Syntax at line number: %d, " \
"Missing \", ignored\n"
#define WARN_MISSING_QUOTE_AT_EOL \
"Syntax at line number: %d, " \
"Missing \" at EOL, ignored\n"
#define WARN_INVALID_STRING \
"the string after closing \" " \
"is ignored at line number %d.\n"
#define WARN_DUP_MSG \
"Duplicate id \"%s\" at line number: " \
"%d, line ignored\n"
#define DIAG_GNU_FOUND \
"GNU PO file found.\n"
#define DIAG_INVOKING_GNU \
"Generating the MO file in the GNU MO format.\n"
#ifdef __cplusplus
}
#endif
#endif