File: error.c

package info (click to toggle)
libhdf4 4.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,384 kB
  • sloc: ansic: 128,700; sh: 15,015; fortran: 12,444; java: 5,863; xml: 1,205; makefile: 794; yacc: 678; pascal: 418; perl: 360; javascript: 203; lex: 163; csh: 41
file content (59 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download | duplicates (2)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*********************************************************************
 *   Copyright 1993, UCAR/Unidata
 *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
 *********************************************************************/

#include <stdarg.h>
#include <stdio.h>

#include "hdf.h"

#ifdef H4_HAVE_NETCDF
#include "netcdf.h"
#else
#include "hdf4_netcdf.h"
#endif

#include "error.h"

int error_count = 0;

/*
 * Use for logging error conditions.
 */
void
error(const char *fmt, ...)
{
    va_list args;

    fprintf(stderr, "*** ");

    va_start(args, fmt);
    (void)vfprintf(stderr, fmt, args);
    va_end(args);

    fprintf(stderr, "\n");
    error_count++;
}

/*
 * Turn off netCDF library handling of errors.  Caller must check all error
 * returns after calling this, until on_errs() is called.
 */
void
off_errs(void)
{
    ncopts &= ~NC_FATAL;   /* make errors nonfatal */
    ncopts &= ~NC_VERBOSE; /* turn off error messages */
}

/*
 * Let netCDF library handle subsequent errors.  Callers don't need to check
 * error returns after this.  (This is the initial default.)
 */
void
on_errs(void)
{
    ncopts |= NC_FATAL;   /* make errors fatal */
    ncopts |= NC_VERBOSE; /* library prints error messages */
}