errorsubr.c revision d321a33cdd896e6b211d113a33698dd76e89b861
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include "error.h"
/*
* Arrayify a list of rules
*/
void
{
int listlength;
int listindex;
continue;
}
*e_length = listlength;
}
/*PRINTFLIKE1*/
static void
{
exit(6);
}
void *
{
void *back;
error("Ran out of memory.\n");
exit(1);
}
return (back);
}
char *
{
char *outstring;
instring);
return (outstring);
}
/*
* find the position of a given character in a string
* (one based)
*/
int
{
int i;
if (string)
return (i);
}
return (-1);
}
/*
* clobber the first occurance of ch in string by the new character
*/
char *
{
if (cp)
while (*cp) {
break;
}
cp++;
}
return (string);
}
char
{
int length;
return ('\0');
if (length >= 1)
else
return ('\0');
}
char
{
if (string)
return (string[0]);
else
return ('\0');
}
char
next_lastchar(char *string)
{
int length;
return ('\0');
if (length >= 2)
else
return ('\0');
}
void
{
int length = 0;
if (string)
if (length >= 1)
}
/*
* parse a string that is the result of a format %s(%d)
* return TRUE if this is of the proper format
*/
{
char *cp;
int length = 0;
if (string)
continue;
if (*cp == '(') {
*cp = '(';
return (TRUE);
}
}
return (FALSE);
}
static char cincomment[] = CINCOMMENT;
static char coutcomment[] = COUTCOMMENT;
static char fincomment[] = FINCOMMENT;
static char foutcomment[] = FOUTCOMMENT;
static char piincomment[] = PIINCOMMENT;
static char pioutcomment[] = PIOUTCOMMENT;
static char lispincomment[] = LISPINCOMMENT;
static char riincomment[] = RIINCOMMENT;
static char rioutcomment[] = RIOUTCOMMENT;
static char troffincomment[] = TROFFINCOMMENT;
static char troffoutcomment[] = TROFFOUTCOMMENT;
static char mod2incomment[] = MOD2INCOMMENT;
static char mod2outcomment[] = MOD2OUTCOMMENT;
struct lang_desc lang_table[] = {
0, 0, 0
};
void
{
int i;
continue;
continue;
(void) printf("Error %d, (%s error) [%s], text = \"",
i,
(void) printf("\"\n");
}
}
void
{
int i;
char *sep = "";
for (i = 0; i < wordc; i++)
if (wordv[i]) {
sep = " ";
}
}
/*
* Given a string, parse it into a number of words, and build
* a wordc wordv combination pointing into it.
*/
void
{
char *cp;
char *saltedbuffer;
char **wordv;
int wordcount;
int wordindex;
cp++;
cp++;
}
cp++;
if (*cp == 0)
break;
cp++;
*cp++ = '\0';
}
if (wordcount != 0)
error("Initial miscount of the number of words in a line\n");
#ifdef FULLDEBUG
(void) printf("\n");
#endif
}
/*
* Compare two 0 based wordvectors
*/
int
{
int i;
int back;
for (i = 0; i < wordc; i++) {
return (-1);
return (back);
}
}
return (0); /* they are equal */
}
/*
* splice a 0 basedword vector onto the tail of a
* new wordv, allowing the first emptyhead slots to be empty
*/
char **
{
char **nwordv;
int i;
for (i = 0; i < emptyhead; i++)
nwordv[i] = 0;
}
return (nwordv);
}
/*
* plural'ize and verb forms
*/
static char *S = "s";
static char *N = "";
char *
plural(int n)
{
return (n > 1 ? S : N);
}
char *
verbform(int n)
{
return (n > 1 ? N : S);
}