error.c

Sapphire/src/embc/error.c · 1.6 KB

From the archive sapphire_0.3.zip

Download the archive   « Back to the archive contents

/*
 * 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 <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>

#include "emerald.h"
#include "embc.h"


/*
 * Functions
 */
void warning( char *pFormat, ... )
{
    va_list vlArgs;
    char cStr[MAX_STRING];

    va_start( vlArgs, pFormat );
    vsnprintf( cStr, MAX_STRING, pFormat, vlArgs );

    /* if ( pCOFilename != NULL && pCOFilename[0] != '\0' )
        fprintf( stderr, "FILE: %s / LINE: %ld\n", pCOFilename,
          lCurrentLine ); */

    fprintf( stderr, "Warning: %s\n", cStr );
    va_end( vlArgs );
}


void error( char *pFormat, ... )
{
    va_list vlArgs;
    char cStr[MAX_STRING];

    va_start( vlArgs, pFormat );
    vsnprintf( cStr, MAX_STRING, pFormat, vlArgs );

    /* if ( pCOFilename != NULL && pCOFilename[0] != '\0' )
        fprintf( stderr, "FILE: %s / LINE: %ld\n", pCOFilename,
          lCurrentLine ); */

    fprintf( stderr, "Error: %s\n", cStr );
    va_end( vlArgs );
}


void fatal( char *pFormat, ... )
{
    va_list vlArgs;
    char cStr[MAX_STRING];

    va_start( vlArgs, pFormat );
    vsnprintf( cStr, MAX_STRING, pFormat, vlArgs );

    /* if ( pCOFilename != NULL && pCOFilename[0] != '\0' )
        fprintf( stderr, "FILE: %s / LINE: %ld\n", pCOFilename,
          lCurrentLine ); */

    fprintf( stderr, "Fatal Error: %s\n", cStr );
    exit( 1 );
    va_end( vlArgs );
}


/*
 * End of error.c
 */

Site Stats

Snippets: 1791
Codebases: 571