errorsubr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 1990 Sun Microsystems. Inc */
#pragma ident "%Z%%M% %I% %E% SMI"
/* - - - - -- - - - -- - - - - - - - - - - - - - - - - - - - - -*/
#include <stdio.h>
#include <ctype.h>
#include "error.h"
/*
* Arrayify a list of rules
*/
int *e_length;
{
reg int listlength;
continue;
}
*e_length = listlength;
}
/*VARARGS1*/
char *msg;
{
exit(6);
}
/*ARGSUSED*/
int nelements;
int size;
{
char *back;
error("Ran out of memory.\n");
exit(1);
}
return(back);
}
char *instring;
{
char *outstring;
instring);
return(outstring);
}
/*
* find the position of a given character in a string
* (one based)
*/
{
reg int i;
if (string)
return(i);
}
return(-1);
}
/*
* clobber the first occurance of ch in string by the new character
*/
char *string;
{
if (cp)
while (*cp){
break;
}
cp++;
}
return(string);
}
char *string;
{
int length;
if (string == 0) return('\0');
if (length >= 1)
else
return('\0');
}
char *string;
{
if (string)
return(string[0]);
else
return('\0');
}
char next_lastchar(string)
char *string;
{
int length;
if (string == 0) return('\0');
if (length >= 2)
else
return('\0');
}
{
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 *string;
{
int length = 0;
if (string)
if ( (length >= 4)
--cp)
continue;
if (*cp == '('){
*cp = '(';
return(TRUE);
}
}
return(FALSE);
}
/*
* parse a quoted string that is the result of a format \"%s\"(%d)
* return TRUE if this is of the proper format
*/
char *string;
{
int length = 0;
if (string)
if ( (length >= 4)
--cp)
continue;
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
};
int errorc;
{
reg int i;
continue;
continue;
printf("Error %d, (%s error) [%s], text = \"",
i,
printf("\"\n");
}
}
int wordc;
char *wordv[];
{
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.
*/
char *string;
int *r_wordc;
char ***r_wordv;
{
char *saltedbuffer;
char **wordv;
int wordcount;
int wordindex;
cp++;
if (*cp == 0)
break;
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
printf("\n");
#endif
}
/*
* Compare two 0 based wordvectors
*/
char **wordv1;
int wordc;
char **wordv2;
{
reg 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
*/
int emptyhead;
int wordc;
char **wordv;
{
reg 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(n)
int n;
{
return( n > 1 ? S : N);
}
char *verbform(n)
int n;
{
return( n > 1 ? N : S);
}