#include "dbinc.h" /***************************************************************************** * * * COMMON OCEANOGRAPHIC DATA ACCESS SYSTEM (CODAS) * * * * WRITTEN BY: RAMON CABRERA, ERIC FIRING, and JULIE RANADA * * JOINT INSTITUTE FOR MARINE AND ATMOSPHERIC RESEARCH * * 1000 POPE ROAD MSB 404 * * HONOLULU, HI 96822 * * * * VERSION: 3.00 * * * * DATE: APRIL 1989 * * * *****************************************************************************/ /* FILE: dberror.c */ extern NAME_LIST_ENTRY_TYPE ERROR_CODE[]; extern NAME_LIST_ENTRY_TYPE DATA_CODE[]; /*----------------------------------------------------------------------------- FUNCTION: DBERROR If (ierr) is set from some preceding CODAS function call, it prints the appropriate message for the given error code (& data code, if provided), as well as some user-supplied message (if provided); PARAMETERS: ierr = pointer to error code msg = pointer to user-supplied message (NULL if not supplied) RETURNS: *ierr */ int DBERROR(int *ierr, char *msg) { if (*ierr) { if (abs(*ierr) >= 100) { printf("\n CODAS ERROR CODE: %s", get_name(ERROR_CODE, (int) (*ierr/1000))); printf("\n DATA STRUCTURE: %s", get_name(DATA_CODE, abs(*ierr % 1000))); } else printf("\n CODAS ERROR CODE: %s", get_name(ERROR_CODE, *ierr)); if (msg != NULL) printf("\n %s", msg); } return(*ierr); }