/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <setjmp.h>
#include <string.h>
/* external functions */
extern int getopt();
extern void exit();
extern int atoi();
extern int _filbuf();
extern char *optarg;
/* static functions */
static void extract();
static void replace();
static void yankstr();
static void badformat();
static void prstr();
static int getachar();
static void usage();
/* static variables */
int
{
int ch;
switch (ch) {
case 'e':
if (rflg)
errflg++;
else
eflg++;
continue;
case 'r':
if (eflg)
errflg++;
else
rflg++;
continue;
case 'd':
if (eflg)
errflg++;
else
dflg++;
continue;
default:
errflg++;
}
usage();
if (!rflg)
else {
usage();
}
return (0);
}
static void
char *name;
{
(void) fprintf(
exit(1);
}
flag = 1;
Lineno = 0;
return;
for (;;) {
char ch;
switch (ch) {
case '#':
if (Posno != 0)
continue;
do {
if (ch == 'd')
continue;
while (getachar() != '\n');
break;
case '"':
yankstr();
break;
case '\'':
if (ch == '\\')
break;
case '/':
if (ch == '*') {
int level = 0;
while (level != 2) {
level++;
level++;
else
level = 0;
}
}
break;
}
}
}
static void
yankstr()
{
char cc;
int saved_posno;
int saved_lineno;
saved_posno = Posno;
if (cc == '\\') {
}
if (cc == '\n') {
dp--;
continue;
}
}
*dp = 0;
}
static void
register char *cp;
{
if (eflg)
cp);
else
}
static void
usage()
{
exit(1);
}
static int
getachar()
{
int cc;
if (flag) {
Lineno++;
Posno = 0;
flag = 0;
} else
Posno++;
if (cc == '\n')
flag = 1;
return (cc);
}
static void
char *name;
{
char *cp;
int savelineno = 0;
char *repstr;
/* keeps track of character position within input file */
char *inp;
/* keeps track of character position within output buffer */
char *outp;
char *msgfile;
linebuf[0] = '\0';
/* open input C source file */
"exstr: ERROR: couldn't open file '%s'\n", name);
exit(1);
}
/* process file containing the list of strings */
wrong_msg = 0;
/* save a copy of the current line */
/* take apart the input string */
*repbufp++ = '\0';
/* verify that string belongs to the input C source file */
continue;
*repstr++ = '\0';
if (curlineno < savelineno) {
"exstr: ERROR: stdin: line out of order\n");
exit(1);
}
*repstr++ = '\0';
*repstr++ = '\0';
"exstr: ERROR: stdin: invalid message file name "
"'%s'\n", msgfile);
exit(1);
}
*repstr++ = '\0';
while (*cp)
wrong_msg++;
break;
}
"message number '%s'\n", repbufp);
exit(1);
}
/* move up to this line */
while (*inp != '\0')
*outp = '\0';
} else if (*linebuf != '\0')
exit(1);
}
Lineno++;
Posno = 0;
}
"Bad input record line number %d\n", Lineno);
exit(1);
}
Posno++;
}
if (*inp != '"') {
"string '%s' in line (%d) of file (%s)\n", repstr,
exit(1);
}
/* check if string continues in next line */
"error in file (%s)\n", Fname);
exit(1);
}
cont_str++;
Lineno++;
}
if (cont_str) {
;
if (*cp == '\0') {
"replace string '%s' in line (%d) of file "
exit(1);
}
}
if (dflg)
repstr);
else
if (!cont_str) {
}
else
cont_str = 0;
}
while (*inp != '\0')
*outp = '\0';
}
}
static void
char *line;
{
"replacement string\n%s", line);
exit(1);
}