Commit 9b63eaf9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Version sting (bug fix).

parent ee6ea6ec
......@@ -65,19 +65,17 @@ static
void cdfComment(int ncid)
{
static char comment[256] = "Climate Data Interface version ";
static int init = 0;
static bool init = false;
if ( ! init )
{
init = 1;
init = true;
const char *libvers = cdiLibraryVersion();
const char *blank = strchr(libvers, ' ');
size_t size = blank ? (size_t)(blank - libvers) : 0;
if ( size == 0 || ! isdigit((int) *libvers) )
if ( ! isdigit((int) *libvers) )
strcat(comment, "??");
else
strncat(comment, libvers, size);
strcat(comment, libvers);
strcat(comment, " (http://mpimet.mpg.de/cdi)");
}
......
#if defined (HAVE_CONFIG_H)
# include "config.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cdi.h"
/*
* A version string.
*/
// A version string
#if defined (VERSION)
static const char cdi_libvers[] = VERSION;
#ifdef VERSION
static const char cdi_libvers[] = VERSION;
#else
# error "VERSION undefined"
#endif
/*
#if defined(__cplusplus)
extern "C" {
#error "VERSION undefined"
#endif
const char *cdiLibraryVersion(void);
#if defined(__cplusplus)
}
#endif
*/
const char *cdiLibraryVersion(void)
{
return (cdi_libvers);
return cdi_libvers;
}
/*
* Local Variables:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment