1/**
2 * MOAB, a Mesh-Oriented datABase, is a software component for creating,
3 * storing and accessing finite element mesh data.
4 *
5 * Copyright 2004 Sandia Corporation. Under the terms of Contract
6 * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
7 * retains certain rights in this software.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 */1516#include<stdarg.h>17#include<stdio.h>18#include<string.h>1920#include"status.h"2122#ifdef _WIN3223#define vsnprintf( A, B, C, D ) _vsnprintf( ( A ), ( B ), ( C ), ( D ) )24#endif2526intmhdf_isError( mhdf_Status const* status )
27 {
28return !!status->message[0];
29 }
3031constchar* mhdf_message( mhdf_Status const* status )
32 {
33return status->message;
34 }
3536voidmhdf_setOkay( mhdf_Status* status )
37 {
38if( status ) status->message[0] = '\0';
39 }
4041voidmhdf_setFail( mhdf_Status* status, constchar* fmt, ... )
42 {
43if( status )
44 {
45 va_list args;
46va_start( args, fmt );
47vsnprintf( status->message, MHDF_MESSAGE_BUFFER_LEN, fmt, args );
48va_end( args );
49if( !status->message[0] ) strncpy( status->message, "(Uknown error)", MHDF_MESSAGE_BUFFER_LEN );
50 }
51 }