isc_abort.c 795 Bytes
Newer Older
Per Cederqvist's avatar
Per Cederqvist committed
1
2
3
4
5
6
7
8
9
10
11
/*
** isc_abort.c                                  Route to handle fatal errors
**
** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
**                    Lysator Academic Computer Association.
**
** history:
** 910305 pen      moved into separate file
*/

#include <stdio.h>
Per Cederqvist's avatar
Per Cederqvist committed
12
#ifdef HAVE_STDLIB_H
Per Cederqvist's avatar
Per Cederqvist committed
13
#include <stdlib.h>
Per Cederqvist's avatar
Per Cederqvist committed
14
#endif
Per Cederqvist's avatar
Per Cederqvist committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stddef.h>
#include "isc.h"
#include "intern.h"

/*
** External function declarations
*/

static void (*isc_abortfn)(const char *msg) = (void (*)(const char *))NULL;

  
void
isc_setabortfn(void (*abortfn)(const char *msg))
{
  isc_abortfn = abortfn;
}


void
isc_abort(const char *message)
{
  if (isc_abortfn)
    (*isc_abortfn)(message);
  else
  {
    fprintf(stderr, "\n\r*** ISC SUBSYSTEM FATAL ERROR: %s\n\r", message);
    abort();
  }
}