File: g_error.c

package info (click to toggle)
plotutils 2.0-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,964 kB
  • ctags: 2,522
  • sloc: ansic: 38,416; sh: 1,853; yacc: 856; makefile: 181; lex: 144
file content (37 lines) | stat: -rw-r--r-- 859 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* This file contains the generic error and warning methods.  They simply
   write the specified message to the plotter error stream, if it has one.
   In the case of an error, the program exits. */

#include "sys-defines.h"
#include "plot.h"
#include "extern.h"

void
#ifdef _HAVE_PROTOS
_g_warning (const char *msg)
#else
_g_warning (msg)
     const char *msg;
#endif
{
  if (libplot_warning_handler != NULL)
    (*libplot_warning_handler)((char *)msg);
  else if (_plotter->errstream != NULL)
    fprintf (_plotter->errstream, "libplot: %s\n", msg);
}

void
#ifdef _HAVE_PROTOS
_g_error (const char *msg)
#else
_g_error (msg)
     const char *msg;
#endif
{
  if (libplot_error_handler != NULL)
    (*libplot_error_handler)((char *)msg);
  else if (_plotter->errstream != NULL)
    fprintf (_plotter->errstream, "libplot: error: %s\n", msg);

  exit (1);
}