My Project
programmer's documentation
Functions
bft_error.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft_printf.h"
#include "bft_error.h"
Include dependency graph for bft_error.c:

Functions

void bft_error (const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
 Calls the error handler (set by bft_error_handler_set() or default). More...
 
bft_error_handler_tbft_error_handler_get (void)
 Returns the error handler associated with the bft_error() function. More...
 
void bft_error_handler_set (bft_error_handler_t *const handler)
 Associates an error handler with the bft_error() function. More...
 

Function Documentation

◆ bft_error()

void bft_error ( const char *const  file_name,
const int  line_num,
const int  sys_error_code,
const char *const  format,
  ... 
)

Calls the error handler (set by bft_error_handler_set() or default).

With the default error handler, bft_print_flush() is called, an error message is output to stderr, and the current process exits with an EXIT_FAILURE code.

Parameters
[in]file_namename of source file from which error handler called.
[in]line_numline of source file from which error handler called.
[in]sys_error_codeerror code if error in system or libc call, 0 otherwise.
[in]formatformat string, as printf() and family.
[in]...variable arguments based on format string.

◆ bft_error_handler_get()

bft_error_handler_t* bft_error_handler_get ( void  )

Returns the error handler associated with the bft_error() function.

Returns
pointer to the error handler function.

◆ bft_error_handler_set()

void bft_error_handler_set ( bft_error_handler_t *const  handler)

Associates an error handler with the bft_error() function.

Parameters
[in]handlerpointer to the error handler function.