/*
* Copyright (C) 1995-1997 Christopher D. Granz
*
* This header may not be removed.
*
* Refer to the file "License" included in this package for further
* information and before using any of the following.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include "areacon.h"
/*
* Functions
*/
void warning( char *pFormat, ... )
{
va_list vlArgs;
char cStr[MAX_STRING];
int i;
VA_START( vlArgs, pFormat );
#ifdef _sysBSD
vsnprintf( cStr, MAX_STRING, pFormat, vlArgs );
#else
vsprintf( cStr, pFormat, vlArgs );
#endif
for ( i = 0; cStr[i] != '\0'; i++ )
{
if ( i == 75 )
{
while ( cStr[i] != ' ' )
{
if ( i == 0 )
{
fprintf( stderr, "\nNo spaces in log string.\n" );
break;
}
i--;
}
cStr[i] = '\n';
break;
}
}
fprintf( stderr, "Warning: %s\n", cStr );
VA_END( vlArgs );
}
void error( char *pFormat, ... )
{
va_list vlArgs;
char cStr[MAX_STRING];
int i;
VA_START( vlArgs, pFormat );
#ifdef _sysBSD
vsnprintf( cStr, MAX_STRING, pFormat, vlArgs );
#else
vsprintf( cStr, pFormat, vlArgs );
#endif
for ( i = 0; cStr[i] != '\0'; i++ )
{
if ( i == 75 )
{
while ( cStr[i] != ' ' )
{
if ( i == 0 )
{
fprintf( stderr, "\nNo spaces in log string.\n" );
break;
}
i--;
}
cStr[i] = '\n';
break;
}
}
fprintf( stderr, "Error: %s\n", cStr );
VA_END( vlArgs );
}
void fatal( char *pFormat, ... )
{
va_list vlArgs;
char cStr[MAX_STRING];
int i;
VA_START( vlArgs, pFormat );
#ifdef _sysBSD
vsnprintf( cStr, MAX_STRING, pFormat, vlArgs );
#else
vsprintf( cStr, pFormat, vlArgs );
#endif
for ( i = 0; cStr[i] != '\0'; i++ )
{
if ( i == 75 )
{
while ( cStr[i] != ' ' )
{
if ( i == 0 )
{
fprintf( stderr, "\nNo spaces in log string.\n" );
break;
}
i--;
}
cStr[i] = '\n';
break;
}
}
fprintf( stderr, "Fatal error: %s\n", cStr );
exit( 1 );
VA_END( vlArgs );
}
/*
* End of error.c
*/