2
* Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
3
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
4
* retains certain rights in this software.
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions are
10
* * Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
13
* * Redistributions in binary form must reproduce the above
14
* copyright notice, this list of conditions and the following
15
* disclaimer in the documentation and/or other materials provided
16
* with the distribution.
18
* * Neither the name of Sandia Corporation nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
/*****************************************************************************
39
* author - Sandia National Laboratories
40
* Vic Yarberry - Original
47
* char* pname procedure name
48
* char* err_string error message string
49
* int errcode error code
55
* $Id: exerr.c,v 1.2 2006/11/29 18:09:13 dcthomp Exp $
57
*****************************************************************************/
59
/* Generalized error reporting function
60
* global integer used for suppressing error messages and determining
61
* the fatality of errors.
70
int exerrval = 0; /* clear initial global error code value */
72
static char last_pname[MAX_ERR_LENGTH];
73
static char last_errmsg[MAX_ERR_LENGTH];
74
static int last_errcode;
76
void ex_err( const char *pname, /* procedure name */
77
const char *err_string, /* error message string */
78
int errcode) /* error code */
80
if (errcode == 0) /* zero is no error, ignore and return */
83
else if (errcode == EX_PRTLASTMSG)
85
fprintf(stderr, "[%s] %s\n",last_pname,last_errmsg);
86
fprintf(stderr, " exerrval = %d\n",last_errcode);
90
else if (exoptval & EX_VERBOSE) /* check see if we really want to hear this */
92
fprintf(stderr, "[%s] %s\n",pname,err_string);
93
if (exoptval & EX_VERBOSE)
94
fprintf(stderr, " exerrval = %d\n",errcode);
98
fprintf (stderr," In FORTRAN interface, string too small\n");
101
fprintf (stderr," length of name exceeds MAX_NC_NAME\n");
107
/* save the error message for replays */
108
strcpy(last_errmsg, err_string);
109
strcpy(last_pname, pname);
110
last_errcode = errcode;
114
/* with netCDF 3.4, (fatal) system error codes are > 0;
115
so all EXODUS fatal error codes are > 0 */
116
if ((errcode > 0) && (exoptval & EX_ABORT))