/*
* 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.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
/*
* TEXTDOMAIN should be defined in Makefile
* in case it isn't, define it here
*/
#if !defined(TEXT_DOMAIN)
#endif
static char *
{
if (*in == '\\') {
switch (*++in) {
case 'b' :
*out = '\b';
break;
case 'f' :
*out = '\f';
break;
case 'n' :
*out = '\n';
break;
case 'r' :
*out = '\r';
break;
case 't' :
*out = '\t';
break;
case 'v' :
*out = '\v';
break;
default:
break;
}
} else
}
return (cp);
}
#define ERR_USAGE \
"Usage: gettext [-d domainname | --domain=domainname ] " \
"[domain] \"msgid\"\n" \
" gettext -s [-d domainname | --domain=domainname] [-e] [-n] "\
"\"msgid\" ...\n"
static void
usage(void) {
exit(-1);
}
int
{
char c, *arg;
int exp_flag = 0;
int no_newline = 0;
int echo_flag = 0;
(void) textdomain(TEXT_DOMAIN);
argv++;
while (--argc > 1) {
if (*arg == '-') {
if (!*(arg + 1)) {
/* not an option */
break;
}
loop:
if ((c = *++arg) == '\0') {
/* next argument */
argv++;
continue;
} else if (c != '-') {
switch (c) {
case 'd':
/* domainname */
if (*(arg + 1)) {
/*
* no spaces between -d and
* optarg
*/
argv++;
continue;
}
if (--argc > 1) {
argv++;
continue;
}
/* not enough args */
usage();
/* NOTREACHED */
break;
case 'e':
/* enable escape sequence expansion */
exp_flag = 1;
goto loop;
/* NOTREACHED */
case 'n':
/* suppress tailing newline */
no_newline = 1;
goto loop;
/* NOTREACHED */
case 's':
echo_flag = 1;
goto loop;
/* NOTREACHED */
default:
/* illegal option */
usage();
/* NOTREACHED */
break;
}
/* NOTREACHED */
}
/* c == '-' */
/* "--" found, option end */
argv++;
argc--;
break;
}
/* long option */
arg++;
/* domainname */
arg += 7;
if (*arg == '\0') {
/* illegal option */
usage();
/* NOTREACHED */
}
argv++;
continue;
}
/* illegal option */
usage();
/* NOTREACHED */
}
break;
}
if (argc == 0) {
usage();
/* NOTREACHED */
}
if (!echo_flag) {
/* traditional mode */
if (argc == 2) {
/*
* textdomain is specified by the argument.
*/
} else if (!domain) {
/*
* textdomain is not specified by the argument.
* TEXTDOMAIN will be used.
*/
if (!domain) {
/*
* no domain specified
* Just print the argument given.
*/
exit(1);
}
}
if (domainpath) {
}
}
/* echo mode */
if (!domain) {
}
if (domainpath && domain) {
}
while (argc-- > 0) {
if (exp_flag)
else
stdout);
if (argc > 0)
}
if (!no_newline)
}