/
Sapphire/bin/
Sapphire/db/
Sapphire/db/OLC_rooms/
Sapphire/db/abi/
Sapphire/db/em_src/
Sapphire/db/helps/
Sapphire/db/helps/emman/ifunc/
Sapphire/db/npcs/Tatt/
Sapphire/db/objects/Tatt/
Sapphire/db/q_data/
Sapphire/db/rooms/Tatt/
Sapphire/doc/
Sapphire/doc/em/
Sapphire/etc/
Sapphire/src/abic/
Sapphire/src/areacon/
Sapphire/src/client/
Sapphire/src/embc/
Sapphire/src/emi/
Sapphire/src/emi/test/
Sapphire/src/include/
Sapphire/src/sapphire/em/
Sapphire/src/tcon/
/*
 * 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
 */