ncdf4a13/nctest/error.c

Go to the documentation of this file.
00001 /*********************************************************************
00002  *   Copyright 1993, UCAR/Unidata
00003  *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
00004  *   $Header: /upc/share/CVS/netcdf-3/nctest/error.c,v 1.8 2004/11/16 21:33:07 russ Exp $
00005  *********************************************************************/
00006 
00007 #include <stdio.h>
00008 
00009 #ifndef NO_STDARG
00010 #include <stdarg.h>
00011 #else
00012 #include <varargs.h>
00013 #endif
00014 
00015 #include <netcdf.h>
00016 #include "error.h"
00017 
00018 static int      error_count = 0;
00019 
00020 /*
00021  * Use for logging error conditions.
00022  */
00023 #ifndef NO_STDARG
00024 void
00025 error(const char *fmt, ...)
00026 #else
00027 /*VARARGS1*/
00028 void
00029 error(fmt, va_alist)
00030      const char *fmt ;
00031      va_dcl
00032 #endif
00033 {
00034     va_list args ;
00035 
00036     (void) fprintf(stderr,"*** ");
00037 
00038 #ifndef NO_STDARG
00039     va_start(args, fmt) ;
00040 #else
00041     va_start(args) ;
00042 #endif
00043     (void) vfprintf(stderr,fmt,args) ;
00044     va_end(args) ;
00045 
00046     (void) fprintf(stderr, "\n") ;
00047     error_count++;
00048 }
00049 
00050 
00051 /*
00052  * Turn off netCDF library handling of errors.  Caller must check all error
00053  * returns after calling this, until on_errs() is called.
00054  */
00055 void
00056 off_errs()
00057 {
00058     extern int ncopts;          /* error options */
00059     ncopts &= ~NC_FATAL;        /* make errors nonfatal */
00060     ncopts &= ~NC_VERBOSE;      /* turn off error messages */
00061 }
00062 
00063 
00064 /*
00065  * Let netCDF library handle subsequent errors.  Callers don't need to check
00066  * error returns after this.  (This is the initial default.)
00067  */
00068 void
00069 on_errs()
00070 {
00071     extern int ncopts;          /* error options */
00072     ncopts |= NC_FATAL;         /* make errors fatal */
00073     ncopts |= NC_VERBOSE;       /* library prints error messages */
00074 }

Generated on Thu Mar 16 18:10:09 2006 for nco by  doxygen 1.4.4