/** \file \internal Basic diskless API tests. Copyright 2011, UCAR/Unidata. See COPYRIGHT file for copying and redistribution conditions. */ #undef DDBG #include #include #include "err_macros.h" #include #include #include /* netcdf tst_diskless { variables: int resistor_value; float capacitor_value; short number_of_555_timer_chips; } */ #define FLAGS4 (NC_DISKLESS|NC_NETCDF4|NC_CLASSIC_MODEL) #define FLAGS3 (NC_DISKLESS) #define PERSIST (NC_WRITE) #define RESISTOR "resistor_value" #define CAPACITOR "capacitor_value" #define NUM555 "number_of_555_timer_chips" #ifdef DDBG #undef ERR void fail(int line) { fflush(stdout); fprintf(stderr,"\nline=%d\n",line); fflush(stderr); exit(1); } #define ERR fail(__LINE__) #endif /* Control flags */ static int flags, persist, usenetcdf4, mmap; static void removefile(int persist, char* filename) { if(persist) { if(remove(filename) != 0) { if(errno != ENOENT) { fprintf(stderr,"Could not remove file: %s: %d\n",filename,errno); perror(""); exit(1); } } } } int main(int argc, char **argv) { int i; char* filename = "tst_diskless.nc"; /* Set defaults */ persist = 0; usenetcdf4 = 0; mmap = 0; for(i=1;i