Back to index

extremetuxracer  0.5beta
Functions
error_util.cpp File Reference
#include "error_util.h"
#include "winsys.h"
#include "game_config.h"

Go to the source code of this file.

Functions

void print_warning (int warning_level, char *fmt,...)
void handle_error (int exit_code, char *fmt,...)
void handle_system_error (int exit_code, char *fmt,...)

Function Documentation

void handle_error ( int  exit_code,
char *  fmt,
  ... 
)

Definition at line 54 of file error_util.cpp.

{
    va_list args;

    va_start( args, fmt );

    fprintf( stderr, "*** " PROG_NAME " error: " );
    vfprintf( stderr, fmt, args );
    fprintf( stderr, "\n" );

    va_end( args );

    winsys_exit( exit_code );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_system_error ( int  exit_code,
char *  fmt,
  ... 
)

Definition at line 69 of file error_util.cpp.

{
    va_list args;

    va_start( args, fmt );

    fprintf( stderr, "*** " PROG_NAME " error: " );
    vfprintf( stderr, fmt, args );
    fprintf( stderr, " (%s)\n", strerror( errno ) );

    va_end( args );

    winsys_exit( exit_code );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void print_warning ( int  warning_level,
char *  fmt,
  ... 
)

Definition at line 33 of file error_util.cpp.

{
    va_list args;

    /* We enforce the fact that warning level 0 prints no warnings */
    check_assertion( warning_level > 0, "warning levels must be > 0" );
    check_assertion( warning_level <= 100, "warning levels must be <= 100" );

    if ( warning_level > getparam_warning_level() ) {
       return;
    }

    va_start( args, fmt );

    fprintf( stderr, "%%%%%% " PROG_NAME " warning: " );
    vfprintf( stderr, fmt, args );
    fprintf( stderr, "\n" );

    va_end( args );
}

Here is the caller graph for this function: