[netcdf] 01/07: New upstream version 4.6.1

Bas Couwenberg sebastic at debian.org
Tue Mar 20 06:53:05 UTC 2018


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository netcdf.

commit 2cfdf3d5c9a11b7c6a9b82aad796f490ab1c842b
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Tue Mar 20 07:22:51 2018 +0100

    New upstream version 4.6.1
---
 .github/CODEOWNERS                            |    9 +
 .gitignore                                    |    1 -
 CMakeLists.txt                                |  246 +--
 CODE_OF_CONDUCT.md                            |   46 +
 Makefile.am                                   |   42 +-
 Makefile.in                                   |   59 +-
 RELEASE_NOTES.md                              |    8 +-
 aclocal.m4                                    |  191 +--
 cf                                            |    7 +-
 cf.cmake                                      |    7 +-
 compile                                       |    8 +-
 config.guess                                  |  559 +++----
 config.h.cmake.in                             |  159 +-
 config.h.cmake.in.old-works                   |   50 -
 config.h.in                                   |  113 +-
 config.sub                                    |  249 ++-
 configure                                     | 1266 +++------------
 configure.ac                                  |  149 +-
 dap4_test/Makefile.in                         |   74 +-
 depcomp                                       |    8 +-
 docs/Doxyfile.developer                       |    2 +-
 docs/Makefile.am                              |    2 +-
 docs/Makefile.in                              |   20 +-
 docs/filters.md                               |   34 +-
 docs/images/Makefile.in                       |   16 +-
 docs/indexing.dox                             |  218 +++
 docs/windows-binaries.md                      |   26 +-
 examples/C/Makefile.am                        |   14 +-
 examples/C/Makefile.in                        |  139 +-
 examples/C/filter_example.c                   |    2 +-
 examples/C/hdf5plugins/.gitignore             |   11 +
 examples/C/hdf5plugins/CMakeLists.txt         |    6 -
 examples/C/hdf5plugins/H5Zbzip2.c             |  181 ---
 examples/C/hdf5plugins/Makefile.am            |    2 +-
 examples/C/hdf5plugins/Makefile.in            |   71 +-
 examples/C/hdf5plugins/blocksort.c            | 1094 -------------
 examples/C/hdf5plugins/bzlib.c                | 1572 -------------------
 examples/C/hdf5plugins/bzlib.h                |  282 ----
 examples/C/hdf5plugins/bzlib_private.h        |  509 ------
 examples/C/hdf5plugins/compress.c             |  672 --------
 examples/C/hdf5plugins/crctable.c             |  104 --
 examples/C/hdf5plugins/decompress.c           |  646 --------
 examples/C/hdf5plugins/h5bzip2.h              |   30 -
 examples/C/hdf5plugins/huffman.c              |  205 ---
 examples/C/hdf5plugins/randtable.c            |   84 -
 examples/C/run_nc4_valgrind_tests.sh          |   24 -
 examples/C/run_valgrind_tests.sh              |   24 -
 examples/CDL/Makefile.in                      |   18 +-
 examples/Makefile.in                          |   18 +-
 h5_test/Makefile.am                           |   13 +-
 h5_test/Makefile.in                           |  191 ++-
 h5_test/run_valgrind_tests.sh                 |   29 -
 hdf4_test/CMakeLists.txt                      |   16 +
 hdf4_test/Makefile.am                         |   37 +
 {nctest => hdf4_test}/Makefile.in             |  262 ++--
 {nc_test4 => hdf4_test}/ref_chunked.hdf4      |  Bin
 {nc_test4 => hdf4_test}/ref_contiguous.hdf4   |  Bin
 hdf4_test/run_formatx_hdf4.sh                 |   51 +
 {nc_test4 => hdf4_test}/run_get_hdf4_files.sh |    2 +-
 {nc_test4 => hdf4_test}/tst_chunk_hdf4.c      |    0
 {nc_test4 => hdf4_test}/tst_h4_lendian.c      |    1 -
 {nc_test4 => hdf4_test}/tst_interops2.c       |    2 +-
 {nc_test4 => hdf4_test}/tst_interops3.c       |    1 -
 include/Makefile.am                           |   14 +-
 include/Makefile.in                           |   23 +-
 include/hdf4dispatch.h                        |  276 ++++
 include/nc3dispatch.h                         |    5 +-
 include/nc3internal.h                         |   32 +-
 include/nc4internal.h                         |    1 +
 include/nc_tests.h                            |    1 +
 include/ncdispatch.h                          |   10 +-
 include/nchashmap.h                           |  113 +-
 include/nclist.h                              |   16 +-
 include/nclistmap.h                           |  100 ++
 include/netcdf.h                              |    7 +-
 include/netcdf_meta.h.in                      |    2 +-
 include/onstack.h                             |    2 +-
 install-sh                                    |   45 +-
 libdap2/Makefile.in                           |  126 +-
 libdap2/dapdump.c                             |    4 +-
 libdap2/dapincludes.h                         |    1 -
 libdap2/ncd2dispatch.c                        |   21 +-
 libdap2/ncd2dispatch.h                        |    6 +-
 libdap4/Makefile.in                           |  156 +-
 libdap4/d4chunk.c                             |    2 +-
 libdap4/d4curlfunctions.c                     |    6 +-
 libdap4/d4varx.c                              |    2 +-
 libdap4/ncd4dispatch.c                        |    2 +-
 libdispatch/Makefile.in                       |  277 +++-
 libdispatch/ddim.c                            |    3 +-
 libdispatch/derror.c                          |    2 +
 libdispatch/dfile.c                           |  148 +-
 libdispatch/dfilter.c                         |    2 +-
 libdispatch/drc.c                             |   55 +-
 libdispatch/dvar.c                            |  209 +--
 libdispatch/ncbytes.c                         |    6 +-
 libdispatch/nchashmap.c                       | 2094 +++++++++++++++++++++++--
 libdispatch/nclist.c                          |   41 +-
 libdispatch/nclistmgr.c                       |    5 +
 libhdf4/CMakeLists.txt                        |   17 +
 libhdf4/Makefile.am                           |   25 +
 {libsrcp => libhdf4}/Makefile.in              |  130 +-
 libhdf4/hdf4attr.c                            |   69 +
 libhdf4/hdf4dim.c                             |   44 +
 libhdf4/hdf4dispatch.c                        |  134 ++
 libhdf4/hdf4file.c                            |  713 +++++++++
 libsrc4/ncfunc.c => libhdf4/hdf4func.c        |   63 +-
 libhdf4/hdf4grp.c                             |   53 +
 libhdf4/hdf4type.c                            |  309 ++++
 libhdf4/hdf4var.c                             |  379 +++++
 liblib/CMakeLists.txt                         |    4 +
 liblib/Makefile.am                            |    8 +-
 liblib/Makefile.in                            |   68 +-
 liblib/nc_initialize.c                        |    8 +
 libnetcdf.settings.in                         |    2 +-
 libsrc/CMakeLists.txt                         |    1 +
 libsrc/Makefile.in                            |  134 +-
 libsrc/attr.c                                 | 1396 +++++++++--------
 libsrc/attr.m4                                |   30 +-
 libsrc/nc3dispatch.c                          |   12 +-
 libsrc/nc3internal.c                          |  120 +-
 libsrc/posixio.c                              |    4 -
 libsrc/putget.c                               |    4 -
 libsrc/putget.m4                              |    4 -
 libsrc/v1hpg.c                                |   28 +-
 libsrc/var.c                                  |  115 +-
 libsrc4/Makefile.in                           |  111 +-
 libsrc4/nc4attr.c                             | 1055 ++++++-------
 libsrc4/nc4dim.c                              |  211 +--
 libsrc4/nc4dispatch.c                         |    4 +-
 libsrc4/nc4file.c                             |  558 +------
 libsrc4/nc4grp.c                              |    4 +-
 libsrc4/nc4hdf.c                              |   99 +-
 libsrc4/nc4internal.c                         |   32 +-
 libsrc4/nc4var.c                              |  121 +-
 libsrc4/ncfunc.c                              |   14 +-
 libsrcp/Makefile.in                           |   51 +-
 libsrcp/ncpdispatch.c                         |   19 +-
 missing                                       |   14 +-
 nc_test/CMakeLists.txt                        |    2 +-
 nc_test/Makefile.am                           |   38 +-
 nc_test/Makefile.in                           |  397 +++--
 nc_test/bad_cdf5_begin.nc                     |  Bin 0 -> 220 bytes
 nc_test/run_cdf5.sh                           |    6 +
 nc_test/run_valgrind_tests.sh                 |   29 -
 nc_test/test_write.c                          |   17 +
 nc_test/test_write.m4                         |   17 +
 nc_test/tst_cdf5_begin.c                      |   56 +
 nc_test/tst_def_var_fill.c                    |  151 ++
 nc_test/tst_meta.c                            |    7 +
 nc_test/tst_names.c                           |   15 +-
 nc_test/tst_open_cdf5.c                       |   25 +
 nc_test/util.c                                |    4 -
 nc_test4/CMakeLists.txt                       |   21 +-
 nc_test4/Makefile.am                          |   72 +-
 nc_test4/Makefile.in                          |  718 +++++----
 nc_test4/hdf5plugins/CMakeLists.txt           |   13 +-
 nc_test4/hdf5plugins/H5Zmisc.c                |   11 +-
 nc_test4/hdf5plugins/Makefile.am              |    4 +-
 nc_test4/hdf5plugins/Makefile.in              |   77 +-
 nc_test4/run_chunk_hdf4.sh                    |   26 -
 nc_test4/run_hdf4_valgrind_tests.sh           |   25 -
 nc_test4/run_valgrind_tests.sh                |   32 -
 nc_test4/run_valgrind_tests2.sh               |   23 -
 nc_test4/test_filter_misc.c                   |    7 +-
 nc_test4/tst_atts.c                           |  357 ++++-
 nc_test4/tst_atts2.c                          |   13 +-
 nc_test4/tst_chunks.c                         |  120 +-
 nc_test4/tst_dims.c                           |  430 +++--
 nc_test4/tst_filter.sh                        |   83 +-
 nc_test4/tst_filterparser.c                   |    9 +-
 nc_test4/tst_formatx_hdf4.sh                  |   32 -
 nc_test4/tst_grps.c                           |    6 +-
 nc_test4/tst_h5_endians.c                     |    4 +-
 nc_test4/tst_hdf4_read_var.sh                 |   27 -
 nc_test4/tst_nc_test_file.c                   |   33 -
 nc_test4/tst_put_vars_two_unlim_dim.c         |    1 +
 nc_test4/tst_rehash.c                         |    3 +-
 nc_test4/tst_rename.c                         |  147 +-
 nc_test4/tst_rename2.c                        |  140 ++
 nc_test4/tst_strings.c                        |  219 ++-
 nc_test4/tst_types.c                          |    2 +-
 nc_test4/tst_vars.c                           |   73 +-
 nc_test4/tst_vars2.c                          |  205 ++-
 ncdap_test/Makefile.in                        |  100 +-
 ncdap_test/expected3/Makefile.in              |   16 +-
 ncdap_test/expectremote3/Makefile.in          |   16 +-
 ncdap_test/testdata3/Makefile.in              |   16 +-
 ncdump/Makefile.am                            |    4 +
 ncdump/Makefile.in                            |  228 ++-
 ncdump/cdl/Makefile.in                        |   16 +-
 ncdump/expected/Makefile.in                   |   16 +-
 ncdump/nccopy.c                               |  167 +-
 ncgen/Makefile.in                             |  144 +-
 ncgen/genbin.c                                |    4 +-
 ncgen/genlib.c                                |    2 +
 ncgen/ncgen.y                                 |   18 +-
 ncgen/ncgeny.c                                |  618 ++++----
 ncgen/ncgeny.h                                |    2 +-
 ncgen3/Makefile.in                            |   87 +-
 nctest/Makefile.am                            |    8 +-
 nctest/Makefile.in                            |  146 +-
 nctest/run_valgrind_tests.sh                  |   28 -
 oc2/Makefile.in                               |  124 +-
 test-driver                                   |    8 +-
 test_common.in                                |    4 +-
 206 files changed, 12461 insertions(+), 12872 deletions(-)

diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..4e2b093
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,9 @@
+# These owners will be the default owners for everything in the repo.
+# Unless a later match takes precedence, global owners
+# will be requested for review when someone opens a pull request.
+*       @WardF @DennisHeimbigner
+
+# Order is important; the last matching pattern takes the most precedence.
+# When someone opens a pull request that only modifies specified file types, only
+# that owner will be requested for a review, not the global owner(s).
+# Email addresses can be used as well as GitHub user names.
diff --git a/.gitignore b/.gitignore
index e961777..1bd71d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-### 'Normal' gitignore files.
 autom4te.cache
 debug.txt
 CTestConfig.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8214ed5..4858eb1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ set(PACKAGE "netCDF" CACHE STRING "")
 
 SET(NC_VERSION_MAJOR 4)
 SET(NC_VERSION_MINOR 6)
-SET(NC_VERSION_PATCH 0)
+SET(NC_VERSION_PATCH 1)
 SET(NC_VERSION_NOTE "")
 SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
 SET(VERSION ${netCDF_VERSION})
@@ -86,16 +86,16 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/"
   CACHE INTERNAL "Location of our custom CMake modules.")
 
 # auto-configure style checks, other CMake modules.
-INCLUDE(${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceCompiles.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/GetPrerequisites.cmake)
+INCLUDE(CheckLibraryExists)
+INCLUDE(CheckIncludeFile)
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckTypeSize)
+INCLUDE(CheckFunctionExists)
+INCLUDE(CheckCXXSourceCompiles)
+INCLUDE(CheckCSourceCompiles)
+INCLUDE(TestBigEndian)
+INCLUDE(CheckSymbolExists)
+INCLUDE(GetPrerequisites)
 
 INCLUDE(CheckCCompilerFlag)
 FIND_PACKAGE(PkgConfig QUIET)
@@ -325,6 +325,35 @@ IF(${CMAKE_SYSTEM_NAME} EQUAL "Darwin")
   SET(CMAKE_OSX_ARCHITECTURES i386;x86_64)
 ENDIF(${CMAKE_SYSTEM_NAME} EQUAL "Darwin")
 
+# Macro for replacing '/MD' with '/MT'.
+# Used only on Windows, /MD tells VS to use the shared
+# CRT libs, MT tells VS to use the static CRT libs.
+#
+# Taken From:
+#   http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
+#
+MACRO(specify_static_crt_flag)
+  SET(vars
+    CMAKE_C_FLAGS
+    CMAKE_C_FLAGS_DEBUG
+    CMAKE_C_FLAGS_MINSIZEREL
+    CMAKE_C_FLAGS_RELWITHDEBINFO
+    CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG
+    CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
+    CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+
+  FOREACH(flag_var ${vars})
+    IF(${flag_var} MATCHES "/MD")
+      STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+    ENDIF()
+  ENDFOREACH()
+
+  FOREACH(flag_var ${vars})
+    MESSAGE(STATUS " '${flag_var}': ${${flag_var}}")
+  ENDFOREACH()
+  MESSAGE(STATUS "")
+ENDMACRO()
+
 # Option to use Static Runtimes in MSVC
 IF(MSVC)
   OPTION(NC_USE_STATIC_CRT "Use static CRT Libraries ('\\MT')." OFF)
@@ -402,7 +431,7 @@ IF(NC_EXTRA_DEPS)
     STRING(REGEX REPLACE "^-l" "" _LIB ${_DEP})
     FIND_LIBRARY("${_LIB}_DEP" NAMES "${_LIB}" "lib${_LIB}")
     MESSAGE(${${_LIB}_DEP})
-    IF(NOT "${_LIB}_DEP")
+    IF("${${_LIB}_DEP}" STREQUAL "${_LIB}_DEP-NOTFOUND")
       MESSAGE(FATAL_ERROR "Error finding ${_LIB}.")
     ELSE()
       MESSAGE(STATUS "Found ${_LIB}: ${${_LIB}_DEP}")
@@ -418,7 +447,7 @@ ENDIF()
 ###
 
 # Option to use HDF4
-OPTION(ENABLE_HDF4 "Build netCDF-4 with HDF5 read capability(HDF4, HDF5 and Zlib required)." OFF)
+OPTION(ENABLE_HDF4 "Build netCDF-4 with HDF4 read capability(HDF4, HDF5 and Zlib required)." OFF)
 IF(ENABLE_HDF4)
   SET(USE_HDF4 ON)
   # Check for include files, libraries.
@@ -427,7 +456,6 @@ IF(ENABLE_HDF4)
   IF(NOT MFHDF_H_INCLUDE_DIR)
     MESSAGE(FATAL_ERROR "HDF4 Support specified, cannot find file mfhdf.h")
   ELSE()
-    SET(HAVE_MFHDF_H ON CACHE BOOL "")
     INCLUDE_DIRECTORIES(${MFHDF_H_INCLUDE_DIR})
   ENDIF()
 
@@ -498,6 +526,11 @@ IF(ENABLE_NETCDF_4)
   SET(USE_NETCDF4 ON CACHE BOOL "")
   SET(ENABLE_NETCDF_4 ON CACHE BOOL "")
   SET(ENABLE_NETCDF4 ON CACHE BOOL "")
+ELSE()
+  SET(USE_HDF4_FILE_TESTS OFF)
+  SET(USE_HDF4 OFF)
+  SET(ENABLE_HDF4_FILE_TESTS OFF)
+  SET(ENABLE_HDF4 OFF)
 ENDIF()
 
 # Option to allow for strict null file padding.
@@ -675,7 +708,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
     ENDIF()
 
     IF(HDF5_IS_PARALLEL_MPIO)
-      SET(HAVE_H5PGET_FAPL_MPIO TRUE)
       SET(USE_PARALLEL_MPIO ON)
     ENDIF()
 
@@ -685,16 +717,8 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
 
     #Check to see if HDF5 library has collective metadata APIs, (HDF5 >= 1.10.0)
     CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_all_coll_metadata_ops "" HDF5_HAS_COLL_METADATA_OPS)
-
-    OPTION(ENABLE_DYNAMIC_LOADING "Enable Dynamic Loading" ON)
-    IF(ENABLE_DYNAMIC_LOADING)
-      SET(USE_LIBDL ON CACHE BOOL "")
-    ENDIF()
   ENDIF(NOT MSVC)
 
-  # Make sure the user has built the library with zlib support.
-  CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_deflate "" HAVE_H5PSET_DEFLATE)
-
   #Check to see if H5Z_SZIP exists in HDF5_Libraries. If so, we must use szip.
   CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Z_SZIP "" USE_SZIP)
   IF(USE_SZIP)
@@ -708,53 +732,20 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
     ENDIF()
   ENDIF()
 
-  CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HDF5_HAS_H5FREE)
-  IF(HDF5_HAS_H5FREE)
-    SET(HAVE_H5FREE_MEMORY TRUE)
-  ENDIF(HDF5_HAS_H5FREE)
   CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Pset_libver_bounds "" HDF5_HAS_LIBVER_BOUNDS)
 
-  IF(HDF5_HAS_LIBVER_BOUNDS)
-    SET(HAVE_H5PSET_LIBVER_BOUNDS TRUE)
-  ENDIF(HDF5_HAS_LIBVER_BOUNDS)
-
   IF(HDF5_PARALLEL)
 	SET(HDF5_CC h5pcc)
   ELSE()
 	SET(HDF5_CC h5cc)
   ENDIF()
 
-  # Starting with hdf5 1.8.11, dynamic loading is an option.
-  # In case hdf5 has a dependency on libdl, the user must specify
-  # -DENABLE_DYNAMIC_LOADING=ON when configuring netcdf.
-  IF(USE_LIBDL)
-    FIND_LIBRARY(LIBDL NAMES dl dld)
-    FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h)
-    IF(NOT LIBDL)
-      MESSAGE(ERROR "Cannot find libdl, but dynamic loading was specified.")
-    ENDIF()
-    IF(NOT LIBDL_INCLUDE_DIR)
-      MESSAGE(ERROR "Cannot find dlfcn.h, but dynamic loading was specified.")
-    ENDIF()
-    MESSAGE(STATUS "Found libdl: ${LIBDL}")
-    SET(HAVE_LIBDL ON)
-    INCLUDE_DIRECTORIES(${LIBDL_INCLUDE_DIR})
-  ENDIF()
-
   SET(H5_USE_16_API 1)
   OPTION(NC_ENABLE_HDF_16_API "Enable HDF5 1.6.x Compatibility(Required)" ON)
   IF(NOT NC_ENABLE_HDF_16_API)
     SET(H5_USE_16_API 0)
   ENDIF()
 
-  # Check for ZLib, but only if using HDF5.
-  FIND_PACKAGE(ZLIB)
-  IF(NOT ZLIB_LIBRARY)
-    MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find ZLib.")
-  ENDIF()
-  SET(USE_ZLIB ON)
-  INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
-
   FIND_PATH(HAVE_HDF5_H hdf5.h)
   IF(NOT HAVE_HDF5_H)
     MESSAGE(FATAL_ERROR "Compiling a test with hdf5 failed. Either hdf5.h cannot be found, or the log messages should be checked for another reason.")
@@ -762,6 +753,9 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
     INCLUDE_DIRECTORIES(${HAVE_HDF5_H})
   ENDIF(NOT HAVE_HDF5_H)
 
+  #option to include HDF5 High Level header file (hdf5_hl.h) in case we are not doing a make install
+  INCLUDE_DIRECTORIES(${HDF5_HL_INCLUDE_DIR})
+
 
 ENDIF(USE_HDF5 OR ENABLE_NETCDF_4)
 
@@ -816,12 +810,6 @@ IF(ENABLE_DAP)
   #include <curl/curl.h>
   int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE)
 
-  # Check to see if CURLOPT_CHUNK_BGN_FUNCTION is defined.
-  # It showed up in curl 7.21.0.
-  CHECK_C_SOURCE_COMPILES("
-  #include <curl/curl.h>
-  int main() {int x = CURLOPT_CHUNK_BGN_FUNCTION;}" HAVE_CURLOPT_CHUNK_BGN_FUNCTION)
-
   # Check to see if CURLINFO_HTTP_CONNECTCODE is defined.
   # It showed up in curl 7.10.7.
   CHECK_C_SOURCE_COMPILES("
@@ -1097,7 +1085,7 @@ IF(STATUS_RELAX_COORD_BOUND)
 ENDIF()
 
 # Enable Parallel Tests.
-OPTION(ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Ignored if netCDF4 is not enabled, or if there is no parallel I/O Support." ${USE_PARALLEL})
+OPTION(ENABLE_PARALLEL_TESTS "Enable Parallel IO Tests. Requires HDF5/NetCDF4 with parallel I/O Support." ${USE_PARALLEL})
 IF(ENABLE_PARALLEL_TESTS AND USE_PARALLEL)
   SET(TEST_PARALLEL ON CACHE BOOL "")
   IF(USE_NETCDF4)
@@ -1105,6 +1093,10 @@ IF(ENABLE_PARALLEL_TESTS AND USE_PARALLEL)
   ENDIF()
 ENDIF()
 
+IF (ENABLE_PARALLEL_TESTS AND NOT USE_PARALLEL)
+  MESSAGE(FATAL_ERROR "Parallel tests requested, but no parallel HDF5 installation detected.")
+ENDIF()
+
 # Enable special filter test; experimental when using cmake.
 OPTION(ENABLE_FILTER_TESTING "Enable filter testing. Ignored if shared libraries or netCDF4 are not enabled" OFF)
 IF(NOT ENABLE_NETCDF4)
@@ -1203,20 +1195,6 @@ MARK_AS_ADVANCED(ENABLE_SHARED_LIBRARY_VERSION)
 # Option checks
 ################################
 
-####
-# Check to see if char is signed or unsigned.
-####
-
-SET(SIGNED_TEST_SOURCE "\n
-  #include <stdlib.h>\n
-  int main(void) {\n
-    char error_if_char_is_signed[((char)-1) < 0 ? -1 : 1];\n
-    error_if_char_is_signed[0] = 0;
-    return -;\n
-}\n")
-
-CHECK_C_SOURCE_COMPILES("${SIGNED_TEST_SOURCE}" __CHAR_UNSIGNED__)
-
 # Library include checks
 CHECK_INCLUDE_FILE("math.h"      HAVE_MATH_H)
 CHECK_INCLUDE_FILE("unistd.h"  HAVE_UNISTD_H)
@@ -1228,13 +1206,8 @@ ENDIF()
 
 CHECK_INCLUDE_FILE("alloca.h"  HAVE_ALLOCA_H)
 CHECK_INCLUDE_FILE("malloc.h"    HAVE_MALLOC_H)
-CHECK_INCLUDE_FILE("ctype.h"   HAVE_CTYPE_H)
-CHECK_INCLUDE_FILE("dirent.h"  HAVE_DIRENT_H)
-CHECK_INCLUDE_FILE("dlfcn.h"   HAVE_DLFCN_H)
-CHECK_INCLUDE_FILE("errno.h"   HAVE_ERRNO_H)
 CHECK_INCLUDE_FILE("fcntl.h"   HAVE_FCNTL_H)
 CHECK_INCLUDE_FILE("getopt.h"  HAVE_GETOPT_H)
-CHECK_INCLUDE_FILE("stdbool.h"   HAVE_STDBOOL_H)
 CHECK_INCLUDE_FILE("locale.h"  HAVE_LOCALE_H)
 CHECK_INCLUDE_FILE("stdint.h"  HAVE_STDINT_H)
 CHECK_INCLUDE_FILE("stdio.h"   HAVE_STDIO_H)
@@ -1245,50 +1218,30 @@ CHECK_INCLUDE_FILE("stdlib.h"  HAVE_STDLIB_H)
 CHECK_INCLUDE_FILE("stdarg.h"    HAVE_STDARG_H)
 CHECK_INCLUDE_FILE("strings.h"   HAVE_STRINGS_H)
 CHECK_INCLUDE_FILE("signal.h"    HAVE_SIGNAL_H)
-CHECK_INCLUDE_FILE("sys/dir.h"   HAVE_SYS_DIR_H)
-CHECK_INCLUDE_FILE("sys/ndir.h"  HAVE_SYS_NDIR_H)
 CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
 CHECK_INCLUDE_FILE("sys/stat.h"  HAVE_SYS_STAT_H)
 CHECK_INCLUDE_FILE("sys/time.h"  HAVE_SYS_TIME_H)
 CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
-CHECK_INCLUDE_FILE("sys/wait.h"  HAVE_SYS_WAIT_H)
 CHECK_INCLUDE_FILE("sys/mman.h"  HAVE_SYS_MMAN_H)
 CHECK_INCLUDE_FILE("sys/resource.h" HAVE_SYS_RESOURCE_H)
-CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H)
 CHECK_INCLUDE_FILE("fcntl.h"  HAVE_FCNTL_H)
 CHECK_INCLUDE_FILE("inttypes.h"  HAVE_INTTYPES_H)
 CHECK_INCLUDE_FILE("pstdint.h"  HAVE_PSTDINT_H)
 CHECK_INCLUDE_FILE("endian.h" HAVE_ENDIAN_H)
 CHECK_INCLUDE_FILE("BaseTsd.h"  HAVE_BASETSD_H)
 CHECK_INCLUDE_FILE("stddef.h"   HAVE_STDDEF_H)
-CHECK_INCLUDE_FILE("memory.h"  HAVE_MEMORY_H)
 CHECK_INCLUDE_FILE("string.h"  HAVE_STRING_H)
 CHECK_INCLUDE_FILE("winsock2.h" HAVE_WINSOCK2_H)
 CHECK_INCLUDE_FILE("ftw.h"  HAVE_FTW_H)
-
-CHECK_INCLUDE_FILES("time.h;sys/time.h" TIME_WITH_SYS_TIME)
-
-IF(NOT HAVE_STDLIB_H)
-  SET(NO_STDLIB_H TRUE)
-ENDIF(NOT HAVE_STDLIB_H)
-
-IF(NOT HAVE_SYS_TYPES_H)
-  SET(NO_SYS_TYPES_H TRUE)
-ENDIF(NOT HAVE_SYS_TYPES_H)
-
+CHECK_INCLUDE_FILE("libgen.h" HAVE_LIBGEN_H)
 
 # Symbol Exists
 CHECK_SYMBOL_EXISTS(isfinite "math.h" HAVE_DECL_ISFINITE)
 CHECK_SYMBOL_EXISTS(isnan "math.h" HAVE_DECL_ISNAN)
 CHECK_SYMBOL_EXISTS(isinf "math.h" HAVE_DECL_ISINF)
-CHECK_SYMBOL_EXISTS(signbit "math.h" HAVE_DECL_SIGNBIT)
 CHECK_SYMBOL_EXISTS(st_blksize "sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE)
 CHECK_SYMBOL_EXISTS(alloca "alloca.h" HAVE_ALLOCA)
 CHECK_SYMBOL_EXISTS(snprintf "stdio.h" HAVE_SNPRINTF)
-CHECK_SYMBOL_EXISTS(vprintf "stdio.h" HAVE_VPRINTF)
-
-# For historic purposes...
-SET(HAVE_ST_BLKSIZE ${HAVE_STRUCT_STAT_ST_BLKSIZE})
 
 # Type checks
 # Aliases for automake consistency
@@ -1303,6 +1256,11 @@ IF(SIZEOF_UINT)
   SET(HAVE_UINT TRUE)
 ENDIF(SIZEOF_UINT)
 
+CHECK_TYPE_SIZE("schar"      SIZEOF_SCHAR)
+IF(SIZEOF_SCHAR)
+  SET(HAVE_SCHAR TRUE)
+ENDIF(SIZEOF_SCHAR)
+
 CHECK_TYPE_SIZE("long"      SIZEOF_LONG)
 CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
 IF(SIZEOF_LONG_LONG)
@@ -1310,9 +1268,6 @@ IF(SIZEOF_LONG_LONG)
 ENDIF(SIZEOF_LONG_LONG)
 
 CHECK_TYPE_SIZE("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
-IF(SIZEOF_UNSIGNED_LONG_LONG)
-  SET(HAVE_UNSIGNED_LONG_LONG_INT TRUE)
-ENDIF(SIZEOF_UNSIGNED_LONG_LONG)
 
 CHECK_TYPE_SIZE("off_t"     SIZEOF_OFF_T)
 CHECK_TYPE_SIZE("off64_t"   SIZEOF_OFF64_T)
@@ -1323,20 +1278,12 @@ IF(SIZEOF_USHORT)
 ENDIF(SIZEOF_USHORT)
 
 CHECK_TYPE_SIZE("_Bool"     SIZEOF__BOOL)
-IF(SIZEOF__BOOL)
-  SET(HAVE__BOOL TRUE)
-ENDIF(SIZEOF__BOOL)
 
 CHECK_TYPE_SIZE("size_t"    SIZEOF_SIZE_T)
-IF(SIZEOF_SIZE_T)
-  SET(HAVE_SIZE_T TRUE)
-ENDIF(SIZEOF_SIZE_T)
 
-CHECK_TYPE_SIZE("ssize_t"   SIZEOF_SSIZE_T)
-CHECK_TYPE_SIZE("ptrdiff_t" SIZEOF_PTRDIFF_T)
-IF(SIZEOF_PTRDIFF_T)
-  SET(HAVE_PTRDIFF_T TRUE)
-ENDIF(SIZEOF_PTRDIFF_T)
+
+CHECK_TYPE_SIZE("ssize_t"   HAVE_SSIZE_T)
+
 
 # __int64 is used on Windows for large file support.
 CHECK_TYPE_SIZE("__int64"   SIZEOF___INT_64)
@@ -1355,44 +1302,24 @@ IF(MSVC AND SIZEOF___INT_64)
   SET(SIZEOF_OFF_T  ${SIZEOF___INT_64})
 ENDIF()
 
-IF(SIZEOF_SSIZE_T)
-  SET(HAVE_SSIZE_T 1)
-ELSE()
-  CHECK_TYPE_SIZE("SSIZE_T" SIZEOF_SSIZE_T)
-  IF(SIZEOF_SSIZE_T)
-    SET(HAVE_SSIZE_T 1)
-  ENDIF()
-ENDIF()
-
 # Check for various functions.
 CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
 CHECK_FUNCTION_EXISTS(strlcat   HAVE_STRLCAT)
-CHECK_FUNCTION_EXISTS(strerror  HAVE_STRERROR)
-CHECK_FUNCTION_EXISTS(strchr  HAVE_STRCHR)
-CHECK_FUNCTION_EXISTS(strrchr HAVE_STRRCHR)
-CHECK_FUNCTION_EXISTS(strcat  HAVE_STRCAT)
-CHECK_FUNCTION_EXISTS(strcpy  HAVE_STRCPY)
 CHECK_FUNCTION_EXISTS(strdup  HAVE_STRDUP)
 CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
-CHECK_FUNCTION_EXISTS(strcasecmp  HAVE_STRCASECMP)
-CHECK_FUNCTION_EXISTS(strtod  HAVE_STRTOD)
 CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL)
 CHECK_FUNCTION_EXISTS(strtoull  HAVE_STRTOULL)
-CHECK_FUNCTION_EXISTS(strstr  HAVE_STRSTR)
 CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
 CHECK_FUNCTION_EXISTS(mktemp HAVE_MKTEMP)
-CHECK_FUNCTION_EXISTS(rand  HAVE_RAND)
 CHECK_FUNCTION_EXISTS(random HAVE_RANDOM)
 CHECK_FUNCTION_EXISTS(gettimeofday  HAVE_GETTIMEOFDAY)
 CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
 CHECK_FUNCTION_EXISTS(MPI_Comm_f2c  HAVE_MPI_COMM_F2C)
 CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
-CHECK_FUNCTION_EXISTS(memcmp HAVE_MEMCMP)
 CHECK_FUNCTION_EXISTS(getpagesize HAVE_GETPAGESIZE)
 CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
 CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT)
 CHECK_FUNCTION_EXISTS(_filelengthi64 HAVE_FILE_LENGTH_I64)
-CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
 CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
 
 IF(ENABLE_MMAP)
@@ -1400,7 +1327,6 @@ IF(ENABLE_MMAP)
     MESSAGE(WARNING "mremap not found: disabling MMAP support.")
     SET(ENABLE_MMAP OFF)
   ELSE(NOT HAVE_MREMAP)
-    SET(HAVE_MMAP ON)
     SET(BUILD_MMAP ON)
     SET(USE_MMAP ON)
   ENDIF(NOT HAVE_MREMAP)
@@ -1428,12 +1354,16 @@ ENDMACRO()
 # A basic script used to convert m4 files
 FIND_PROGRAM(NC_M4 NAMES m4)
 IF(NC_M4)
-    SET(HAVE_M4 TRUE)
-ENDIF()
+  MESSAGE(STATUS "Found m4: ${NC_M4}")
+  SET(HAVE_M4 TRUE)
+ELSE(NC_M4)
+  MESSAGE(STATUS "m4 not found.")
+ENDIF(NC_M4)
 
 MACRO(GEN_m4 filename)
 
-IF(HAVE_M4)
+  IF(HAVE_M4)
+
   # If m4 is available, remove generated file if it exists.
   IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
     FILE(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/${filename}.c)
@@ -1629,34 +1559,7 @@ MACRO(add_sh_test prefix F)
   ENDIF()
 ENDMACRO()
 
-# Macro for replacing '/MD' with '/MT'.
-# Used only on Windows, /MD tells VS to use the shared
-# CRT libs, MT tells VS to use the static CRT libs.
-#
-# Taken From:
-#   http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
-#
-MACRO(specify_static_crt_flag)
-  SET(vars
-    CMAKE_C_FLAGS
-    CMAKE_C_FLAGS_DEBUG
-    CMAKE_C_FLAGS_MINSIZEREL
-    CMAKE_C_FLAGS_RELWITHDEBINFO
-    CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG
-    CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
-    CMAKE_CXX_FLAGS_RELWITHDEBINFO)
-
-  FOREACH(flag_var ${vars})
-    IF(${flag_var} MATCHES "/MD")
-      STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
-    ENDIF()
-  ENDFOREACH()
 
-  FOREACH(flag_var ${vars})
-    MESSAGE(STATUS " '${flag_var}': ${${flag_var}}")
-  ENDFOREACH()
-  MESSAGE(STATUS "")
-ENDMACRO()
 
 # A function used to create autotools-style 'yes/no' definitions.
 # If a variable is set, it 'yes' is returned. Otherwise, 'no' is
@@ -1721,6 +1624,11 @@ IF(USE_HDF5)
   add_subdirectory(libsrc4)
 ENDIF(USE_HDF5)
 
+IF(USE_HDF4)
+  add_subdirectory(libhdf4)
+  add_subdirectory(hdf4_test)
+ENDIF(USE_HDF4)
+
 IF(ENABLE_DAP2)
   ADD_SUBDIRECTORY(oc2)
   ADD_SUBDIRECTORY(libdap2)
@@ -1926,7 +1834,7 @@ is_enabled(USE_MMAP HAS_MMAP)
 is_enabled(JNA HAS_JNA)
 is_enabled(STATUS_RELAX_COORD_BOUND RELAX_COORD_BOUND)
 is_enabled(USE_CDF5 HAS_CDF5)
-is_enabled(ENABLE_ERANGE_FILL ENABLE_ERANGE_FILL)
+is_enabled(ENABLE_ERANGE_FILL HAS_ERANGE_FILL)
 
 # Generate file from template.
 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libnetcdf.settings.in"
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..0bd0792
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support-netcdf at unidata.ucar.edu. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/Makefile.am b/Makefile.am
index 0a88c72..02f8e3f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,15 @@
 ## This is a automake file, part of Unidata's netCDF package.
-# Copyright 2005-2013, see the COPYRIGHT file for more information.
+# Copyright 2005-2018, see the COPYRIGHT file for more information.
 
 # This is the main automake file for netCDF. It builds the different
 # netcdf directories. Not all directories are built, depending on the
 # options selected during configure.
+
 # Ed Hartnett, Ward Fisher
 
+
+
+
 # This directory stores libtool macros, put there by aclocal.
 ACLOCAL_AMFLAGS = -I m4
 
@@ -17,14 +21,9 @@ RELEASE_NOTES.md CTestCustom.cmake CTestConfig.cmake.in			\
 libnetcdf.settings.in netCDFConfig.cmake.in CMakeInstallation.cmake	\
 test-driver-verbose test_common.in
 
-pkgconfigdir=$(libdir)/pkgconfig
+pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = netcdf.pc
 
-# We need a way to automatically generate INSTALL from
-# docs/install.doc, now that we've switched from texinfo to doxygen.
-# INSTALL:
-#	non-existent-doxygen-to-text-utility <  docs/install.doc > INSTALL
-
 # Does the user want to build the V2 API?
 if BUILD_V2
 V2_TEST = nctest
@@ -66,17 +65,24 @@ if USE_PNETCDF
 LIBSRCP = libsrcp
 endif
 
+# Build HDF4 if desired.
+if USE_HDF4
+HDF4_TEST_DIR = hdf4_test
+LIBHDF4 = libhdf4
+endif
+
 # Define Test directories
 if BUILD_TESTSETS
-TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(NCDAP2TESTDIR) $(NCDAP4TESTDIR)
+TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(HDF4_TEST_DIR)	\
+$(NCDAP2TESTDIR) $(NCDAP4TESTDIR)
 endif
 
 # This is the list of subdirs for which Makefiles will be constructed
 # and run. ncgen must come before ncdump, because their tests
 # depend on it.
 SUBDIRS = include $(H5_TEST_DIR) libdispatch libsrc $(LIBSRC4_DIR)	\
-$(LIBSRCP) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3) $(NCGEN)		\
-$(NCDUMP) $(TESTDIRS) docs $(EXAMPLES)
+$(LIBSRCP) $(LIBHDF4) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3)		\
+$(NCGEN) $(NCDUMP) $(TESTDIRS) docs $(EXAMPLES)
 
 # Remove these generated files, for a distclean.
 DISTCLEANFILES = VERSION comps.txt test_prog libnetcdf.settings	\
@@ -85,21 +91,6 @@ test_common.sh
 # The nc-config script helps the user build programs with netCDF.
 bin_SCRIPTS = nc-config
 
-# What needs to go in the binrary dist?
-BINFILES = README_BINARIES.txt
-BINFILES += include/netcdf.h share/man/man3/netcdf.3 lib/libnetcdf.a
-BINFILES += libnetcdf.settings
-ZIPBINFILES = ${prefix}/include/netcdf.h			\
-${prefix}/share/man/man3/netcdf.3 ${prefix}/lib/libnetcdf.a
-
-if BUILD_UTILITIES
-BINFILES += bin/ncgen3$(EXEEXT) bin/ncgen$(EXEEXT) bin/ncdump$(EXEEXT)	\
-share/man/man1/ncgen.1 share/man/man1/ncdump.1
-ZIPBINFILES += ${prefix}/bin/ncgen3$(EXEEXT)				\
-${prefix}/bin/ncgen$(EXEEXT) ${prefix}/bin/ncdump$(EXEEXT)		\
-${prefix}/share/man/man1/ncgen.1 ${prefix}/share/man/man1/ncdump.1
-endif
-
 # install libnetcdf.settings in lib directory.
 settingsdir = $(libdir)
 settings_DATA = libnetcdf.settings
@@ -118,7 +109,6 @@ mm4::
 	  b=`basename $$m` ; d=`dirname $$m`;\
 	  pushd $$d; m4 -s $${b}.m4 > $${b}.c ; popd; done
 
-
 #####
 # If ENABLE_FORTRAN was turned on,
 # we have new make targets, build-netcdf-fortran and
diff --git a/Makefile.in b/Makefile.in
index 8681604..9069528 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,11 +14,12 @@
 
 @SET_MAKE@
 
-# Copyright 2005-2013, see the COPYRIGHT file for more information.
+# Copyright 2005-2018, see the COPYRIGHT file for more information.
 
 # This is the main automake file for netCDF. It builds the different
 # netcdf directories. Not all directories are built, depending on the
 # options selected during configure.
+
 # Ed Hartnett, Ward Fisher
 
 
@@ -97,13 +98,6 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
- at BUILD_UTILITIES_TRUE@am__append_1 = bin/ncgen3$(EXEEXT) bin/ncgen$(EXEEXT) bin/ncdump$(EXEEXT)	\
- at BUILD_UTILITIES_TRUE@share/man/man1/ncgen.1 share/man/man1/ncdump.1
-
- at BUILD_UTILITIES_TRUE@am__append_2 = ${prefix}/bin/ncgen3$(EXEEXT)				\
- at BUILD_UTILITIES_TRUE@${prefix}/bin/ncgen$(EXEEXT) ${prefix}/bin/ncdump$(EXEEXT)		\
- at BUILD_UTILITIES_TRUE@${prefix}/share/man/man1/ncgen.1 ${prefix}/share/man/man1/ncdump.1
-
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -186,7 +180,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	cscope distdir dist dist-all distcheck
+	cscope distdir distdir-am dist dist-all distcheck
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
 	$(LISP)config.h.in
 # Read a list of newline-separated strings from the standard input,
@@ -208,9 +202,9 @@ am__define_uniq_tagged_files = \
 ETAGS = etags
 CTAGS = ctags
 CSCOPE = cscope
-DIST_SUBDIRS = include h5_test libdispatch libsrc libsrc4 libsrcp oc2 \
-	libdap2 libdap4 liblib ncgen3 ncgen ncdump nctest nc_test \
-	nc_test4 ncdap_test dap4_test docs examples
+DIST_SUBDIRS = include h5_test libdispatch libsrc libsrc4 libsrcp \
+	libhdf4 oc2 libdap2 libdap4 liblib ncgen3 ncgen ncdump nctest \
+	nc_test nc_test4 hdf4_test ncdap_test dap4_test docs examples
 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(srcdir)/libnetcdf.settings.in $(srcdir)/nc-config.in \
 	$(srcdir)/netcdf.pc.in $(srcdir)/postinstall.sh.in \
@@ -295,7 +289,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -304,6 +297,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -342,6 +336,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -455,11 +450,6 @@ test-driver-verbose test_common.in
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = netcdf.pc
 
-# We need a way to automatically generate INSTALL from
-# docs/install.doc, now that we've switched from texinfo to doxygen.
-# INSTALL:
-#	non-existent-doxygen-to-text-utility <  docs/install.doc > INSTALL
-
 # Does the user want to build the V2 API?
 @BUILD_V2_TRUE at V2_TEST = nctest
 
@@ -486,15 +476,21 @@ pkgconfig_DATA = netcdf.pc
 # Build pnetcdf
 @USE_PNETCDF_TRUE at LIBSRCP = libsrcp
 
+# Build HDF4 if desired.
+ at USE_HDF4_TRUE@HDF4_TEST_DIR = hdf4_test
+ at USE_HDF4_TRUE@LIBHDF4 = libhdf4
+
 # Define Test directories
- at BUILD_TESTSETS_TRUE@TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(NCDAP2TESTDIR) $(NCDAP4TESTDIR)
+ at BUILD_TESTSETS_TRUE@TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(HDF4_TEST_DIR)	\
+ at BUILD_TESTSETS_TRUE@$(NCDAP2TESTDIR) $(NCDAP4TESTDIR)
+
 
 # This is the list of subdirs for which Makefiles will be constructed
 # and run. ncgen must come before ncdump, because their tests
 # depend on it.
 SUBDIRS = include $(H5_TEST_DIR) libdispatch libsrc $(LIBSRC4_DIR)	\
-$(LIBSRCP) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3) $(NCGEN)		\
-$(NCDUMP) $(TESTDIRS) docs $(EXAMPLES)
+$(LIBSRCP) $(LIBHDF4) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3)		\
+$(NCGEN) $(NCDUMP) $(TESTDIRS) docs $(EXAMPLES)
 
 
 # Remove these generated files, for a distclean.
@@ -505,14 +501,6 @@ test_common.sh
 # The nc-config script helps the user build programs with netCDF.
 bin_SCRIPTS = nc-config
 
-# What needs to go in the binrary dist?
-BINFILES = README_BINARIES.txt include/netcdf.h \
-	share/man/man3/netcdf.3 lib/libnetcdf.a libnetcdf.settings \
-	$(am__append_1)
-ZIPBINFILES = ${prefix}/include/netcdf.h \
-	${prefix}/share/man/man3/netcdf.3 ${prefix}/lib/libnetcdf.a \
-	$(am__append_2)
-
 # install libnetcdf.settings in lib directory.
 settingsdir = $(libdir)
 settings_DATA = libnetcdf.settings
@@ -550,8 +538,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	    echo ' $(SHELL) ./config.status'; \
 	    $(SHELL) ./config.status;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -780,7 +768,10 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	$(am__remove_distdir)
 	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index be5741e..5b2afd7 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -5,7 +5,13 @@ Release Notes       {#RELEASE_NOTES}
 
 This file contains a high-level description of this package's evolution. Releases are in reverse chronological order (most recent first). Note that, as of netcdf 4.2, the `netcdf-c++` and `netcdf-fortran` libraries have been separated into their own libraries.
 
-## 4.6.1 - TBD
+## 4.6.1 - March 19, 2018
+
+* [Bug Fix] Corrected an issue which could result in a dap4 failure. See [Github #888](https://github.com/Unidata/netcdf-c/pull/888) for more information.
+* [Bug Fix][Enhancement] Allow `nccopy` to control output filter suppresion.  See [Github #894](https://github.com/Unidata/netcdf-c/pull/894) for more information.
+* [Enhancement] Reverted some new behaviors that, while in line with the netCDF specification, broke existing workflows.  See [Github #843](https://github.com/Unidata/netcdf-c/issues/843) for more information.
+* [Bug Fix] Improved support for CRT builds with Visual Studio, improves zlib detection in hdf5 library. See [Github #853](https://github.com/Unidata/netcdf-c/pull/853) for more information.
+* [Enhancement][Internal] Moved HDF4 into a distinct dispatch layer. See [Github #849](https://github.com/Unidata/netcdf-c/pull/849) for more information.
 
 ## 4.6.0 - January 24, 2018
 * [Enhancement] Full support for using HDF5 dynamic filters, both for reading and writing. See the file docs/filters.md.
diff --git a/aclocal.m4 b/aclocal.m4
index 8897626..4efb5e5 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
 
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002-2017 Free Software Foundation, Inc.
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.15'
+[am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.15.1], [],
+m4_if([$1], [1.16.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15.1])dnl
+[AM_AUTOMAKE_VERSION([1.16.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -332,13 +332,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@@ -346,49 +345,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  AS_CASE([$CONFIG_FILES],
+          [*\'*], [eval set x "$CONFIG_FILES"],
+          [*], [set x $CONFIG_FILES])
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`AS_DIRNAME("$mf")`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "$am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`AS_DIRNAME(["$file"])`
-      AS_MKDIR_P([$dirpart/$fdir])
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`AS_DIRNAME(["$am_mf"])`
+    am_filepart=`AS_BASENAME(["$am_mf"])`
+    AM_RUN_LOG([cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles]) || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  Try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).])
+  fi
+  AS_UNSET([am_dirpart])
+  AS_UNSET([am_filepart])
+  AS_UNSET([am_mf])
+  AS_UNSET([am_rc])
+  rm -f conftest-deps.mk
 }
 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
 
@@ -397,18 +388,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # -----------------------------
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each '.P' file that we will
-# need in order to bootstrap the dependency handling code.
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
+     [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -495,8 +485,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
 # For better backward compatibility.  To be removed once Automake 1.9.x
 # dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
 # We need awk for the "check" target (and possibly the TAP driver).  The
 # system "awk" is bad on some platforms.
@@ -563,7 +553,7 @@ END
 Aborting the configuration process, to ensure you take notice of the issue.
 
 You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
 
 If you want to complete the configuration process using your problematic
 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -605,7 +595,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -626,7 +616,7 @@ if test x"${install_sh+set}" != xset; then
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2017 Free Software Foundation, Inc.
+# Copyright (C) 2003-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -648,7 +638,7 @@ AC_SUBST([am__leading_dot])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -683,7 +673,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -691,49 +681,42 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 
 # AM_MAKE_INCLUDE()
 # -----------------
-# Check to see how make treats includes.
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
 AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
 am__doit:
-	@echo this is the am__doit target
+	@echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+  AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+      ['0:this is the am__doit target'],
+      [AS_CASE([$s],
+          [BSD], [am__include='.include' am__quote='"'],
+          [am__include='include' am__quote=''])])
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2017 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -772,7 +755,7 @@ fi
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -801,7 +784,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -848,7 +831,7 @@ AC_LANG_POP([C])])
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -867,7 +850,7 @@ AC_DEFUN([AM_RUN_LOG],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -948,7 +931,7 @@ AC_CONFIG_COMMANDS_PRE(
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2017 Free Software Foundation, Inc.
+# Copyright (C) 2009-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1008,7 +991,7 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2017 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1036,7 +1019,7 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2017 Free Software Foundation, Inc.
+# Copyright (C) 2006-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1055,7 +1038,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2017 Free Software Foundation, Inc.
+# Copyright (C) 2004-2018 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/cf b/cf
index 5e74acd..84b259b 100644
--- a/cf
+++ b/cf
@@ -1,6 +1,6 @@
 #!/bin/bash
 #NB=1
-#DB=1
+DB=1
 #X=-x
 FAST=1
 
@@ -117,14 +117,15 @@ FLAGS="$FLAGS --enable-logging"
 #FLAGS="$FLAGS --disable-properties-attribute"
 #FLAGS="$FLAGS --disable-silent-rules"
 #FLAGS="$FLAGS --with-testservers=remotestserver.localhost:8083"
-#FLAGS="$FLAGS --disable-filter-testing"
+FLAGS="$FLAGS --enable-filter-testing"
 
 if test "x$PAR4" != x1 ; then
 FLAGS="$FLAGS --disable-parallel4"
 fi
 
 if test "x${DB}" = x1 ; then
-FLAGS="$FLAGS --disable-shared --enable-static"
+#FLAGS="$FLAGS --disable-shared --enable-static"
+FLAGS="$FLAGS --enable-static"
 else
 FLAGS="$FLAGS --enable-shared"
 fi
diff --git a/cf.cmake b/cf.cmake
index af71c3e..5681512 100644
--- a/cf.cmake
+++ b/cf.cmake
@@ -1,9 +1,9 @@
 # Visual Studio
 
 # Is netcdf-4 and/or DAP enabled?
-NC4=1
-#DAP=1
-#CDF5=1
+#NC4=1
+DAP=1
+CDF5=1
 #HDF4=1
 
 case "$1" in
@@ -44,6 +44,7 @@ FLAGS="$FLAGS -DENABLE_EXAMPLES=false"
 FLAGS="$FLAGS -DENABLE_DYNAMIC_LOADING=false"
 FLAGS="$FLAGS -DENABLE_WINSOCK2=false"
 #FLAGS="$FLAGS -DENABLE_LARGE_FILE_TESTS=true"
+FLAGS="$FLAGS -DENABLE_FILTER_TESTING=true"
 
 rm -fr build
 mkdir build
diff --git a/compile b/compile
index 2ab71e4..99e5052 100755
--- a/compile
+++ b/compile
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2016-01-11.22; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey at cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@ scriptversion=2016-01-11.22; # UTC
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -340,7 +340,7 @@ exit $ret
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/config.guess b/config.guess
index 2193702..256083a 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2017 Free Software Foundation, Inc.
+#   Copyright 1992-2018 Free Software Foundation, Inc.
 
-timestamp='2017-05-27'
+timestamp='2018-03-08'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ timestamp='2017-05-27'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -27,7 +27,7 @@ timestamp='2017-05-27'
 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
 # Please send patches to <config-patches at gnu.org>.
 
@@ -39,7 +39,7 @@ Usage: $0 [OPTION]
 
 Output the configuration name of the system \`$me' is run on.
 
-Operation modes:
+Options:
   -h, --help         print this help, then exit
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2017 Free Software Foundation, Inc.
+Copyright 1992-2018 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -107,9 +107,9 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
 dummy=$tmp/dummy ;
 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
 case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
+ ,,)    echo "int x;" > "$dummy.c" ;
 	for c in cc gcc c89 c99 ; do
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	  if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
 	     CC_FOR_BUILD="$c"; break ;
 	  fi ;
 	done ;
@@ -132,14 +132,14 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-case "${UNAME_SYSTEM}" in
+case "$UNAME_SYSTEM" in
 Linux|GNU|GNU/*)
 	# If the system lacks a compiler, then just pick glibc.
 	# We could probably try harder.
 	LIBC=gnu
 
-	eval $set_cc_for_build
-	cat <<-EOF > $dummy.c
+	eval "$set_cc_for_build"
+	cat <<-EOF > "$dummy.c"
 	#include <features.h>
 	#if defined(__UCLIBC__)
 	LIBC=uclibc
@@ -149,13 +149,20 @@ Linux|GNU|GNU/*)
 	LIBC=gnu
 	#endif
 	EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
+
+	# If ldd exists, use it to detect musl libc.
+	if command -v ldd >/dev/null && \
+		ldd --version 2>&1 | grep -q ^musl
+	then
+	    LIBC=musl
+	fi
 	;;
 esac
 
 # Note: order is significant - the case branches are not exclusive.
 
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -169,30 +176,30 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
 	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
-	    /sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || \
+	    "/sbin/$sysctl" 2>/dev/null || \
+	    "/usr/sbin/$sysctl" 2>/dev/null || \
 	    echo unknown)`
-	case "${UNAME_MACHINE_ARCH}" in
+	case "$UNAME_MACHINE_ARCH" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
 	    earmv*)
-		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
-		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
-		machine=${arch}${endian}-unknown
+		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine="${arch}${endian}"-unknown
 		;;
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently (or will in the future) and ABI.
-	case "${UNAME_MACHINE_ARCH}" in
+	case "$UNAME_MACHINE_ARCH" in
 	    earm*)
 		os=netbsdelf
 		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-		eval $set_cc_for_build
+		eval "$set_cc_for_build"
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep -q __ELF__
 		then
@@ -208,10 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		;;
 	esac
 	# Determine ABI tags.
-	case "${UNAME_MACHINE_ARCH}" in
+	case "$UNAME_MACHINE_ARCH" in
 	    earm*)
 		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
-		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
 		;;
 	esac
 	# The OS release
@@ -219,46 +226,55 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# thus, need a distinct triplet. However, they do not need
 	# kernel version information, so it can be replaced with a
 	# suitable tag, in the style of linux-gnu.
-	case "${UNAME_VERSION}" in
+	case "$UNAME_VERSION" in
 	    Debian*)
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
+		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}${abi}"
+	echo "$machine-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
 	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
 	exit ;;
     *:LibertyBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
+	exit ;;
+    *:MidnightBSD:*:*)
+	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
 	exit ;;
     *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
 	exit ;;
     *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
 	exit ;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
 	exit ;;
     *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
 	exit ;;
     *:Sortix:*:*)
-	echo ${UNAME_MACHINE}-unknown-sortix
+	echo "$UNAME_MACHINE"-unknown-sortix
+	exit ;;
+    *:Redox:*:*)
+	echo "$UNAME_MACHINE"-unknown-redox
 	exit ;;
+    mips:OSF1:*.*)
+        echo mips-dec-osf1
+        exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
@@ -310,28 +326,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
 	exit $exitcode ;;
-    Alpha\ *:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# Should we change UNAME_MACHINE based on the output of uname instead
-	# of the specific Alpha model?
-	echo alpha-pc-interix
-	exit ;;
-    21064:Windows_NT:50:3)
-	echo alpha-dec-winnt3.5
-	exit ;;
     Amiga*:UNIX_System_V:4.0:*)
 	echo m68k-unknown-sysv4
 	exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
+	echo "$UNAME_MACHINE"-unknown-amigaos
 	exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
+	echo "$UNAME_MACHINE"-unknown-morphos
 	exit ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
@@ -343,7 +350,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix${UNAME_RELEASE}
+	echo arm-acorn-riscix"$UNAME_RELEASE"
 	exit ;;
     arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
@@ -370,19 +377,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
     s390x:SunOS:*:*)
-	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
 	exit ;;
     sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
 	exit ;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-	echo i386-pc-auroraux${UNAME_RELEASE}
+	echo i386-pc-auroraux"$UNAME_RELEASE"
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	eval $set_cc_for_build
+	eval "$set_cc_for_build"
 	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
@@ -395,13 +402,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		SUN_ARCH=x86_64
 	    fi
 	fi
-	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     sun4*:SunOS:*:*)
 	case "`/usr/bin/arch -k`" in
@@ -410,25 +417,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		;;
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
 	exit ;;
     sun3*:SunOS:*:*)
-	echo m68k-sun-sunos${UNAME_RELEASE}
+	echo m68k-sun-sunos"$UNAME_RELEASE"
 	exit ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
+	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
-		echo m68k-sun-sunos${UNAME_RELEASE}
+		echo m68k-sun-sunos"$UNAME_RELEASE"
 		;;
 	    sun4)
-		echo sparc-sun-sunos${UNAME_RELEASE}
+		echo sparc-sun-sunos"$UNAME_RELEASE"
 		;;
 	esac
 	exit ;;
     aushp:SunOS:*:*)
-	echo sparc-auspex-sunos${UNAME_RELEASE}
+	echo sparc-auspex-sunos"$UNAME_RELEASE"
 	exit ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
@@ -439,44 +446,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint"$UNAME_RELEASE"
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint${UNAME_RELEASE}
+	echo m68k-milan-mint"$UNAME_RELEASE"
 	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint${UNAME_RELEASE}
+	echo m68k-hades-mint"$UNAME_RELEASE"
 	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint${UNAME_RELEASE}
+	echo m68k-unknown-mint"$UNAME_RELEASE"
 	exit ;;
     m68k:machten:*:*)
-	echo m68k-apple-machten${UNAME_RELEASE}
+	echo m68k-apple-machten"$UNAME_RELEASE"
 	exit ;;
     powerpc:machten:*:*)
-	echo powerpc-apple-machten${UNAME_RELEASE}
+	echo powerpc-apple-machten"$UNAME_RELEASE"
 	exit ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
 	exit ;;
     RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix${UNAME_RELEASE}
+	echo mips-dec-ultrix"$UNAME_RELEASE"
 	exit ;;
     VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix${UNAME_RELEASE}
+	echo vax-dec-ultrix"$UNAME_RELEASE"
 	exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix${UNAME_RELEASE}
+	echo clipper-intergraph-clix"$UNAME_RELEASE"
 	exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	eval "$set_cc_for_build"
+	sed 's/^	//' << EOF > "$dummy.c"
 #ifdef __cplusplus
 #include <stdio.h>  /* for printf() prototype */
 	int main (int argc, char *argv[]) {
@@ -485,23 +492,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 #endif
 	#if defined (host_mips) && defined (MIPSEB)
 	#if defined (SYSTYPE_SYSV)
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
 	#endif
 	#if defined (SYSTYPE_SVR4)
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
 	#endif
 	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
 	#endif
 	#endif
 	  exit (-1);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
 	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos${UNAME_RELEASE}
+	echo mips-mips-riscos"$UNAME_RELEASE"
 	exit ;;
     Motorola:PowerMAX_OS:*:*)
 	echo powerpc-motorola-powermax
@@ -527,17 +534,17 @@ EOF
     AViiON:dgux:*:*)
 	# DG/UX returns AViiON for all architectures
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
 	then
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
+	       [ "$TARGET_BINARY_INTERFACE"x = x ]
 	    then
-		echo m88k-dg-dgux${UNAME_RELEASE}
+		echo m88k-dg-dgux"$UNAME_RELEASE"
 	    else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
 	    fi
 	else
-	    echo i586-dg-dgux${UNAME_RELEASE}
+	    echo i586-dg-dgux"$UNAME_RELEASE"
 	fi
 	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
@@ -554,7 +561,7 @@ EOF
 	echo m68k-tektronix-bsd
 	exit ;;
     *:IRIX*:*:*)
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
 	exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
@@ -566,14 +573,14 @@ EOF
 	if [ -x /usr/bin/oslevel ] ; then
 		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
 	fi
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
 	exit ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval $set_cc_for_build
-		sed 's/^		//' << EOF >$dummy.c
+		eval "$set_cc_for_build"
+		sed 's/^		//' << EOF > "$dummy.c"
 		#include <sys/systemcfg.h>
 
 		main()
@@ -584,7 +591,7 @@ EOF
 			exit(0);
 			}
 EOF
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
 		then
 			echo "$SYSTEM_NAME"
 		else
@@ -598,7 +605,7 @@ EOF
 	exit ;;
     *:AIX:*:[4567])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
@@ -607,18 +614,18 @@ EOF
 		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
 			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
 	fi
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
 	exit ;;
     *:AIX:*:*)
 	echo rs6000-ibm-aix
 	exit ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
 	echo romp-ibm-bsd4.4
 	exit ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
 	exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
 	echo rs6000-bull-bosx
@@ -633,28 +640,28 @@ EOF
 	echo m68k-hp-bsd4.4
 	exit ;;
     9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	case "${UNAME_MACHINE}" in
-	    9000/31? )            HP_ARCH=m68000 ;;
-	    9000/[34]?? )         HP_ARCH=m68k ;;
+	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+	case "$UNAME_MACHINE" in
+	    9000/31?)            HP_ARCH=m68000 ;;
+	    9000/[34]??)         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
 		if [ -x /usr/bin/getconf ]; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-		    case "${sc_cpu_version}" in
+		    case "$sc_cpu_version" in
 		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
 		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
-			case "${sc_kernel_bits}" in
+			case "$sc_kernel_bits" in
 			  32) HP_ARCH=hppa2.0n ;;
 			  64) HP_ARCH=hppa2.0w ;;
 			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
-		if [ "${HP_ARCH}" = "" ]; then
-		    eval $set_cc_for_build
-		    sed 's/^		//' << EOF >$dummy.c
+		if [ "$HP_ARCH" = "" ]; then
+		    eval "$set_cc_for_build"
+		    sed 's/^		//' << EOF > "$dummy.c"
 
 		#define _HPUX_SOURCE
 		#include <stdlib.h>
@@ -687,13 +694,13 @@ EOF
 		    exit (0);
 		}
 EOF
-		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = hppa2.0w ]
+	if [ "$HP_ARCH" = hppa2.0w ]
 	then
-	    eval $set_cc_for_build
+	    eval "$set_cc_for_build"
 
 	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
 	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
@@ -712,15 +719,15 @@ EOF
 		HP_ARCH=hppa64
 	    fi
 	fi
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
 	exit ;;
     ia64:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux${HPUX_REV}
+	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux"$HPUX_REV"
 	exit ;;
     3050*:HI-UX:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	eval "$set_cc_for_build"
+	sed 's/^	//' << EOF > "$dummy.c"
 	#include <unistd.h>
 	int
 	main ()
@@ -745,11 +752,11 @@ EOF
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
 		{ echo "$SYSTEM_NAME"; exit; }
 	echo unknown-hitachi-hiuxwe2
 	exit ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
 	echo hppa1.1-hp-bsd
 	exit ;;
     9000/8??:4.3bsd:*:*)
@@ -758,7 +765,7 @@ EOF
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
 	echo hppa1.0-hp-mpeix
 	exit ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
 	echo hppa1.1-hp-osf
 	exit ;;
     hp8??:OSF1:*:*)
@@ -766,9 +773,9 @@ EOF
 	exit ;;
     i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	    echo "$UNAME_MACHINE"-unknown-osf1mk
 	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
+	    echo "$UNAME_MACHINE"-unknown-osf1
 	fi
 	exit ;;
     parisc*:Lites*:*:*)
@@ -793,128 +800,109 @@ EOF
 	echo c4-convex-bsd
 	exit ;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*[A-Z]90:*:*:*)
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
 	      -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
 	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
 	exit ;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	echo sparc-unknown-bsdi"$UNAME_RELEASE"
 	exit ;;
     *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
 	exit ;;
     *:FreeBSD:*:*)
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	case ${UNAME_PROCESSOR} in
+	case "$UNAME_PROCESSOR" in
 	    amd64)
 		UNAME_PROCESSOR=x86_64 ;;
 	    i386)
 		UNAME_PROCESSOR=i586 ;;
 	esac
-	echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
 	exit ;;
     i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
+	echo "$UNAME_MACHINE"-pc-cygwin
 	exit ;;
     *:MINGW64*:*)
-	echo ${UNAME_MACHINE}-pc-mingw64
+	echo "$UNAME_MACHINE"-pc-mingw64
 	exit ;;
     *:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
+	echo "$UNAME_MACHINE"-pc-mingw32
 	exit ;;
     *:MSYS*:*)
-	echo ${UNAME_MACHINE}-pc-msys
-	exit ;;
-    i*:windows32*:*)
-	# uname -m includes "-pc" on this system.
-	echo ${UNAME_MACHINE}-mingw32
+	echo "$UNAME_MACHINE"-pc-msys
 	exit ;;
     i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
+	echo "$UNAME_MACHINE"-pc-pw32
 	exit ;;
     *:Interix*:*)
-	case ${UNAME_MACHINE} in
+	case "$UNAME_MACHINE" in
 	    x86)
-		echo i586-pc-interix${UNAME_RELEASE}
+		echo i586-pc-interix"$UNAME_RELEASE"
 		exit ;;
 	    authenticamd | genuineintel | EM64T)
-		echo x86_64-unknown-interix${UNAME_RELEASE}
+		echo x86_64-unknown-interix"$UNAME_RELEASE"
 		exit ;;
 	    IA64)
-		echo ia64-unknown-interix${UNAME_RELEASE}
+		echo ia64-unknown-interix"$UNAME_RELEASE"
 		exit ;;
 	esac ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-	echo i${UNAME_MACHINE}-pc-mks
-	exit ;;
-    8664:Windows_NT:*)
-	echo x86_64-pc-mks
-	exit ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-	# UNAME_MACHINE based on the output of uname instead of i386?
-	echo i586-pc-interix
-	exit ;;
     i*:UWIN*:*)
-	echo ${UNAME_MACHINE}-pc-uwin
+	echo "$UNAME_MACHINE"-pc-uwin
 	exit ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
 	echo x86_64-unknown-cygwin
 	exit ;;
-    p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
-	exit ;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
 	exit ;;
     i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
+	echo "$UNAME_MACHINE"-pc-minix
 	exit ;;
     aarch64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -928,63 +916,63 @@ EOF
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     arm*:Linux:*:*)
-	eval $set_cc_for_build
+	eval "$set_cc_for_build"
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
 	    else
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
 	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     cris:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
 	exit ;;
     crisv32:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
 	exit ;;
     e2k:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     frv:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     hexagon:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     i*86:Linux:*:*)
-	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     k1om:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
+	eval "$set_cc_for_build"
+	sed 's/^	//' << EOF > "$dummy.c"
 	#undef CPU
 	#undef ${UNAME_MACHINE}
 	#undef ${UNAME_MACHINE}el
@@ -998,70 +986,70 @@ EOF
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
+	test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
 	;;
     mips64el:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     openrisc*:Linux:*:*)
-	echo or1k-unknown-linux-${LIBC}
+	echo or1k-unknown-linux-"$LIBC"
 	exit ;;
     or32:Linux:*:* | or1k*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-${LIBC}
+	echo sparc-unknown-linux-"$LIBC"
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-${LIBC}
+	echo hppa64-unknown-linux-"$LIBC"
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
-	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
-	  *)    echo hppa-unknown-linux-${LIBC} ;;
+	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
+	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
+	  *)    echo hppa-unknown-linux-"$LIBC" ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-${LIBC}
+	echo powerpc64-unknown-linux-"$LIBC"
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-${LIBC}
+	echo powerpc-unknown-linux-"$LIBC"
 	exit ;;
     ppc64le:Linux:*:*)
-	echo powerpc64le-unknown-linux-${LIBC}
+	echo powerpc64le-unknown-linux-"$LIBC"
 	exit ;;
     ppcle:Linux:*:*)
-	echo powerpcle-unknown-linux-${LIBC}
+	echo powerpcle-unknown-linux-"$LIBC"
 	exit ;;
     riscv32:Linux:*:* | riscv64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1075,34 +1063,34 @@ EOF
 	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
 	# Use sysv4.2uw... so that sysv4* matches it.
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
 	exit ;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
+	echo "$UNAME_MACHINE"-pc-os2-emx
 	exit ;;
     i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
+	echo "$UNAME_MACHINE"-unknown-stop
 	exit ;;
     i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
+	echo "$UNAME_MACHINE"-unknown-atheos
 	exit ;;
     i*86:syllable:*:*)
-	echo ${UNAME_MACHINE}-pc-syllable
+	echo "$UNAME_MACHINE"-pc-syllable
 	exit ;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
+	echo i386-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     i*86:*DOS:*:*)
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	echo "$UNAME_MACHINE"-pc-msdosdjgpp
 	exit ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+    i*86:*:4.*:*)
+	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
 	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
 	fi
 	exit ;;
     i*86:*:5:[678]*)
@@ -1112,12 +1100,12 @@ EOF
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
 	exit ;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
 		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
 		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
@@ -1127,9 +1115,9 @@ EOF
 			&& UNAME_MACHINE=i686
 		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
 	else
-		echo ${UNAME_MACHINE}-pc-sysv32
+		echo "$UNAME_MACHINE"-pc-sysv32
 	fi
 	exit ;;
     pc:*:*:*)
@@ -1149,9 +1137,9 @@ EOF
 	exit ;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
 	fi
 	exit ;;
     mini*:CTIX:SYS*5:*)
@@ -1171,9 +1159,9 @@ EOF
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	  && { echo i486-ncr-sysv4; exit; } ;;
@@ -1182,28 +1170,28 @@ EOF
 	test -r /etc/.relid \
 	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	echo m68k-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit ;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	echo sparc-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv${UNAME_RELEASE}
+	echo mips-dde-sysv"$UNAME_RELEASE"
 	exit ;;
     RM*:ReliantUNIX-*:*:*)
 	echo mips-sni-sysv4
@@ -1214,7 +1202,7 @@ EOF
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo ${UNAME_MACHINE}-sni-sysv4
+		echo "$UNAME_MACHINE"-sni-sysv4
 	else
 		echo ns32k-sni-sysv
 	fi
@@ -1234,23 +1222,23 @@ EOF
 	exit ;;
     i*86:VOS:*:*)
 	# From Paul.Green at stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
+	echo "$UNAME_MACHINE"-stratus-vos
 	exit ;;
     *:VOS:*:*)
 	# From Paul.Green at stratus.com.
 	echo hppa1.1-stratus-vos
 	exit ;;
     mc68*:A/UX:*:*)
-	echo m68k-apple-aux${UNAME_RELEASE}
+	echo m68k-apple-aux"$UNAME_RELEASE"
 	exit ;;
     news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-		echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv"$UNAME_RELEASE"
 	else
-		echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv"$UNAME_RELEASE"
 	fi
 	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
@@ -1269,39 +1257,39 @@ EOF
 	echo x86_64-unknown-haiku
 	exit ;;
     SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
+	echo sx4-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux${UNAME_RELEASE}
+	echo sx5-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux${UNAME_RELEASE}
+	echo sx6-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-7:SUPER-UX:*:*)
-	echo sx7-nec-superux${UNAME_RELEASE}
+	echo sx7-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-8:SUPER-UX:*:*)
-	echo sx8-nec-superux${UNAME_RELEASE}
+	echo sx8-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-8R:SUPER-UX:*:*)
-	echo sx8r-nec-superux${UNAME_RELEASE}
+	echo sx8r-nec-superux"$UNAME_RELEASE"
 	exit ;;
     SX-ACE:SUPER-UX:*:*)
-	echo sxace-nec-superux${UNAME_RELEASE}
+	echo sxace-nec-superux"$UNAME_RELEASE"
 	exit ;;
     Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
 	exit ;;
     *:Rhapsody:*:*)
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
 	exit ;;
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	eval $set_cc_for_build
+	eval "$set_cc_for_build"
 	if test "$UNAME_PROCESSOR" = unknown ; then
 	    UNAME_PROCESSOR=powerpc
 	fi
-	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+	if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
 	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
 		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
@@ -1329,7 +1317,7 @@ EOF
 	    # that Apple uses in portable devices.
 	    UNAME_PROCESSOR=x86_64
 	fi
-	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
@@ -1337,22 +1325,25 @@ EOF
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
 	exit ;;
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
     NEO-*:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk${UNAME_RELEASE}
+	echo neo-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     NSE-*:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk${UNAME_RELEASE}
+	echo nse-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     NSR-*:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk${UNAME_RELEASE}
+	echo nsr-tandem-nsk"$UNAME_RELEASE"
+	exit ;;
+    NSV-*:NONSTOP_KERNEL:*:*)
+	echo nsv-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     NSX-*:NONSTOP_KERNEL:*:*)
-	echo nsx-tandem-nsk${UNAME_RELEASE}
+	echo nsx-tandem-nsk"$UNAME_RELEASE"
 	exit ;;
     *:NonStop-UX:*:*)
 	echo mips-compaq-nonstopux
@@ -1361,7 +1352,7 @@ EOF
 	echo bs2000-siemens-sysv
 	exit ;;
     DS/*:UNIX_System_V:*:*)
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
 	exit ;;
     *:Plan9:*:*)
 	# "uname -m" is not consistent, so use $cputype instead. 386
@@ -1372,7 +1363,7 @@ EOF
 	else
 	    UNAME_MACHINE="$cputype"
 	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
+	echo "$UNAME_MACHINE"-unknown-plan9
 	exit ;;
     *:TOPS-10:*:*)
 	echo pdp10-unknown-tops10
@@ -1393,14 +1384,14 @@ EOF
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux"$UNAME_RELEASE"
 	exit ;;
     *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
 	exit ;;
     *:*VMS:*:*)
 	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "${UNAME_MACHINE}" in
+	case "$UNAME_MACHINE" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
 	    V*) echo vax-dec-vms ; exit ;;
@@ -1409,32 +1400,44 @@ EOF
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
+	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
 	exit ;;
     i*86:rdos:*:*)
-	echo ${UNAME_MACHINE}-pc-rdos
+	echo "$UNAME_MACHINE"-pc-rdos
 	exit ;;
     i*86:AROS:*:*)
-	echo ${UNAME_MACHINE}-pc-aros
+	echo "$UNAME_MACHINE"-pc-aros
 	exit ;;
     x86_64:VMkernel:*:*)
-	echo ${UNAME_MACHINE}-unknown-esx
+	echo "$UNAME_MACHINE"-unknown-esx
 	exit ;;
     amd64:Isilon\ OneFS:*:*)
 	echo x86_64-unknown-onefs
 	exit ;;
 esac
 
+echo "$0: unable to guess system type" >&2
+
+case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+    mips:Linux | mips64:Linux)
+	# If we got here on MIPS GNU/Linux, output extra information.
+	cat >&2 <<EOF
+
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
+the system type. Please install a C compiler and try again.
+EOF
+	;;
+esac
+
 cat >&2 <<EOF
-$0: unable to guess system type
 
 This script (version $timestamp), has failed to recognize the
-operating system you are using. If your script is old, overwrite
-config.guess and config.sub with the latest versions from:
+operating system you are using. If your script is old, overwrite *all*
+copies of config.guess and config.sub with the latest versions from:
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 If $0 has already been updated, send the following data and any
 information you think might be pertinent to config-patches at gnu.org to
@@ -1457,16 +1460,16 @@ hostinfo               = `(hostinfo) 2>/dev/null`
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
 
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM  = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
 EOF
 
 exit 1
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 80c07b7..35be9ca 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -145,9 +145,6 @@ are set when opening a binary file on Windows. */
    */
 #cmakedefine HAVE_ALLOCA_H 1
 
-/* Define to 1 if you have the <ctype.h> header file. */
-#cmakedefine HAVE_CTYPE_H 1
-
 /* Define to 1 if you have hdf5_coll_metadata_ops */
 #cmakedefine HDF5_HAS_COLL_METADATA_OPS 1
 
@@ -157,9 +154,6 @@ are set when opening a binary file on Windows. */
 /* Is CURLINFO_HTTP_CODE defined */
 #cmakedefine HAVE_CURLINFO_HTTP_CONNECTCODE 1
 
-/* Is CURLOPT_CHUNK_BGN_FUNCTION defined */
-#cmakedefine HAVE_CURLOPT_CHUNK_BGN_FUNCTION 1
-
 /* Is CURLOPT_KEYPASSWD defined */
 #cmakedefine HAVE_CURLOPT_KEYPASSWD 1
 
@@ -181,23 +175,6 @@ are set when opening a binary file on Windows. */
    */
 #cmakedefine HAVE_DECL_ISNAN 1
 
-/* Define to 1 if you have the declaration of `signbit', and to 0 if you
-   don't. */
-#cmakedefine HAVE_DECL_SIGNBIT 1
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
-   */
-#cmakedefine HAVE_DIRENT_H 1
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#cmakedefine HAVE_DLFCN_H 1
-
-/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
-#cmakedefine HAVE_DOPRNT 1
-
-/* Define to 1 if you have the <errno.h> header file. */
-#cmakedefine HAVE_ERRNO_H 1
-
 /* Define to 1 if you have the <fcntl.h> header file. */
 #cmakedefine HAVE_FCNTL_H 1
 
@@ -223,18 +200,6 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the `gettimeofday' function. */
 #cmakedefine HAVE_GETTIMEOFDAY 1
 
-/* Define to 1 if you have the `H5free_memory' function. */
-#cmakedefine HAVE_H5FREE_MEMORY 1
-
-/* Define to 1 if you have the `H5Pget_fapl_mpio' function. */
-#cmakedefine HAVE_H5PGET_FAPL_MPIO 1
-
-/* Define to 1 if you have the `H5Pget_fapl_mpiposix' function. */
-#cmakedefine HAVE_H5PGET_FAPL_MPIPOSIX 1
-
-/* Define to 1 if you have the `H5Pset_deflate' function. */
-#cmakedefine HAVE_H5PSET_DEFLATE 1
-
 /* if true, netcdf4 file properties will be set using H5Pset_libver_bounds */
 #cmakedefine HDF5_HAS_LIBVER_BOUNDS 1
 
@@ -253,9 +218,6 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <inttypes.h> header file. */
 #cmakedefine HAVE_INTTYPES_H 1
 
-/* Define to 1 if you have the `df' library (-ldf). */
-#cmakedefine HAVE_LIBDF 1
-
 /* Define to 1 if you have the `dl' library (-ldl). */
 #cmakedefine HAVE_LIBDL 1
 
@@ -283,48 +245,24 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <malloc.h> header file. */
 #cmakedefine HAVE_MALLOC_H 1
 
-/* Define to 1 if you have the `memcmp' function. */
-#cmakedefine HAVE_MEMCMP 1
-
 /* Define to 1 if you have the `memmove' function. */
 #cmakedefine HAVE_MEMMOVE 1
 
-/* Define to 1 if you have the <memory.h> header file. */
-#cmakedefine HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the <mfhdf.h> header file. */
-#cmakedefine HAVE_MFHDF_H 1
-
 /* Define to 1 if you have the `mkstemp' function. */
 #cmakedefine HAVE_MKSTEMP 1
 
 /* Define to 1 if you have the `mktemp' function. */
 #cmakedefine HAVE_MKTEMP 1
 
-/* Define to 1 if you have a working `mmap' system call. */
-#cmakedefine HAVE_MMAP 1
-
 /* Define to 1 if you have the `MPI_Comm_f2c' function. */
 #cmakedefine HAVE_MPI_COMM_F2C 1
 
 /* Define to 1 if you have the `mremap' function. */
 #cmakedefine HAVE_MREMAP 1
 
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#cmakedefine HAVE_NDIR_H 1
-
-/* Define to 1 if the system has the type `ptrdiff_t'. */
-#cmakedefine HAVE_PTRDIFF_T 1
-
-/* Define to 1 if you have the `rand' function. */
-#cmakedefine HAVE_RAND 1
-
 /* Define to 1 if you have the `random' function. */
 #cmakedefine HAVE_RANDOM 1
 
-/* Define to 1 if the system has the type `size_t'. */
-#cmakedefine HAVE_SIZE_T 1
-
 /* Define to 1 if you have the `snprintf' function. */
 #cmakedefine HAVE_SNPRINTF 1
 
@@ -334,9 +272,6 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <stdarg.h> header file. */
 #cmakedefine HAVE_STDARG_H 1
 
-/* Define to 1 if stdbool.h conforms to C99. */
-#cmakedefine HAVE_STDBOOL_H 1
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #cmakedefine HAVE_STDINT_H 1
 
@@ -346,27 +281,12 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <stdlib.h> header file. */
 #cmakedefine HAVE_STDLIB_H 1
 
-/* Define to 1 if you have the `strcasecmp' function. */
-#cmakedefine HAVE_STRCASECMP 1
-
-/* Define to 1 if you have the `strcat' function. */
-#cmakedefine HAVE_STRCAT 1
-
-/* Define to 1 if you have the `strchr' function. */
-#cmakedefine HAVE_STRCHR 1
-
-/* Define to 1 if you have the `strcpy' function. */
-#cmakedefine HAVE_STRCPY 1
-
 /* Define to 1 if you have the `strdup' function. */
 #cmakedefine HAVE_STRDUP 1
 
 /* Define to 1 if you have the `strndup` function. */
 #cmakedefine HAVE_STRNDUP
 
-/* Define to 1 if you have the `strerror' function. */
-#cmakedefine HAVE_STRERROR 1
-
 /* Define to 1 if you have the <strings.h> header file. */
 #cmakedefine HAVE_STRINGS_H 1
 
@@ -379,18 +299,12 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <ftw.h> header file. */
 #cmakedefine HAVE_FTW_H 1
 
+/* Define to 1 if you have the <libgen.h> header file. */
+#cmakedefine HAVE_LIBGEN_H 1
+
 /* Define to 1 if you have the `strlcat' function. */
 #cmakedefine HAVE_STRLCAT 1
 
-/* Define to 1 if you have the `strrchr' function. */
-#cmakedefine HAVE_STRRCHR 1
-
-/* Define to 1 if you have the `strstr' function. */
-#cmakedefine HAVE_STRSTR 1
-
-/* Define to 1 if you have the `strtod' function. */
-#cmakedefine HAVE_STRTOD 1
-
 /* Define to 1 if you have the `strtoll' function. */
 #cmakedefine HAVE_STRTOLL 1
 
@@ -403,24 +317,9 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #cmakedefine HAVE_STRUCT_STAT_ST_BLKSIZE 1
 
-/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
-   `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
-#cmakedefine HAVE_ST_BLKSIZE 1
-
 /* Define to 1 if you have the `sysconf' function. */
 #cmakedefine HAVE_SYSCONF 1
 
-/* Define to 1 if you have the <sys/cdefs.h> header file. */
-#cmakedefine HAVE_SYS_CDEFS_H 1
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
-   */
-#cmakedefine HAVE_SYS_DIR_H 1
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
-   */
-#cmakedefine HAVE_SYS_NDIR_H 1
-
 /* Define to 1 if you have the <sys/param.h> header file. */
 #cmakedefine HAVE_SYS_PARAM_H 1
 
@@ -436,9 +335,6 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <sys/types.h> header file. */
 #cmakedefine HAVE_SYS_TYPES_H 1
 
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#cmakedefine HAVE_SYS_WAIT_H 1
-
 /* Define to 1 if the system has the type `uchar'. */
 #cmakedefine HAVE_UCHAR 1
 
@@ -452,18 +348,9 @@ are set when opening a binary file on Windows. */
 #cmakedefine HAVE_UNISTD_H 1
 #cmakedefine YY_NO_UNISTD_H 1
 
-/* Define to 1 if the system has the type 'unsigned long long int'. */
-#cmakedefine HAVE_UNSIGNED_LONG_LONG_INT 1
-
 /* Define to 1 if the system has the type `ushort'. */
 #cmakedefine HAVE_USHORT 1
 
-/* Define to 1 if you have the `vprintf' function. */
-#cmakedefine HAVE_VPRINTF 1
-
-/* Define to 1 if the system has the type `_Bool'. */
-#cmakedefine HAVE__BOOL 1
-
 /* if true, H5free_memory() will be used to free hdf5-allocated memory in
    nc4file. */
 #cmakedefine HDF5_HAS_H5FREE 1
@@ -504,12 +391,6 @@ are set when opening a binary file on Windows. */
 /* do not build the netCDF version 2 API */
 #cmakedefine NO_NETCDF_2 1
 
-/* no stdlib.h */
-#cmakedefine NO_STDLIB_H 1
-
-/* no sys_types.h */
-#cmakedefine NO_SYS_TYPES_H 1
-
 /* Name of package */
 #define PACKAGE "netcdf"
 
@@ -543,9 +424,6 @@ are set when opening a binary file on Windows. */
 /* The size of `uchar` as computed by sizeof. */
 #cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
 
-/* The size of `ssize_t` as computed by sizeof. */
-#cmakedefine SIZEOF_SSIZE_T @SIZEOF_SSIZE_T@
-
 /* The size of `__int64` found on Windows systems. */
 #cmakedefine SIZEOF___INT64 ${SIZEOF___INT64}
 
@@ -573,9 +451,6 @@ are set when opening a binary file on Windows. */
 /* The size of `off_t', as computed by sizeof. */
 #cmakedefine SIZEOF_OFF_T ${SIZEOF_OFF_T}
 
-/* The size of `ptrdiff_t', as computed by sizeof. */
-#cmakedefine SIZEOF_PTRDIFF_T ${SIZEOF_PTRDIFF_T}
-
 /* The size of `short', as computed by sizeof. */
 #cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT}
 
@@ -600,23 +475,9 @@ are set when opening a binary file on Windows. */
 /* The size of `void*', as computed by sizeof. */
 #cmakedefine SIZEOF_VOIDP ${SIZEOF_VOIDP}
 
-/* If using the C implementation of alloca, define if you know the
-   direction of stack growth for your system; otherwise it will be
-   automatically deduced at runtime.
-	STACK_DIRECTION > 0 => grows toward higher addresses
-	STACK_DIRECTION < 0 => grows toward lower addresses
-	STACK_DIRECTION = 0 => direction of growth unknown */
-#cmakedefine STACK_DIRECTION ${STACK_DIRECTION}
-
-/* Define to 1 if you have the ANSI C header files. */
-#cmakedefine STDC_HEADERS 1
-
 /* Place to put very large netCDF test files. */
 #cmakedefine TEMP_LARGE "${TEMP_LARGE}"
 
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#cmakedefine TIME_WITH_SYS_TIME 1
-
 /* if true, build DAP Client */
 #cmakedefine USE_DAP 1
 
@@ -639,9 +500,6 @@ are set when opening a binary file on Windows. */
    it. */
 //#cmakedefine USE_HDF4_FILE_TESTS 1
 
-/* if true, enable dynamic loading support */
-#cmakedefine USE_LIBDL 1
-
 /* if true, use mmap for in-memory files */
 #cmakedefine USE_MMAP 1
 
@@ -672,9 +530,6 @@ are set when opening a binary file on Windows. */
 /* if true, compile in szip compression in netCDF-4 variables */
 #cmakedefine USE_SZIP 1
 
-/* if true, compile in zlib compression in netCDF-4 variables */
-#cmakedefine USE_ZLIB 1
-
 /* Version number of package */
 #cmakedefine VERSION "${netCDF_VERSION}"
 
@@ -698,17 +553,15 @@ are set when opening a binary file on Windows. */
 /* Define for large files, on AIX-style hosts. */
 #cmakedefine _LARGE_FILES ${_LARGE_FILES}
 
-/* Define to 1 if type `char' is unsigned and you are not using gcc.  */
-#ifndef __CHAR_UNSIGNED__
-#cmakedefine  __CHAR_UNSIGNED__
-#endif
-
 /* Define to `long int' if <sys/types.h> does not define. */
 #cmakedefine off_t long int
 
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 #cmakedefine size_t unsigned int
 
+/* Define to `unsigned long if <sys/types.h> does not define. */
+#cmakedefine uintptr_t unsigned long
+
 /* Define strcasecmp, snprintf on Win32 systems. */
 #ifdef _WIN32
     #ifndef HAVE_STRCASECMP
diff --git a/config.h.cmake.in.old-works b/config.h.cmake.in.old-works
index 2af9778..be1bbe2 100644
--- a/config.h.cmake.in.old-works
+++ b/config.h.cmake.in.old-works
@@ -92,7 +92,6 @@ are set when opening a binary file on Windows. */
 #cmakedefine ENABLE_DAP_REMOTE_TESTS 1
 #cmakedefine EXTRA_TESTS
 #cmakedefine USE_NETCDF4 1
-#cmakedefine USE_LIBDL 1
 #cmakedefine USE_HDF4 1
 #cmakedefine USE_HDF5 1
 #cmakedefine USE_FFIO 1
@@ -110,7 +109,6 @@ are set when opening a binary file on Windows. */
 #cmakedefine BUILD_RPC 1
 #cmakedefine USE_DISKLESS 1
 #cmakedefine USE_SZIP 1
-#cmakedefine USE_ZLIB 1
 #cmakedefine USE_X_GETOPT 1
 #cmakedefine ENABLE_EXTREME_NUMBERS
 #cmakedefine LARGE_FILE_TESTS 1
@@ -120,9 +118,6 @@ are set when opening a binary file on Windows. */
 #cmakedefine HAVE_CURLOPT_PASSWORD 1
 #cmakedefine HAVE_CURLOPT_KEYPASSWD 1
 #cmakedefine HAVE_CURLINFO_RESPONSE_CODE 1
-#cmakedefine HAVE_CURLOPT_CHUNK_BGN_FUNCTION 1
-#cmakedefine HAVE_DECL_SIGNBIT 1
-#cmakedefine HAVE_DOPRNT
 #cmakedefine HAVE_ALLOCA
 #cmakedefine HAVE_SSIZE_T 1
 #cmakedefine HAVE_LIBPNETCDF 1
@@ -131,22 +126,10 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <alloca.h> header file. */
 #cmakedefine HAVE_ALLOCA_H @HAVE_ALLOCA_H@
 
-/* Define to 1 if you have the <ctype.h> header file. */
-#cmakedefine HAVE_CTYPE_H @HAVE_CTYPE_H@
-
-/* Define to 1 if you have the <dirent> header file. */
-#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@
 #cmakedefine YY_NO_UNISTD_H @YY_NO_UNISTD_H@
 
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@
-
-/* Define to 1 if you have the <errno.h> header file. */
-#cmakedefine HAVE_ERRNO_H @HAVE_ERRNO_H@
-
 /* Define to 1 if you have the <fcntl.h> header file. */
 #cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@
 
@@ -162,9 +145,6 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <hdf5_hl.h> header file. */
 #cmakedefine HAVE_HDF5_HL_H @HAVE_HDF5_HL_H@
 
-/* Define to 1 if you have the <stdbool.h> header file. */
-#cmakedefine HAVE_STDBOOL_H @HAVE_STDBOOL_H@
-
 /* Define to 1 if you have the <locale.h> header file. */
 #cmakedefine HAVE_LOCAL_H @HAVE_LOCAL_H@
 
@@ -183,12 +163,6 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <signal.h> header file. */
 #cmakedefine HAVE_SIGNAL_H @HAVE_SIGNAL_H@
 
-/* Define to 1 if you have the <sys/dir.h> header file. */
-#cmakedefine HAVE_SYS_DIR_H @HAVE_SYS_DIR_H@
-
-/* Define to 1 if you have the <sys/ndir.h> header file. */
-#cmakedefine HAVE_SYS_NDIR_H @HAVE_SYS_NDIR_H@
-
 /* Define to 1 if you have the <sys/param.h> header file. */
 #cmakedefine HAVE_SYS_PARAM_H @HAVE_SYS_PARAM_H@
 
@@ -204,15 +178,9 @@ are set when opening a binary file on Windows. */
 /* Define to 1 if you have the <sys/types.h> header file. */
 #cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@
 
-/* Define to 1 if you have the <sys/wait.h> header file. */
-#cmakedefine HAVE_SYS_WAIT_H @HAVE_SYS_WAIT_H@
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@
 
-/* Define to 1 if you have the <fcntl.h> header file. */
-#cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@
-
 /* Define to 1 if you have the <malloc.h> header file. */
 #cmakedefine HAVE_MALLOC_H @HAVE_MALLOC_H@
 
@@ -228,11 +196,6 @@ are set when opening a binary file on Windows. */
 #cmakedefine SIZEOF_ULONGLONG @SIZEOF_ULONGLONG@
 #cmakedefine SIZEOF_UNSIGNED_LONG_LONG @SIZEOF_UNSIGNED_LONG_LONG@
 
-/* Define whether char is signed by default. */
-#ifndef __CHAR_UNSIGNED__
-#cmakedefine __CHAR_UNSIGNED__
-#endif
-
 /* The size of `void*` as computed by sizeof. */
 #cmakedefine SIZEOF_VOIDSTAR @SIZEOF_VOIDSTAR@
 /* The size of `char` as computed by sizeof. */
@@ -254,8 +217,6 @@ are set when opening a binary file on Windows. */
 #cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
 /* The size of `size_t` as computed by sizeof. */
 #cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
-/* The size of `ssize_t` as computed by sizeof. */
-#cmakedefine SIZEOF_SSIZE_T @SIZEOF_SSIZE_T@
 /* The size of `uchar` as computed by sizeof. */
 #cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
 /* The size of `__int64` found on Windows systems. */
@@ -269,25 +230,15 @@ are set when opening a binary file on Windows. */
 #cmakedefine HAVE_STRDUP
 #cmakedefine HAVE_STRNDUP
 #cmakedefine HAVE_STRLCAT
-#cmakedefine HAVE_STRERROR
 #cmakedefine HAVE_SNPRINTF
-#cmakedefine HAVE_STRCHR
-#cmakedefine HAVE_STRRCHR
-#cmakedefine HAVE_STRCAT
-#cmakedefine HAVE_STRCPY
 #cmakedefine HAVE_STRDUP
-#cmakedefine HAVE_STRCASECMP
-#cmakedefine HAVE_STRTOD
 #cmakedefine HAVE_STRTOLL
 #cmakedefine HAVE_STROULL
-#cmakedefine HAVE_STRSTR
 #cmakedefine HAVE_MKSTEMP
-#cmakedefine HAVE_RAND
 #cmakedefine HAVE_RANDOM
 #cmakedefine HAVE_GETTIMEOFDAY
 #cmakedefine HAVE_MPI_COMM_F2C
 #cmakedefine HAVE_MEMMOVE
-#cmakedefine HAVE_MMAP
 #cmakedefine HAVE_GETPAGESIZE
 #cmakedefine HAVE_SYSCONF
 #cmakedefine HAVE_MREMAP
@@ -297,7 +248,6 @@ are set when opening a binary file on Windows. */
 #cmakedefine HAVE_FSYNC
 
 #cmakedefine HAVE_H5PGET_FAPL_MPIPOSIX 1
-#cmakedefine HAVE_H5PSET_DEFLATE
 #cmakedefine HAVE_H5Z_SZIP
 
 
diff --git a/config.h.in b/config.h.in
index 652efd3..d0d2fea 100644
--- a/config.h.in
+++ b/config.h.in
@@ -57,15 +57,9 @@
    */
 #undef HAVE_ALLOCA_H
 
-/* Define to 1 if you have the <ctype.h> header file. */
-#undef HAVE_CTYPE_H
-
 /* Is CURLINFO_RESPONSE_CODE defined */
 #undef HAVE_CURLINFO_RESPONSE_CODE
 
-/* Is CURLOPT_CHUNK_BGN_FUNCTION defined */
-#undef HAVE_CURLOPT_CHUNK_BGN_FUNCTION
-
 /* Is CURLOPT_KEYPASSWD defined */
 #undef HAVE_CURLOPT_KEYPASSWD
 
@@ -87,23 +81,9 @@
    */
 #undef HAVE_DECL_ISNAN
 
-/* Define to 1 if you have the declaration of `signbit', and to 0 if you
-   don't. */
-#undef HAVE_DECL_SIGNBIT
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_DIRENT_H
-
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
-/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
-#undef HAVE_DOPRNT
-
-/* Define to 1 if you have the <errno.h> header file. */
-#undef HAVE_ERRNO_H
-
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -158,8 +138,8 @@
 /* Define to 1 if you have the `df' library (-ldf). */
 #undef HAVE_LIBDF
 
-/* Define to 1 if you have the `dl' library (-ldl). */
-#undef HAVE_LIBDL
+/* Define to 1 if you have the <libgen.h> header file. */
+#undef HAVE_LIBGEN_H
 
 /* Define to 1 if you have the `jpeg' library (-ljpeg). */
 #undef HAVE_LIBJPEG
@@ -185,9 +165,6 @@
 /* Define to 1 if you have the <malloc.h> header file. */
 #undef HAVE_MALLOC_H
 
-/* Define to 1 if you have the `memcmp' function. */
-#undef HAVE_MEMCMP
-
 /* Define to 1 if you have the `memmove' function. */
 #undef HAVE_MEMMOVE
 
@@ -203,24 +180,12 @@
 /* Define to 1 if you have the `mktemp' function. */
 #undef HAVE_MKTEMP
 
-/* Define to 1 if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
 /* Define to 1 if you have the `MPI_Comm_f2c' function. */
 #undef HAVE_MPI_COMM_F2C
 
 /* Define to 1 if you have the `mremap' function. */
 #undef HAVE_MREMAP
 
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#undef HAVE_NDIR_H
-
-/* Define to 1 if the system has the type `ptrdiff_t'. */
-#undef HAVE_PTRDIFF_T
-
-/* Define to 1 if you have the `rand' function. */
-#undef HAVE_RAND
-
 /* Define to 1 if you have the `random' function. */
 #undef HAVE_RANDOM
 
@@ -239,9 +204,6 @@
 /* Define to 1 if you have the <stdarg.h> header file. */
 #undef HAVE_STDARG_H
 
-/* Define to 1 if stdbool.h conforms to C99. */
-#undef HAVE_STDBOOL_H
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -251,24 +213,9 @@
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
-/* Define to 1 if you have the `strcat' function. */
-#undef HAVE_STRCAT
-
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
-/* Define to 1 if you have the `strcpy' function. */
-#undef HAVE_STRCPY
-
 /* Define to 1 if you have the `strdup' function. */
 #undef HAVE_STRDUP
 
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
@@ -278,15 +225,6 @@
 /* Define to 1 if you have the `strlcat' function. */
 #undef HAVE_STRLCAT
 
-/* Define to 1 if you have the `strrchr' function. */
-#undef HAVE_STRRCHR
-
-/* Define to 1 if you have the `strstr' function. */
-#undef HAVE_STRSTR
-
-/* Define to 1 if you have the `strtod' function. */
-#undef HAVE_STRTOD
-
 /* Define to 1 if you have the `strtoll' function. */
 #undef HAVE_STRTOLL
 
@@ -303,17 +241,6 @@
 /* Define to 1 if you have the `sysconf' function. */
 #undef HAVE_SYSCONF
 
-/* Define to 1 if you have the <sys/cdefs.h> header file. */
-#undef HAVE_SYS_CDEFS_H
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_SYS_DIR_H
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_SYS_NDIR_H
-
 /* Define to 1 if you have the <sys/param.h> header file. */
 #undef HAVE_SYS_PARAM_H
 
@@ -329,17 +256,14 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
 /* Define to 1 if the system has the type `uchar'. */
 #undef HAVE_UCHAR
 
 /* Define to 1 if the system has the type `uint'. */
 #undef HAVE_UINT
 
-/* Define to 1 if the system has the type `uint64 off_t'. */
-#undef HAVE_UINT64_OFF_T
+/* Define to 1 if the system has the type `uint64'. */
+#undef HAVE_UINT64
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
@@ -350,12 +274,6 @@
 /* Define to 1 if the system has the type `ushort'. */
 #undef HAVE_USHORT
 
-/* Define to 1 if you have the `vprintf' function. */
-#undef HAVE_VPRINTF
-
-/* Define to 1 if the system has the type `_Bool'. */
-#undef HAVE__BOOL
-
 /* if true, use collective metadata ops in parallel netCDF-4 */
 #undef HDF5_HAS_COLL_METADATA_OPS
 
@@ -393,12 +311,6 @@
 /* do not build the netCDF version 2 API */
 #undef NO_NETCDF_2
 
-/* no stdlib.h */
-#undef NO_STDLIB_H
-
-/* no sys_types.h */
-#undef NO_SYS_TYPES_H
-
 /* Name of package */
 #undef PACKAGE
 
@@ -444,9 +356,6 @@
 /* The size of `off_t', as computed by sizeof. */
 #undef SIZEOF_OFF_T
 
-/* The size of `ptrdiff_t', as computed by sizeof. */
-#undef SIZEOF_PTRDIFF_T
-
 /* The size of `short', as computed by sizeof. */
 #undef SIZEOF_SHORT
 
@@ -494,9 +403,6 @@
 /* Place to put very large netCDF test files. */
 #undef TEMP_LARGE
 
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
 /* if true, enable CDF5 Support */
 #undef USE_CDF5
 
@@ -522,9 +428,6 @@
    it. */
 #undef USE_HDF4_FILE_TESTS
 
-/* if true, enable dynamic loading support */
-#undef USE_LIBDL
-
 /* if true, use mmap for in-memory files */
 #undef USE_MMAP
 
@@ -558,9 +461,6 @@
 /* if true, compile in szip compression in netCDF-4 variables */
 #undef USE_SZIP
 
-/* if true, compile in zlib compression in netCDF-4 variables */
-#undef USE_ZLIB
-
 /* Version number of package */
 #undef VERSION
 
@@ -587,11 +487,6 @@
 /* Define for large files, on AIX-style hosts. */
 #undef _LARGE_FILES
 
-/* Define to 1 if type `char' is unsigned and you are not using gcc.  */
-#ifndef __CHAR_UNSIGNED__
-# undef __CHAR_UNSIGNED__
-#endif
-
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 
diff --git a/config.sub b/config.sub
index 40ea5df..9ccf09a 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2017 Free Software Foundation, Inc.
+#   Copyright 1992-2018 Free Software Foundation, Inc.
 
-timestamp='2017-04-02'
+timestamp='2018-03-08'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ timestamp='2017-04-02'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -33,7 +33,7 @@ timestamp='2017-04-02'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -57,7 +57,7 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
-Operation modes:
+Options:
   -h, --help         print this help, then exit
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2017 Free Software Foundation, Inc.
+Copyright 1992-2018 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -94,7 +94,7 @@ while test $# -gt 0 ; do
 
     *local*)
        # First pass through any local machine types.
-       echo $1
+       echo "$1"
        exit ;;
 
     * )
@@ -112,7 +112,7 @@ esac
 
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
@@ -120,16 +120,16 @@ case $maybe_os in
   kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
   android-linux)
     os=-linux-android
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
     ;;
   *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
+    basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
+    if [ "$basic_machine" != "$1" ]
+    then os=`echo "$1" | sed 's/.*-/-/'`
     else os=; fi
     ;;
 esac
@@ -178,44 +178,44 @@ case $os in
 		;;
 	-sco6)
 		os=-sco5v6
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco5)
 		os=-sco3.2v5
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco4)
 		os=-sco3.2v4
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco3.2.[4-9]*)
 		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco3.2v[4-9]*)
 		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco5v6*)
 		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco*)
 		os=-sco3.2v2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-udk*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-isc)
 		os=-isc2.2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-clix*)
 		basic_machine=clipper-intergraph
 		;;
 	-isc*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
 		;;
 	-lynx*178)
 		os=-lynxos178
@@ -227,10 +227,7 @@ case $os in
 		os=-lynxos
 		;;
 	-ptx*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-		;;
-	-windowsnt*)
-		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
 		;;
 	-psos*)
 		os=-psos
@@ -299,7 +296,7 @@ case $basic_machine in
 	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
 	| open8 | or1k | or1knd | or32 \
-	| pdp10 | pdp11 | pj | pjl \
+	| pdp10 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pru \
 	| pyramid \
@@ -316,7 +313,6 @@ case $basic_machine in
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| visium \
 	| wasm32 \
-	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
@@ -337,7 +333,7 @@ case $basic_machine in
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
 		;;
 	ms1)
 		basic_machine=mt-unknown
@@ -366,7 +362,7 @@ case $basic_machine in
 	  ;;
 	# Object if more than one company name word.
 	*-*-*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
@@ -461,7 +457,7 @@ case $basic_machine in
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
-		basic_machine=i386-unknown
+		basic_machine=i386-pc
 		os=-bsd
 		;;
 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
@@ -495,7 +491,7 @@ case $basic_machine in
 		basic_machine=x86_64-pc
 		;;
 	amd64-*)
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	amdahl)
 		basic_machine=580-amdahl
@@ -540,7 +536,7 @@ case $basic_machine in
 		os=-linux
 		;;
 	blackfin-*)
-		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
 	bluegene*)
@@ -548,13 +544,13 @@ case $basic_machine in
 		os=-cnk
 		;;
 	c54x-*)
-		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	c55x-*)
-		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	c6x-*)
-		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	c90)
 		basic_machine=c90-cray
@@ -643,7 +639,7 @@ case $basic_machine in
 		basic_machine=rs6000-bull
 		os=-bosx
 		;;
-	dpx2* | dpx2*-bull)
+	dpx2*)
 		basic_machine=m68k-bull
 		os=-sysv3
 		;;
@@ -652,7 +648,7 @@ case $basic_machine in
 		os=$os"spe"
 		;;
 	e500v[12]-*)
-		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=$os"spe"
 		;;
 	ebmon29k)
@@ -744,9 +740,6 @@ case $basic_machine in
 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
 		basic_machine=hppa1.0-hp
 		;;
-	hppa-next)
-		os=-nextstep3
-		;;
 	hppaosf)
 		basic_machine=hppa1.1-hp
 		os=-osf
@@ -759,26 +752,26 @@ case $basic_machine in
 		basic_machine=i370-ibm
 		;;
 	i*86v32)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
 		;;
 	i*86v4*)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-sysv4
 		;;
 	i*86v)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-sysv
 		;;
 	i*86sol2)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
 	i386mach)
 		basic_machine=i386-mach
 		os=-mach
 		;;
-	i386-vsta | vsta)
+	vsta)
 		basic_machine=i386-unknown
 		os=-vsta
 		;;
@@ -797,19 +790,16 @@ case $basic_machine in
 		os=-sysv
 		;;
 	leon-*|leon[3-9]-*)
-		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
 		;;
 	m68knommu)
 		basic_machine=m68k-unknown
 		os=-linux
 		;;
 	m68knommu-*)
-		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
-	m88k-omron*)
-		basic_machine=m88k-omron
-		;;
 	magnum | m3230)
 		basic_machine=mips-mips
 		os=-sysv
@@ -841,10 +831,10 @@ case $basic_machine in
 		os=-mint
 		;;
 	mips3*-*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
 		;;
 	mips3*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
 		;;
 	monitor)
 		basic_machine=m68k-rom68k
@@ -863,7 +853,7 @@ case $basic_machine in
 		os=-msdos
 		;;
 	ms1-*)
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
 		;;
 	msys)
 		basic_machine=i686-pc
@@ -905,7 +895,7 @@ case $basic_machine in
 		basic_machine=v70-nec
 		os=-sysv
 		;;
-	next | m*-next )
+	next | m*-next)
 		basic_machine=m68k-next
 		case $os in
 		    -nextstep* )
@@ -950,6 +940,9 @@ case $basic_machine in
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
+	nsv-tandem)
+		basic_machine=nsv-tandem
+		;;
 	nsx-tandem)
 		basic_machine=nsx-tandem
 		;;
@@ -985,7 +978,7 @@ case $basic_machine in
 		os=-linux
 		;;
 	parisc-*)
-		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
 	pbd)
@@ -1001,7 +994,7 @@ case $basic_machine in
 		basic_machine=i386-pc
 		;;
 	pc98-*)
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
@@ -1016,16 +1009,16 @@ case $basic_machine in
 		basic_machine=i786-pc
 		;;
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pentium4-*)
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	pn)
 		basic_machine=pn-gould
@@ -1035,23 +1028,23 @@ case $basic_machine in
 	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
 	ppc-* | ppcbe-*)
-		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle)
 		basic_machine=powerpcle-unknown
 		;;
 	ppcle-* | powerpclittle-*)
-		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ppc64)	basic_machine=powerpc64-unknown
 		;;
-	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ppc64le | powerpc64little)
 		basic_machine=powerpc64le-unknown
 		;;
 	ppc64le-* | powerpc64little-*)
-		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	ps2)
 		basic_machine=i386-ibm
@@ -1105,17 +1098,10 @@ case $basic_machine in
 	sequent)
 		basic_machine=i386-sequent
 		;;
-	sh)
-		basic_machine=sh-hitachi
-		os=-hms
-		;;
 	sh5el)
 		basic_machine=sh5le-unknown
 		;;
-	sh64)
-		basic_machine=sh64-unknown
-		;;
-	sparclite-wrs | simso-wrs)
+	simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
 		;;
@@ -1134,7 +1120,7 @@ case $basic_machine in
 		os=-sysv4
 		;;
 	strongarm-* | thumb-*)
-		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
 		;;
 	sun2)
 		basic_machine=m68000-sun
@@ -1248,9 +1234,6 @@ case $basic_machine in
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
-	wasm32)
-		basic_machine=wasm32-unknown
-		;;
 	w65*)
 		basic_machine=w65-wdc
 		os=-none
@@ -1259,6 +1242,9 @@ case $basic_machine in
 		basic_machine=hppa1.1-winbond
 		os=-proelf
 		;;
+	x64)
+		basic_machine=x86_64-pc
+		;;
 	xbox)
 		basic_machine=i686-pc
 		os=-mingw32
@@ -1267,20 +1253,12 @@ case $basic_machine in
 		basic_machine=xps100-honeywell
 		;;
 	xscale-* | xscalee[bl]-*)
-		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
 		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
 		;;
-	z8k-*-coff)
-		basic_machine=z8k-unknown
-		os=-sim
-		;;
-	z80-*-coff)
-		basic_machine=z80-unknown
-		os=-sim
-		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -1309,10 +1287,6 @@ case $basic_machine in
 	vax)
 		basic_machine=vax-dec
 		;;
-	pdp10)
-		# there are many clones, so DEC is not a safe bet
-		basic_machine=pdp10-unknown
-		;;
 	pdp11)
 		basic_machine=pdp11-dec
 		;;
@@ -1322,9 +1296,6 @@ case $basic_machine in
 	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
-		basic_machine=sparc-sun
-		;;
 	cydra)
 		basic_machine=cydra-cydrome
 		;;
@@ -1344,7 +1315,7 @@ case $basic_machine in
 		# Make sure to match an already-canonicalized machine name.
 		;;
 	*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
 		exit 1
 		;;
 esac
@@ -1352,10 +1323,10 @@ esac
 # Here we canonicalize certain aliases for manufacturers.
 case $basic_machine in
 	*-digital*)
-		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
 		;;
 	*-commodore*)
-		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
 		;;
 	*)
 		;;
@@ -1366,8 +1337,8 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-	# First match some system type aliases
-	# that might get confused with valid system types.
+	# First match some system type aliases that might get confused
+	# with valid system types.
 	# -solaris* is a basic system type, with this one exception.
 	-auroraux)
 		os=-auroraux
@@ -1378,18 +1349,19 @@ case $os in
 	-solaris)
 		os=-solaris2
 		;;
-	-svr4*)
-		os=-sysv4
-		;;
 	-unixware*)
 		os=-sysv4.2uw
 		;;
 	-gnu/linux*)
 		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
 		;;
-	# First accept the basic system types.
+	# es1800 is here to avoid being matched by es* (a different OS)
+	-es1800*)
+		os=-ose
+		;;
+	# Now accept the basic system types.
 	# The portable systems comes first.
-	# Each alternative MUST END IN A *, to match a version number.
+	# Each alternative MUST end in a * to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
@@ -1399,25 +1371,26 @@ case $os in
 	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
 	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \
 	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
-	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -morphos* | -superux* | -rtmk* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
 	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
-	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
+	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
+	      | -midnightbsd*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1434,12 +1407,12 @@ case $os in
 	-nto*)
 		os=`echo $os | sed -e 's|nto|nto-qnx|'`
 		;;
-	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	-sim | -xray | -os68k* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* \
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 	-mac*)
-		os=`echo $os | sed -e 's|mac|macos|'`
+		os=`echo "$os" | sed -e 's|mac|macos|'`
 		;;
 	-linux-dietlibc)
 		os=-linux-dietlibc
@@ -1448,10 +1421,10 @@ case $os in
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
 	-sunos5*)
-		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
 		;;
 	-sunos6*)
-		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
 		;;
 	-opened*)
 		os=-openedition
@@ -1462,12 +1435,6 @@ case $os in
 	-wince*)
 		os=-wince
 		;;
-	-osfrose*)
-		os=-osfrose
-		;;
-	-osf*)
-		os=-osf
-		;;
 	-utek*)
 		os=-bsd
 		;;
@@ -1492,7 +1459,7 @@ case $os in
 	-nova*)
 		os=-rtmk-nova
 		;;
-	-ns2 )
+	-ns2)
 		os=-nextstep2
 		;;
 	-nsk*)
@@ -1514,7 +1481,7 @@ case $os in
 	-oss*)
 		os=-sysv3
 		;;
-	-svr4)
+	-svr4*)
 		os=-sysv4
 		;;
 	-svr3)
@@ -1529,24 +1496,28 @@ case $os in
 	-ose*)
 		os=-ose
 		;;
-	-es1800*)
-		os=-ose
-		;;
-	-xenix)
-		os=-xenix
-		;;
 	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
 		os=-mint
 		;;
-	-aros*)
-		os=-aros
-		;;
 	-zvmoe)
 		os=-zvmoe
 		;;
 	-dicos*)
 		os=-dicos
 		;;
+	-pikeos*)
+		# Until real need of OS specific support for
+		# particular features comes up, bare metal
+		# configurations are quite functional.
+		case $basic_machine in
+		    arm*)
+			os=-eabi
+			;;
+		    *)
+			os=-elf
+			;;
+		esac
+		;;
 	-nacl*)
 		;;
 	-ios)
@@ -1556,7 +1527,7 @@ case $os in
 	*)
 		# Get rid of the `-' at the beginning of $os.
 		os=`echo $os | sed 's/[^-]*-//'`
-		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
 		exit 1
 		;;
 esac
@@ -1652,9 +1623,6 @@ case $basic_machine in
 	*-be)
 		os=-beos
 		;;
-	*-haiku)
-		os=-haiku
-		;;
 	*-ibm)
 		os=-aix
 		;;
@@ -1694,7 +1662,7 @@ case $basic_machine in
 	m88k-omron*)
 		os=-luna
 		;;
-	*-next )
+	*-next)
 		os=-nextstep
 		;;
 	*-sequent)
@@ -1709,9 +1677,6 @@ case $basic_machine in
 	i370-*)
 		os=-mvs
 		;;
-	*-next)
-		os=-nextstep3
-		;;
 	*-gould)
 		os=-sysv
 		;;
@@ -1821,15 +1786,15 @@ case $basic_machine in
 				vendor=stratus
 				;;
 		esac
-		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
 		;;
 esac
 
-echo $basic_machine$os
+echo "$basic_machine$os"
 exit
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
diff --git a/configure b/configure
index 8214c57..879b370 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 # From configure.ac Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for netCDF 4.6.0.
+# Generated by GNU Autoconf 2.69 for netCDF 4.6.1.
 #
 # Report bugs to <support-netcdf at unidata.ucar.edu>.
 #
@@ -591,8 +591,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='netCDF'
 PACKAGE_TARNAME='netcdf'
-PACKAGE_VERSION='4.6.0'
-PACKAGE_STRING='netCDF 4.6.0'
+PACKAGE_VERSION='4.6.1'
+PACKAGE_STRING='netCDF 4.6.1'
 PACKAGE_BUGREPORT='support-netcdf at unidata.ucar.edu'
 PACKAGE_URL=''
 
@@ -633,13 +633,13 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_header_list=
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 MSVC
 ISCMAKE
+NC_HAS_ERANGE_FILL
 NC_HAS_CDF5
 NC_HAS_PARALLEL4
 NC_HAS_PARALLEL
@@ -661,7 +661,7 @@ AM_CPPFLAGS
 AM_CFLAGS
 enable_static
 enable_shared
-ENABLE_ERANGE_FILL
+HAS_ERANGE_FILL
 RELAX_COORD_BOUND
 HAS_JNA
 HAS_MMAP
@@ -701,8 +701,6 @@ USE_HDF4_FALSE
 USE_HDF4_TRUE
 USE_NETCDF4_FALSE
 USE_NETCDF4_TRUE
-USE_VALGRIND_TESTS_FALSE
-USE_VALGRIND_TESTS_TRUE
 CROSS_COMPILING_FALSE
 CROSS_COMPILING_TRUE
 USE_LOGGING_FALSE
@@ -734,6 +732,10 @@ BUILD_PARALLEL_TRUE
 M4FLAGS
 ENABLE_PARALLEL_FALSE
 ENABLE_PARALLEL_TRUE
+ENABLE_CDF5_FALSE
+ENABLE_CDF5_TRUE
+USE_CDF5_FALSE
+USE_CDF5_TRUE
 ISCYGWIN_FALSE
 ISCYGWIN_TRUE
 ALLOCA
@@ -781,10 +783,6 @@ USE_STDIO_FALSE
 USE_STDIO_TRUE
 USE_FFIO_FALSE
 USE_FFIO_TRUE
-ENABLE_CDF5_FALSE
-ENABLE_CDF5_TRUE
-USE_CDF5_FALSE
-USE_CDF5_TRUE
 USE_STRICT_NULL_BYTE_HEADER_PADDING_FALSE
 USE_STRICT_NULL_BYTE_HEADER_PADDING_TRUE
 INTERNAL_OCLIB_FALSE
@@ -796,7 +794,6 @@ am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
-am__quote
 am__include
 DEPDIR
 OBJEXT
@@ -905,7 +902,8 @@ PACKAGE_VERSION
 PACKAGE_TARNAME
 PACKAGE_NAME
 PATH_SEPARATOR
-SHELL'
+SHELL
+am__quote'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
@@ -920,7 +918,6 @@ enable_dot
 enable_internal_docs
 enable_fsync
 enable_jna
-enable_valgrind_tests
 enable_netcdf_4
 enable_netcdf4
 enable_dynamic_loading
@@ -944,7 +941,6 @@ enable_dap_groups
 with_testservers
 enable_dap_long_tests
 enable_strict_null_byte_header_padding
-enable_cdf5
 enable_ffio
 enable_stdio
 enable_examples
@@ -966,6 +962,7 @@ enable_libtool_lock
 enable_largefile
 enable_diskless
 enable_mmap
+enable_cdf5
 enable_parallel4
 enable_pnetcdf
 enable_erange_fill
@@ -1522,7 +1519,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures netCDF 4.6.0 to adapt to many kinds of systems.
+\`configure' configures netCDF 4.6.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1593,7 +1590,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of netCDF 4.6.0:";;
+     short | recursive ) echo "Configuration of netCDF 4.6.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1622,8 +1619,6 @@ Optional Features:
                           library.
   --enable-fsync          enable fsync support
   --enable-jna            enable jna bug workaround
-  --enable-valgrind-tests build with valgrind-tests (valgrind is required,
-                          static builds only)
   --disable-netcdf-4      do not build with netcdf-4 (else HDF5 and zlib
                           required)
   --disable-netcdf4       (just a synonym for --disable-netcdf-4)
@@ -1640,9 +1635,8 @@ Optional Features:
   --enable-extra-example-tests
                           Run extra example tests; requires GNU sed. Ignored
                           if netCDF-4 is not enabled.
-  --enable-parallel-tests Run extra parallel IO tests. Ignored if netCDF-4 is
-                          not enabled, or built on a system without parallel
-                          I/O support.
+  --enable-parallel-tests Run extra parallel IO tests. Requires netCDF-4 with
+                          parallel I/O support.
   --enable-logging        enable logging capability (only applies when
                           netCDF-4 is built). This debugging features is only
                           of interest to netCDF developers. Ignored if
@@ -1660,7 +1654,6 @@ Optional Features:
   --enable-strict-null-byte-header-padding
                           enable strict null-byte header padding when reading
                           netCDF3 files.
-  --enable-cdf5           build with CDF5 support.
   --enable-ffio           use ffio instead of posixio (ex. on the Cray)
   --enable-stdio          use stdio instead of posixio (ex. on the Cray)
   --disable-examples      don't build the netCDF examples during make check
@@ -1690,6 +1683,7 @@ Optional Features:
   --disable-largefile     omit support for large files
   --disable-diskless      disable support for in-memory (NC_DISKLESS) files
   --enable-mmap           allow mmap for in-memory files
+  --disable-cdf5          build without CDF5 support.
   --disable-parallel4     disable parallel I/O for netcdf-4, even if it's
                           enabled in libhdf5
   --enable-pnetcdf        build with parallel I/O for classic files
@@ -1824,7 +1818,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-netCDF configure 4.6.0
+netCDF configure 4.6.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2533,7 +2527,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by netCDF $as_me 4.6.0, which was
+It was created by netCDF $as_me 4.6.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2813,9 +2807,6 @@ $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
-as_fn_append ac_header_list " stdlib.h"
-as_fn_append ac_header_list " unistd.h"
-as_fn_append ac_header_list " sys/param.h"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -2894,7 +2885,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
  NC_VERSION_MAJOR=4
  NC_VERSION_MINOR=6
- NC_VERSION_PATCH=0
+ NC_VERSION_PATCH=1
  NC_VERSION_NOTE=""
 
 #####
@@ -2904,11 +2895,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 # Create the VERSION file, which contains the package version from
 # AC_INIT.
-echo 4.6.0>VERSION
+echo 4.6.1>VERSION
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.6.0" >&5
-$as_echo "$as_me: netCDF 4.6.0" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.6.1" >&5
+$as_echo "$as_me: netCDF 4.6.1" >&6;}
 
 # Keep libtool macros in an m4 directory.
 
@@ -3081,12 +3072,12 @@ ac_config_links="$ac_config_links nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5
 ac_config_links="$ac_config_links nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc"
 
 
-ac_config_links="$ac_config_links nc_test4/ref_chunked.hdf4:nc_test4/ref_chunked.hdf4"
+ac_config_links="$ac_config_links hdf4_test/ref_chunked.hdf4:hdf4_test/ref_chunked.hdf4"
 
-ac_config_links="$ac_config_links nc_test4/ref_contiguous.hdf4:nc_test4/ref_contiguous.hdf4"
+ac_config_links="$ac_config_links hdf4_test/ref_contiguous.hdf4:hdf4_test/ref_contiguous.hdf4"
 
 
-am__api_version='1.15'
+am__api_version='1.16'
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -3572,7 +3563,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='netcdf'
- VERSION='4.6.0'
+ VERSION='4.6.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3602,8 +3593,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # For better backward compatibility.  To be removed once Automake 1.9.x
 # dies out for good.  For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
 mkdir_p='$(MKDIR_P)'
 
 # We need awk for the "check" target (and possibly the TAP driver).  The
@@ -3654,7 +3645,7 @@ END
 Aborting the configuration process, to ensure you take notice of the issue.
 
 You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
 
 If you want to complete the configuration process using your problematic
 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -3854,18 +3845,6 @@ $as_echo "#define JNA 1" >>confdefs.h
 
 fi
 
-# Does the user want to run extra tests with valgrind?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether extra valgrind tests should be run" >&5
-$as_echo_n "checking whether extra valgrind tests should be run... " >&6; }
-# Check whether --enable-valgrind-tests was given.
-if test "${enable_valgrind_tests+set}" = set; then :
-  enableval=$enable_valgrind_tests;
-fi
-
-test "x$enable_valgrind_tests" = xyes || enable_valgrind_tests=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_valgrind_tests" >&5
-$as_echo "$enable_valgrind_tests" >&6; }
-
 # Does the user want to build netcdf-4?
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we should build netCDF-4" >&5
 $as_echo_n "checking whether we should build netCDF-4... " >&6; }
@@ -3911,6 +3890,9 @@ if test "${enable_hdf4+set}" = set; then :
 fi
 
 test "x$enable_hdf4" = xyes || enable_hdf4=no
+if test "x$enable_hdf4" = xyes -a "x$enable_netcdf_4" = xno; then
+      as_fn_error $? "NetCDF-4 is required for HDF4 features" "$LINENO" 5
+fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_hdf4" >&5
 $as_echo "$enable_hdf4" >&6; }
 
@@ -4124,45 +4106,45 @@ DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
 
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
+cat > confinc.mk << 'END'
 am__doit:
-	@echo this is the am__doit target
+	@echo this is the am__doit target >confinc.out
 .PHONY: am__doit
 END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+  { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+   (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+  case $?:`cat confinc.out 2>/dev/null` in #(
+  '0:this is the am__doit target') :
+    case $s in #(
+  BSD) :
+    am__include='.include' am__quote='"' ;; #(
+  *) :
+    am__include='include' am__quote='' ;;
+esac ;; #(
+  *) :
      ;;
-   esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
+esac
+  if test "$am__include" != "#"; then
+    _am_result="yes ($s style)"
+    break
+  fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }
 
 # Check whether --enable-dependency-tracking was given.
 if test "${enable_dependency_tracking+set}" = set; then :
@@ -5418,44 +5400,6 @@ else
 fi
 
 
-# Check whether we want to enable CDF5 support.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CDF5 support should be enabled (default off)" >&5
-$as_echo_n "checking whether CDF5 support should be enabled (default off)... " >&6; }
-# Check whether --enable-cdf5 was given.
-if test "${enable_cdf5+set}" = set; then :
-  enableval=$enable_cdf5;
-fi
-
-test "x$enable_cdf5" = xyes || enable_cdf5=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_cdf5" >&5
-$as_echo "$enable_cdf5" >&6; }
-
-if test "x$enable_cdf5" = xyes; then
-
-$as_echo "#define USE_CDF5 1" >>confdefs.h
-
-
-$as_echo "#define ENABLE_CDF5 1" >>confdefs.h
-
-fi
-
- if test x$enable_cdf5 = xyes ; then
-  USE_CDF5_TRUE=
-  USE_CDF5_FALSE='#'
-else
-  USE_CDF5_TRUE='#'
-  USE_CDF5_FALSE=
-fi
-
- if test x$enable_cdf5 = xyes ; then
-  ENABLE_CDF5_TRUE=
-  ENABLE_CDF5_FALSE='#'
-else
-  ENABLE_CDF5_TRUE='#'
-  ENABLE_CDF5_FALSE=
-fi
-
-
 # Does the user want to use the ffio module?
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether FFIO will be used" >&5
 $as_echo_n "checking whether FFIO will be used... " >&6; }
@@ -6656,33 +6600,6 @@ $as_echo "#define HAVE_CURLINFO_RESPONSE_CODE 1" >>confdefs.h
 
 fi
 
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include "curl/curl.h"
-int
-main ()
-{
-int x = CURLOPT_CHUNK_BGN_FUNCTION;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  havebgnfunction=yes
-else
-  havebgnfunction=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CURLOPT_CHUNK_BGN_FUNCTION is defined" >&5
-$as_echo_n "checking whether CURLOPT_CHUNK_BGN_FUNCTION is defined... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${havebgnfunction}" >&5
-$as_echo "${havebgnfunction}" >&6; }
-if test $havebgnfunction = yes; then
-
-$as_echo "#define HAVE_CURLOPT_CHUNK_BGN_FUNCTION 1" >>confdefs.h
-
-fi
-
 CFLAGS="$SAVECFLAGS"
 
 # Set up libtool.
@@ -14687,14 +14604,6 @@ CC=$lt_save_CC
 
 
 
-# Valgrind tests don't work with shared builds because of some libtool
-# weirdness.
-if test "x$enable_shared" = xyes; then
-   if test $enable_valgrind_tests = yes; then
-      as_fn_error $? "No valgrind tests with shared libraries" "$LINENO" 5
-   fi
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: finding other utilities" >&5
 $as_echo "$as_me: finding other utilities" >&6;}
 
@@ -15186,38 +15095,6 @@ echo "CPPFLAGS=$CPPFLAGS CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS LIBS=$LIBS" >> c
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking types, headers, and functions" >&5
 $as_echo "$as_me: checking types, headers, and functions" >&6;}
 
-ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdlib_h" = xyes; then :
-
-else
-
-$as_echo "#define NO_STDLIB_H /**/" >>confdefs.h
-
-fi
-
-
-ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_types_h" = xyes; then :
-
-else
-
-$as_echo "#define NO_SYS_TYPES_H /**/" >>confdefs.h
-
-fi
-
-
-for ac_header in sys/dir.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/dir.h" "ac_cv_header_sys_dir_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_dir_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_DIR_H 1
-_ACEOF
-
-fi
-
-done
-
 for ac_header in sys/param.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default"
@@ -15230,165 +15107,19 @@ fi
 
 done
 
-#AC_CHECK_HEADERS([locale.h])
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
-$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if eval \${$as_ac_Header+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_hdr>
-
-int
-main ()
-{
-if ((DIR *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$as_ac_Header=yes"
-else
-  eval "$as_ac_Header=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$as_ac_Header
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+for ac_header in libgen.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default"
+if test "x$ac_cv_header_libgen_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
-_ACEOF
-
-ac_header_dirent=$ac_hdr; break
-fi
-
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if ${ac_cv_search_opendir+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
+#define HAVE_LIBGEN_H 1
 _ACEOF
-for ac_lib in '' dir; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_opendir=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_opendir+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_opendir+:} false; then :
-
-else
-  ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if ${ac_cv_search_opendir+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' x; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_opendir=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_opendir+:} false; then :
-  break
-fi
 done
-if ${ac_cv_search_opendir+:} false; then :
-
-else
-  ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-fi
 
+#AC_CHECK_HEADERS([locale.h])
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
 if ${ac_cv_header_stdc+:} false; then :
@@ -15501,113 +15232,18 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
-$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
-if ${ac_cv_header_sys_wait_h+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-
-int
-main ()
-{
-  int s;
-  wait (&s);
-  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-  ;
-  return 0;
-}
+for ac_header in locale.h stdio.h stdarg.h fcntl.h malloc.h stdlib.h string.h strings.h unistd.h sys/stat.h getopt.h sys/time.h sys/types.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_sys_wait_h=yes
-else
-  ac_cv_header_sys_wait_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
-$as_echo "$ac_cv_header_sys_wait_h" >&6; }
-if test $ac_cv_header_sys_wait_h = yes; then
-
-$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if ${ac_cv_header_time+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_time=yes
-else
-  ac_cv_header_time=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
-
-$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
-
-fi
-
-for ac_header in locale.h stdio.h stdarg.h errno.h ctype.h fcntl.h malloc.h stdlib.h string.h strings.h unistd.h sys/stat.h getopt.h sys/time.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-for ac_func in vprintf
-do :
-  ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
-if test "x$ac_cv_func_vprintf" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_VPRINTF 1
-_ACEOF
-
-ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
-if test "x$ac_cv_func__doprnt" = xyes; then :
-
-$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
-
-fi
-
-fi
-done
-
+done
 
 
 # Do sys/resource.h separately
@@ -15627,114 +15263,6 @@ done
 
 #fi
 
-for ac_header in sys/cdefs.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/cdefs.h" "ac_cv_header_sys_cdefs_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_cdefs_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_CDEFS_H 1
-_ACEOF
-
-fi
-
-done
-
-
-# Check for <stdbool.h> that conforms to C99 requirements
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
-$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if ${ac_cv_header_stdbool_h+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-             #include <stdbool.h>
-             #ifndef bool
-              "error: bool is not defined"
-             #endif
-             #ifndef false
-              "error: false is not defined"
-             #endif
-             #if false
-              "error: false is not 0"
-             #endif
-             #ifndef true
-              "error: true is not defined"
-             #endif
-             #if true != 1
-              "error: true is not 1"
-             #endif
-             #ifndef __bool_true_false_are_defined
-              "error: __bool_true_false_are_defined is not defined"
-             #endif
-
-             struct s { _Bool s: 1; _Bool t; } s;
-
-             char a[true == 1 ? 1 : -1];
-             char b[false == 0 ? 1 : -1];
-             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
-             char d[(bool) 0.5 == true ? 1 : -1];
-             /* See body of main program for 'e'.  */
-             char f[(_Bool) 0.0 == false ? 1 : -1];
-             char g[true];
-             char h[sizeof (_Bool)];
-             char i[sizeof s.t];
-             enum { j = false, k = true, l = false * true, m = true * 256 };
-             /* The following fails for
-                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
-             _Bool n[m];
-             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
-             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-             /* Catch a bug in an HP-UX C compiler.  See
-                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-              */
-             _Bool q = true;
-             _Bool *pq = &q;
-
-int
-main ()
-{
-
-             bool e = &s;
-             *pq |= q;
-             *pq |= ! q;
-             /* Refer to every declared value, to avoid compiler optimizations.  */
-             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
-                     + !m + !n + !o + !p + !q + !pq);
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdbool_h=yes
-else
-  ac_cv_header_stdbool_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
-$as_echo "$ac_cv_header_stdbool_h" >&6; }
-   ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE__BOOL 1
-_ACEOF
-
-
-fi
-
-
-if test $ac_cv_header_stdbool_h = yes; then
-
-$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
-
-fi
-
-
 # See if we have ftw.h to walk directory trees
 for ac_header in ftw.h
 do :
@@ -15750,9 +15278,9 @@ done
 
 
 # Check for these functions...
-for ac_func in strlcat strerror snprintf strchr strrchr strcat strcpy \
-                strdup strcasecmp strtod strtoll strtoull strstr \
-		mkstemp mktemp rand random memcmp \
+for ac_func in strlcat snprintf \
+                strdup strtoll strtoull \
+		mkstemp mktemp random \
 		getrlimit gettimeofday fsync MPI_Comm_f2c
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -15826,207 +15354,6 @@ test "x$enable_mmap" = xyes || enable_mmap=no
 $as_echo "$enable_mmap" >&6; }
 
 # check for mmap and mremap availability before committing to use mmap
-
-
-
-  for ac_header in $ac_header_list
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-
-
-
-
-for ac_func in getpagesize
-do :
-  ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
-if test "x$ac_cv_func_getpagesize" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GETPAGESIZE 1
-_ACEOF
-
-fi
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
-$as_echo_n "checking for working mmap... " >&6; }
-if ${ac_cv_func_mmap_fixed_mapped+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_mmap_fixed_mapped=no
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
-   Here is a matrix of mmap possibilities:
-	mmap private not fixed
-	mmap private fixed at somewhere currently unmapped
-	mmap private fixed at somewhere already mapped
-	mmap shared not fixed
-	mmap shared fixed at somewhere currently unmapped
-	mmap shared fixed at somewhere already mapped
-   For private mappings, we should verify that changes cannot be read()
-   back from the file, nor mmap's back from the file at a different
-   address.  (There have been systems where private was not correctly
-   implemented like the infamous i386 svr4.0, and systems where the
-   VM page cache was not coherent with the file system buffer cache
-   like early versions of FreeBSD and possibly contemporary NetBSD.)
-   For shared mappings, we should conversely verify that changes get
-   propagated back to all the places they're supposed to be.
-
-   Grep wants private fixed already mapped.
-   The main things grep needs to know about mmap are:
-   * does it exist and is it safe to write into the mmap'd area
-   * how to use it (BSD variants)  */
-
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
-char *malloc ();
-#endif
-
-/* This mess was copied from the GNU getpagesize.h.  */
-#ifndef HAVE_GETPAGESIZE
-# ifdef _SC_PAGESIZE
-#  define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-#  ifdef HAVE_SYS_PARAM_H
-#   include <sys/param.h>
-#   ifdef EXEC_PAGESIZE
-#    define getpagesize() EXEC_PAGESIZE
-#   else /* no EXEC_PAGESIZE */
-#    ifdef NBPG
-#     define getpagesize() NBPG * CLSIZE
-#     ifndef CLSIZE
-#      define CLSIZE 1
-#     endif /* no CLSIZE */
-#    else /* no NBPG */
-#     ifdef NBPC
-#      define getpagesize() NBPC
-#     else /* no NBPC */
-#      ifdef PAGESIZE
-#       define getpagesize() PAGESIZE
-#      endif /* PAGESIZE */
-#     endif /* no NBPC */
-#    endif /* no NBPG */
-#   endif /* no EXEC_PAGESIZE */
-#  else /* no HAVE_SYS_PARAM_H */
-#   define getpagesize() 8192	/* punt totally */
-#  endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-int
-main ()
-{
-  char *data, *data2, *data3;
-  const char *cdata2;
-  int i, pagesize;
-  int fd, fd2;
-
-  pagesize = getpagesize ();
-
-  /* First, make a file with some known garbage in it. */
-  data = (char *) malloc (pagesize);
-  if (!data)
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    *(data + i) = rand ();
-  umask (0);
-  fd = creat ("conftest.mmap", 0600);
-  if (fd < 0)
-    return 2;
-  if (write (fd, data, pagesize) != pagesize)
-    return 3;
-  close (fd);
-
-  /* Next, check that the tail of a page is zero-filled.  File must have
-     non-zero length, otherwise we risk SIGBUS for entire page.  */
-  fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
-  if (fd2 < 0)
-    return 4;
-  cdata2 = "";
-  if (write (fd2, cdata2, 1) != 1)
-    return 5;
-  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
-  if (data2 == MAP_FAILED)
-    return 6;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data2 + i))
-      return 7;
-  close (fd2);
-  if (munmap (data2, pagesize))
-    return 8;
-
-  /* Next, try to mmap the file at a fixed address which already has
-     something else allocated at it.  If we can, also make sure that
-     we see the same garbage.  */
-  fd = open ("conftest.mmap", O_RDWR);
-  if (fd < 0)
-    return 9;
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-		     MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    return 10;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data2 + i))
-      return 11;
-
-  /* Finally, make sure that changes to the mapped area do not
-     percolate back to the file as seen by read().  (This is a bug on
-     some variants of i386 svr4.0.)  */
-  for (i = 0; i < pagesize; ++i)
-    *(data2 + i) = *(data2 + i) + 1;
-  data3 = (char *) malloc (pagesize);
-  if (!data3)
-    return 12;
-  if (read (fd, data3, pagesize) != pagesize)
-    return 13;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data3 + i))
-      return 14;
-  close (fd);
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_mmap_fixed_mapped=yes
-else
-  ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
-$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
-
-$as_echo "#define HAVE_MMAP 1" >>confdefs.h
-
-fi
-rm -f conftest.mmap conftest.txt
-
 for ac_func in mremap
 do :
   ac_fn_c_check_func "$LINENO" "mremap" "ac_cv_func_mremap"
@@ -16286,17 +15613,6 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_ISFINITE $ac_have_decl
 _ACEOF
-ac_fn_c_check_decl "$LINENO" "signbit" "ac_cv_have_decl_signbit" "#include <math.h>
-"
-if test "x$ac_cv_have_decl_signbit" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_SIGNBIT $ac_have_decl
-_ACEOF
 
 ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
 if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
@@ -16385,15 +15701,6 @@ _ACEOF
 
 
 fi
-ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
-if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PTRDIFF_T 1
-_ACEOF
-
-
-fi
 ac_fn_c_check_type "$LINENO" "schar" "ac_cv_type_schar" "$ac_includes_default"
 if test "x$ac_cv_type_schar" = xyes; then :
 
@@ -16448,27 +15755,16 @@ _ACEOF
 
 
 fi
-ac_fn_c_check_type "$LINENO" "uint64 off_t" "ac_cv_type_uint64_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint64_off_t" = xyes; then :
+ac_fn_c_check_type "$LINENO" "uint64" "ac_cv_type_uint64" "$ac_includes_default"
+if test "x$ac_cv_type_uint64" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_UINT64_OFF_T 1
+#define HAVE_UINT64 1
 _ACEOF
 
 
 fi
 
-ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
-
-fi
-
 ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
 if test "x$ac_cv_type_off_t" = xyes; then :
 
@@ -16480,39 +15776,6 @@ _ACEOF
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
-$as_echo_n "checking whether char is unsigned... " >&6; }
-if ${ac_cv_c_char_unsigned+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((char) -1) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_char_unsigned=no
-else
-  ac_cv_c_char_unsigned=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5
-$as_echo "$ac_cv_c_char_unsigned" >&6; }
-if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
-  $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h
-
-fi
-
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
 $as_echo_n "checking whether byte ordering is bigendian... " >&6; }
 if ${ac_cv_c_bigendian+:} false; then :
@@ -17065,39 +16328,53 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-$SLEEPCMD
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long long" >&5
-$as_echo_n "checking size of unsigned long long... " >&6; }
-if ${ac_cv_sizeof_unsigned_long_long+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long long))" "ac_cv_sizeof_unsigned_long_long"        "$ac_includes_default"; then :
 
+# Check whether we want to enable CDF5 support.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CDF5 support should be enabled" >&5
+$as_echo_n "checking whether CDF5 support should be enabled... " >&6; }
+# Check whether --enable-cdf5 was given.
+if test "${enable_cdf5+set}" = set; then :
+  enableval=$enable_cdf5; enable_cdf5=${enableval}
 else
-  if test "$ac_cv_type_unsigned_long_long" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (unsigned long long)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_unsigned_long_long=0
-   fi
+  enable_cdf5=auto
+
 fi
 
+if test "x${enable_cdf5}" = xyes && test "$ac_cv_sizeof_size_t" -lt "8" ; then
+      as_fn_error $? "Unable to support CDF5 feature because size_t is less than 4 bytes" "$LINENO" 5
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long_long" >&5
-$as_echo "$ac_cv_sizeof_unsigned_long_long" >&6; }
+if test "$ac_cv_sizeof_size_t" -lt "8" ; then
+   enable_cdf5=no
+else
+   enable_cdf5=yes
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_cdf5" >&5
+$as_echo "$enable_cdf5" >&6; }
+
+if test "x${enable_cdf5}" = xyes; then
 
+$as_echo "#define USE_CDF5 1" >>confdefs.h
 
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long
-_ACEOF
+$as_echo "#define ENABLE_CDF5 1" >>confdefs.h
+
+fi
+
+ if test x$enable_cdf5 = xyes ; then
+  USE_CDF5_TRUE=
+  USE_CDF5_FALSE='#'
+else
+  USE_CDF5_TRUE='#'
+  USE_CDF5_FALSE=
+fi
 
+ if test x$enable_cdf5 = xyes ; then
+  ENABLE_CDF5_TRUE=
+  ENABLE_CDF5_FALSE='#'
+else
+  ENABLE_CDF5_TRUE='#'
+  ENABLE_CDF5_FALSE=
+fi
 
 
 $SLEEPCMD
@@ -17457,40 +16734,6 @@ $SLEEPCMD
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ptrdiff_t" >&5
-$as_echo_n "checking size of ptrdiff_t... " >&6; }
-if ${ac_cv_sizeof_ptrdiff_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (ptrdiff_t))" "ac_cv_sizeof_ptrdiff_t"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_ptrdiff_t" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (ptrdiff_t)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_ptrdiff_t=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_ptrdiff_t" >&5
-$as_echo "$ac_cv_sizeof_ptrdiff_t" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_PTRDIFF_T $ac_cv_sizeof_ptrdiff_t
-_ACEOF
-
-
-$SLEEPCDM
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ssize_t" >&5
 $as_echo_n "checking size of ssize_t... " >&6; }
 if ${ac_cv_sizeof_ssize_t+:} false; then :
@@ -17676,77 +16919,6 @@ $as_echo "#define USE_NETCDF4 1" >>confdefs.h
 $as_echo "#define H5_USE_16_API 1" >>confdefs.h
 
 
-   # The user may have built HDF5 with libdl (dynamic loading support).
-   if test "x$enable_dynamic_loading" = xyes; then
-      for ac_header in dlfcn.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
-if test "x$ac_cv_header_dlfcn_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DLFCN_H 1
-_ACEOF
-
-else
-  nc_dlfcn_h_missing=yes
-fi
-
-done
-
-      if test "x$nc_dlfcn_h_missing" = xyes; then
-      	      as_fn_error $? "Cannot find dlfcn.h, yet --enable-dynamic-loading was used." "$LINENO" 5
-      fi
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dl_dlopen=yes
-else
-  ac_cv_lib_dl_dlopen=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDL 1
-_ACEOF
-
-  LIBS="-ldl $LIBS"
-
-else
-  as_fn_error $? "Can't find or link against libdl. See config.log for errors." "$LINENO" 5
-fi
-
-
-$as_echo "#define USE_LIBDL 1" >>confdefs.h
-
-   fi
-
    # Check for the main hdf5 and hdf5_hl library.
 
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing H5Fflush" >&5
@@ -17880,6 +17052,19 @@ fi
 
 done
 
+   for ac_func in H5Z_SZIP
+do :
+  ac_fn_c_check_func "$LINENO" "H5Z_SZIP" "ac_cv_func_H5Z_SZIP"
+if test "x$ac_cv_func_H5Z_SZIP" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_H5Z_SZIP 1
+_ACEOF
+
+fi
+done
+
+   hdf5_parallel=no
+
    for ac_func in H5Pget_fapl_mpiposix H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -17892,7 +17077,6 @@ _ACEOF
 fi
 done
 
-
    # The user may have parallel HDF5 based on MPI POSIX.
    if test "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
 
@@ -17919,19 +17103,19 @@ $as_echo "#define HDF5_HAS_COLL_METADATA_OPS 1" >>confdefs.h
    if test "x$ac_cv_func_H5Pget_fapl_mpio" = xyes -o "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
       hdf5_parallel=yes
    fi
+
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether parallel io is enabled in hdf5" >&5
 $as_echo_n "checking whether parallel io is enabled in hdf5... " >&6; }
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hdf5_parallel" >&5
 $as_echo "$hdf5_parallel" >&6; }
 
-   # The user must have built HDF5 with the ZLIB library.
-   if test "x$ac_cv_func_H5Pset_deflate" = xyes; then
+   if test "x$hdf5_parallel" = "xno"; then
+      if test "x$enable_parallel_tests" = "xyes"; then
+         as_fn_error $? "Parallel tests requested, but no parallel HDF5 installation detected." "$LINENO" 5
+      fi
+   fi
 
-$as_echo "#define USE_ZLIB 1" >>confdefs.h
 
-   else
-      as_fn_error $? "HDF5 must be built with zlib for netCDF-4" "$LINENO" 5
-   fi
 
    # The user may have built HDF5 with the SZLIB library.
    enable_szlib=no
@@ -18649,14 +17833,6 @@ else
   CROSS_COMPILING_FALSE=
 fi
 
- if test "x$enable_valgrind_tests" = xyes; then
-  USE_VALGRIND_TESTS_TRUE=
-  USE_VALGRIND_TESTS_FALSE='#'
-else
-  USE_VALGRIND_TESTS_TRUE='#'
-  USE_VALGRIND_TESTS_FALSE=
-fi
-
  if test x$enable_netcdf_4 = xyes; then
   USE_NETCDF4_TRUE=
   USE_NETCDF4_FALSE='#'
@@ -19082,7 +18258,7 @@ HAS_JNA=$enable_jna
 
 RELAX_COORD_BOUND=$enable_relax_coord_bound
 
-ENABLE_ERANGE_FILL=$enable_erange_fill
+HAS_ERANGE_FILL=$enable_erange_fill
 
 
 # Include some specifics for netcdf on windows.
@@ -19224,6 +18400,13 @@ ENABLE_ERANGE_FILL=$enable_erange_fill
   fi
 
 
+  if  test "x$enable_erange_fill" = xyes ; then
+      NC_HAS_ERANGE_FILL=1
+  else
+      NC_HAS_ERANGE_FILL=0
+  fi
+
+
 # Automake says that this is always run in top_builddir
 # and that srcdir is defined (== top_srcdir)
 abs_top_builddir=`pwd`
@@ -19249,7 +18432,7 @@ ac_config_files="$ac_config_files nc_test4/findplugin.sh:nc_test4/findplugin.in"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: generating header files and makefiles" >&5
 $as_echo "$as_me: generating header files and makefiles" >&6;}
-ac_config_files="$ac_config_files Makefile nc-config netcdf.pc libnetcdf.settings postinstall.sh include/netcdf_meta.h include/Makefile h5_test/Makefile libsrc/Makefile libsrc4/Makefile libsrcp/Makefile ncdump/Makefile ncgen3/Makefile ncgen/Makefile examples/Makefile examples/C/Makefile examples/C/hdf5plugins/Makefile examples/CDL/Makefile oc2/Makefile libdap2/Makefile libdap4/Makefile libdispatch/Makefile liblib/Makefile ncdump/cdl/Makefile ncdump/expected/Makefile docs/Makefile docs/im [...]
+ac_config_files="$ac_config_files Makefile nc-config netcdf.pc libnetcdf.settings postinstall.sh include/netcdf_meta.h include/Makefile h5_test/Makefile hdf4_test/Makefile libsrc/Makefile libsrc4/Makefile libsrcp/Makefile ncdump/Makefile ncgen3/Makefile ncgen/Makefile examples/Makefile examples/C/Makefile examples/C/hdf5plugins/Makefile examples/CDL/Makefile oc2/Makefile libdap2/Makefile libdap4/Makefile libhdf4/Makefile libdispatch/Makefile liblib/Makefile ncdump/cdl/Makefile ncdump/exp [...]
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -19412,14 +18595,6 @@ if test -z "${USE_STRICT_NULL_BYTE_HEADER_PADDING_TRUE}" && test -z "${USE_STRIC
   as_fn_error $? "conditional \"USE_STRICT_NULL_BYTE_HEADER_PADDING\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_CDF5_TRUE}" && test -z "${USE_CDF5_FALSE}"; then
-  as_fn_error $? "conditional \"USE_CDF5\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${ENABLE_CDF5_TRUE}" && test -z "${ENABLE_CDF5_FALSE}"; then
-  as_fn_error $? "conditional \"ENABLE_CDF5\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_FFIO_TRUE}" && test -z "${USE_FFIO_FALSE}"; then
   as_fn_error $? "conditional \"USE_FFIO\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19461,6 +18636,14 @@ if test -z "${ISCYGWIN_TRUE}" && test -z "${ISCYGWIN_FALSE}"; then
   as_fn_error $? "conditional \"ISCYGWIN\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_CDF5_TRUE}" && test -z "${USE_CDF5_FALSE}"; then
+  as_fn_error $? "conditional \"USE_CDF5\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_CDF5_TRUE}" && test -z "${ENABLE_CDF5_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_CDF5\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${ENABLE_PARALLEL_TRUE}" && test -z "${ENABLE_PARALLEL_FALSE}"; then
   as_fn_error $? "conditional \"ENABLE_PARALLEL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19529,10 +18712,6 @@ if test -z "${CROSS_COMPILING_TRUE}" && test -z "${CROSS_COMPILING_FALSE}"; then
   as_fn_error $? "conditional \"CROSS_COMPILING\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_VALGRIND_TESTS_TRUE}" && test -z "${USE_VALGRIND_TESTS_FALSE}"; then
-  as_fn_error $? "conditional \"USE_VALGRIND_TESTS\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_NETCDF4_TRUE}" && test -z "${USE_NETCDF4_FALSE}"; then
   as_fn_error $? "conditional \"USE_NETCDF4\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19978,7 +19157,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by netCDF $as_me 4.6.0, which was
+This file was extended by netCDF $as_me 4.6.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20048,7 +19227,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-netCDF config.status 4.6.0
+netCDF config.status 4.6.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -20167,7 +19346,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #
 # INIT-COMMANDS
 #
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
 
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
@@ -20464,8 +19643,8 @@ do
     "nc_test4/ref_hdf5_compat1.nc") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_hdf5_compat1.nc:nc_test4/ref_hdf5_compat1.nc" ;;
     "nc_test4/ref_hdf5_compat2.nc") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5_compat2.nc" ;;
     "nc_test4/ref_hdf5_compat3.nc") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc" ;;
-    "nc_test4/ref_chunked.hdf4") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_chunked.hdf4:nc_test4/ref_chunked.hdf4" ;;
-    "nc_test4/ref_contiguous.hdf4") CONFIG_LINKS="$CONFIG_LINKS nc_test4/ref_contiguous.hdf4:nc_test4/ref_contiguous.hdf4" ;;
+    "hdf4_test/ref_chunked.hdf4") CONFIG_LINKS="$CONFIG_LINKS hdf4_test/ref_chunked.hdf4:hdf4_test/ref_chunked.hdf4" ;;
+    "hdf4_test/ref_contiguous.hdf4") CONFIG_LINKS="$CONFIG_LINKS hdf4_test/ref_contiguous.hdf4:hdf4_test/ref_contiguous.hdf4" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "docs/Doxyfile") CONFIG_FILES="$CONFIG_FILES docs/Doxyfile" ;;
@@ -20479,6 +19658,7 @@ do
     "include/netcdf_meta.h") CONFIG_FILES="$CONFIG_FILES include/netcdf_meta.h" ;;
     "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
     "h5_test/Makefile") CONFIG_FILES="$CONFIG_FILES h5_test/Makefile" ;;
+    "hdf4_test/Makefile") CONFIG_FILES="$CONFIG_FILES hdf4_test/Makefile" ;;
     "libsrc/Makefile") CONFIG_FILES="$CONFIG_FILES libsrc/Makefile" ;;
     "libsrc4/Makefile") CONFIG_FILES="$CONFIG_FILES libsrc4/Makefile" ;;
     "libsrcp/Makefile") CONFIG_FILES="$CONFIG_FILES libsrcp/Makefile" ;;
@@ -20492,6 +19672,7 @@ do
     "oc2/Makefile") CONFIG_FILES="$CONFIG_FILES oc2/Makefile" ;;
     "libdap2/Makefile") CONFIG_FILES="$CONFIG_FILES libdap2/Makefile" ;;
     "libdap4/Makefile") CONFIG_FILES="$CONFIG_FILES libdap4/Makefile" ;;
+    "libhdf4/Makefile") CONFIG_FILES="$CONFIG_FILES libhdf4/Makefile" ;;
     "libdispatch/Makefile") CONFIG_FILES="$CONFIG_FILES libdispatch/Makefile" ;;
     "liblib/Makefile") CONFIG_FILES="$CONFIG_FILES liblib/Makefile" ;;
     "ncdump/cdl/Makefile") CONFIG_FILES="$CONFIG_FILES ncdump/cdl/Makefile" ;;
@@ -21138,29 +20319,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
   # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
-  esac
+  # TODO: see whether this extra hack can be removed once we start
+  # requiring Autoconf 2.70 or later.
+  case $CONFIG_FILES in #(
+  *\'*) :
+    eval set x "$CONFIG_FILES" ;; #(
+  *) :
+    set x $CONFIG_FILES ;; #(
+  *) :
+     ;;
+esac
   shift
-  for mf
+  # Used to flag and report bootstrapping failures.
+  am_rc=0
+  for am_mf
   do
     # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named 'Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
+    am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile which includes
+    # dependency-tracking related rules and includes.
+    # Grep'ing the whole file directly is not great: AIX grep has a line
     # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$mf" : 'X\(//\)[^/]' \| \
-	 X"$mf" : 'X\(//\)$' \| \
-	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$mf" |
+    sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+      || continue
+    am_dirpart=`$as_dirname -- "$am_mf" ||
+$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$am_mf" : 'X\(//\)[^/]' \| \
+	 X"$am_mf" : 'X\(//\)$' \| \
+	 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$am_mf" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -21178,53 +20365,48 @@ $as_echo X"$mf" |
 	    q
 	  }
 	  s/.*/./; q'`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running 'make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "$am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$file" : 'X\(//\)[^/]' \| \
-	 X"$file" : 'X\(//\)$' \| \
-	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
+    am_filepart=`$as_basename -- "$am_mf" ||
+$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$am_mf" : 'X\(//\)$' \| \
+	 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$am_mf" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
 	    s//\1/
 	    q
 	  }
-	  /^X\(\/\/\)$/{
+	  /^X\/\(\/\/\)$/{
 	    s//\1/
 	    q
 	  }
-	  /^X\(\/\).*/{
+	  /^X\/\(\/\).*/{
 	    s//\1/
 	    q
 	  }
 	  s/.*/./; q'`
-      as_dir=$dirpart/$fdir; as_fn_mkdir_p
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
+    { echo "$as_me:$LINENO: cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles" >&5
+   (cd "$am_dirpart" \
+      && sed -e '/# am--include-marker/d' "$am_filepart" \
+        | $MAKE -f - am--depfiles) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } || am_rc=$?
   done
+  if test $am_rc -ne 0; then
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Something went wrong bootstrapping makefile fragments
+    for automatic dependency tracking.  Try re-running configure with the
+    '--disable-dependency-tracking' option to at least be able to build
+    the package (albeit without support for automatic dependency tracking).
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+  { am_dirpart=; unset am_dirpart;}
+  { am_filepart=; unset am_filepart;}
+  { am_mf=; unset am_mf;}
+  { am_rc=; unset am_rc;}
+  rm -f conftest-deps.mk
 }
  ;;
     "libtool":C)
@@ -21778,6 +20960,7 @@ ltmain=$ac_aux_dir/ltmain.sh
     "include/netcdf_meta.h":F) test -f  nc-config && chmod 755 nc-config ;;
     "include/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "h5_test/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
+    "hdf4_test/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "libsrc/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "libsrc4/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "libsrcp/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
@@ -21791,6 +20974,7 @@ ltmain=$ac_aux_dir/ltmain.sh
     "oc2/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "libdap2/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "libdap4/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
+    "libhdf4/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "libdispatch/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "liblib/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
     "ncdump/cdl/Makefile":F) test -f  nc-config && chmod 755 nc-config ;;
diff --git a/configure.ac b/configure.ac
index 4f2787e..b0552d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ AC_REVISION([$Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp $])
 AC_PREREQ([2.59])
 
 # Initialize with name, version, and support email address.
-AC_INIT([netCDF], [4.6.0], [support-netcdf at unidata.ucar.edu])
+AC_INIT([netCDF], [4.6.1], [support-netcdf at unidata.ucar.edu])
 
 ##
 # Prefer an empty CFLAGS variable instead of the default -g -O2.
@@ -27,7 +27,7 @@ AC_INIT([netCDF], [4.6.0], [support-netcdf at unidata.ucar.edu])
 
 AC_SUBST([NC_VERSION_MAJOR]) NC_VERSION_MAJOR=4
 AC_SUBST([NC_VERSION_MINOR]) NC_VERSION_MINOR=6
-AC_SUBST([NC_VERSION_PATCH]) NC_VERSION_PATCH=0
+AC_SUBST([NC_VERSION_PATCH]) NC_VERSION_PATCH=1
 AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE=""
 
 #####
@@ -72,8 +72,8 @@ AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat1.nc:nc_test4/ref_hdf5_compat1.nc])
 AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5_compat2.nc])
 AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc])
 
-AC_CONFIG_LINKS([nc_test4/ref_chunked.hdf4:nc_test4/ref_chunked.hdf4])
-AC_CONFIG_LINKS([nc_test4/ref_contiguous.hdf4:nc_test4/ref_contiguous.hdf4])
+AC_CONFIG_LINKS([hdf4_test/ref_chunked.hdf4:hdf4_test/ref_chunked.hdf4])
+AC_CONFIG_LINKS([hdf4_test/ref_contiguous.hdf4:hdf4_test/ref_contiguous.hdf4])
 
 AM_INIT_AUTOMAKE([foreign dist-zip subdir-objects])
 AM_MAINTAINER_MODE()
@@ -172,14 +172,6 @@ if test "x$enable_jna" = xyes ; then
 AC_DEFINE([JNA], [1], [if true, include jna bug workaround code])
 fi
 
-# Does the user want to run extra tests with valgrind?
-AC_MSG_CHECKING([whether extra valgrind tests should be run])
-AC_ARG_ENABLE([valgrind-tests],
-              [AS_HELP_STRING([--enable-valgrind-tests],
-                              [build with valgrind-tests (valgrind is required, static builds only)])])
-test "x$enable_valgrind_tests" = xyes || enable_valgrind_tests=no
-AC_MSG_RESULT($enable_valgrind_tests)
-
 # Does the user want to build netcdf-4?
 AC_MSG_CHECKING([whether we should build netCDF-4])
 AC_ARG_ENABLE([netcdf-4], [AS_HELP_STRING([--disable-netcdf-4],
@@ -208,6 +200,9 @@ AC_MSG_CHECKING([whether reading of HDF4 SD files is to be enabled])
 AC_ARG_ENABLE([hdf4], [AS_HELP_STRING([--enable-hdf4],
               [build netcdf-4 with HDF4 read capability (HDF4, HDF5 and zlib required)])])
 test "x$enable_hdf4" = xyes || enable_hdf4=no
+if test "x$enable_hdf4" = xyes -a "x$enable_netcdf_4" = xno; then
+      AC_MSG_ERROR([NetCDF-4 is required for HDF4 features])
+fi
 AC_MSG_RESULT($enable_hdf4)
 
 # Does the user want to turn on extra HDF4 file tests?
@@ -241,9 +236,8 @@ AC_MSG_RESULT($enable_extra_example_tests)
 AC_MSG_CHECKING([whether parallel IO tests should be run])
 AC_ARG_ENABLE([parallel-tests],
               [AS_HELP_STRING([--enable-parallel-tests],
-                              [Run extra parallel IO tests. Ignored if \
-                               netCDF-4 is not enabled, or built on a system \
-                               without parallel I/O support.])])
+                              [Run extra parallel IO tests. Requires netCDF-4
+                              with parallel I/O support.])])
 test "x$enable_parallel_tests" = xyes || enable_parallel_tests=no
 AC_MSG_RESULT($enable_parallel_tests)
 
@@ -439,22 +433,6 @@ fi
 
 AM_CONDITIONAL(USE_STRICT_NULL_BYTE_HEADER_PADDING, [test x$enable_strict_null_byte_header_padding = xyes ])
 
-# Check whether we want to enable CDF5 support.
-AC_MSG_CHECKING([whether CDF5 support should be enabled (default off)])
-AC_ARG_ENABLE([cdf5],
-              [AS_HELP_STRING([--enable-cdf5],
-                              [build with CDF5 support.])])
-test "x$enable_cdf5" = xyes || enable_cdf5=no
-AC_MSG_RESULT($enable_cdf5)
-
-if test "x$enable_cdf5" = xyes; then
-   AC_DEFINE([USE_CDF5], [1], [if true, enable CDF5 Support])
-   AC_DEFINE([ENABLE_CDF5], [1], [if true, enable CDF5 Support])
-fi
-
-AM_CONDITIONAL(USE_CDF5, [test x$enable_cdf5 = xyes ])
-AM_CONDITIONAL(ENABLE_CDF5, [test x$enable_cdf5 = xyes ])
-
 # Does the user want to use the ffio module?
 AC_MSG_CHECKING([whether FFIO will be used])
 AC_ARG_ENABLE([ffio],
@@ -677,17 +655,6 @@ if test $haveresponsecode = yes; then
   AC_DEFINE([HAVE_CURLINFO_RESPONSE_CODE],[1],[Is CURLINFO_RESPONSE_CODE defined])
 fi
 
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-[#include "curl/curl.h"],
-[[int x = CURLOPT_CHUNK_BGN_FUNCTION;]])],
-                   [havebgnfunction=yes],
-                   [havebgnfunction=no])
-AC_MSG_CHECKING([whether CURLOPT_CHUNK_BGN_FUNCTION is defined])
-AC_MSG_RESULT([${havebgnfunction}])
-if test $havebgnfunction = yes; then
-  AC_DEFINE([HAVE_CURLOPT_CHUNK_BGN_FUNCTION],[1],[Is CURLOPT_CHUNK_BGN_FUNCTION defined])
-fi
-
 CFLAGS="$SAVECFLAGS"
 
 # Set up libtool.
@@ -695,14 +662,6 @@ AC_MSG_NOTICE([setting up libtool])
 LT_PREREQ([2.2])
 LT_INIT()
 
-# Valgrind tests don't work with shared builds because of some libtool
-# weirdness.
-if test "x$enable_shared" = xyes; then
-   if test $enable_valgrind_tests = yes; then
-      AC_MSG_ERROR([No valgrind tests with shared libraries])
-   fi
-fi
-
 AC_MSG_NOTICE([finding other utilities])
 
 # Is m4 installed? If not, bail.
@@ -758,17 +717,11 @@ echo "CPPFLAGS=$CPPFLAGS CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS LIBS=$LIBS" >> c
 
 AC_MSG_NOTICE([checking types, headers, and functions])
 
-AC_CHECK_HEADER(stdlib.h, ,AC_DEFINE([NO_STDLIB_H], [], [no stdlib.h]))
-AC_CHECK_HEADER(sys/types.h, ,AC_DEFINE([NO_SYS_TYPES_H], [], [no sys_types.h]))
-AC_CHECK_HEADERS([sys/dir.h])
 AC_CHECK_HEADERS([sys/param.h])
+AC_CHECK_HEADERS([libgen.h])
 #AC_CHECK_HEADERS([locale.h])
-AC_HEADER_DIRENT
 AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_HEADER_TIME
-AC_CHECK_HEADERS([locale.h stdio.h stdarg.h errno.h ctype.h fcntl.h malloc.h stdlib.h string.h strings.h unistd.h sys/stat.h getopt.h sys/time.h])
-AC_FUNC_VPRINTF
+AC_CHECK_HEADERS([locale.h stdio.h stdarg.h fcntl.h malloc.h stdlib.h string.h strings.h unistd.h sys/stat.h getopt.h sys/time.h sys/types.h])
 
 # Do sys/resource.h separately
 #AC_CHECK_HEADERS([sys/resource.h],[havesysresource=1],[havesysresource=0])
@@ -776,18 +729,13 @@ AC_FUNC_VPRINTF
 AC_CHECK_HEADERS([sys/resource.h])
 #fi
 
-AC_CHECK_HEADERS([sys/cdefs.h])
-
-# Check for <stdbool.h> that conforms to C99 requirements
-AC_HEADER_STDBOOL
-
 # See if we have ftw.h to walk directory trees
 AC_CHECK_HEADERS([ftw.h])
 
 # Check for these functions...
-AC_CHECK_FUNCS([strlcat strerror snprintf strchr strrchr strcat strcpy \
-                strdup strcasecmp strtod strtoll strtoull strstr \
-		mkstemp mktemp rand random memcmp \
+AC_CHECK_FUNCS([strlcat snprintf \
+                strdup strtoll strtoull \
+		mkstemp mktemp random \
 		getrlimit gettimeofday fsync MPI_Comm_f2c])
 
 # Does the user want to use NC_DISKLESS?
@@ -826,7 +774,6 @@ test "x$enable_mmap" = xyes || enable_mmap=no
 AC_MSG_RESULT($enable_mmap)
 
 # check for mmap and mremap availability before committing to use mmap
-AC_FUNC_MMAP
 AC_CHECK_FUNCS([mremap])
 
 if test "x$ac_cv_func_mmap_fixed_mapped" != xyes -o "x$ac_cv_func_mremap" != xyes ; then
@@ -843,13 +790,11 @@ if test "x$enable_diskless" = xyes ; then
 fi
 
 AC_FUNC_ALLOCA
-AC_CHECK_DECLS([isnan, isinf, isfinite, signbit],,,[#include <math.h>])
+AC_CHECK_DECLS([isnan, isinf, isfinite],,,[#include <math.h>])
 AC_STRUCT_ST_BLKSIZE
 UD_CHECK_IEEE
-AC_CHECK_TYPES([size_t, ssize_t, ptrdiff_t, schar, uchar, longlong, ushort, uint, int64, uint64 off_t])
-AC_TYPE_SIZE_T
+AC_CHECK_TYPES([size_t, ssize_t, schar, uchar, longlong, ushort, uint, int64, uint64])
 AC_TYPE_OFF_T
-AC_C_CHAR_UNSIGNED
 AC_C_BIGENDIAN
 
 ###
@@ -883,8 +828,32 @@ $SLEEPCMD
 AC_CHECK_SIZEOF(size_t)
 $SLEEPCMD
 AC_CHECK_SIZEOF(unsigned long long)
-$SLEEPCMD
-AC_CHECK_SIZEOF(unsigned long long)
+
+# Check whether we want to enable CDF5 support.
+AC_MSG_CHECKING([whether CDF5 support should be enabled])
+AC_ARG_ENABLE([cdf5],
+              [AS_HELP_STRING([--disable-cdf5],
+                              [build without CDF5 support.])],
+              [enable_cdf5=${enableval}], [enable_cdf5=auto]
+)
+if test "x${enable_cdf5}" = xyes && test "$ac_cv_sizeof_size_t" -lt "8" ; then
+   dnl unable to support CDF5, but --enable-cdf5 is explicitly set
+   AC_MSG_ERROR([Unable to support CDF5 feature because size_t is less than 4 bytes])
+fi
+if test "$ac_cv_sizeof_size_t" -lt "8" ; then
+   enable_cdf5=no
+else
+   enable_cdf5=yes
+fi
+AC_MSG_RESULT($enable_cdf5)
+
+if test "x${enable_cdf5}" = xyes; then
+   AC_DEFINE([USE_CDF5], [1], [if true, enable CDF5 Support])
+   AC_DEFINE([ENABLE_CDF5], [1], [if true, enable CDF5 Support])
+fi
+
+AM_CONDITIONAL(USE_CDF5, [test x$enable_cdf5 = xyes ])
+AM_CONDITIONAL(ENABLE_CDF5, [test x$enable_cdf5 = xyes ])
 
 $SLEEPCMD
 if test "$ac_cv_type_uchar" = yes ; then
@@ -919,8 +888,6 @@ else
    AC_CHECK_SIZEOF(unsigned int)
 fi
 $SLEEPCMD
-AC_CHECK_SIZEOF(ptrdiff_t)
-$SLEEPCDM
 AC_CHECK_SIZEOF(ssize_t)
 $SLEEPCMD
 AC_CHECK_SIZEOF([void*])
@@ -940,16 +907,6 @@ if test "x$enable_netcdf_4" = xyes; then
    AC_DEFINE([USE_NETCDF4], [1], [if true, build netCDF-4])
    AC_DEFINE([H5_USE_16_API], [1], [use HDF5 1.6 API])
 
-   # The user may have built HDF5 with libdl (dynamic loading support).
-   if test "x$enable_dynamic_loading" = xyes; then
-      AC_CHECK_HEADERS([dlfcn.h], [], [nc_dlfcn_h_missing=yes])
-      if test "x$nc_dlfcn_h_missing" = xyes; then
-      	      AC_MSG_ERROR([Cannot find dlfcn.h, yet --enable-dynamic-loading was used.])
-      fi
-      AC_CHECK_LIB([dl],[dlopen], [], [AC_MSG_ERROR([Can't find or link against libdl. See config.log for errors.])])
-      AC_DEFINE([USE_LIBDL],[1], [if true, enable dynamic loading support])
-   fi
-
    # Check for the main hdf5 and hdf5_hl library.
 
    AC_SEARCH_LIBS([H5Fflush], [hdf5dll hdf5], [],
@@ -958,8 +915,10 @@ if test "x$enable_netcdf_4" = xyes; then
    [AC_MSG_ERROR([Can't find or link to the hdf5 high-level. Use --disable-netcdf-4, or see config.log for errors.])])
 
    AC_CHECK_HEADERS([hdf5.h], [], [AC_MSG_ERROR([Compiling a test with HDF5 failed.  Either hdf5.h cannot be found, or config.log should be checked for other reason.])])
-   AC_CHECK_FUNCS([H5Pget_fapl_mpiposix H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops])
+   AC_CHECK_FUNCS([H5Z_SZIP])
+   hdf5_parallel=no
 
+   AC_CHECK_FUNCS([H5Pget_fapl_mpiposix H5Pget_fapl_mpio H5Pset_deflate H5Z_SZIP H5free_memory H5Pset_libver_bounds H5Pset_all_coll_metadata_ops])
    # The user may have parallel HDF5 based on MPI POSIX.
    if test "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
       AC_DEFINE([USE_PARALLEL_POSIX], [1], [if true, compile in parallel netCDF-4 based on MPI/POSIX])
@@ -980,16 +939,18 @@ if test "x$enable_netcdf_4" = xyes; then
    if test "x$ac_cv_func_H5Pget_fapl_mpio" = xyes -o "x$ac_cv_func_H5Pget_fapl_mpiposix" = xyes; then
       hdf5_parallel=yes
    fi
+
    AC_MSG_CHECKING([whether parallel io is enabled in hdf5])
    AC_MSG_RESULT([$hdf5_parallel])
 
-   # The user must have built HDF5 with the ZLIB library.
-   if test "x$ac_cv_func_H5Pset_deflate" = xyes; then
-      AC_DEFINE([USE_ZLIB], [1], [if true, compile in zlib compression in netCDF-4 variables])
-   else
-      AC_MSG_ERROR([HDF5 must be built with zlib for netCDF-4])
+   if test "x$hdf5_parallel" = "xno"; then
+      if test "x$enable_parallel_tests" = "xyes"; then
+         AC_MSG_ERROR([Parallel tests requested, but no parallel HDF5 installation detected.])
+      fi
    fi
 
+
+
    # The user may have built HDF5 with the SZLIB library.
    enable_szlib=no
    if test "x$ac_cv_func_H5Z_SZIP" = xyes; then
@@ -1236,7 +1197,6 @@ AM_CONDITIONAL(USE_SZIP, [test "x$ac_cv_func_H5Z_SZIP" = xyes])
 AM_CONDITIONAL(USE_PNETCDF_DIR, [test ! "x$PNETCDFDIR" = x])
 AM_CONDITIONAL(USE_LOGGING, [test "x$enable_logging" = xyes])
 AM_CONDITIONAL(CROSS_COMPILING, [test "x$cross_compiling" = xyes])
-AM_CONDITIONAL(USE_VALGRIND_TESTS, [test "x$enable_valgrind_tests" = xyes])
 AM_CONDITIONAL(USE_NETCDF4, [test x$enable_netcdf_4 = xyes])
 AM_CONDITIONAL(USE_HDF4, [test x$enable_hdf4 = xyes])
 AM_CONDITIONAL(USE_HDF4_FILE_TESTS, [test x$enable_hdf4_file_tests = xyes])
@@ -1372,7 +1332,7 @@ AC_SUBST(HAS_DISKLESS,[$enable_diskless])
 AC_SUBST(HAS_MMAP,[$enable_mmap])
 AC_SUBST(HAS_JNA,[$enable_jna])
 AC_SUBST(RELAX_COORD_BOUND,[$enable_relax_coord_bound])
-AC_SUBST(ENABLE_ERANGE_FILL,[$enable_erange_fill])
+AC_SUBST(HAS_ERANGE_FILL,[$enable_erange_fill])
 
 # Include some specifics for netcdf on windows.
 #AH_VERBATIM([_WIN32_STRICMP],
@@ -1439,6 +1399,7 @@ AX_SET_META([NC_HAS_PNETCDF],[$enable_pnetcdf],[yes])
 AX_SET_META([NC_HAS_PARALLEL],[$enable_parallel],[yes])
 AX_SET_META([NC_HAS_PARALLEL4],[$enable_parallel4],[yes])
 AX_SET_META([NC_HAS_CDF5],[$enable_cdf5],[yes])
+AX_SET_META([NC_HAS_ERANGE_FILL], [$enable_erange_fill],[yes])
 
 # Automake says that this is always run in top_builddir
 # and that srcdir is defined (== top_srcdir)
@@ -1470,6 +1431,7 @@ AC_CONFIG_FILES([Makefile
 		         include/netcdf_meta.h
                  include/Makefile
                  h5_test/Makefile
+                 hdf4_test/Makefile
                  libsrc/Makefile
                  libsrc4/Makefile
                  libsrcp/Makefile
@@ -1483,6 +1445,7 @@ AC_CONFIG_FILES([Makefile
                  oc2/Makefile
                  libdap2/Makefile
                  libdap4/Makefile
+                 libhdf4/Makefile
                  libdispatch/Makefile
                  liblib/Makefile
                  ncdump/cdl/Makefile
diff --git a/dap4_test/Makefile.in b/dap4_test/Makefile.in
index 1ebc836..b36f82e 100644
--- a/dap4_test/Makefile.in
+++ b/dap4_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -170,7 +170,10 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/findtestserver4.Po \
+	./$(DEPDIR)/test_data.Po ./$(DEPDIR)/test_meta.Po \
+	./$(DEPDIR)/test_parse.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -460,7 +463,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -469,6 +471,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -507,6 +510,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -649,8 +653,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -694,10 +698,16 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/findtestserver4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_meta.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_parse.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/findtestserver4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_meta.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_parse.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -901,7 +911,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -937,7 +947,10 @@ recheck: all $(check_PROGRAMS)
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1016,7 +1029,10 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/findtestserver4.Po
+	-rm -f ./$(DEPDIR)/test_data.Po
+	-rm -f ./$(DEPDIR)/test_meta.Po
+	-rm -f ./$(DEPDIR)/test_parse.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1062,7 +1078,10 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/findtestserver4.Po
+	-rm -f ./$(DEPDIR)/test_data.Po
+	-rm -f ./$(DEPDIR)/test_meta.Po
+	-rm -f ./$(DEPDIR)/test_parse.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1083,19 +1102,20 @@ uninstall-am:
 
 .MAKE: all check check-am install install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libtool clean-local \
-	cscopelist-am ctags ctags-am distclean distclean-compile \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	recheck tags tags-am uninstall uninstall-am
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-local cscopelist-am ctags ctags-am distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am recheck tags tags-am uninstall \
+	uninstall-am
 
 .PRECIOUS: Makefile
 
diff --git a/depcomp b/depcomp
index b39f98f..65cbf70 100755
--- a/depcomp
+++ b/depcomp
@@ -1,9 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2016-01-11.22; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2017 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -783,7 +783,7 @@ exit 0
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/docs/Doxyfile.developer b/docs/Doxyfile.developer
index cc93ec2..3180b13 100644
--- a/docs/Doxyfile.developer
+++ b/docs/Doxyfile.developer
@@ -38,7 +38,7 @@ PROJECT_NAME           = netCDF-C
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         = 4.6.0
+PROJECT_NUMBER         = 4.6.1
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 45a387a..6d76b66 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -9,7 +9,7 @@ mainpage.dox tutorial.dox guide.dox types.dox cdl.dox			\
 architecture.dox internal.dox windows-binaries.md			\
 building-with-cmake.md CMakeLists.txt groups.dox install.md notes.md	\
 install-fortran.md all-error-codes.md credits.md auth.md		\
-obsolete/fan_utils.html bestpractices.md filters.md
+obsolete/fan_utils.html bestpractices.md filters.md indexing.dox
 
 # Turn off parallel builds in this directory.
 .NOTPARALLEL:
diff --git a/docs/Makefile.in b/docs/Makefile.in
index cf4e9d6..5106cdb 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -138,7 +138,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	distdir
+	distdir distdir-am
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -223,7 +223,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -232,6 +231,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -270,6 +270,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -375,7 +376,7 @@ mainpage.dox tutorial.dox guide.dox types.dox cdl.dox			\
 architecture.dox internal.dox windows-binaries.md			\
 building-with-cmake.md CMakeLists.txt groups.dox install.md notes.md	\
 install-fortran.md all-error-codes.md credits.md auth.md		\
-obsolete/fan_utils.html bestpractices.md filters.md
+obsolete/fan_utils.html bestpractices.md filters.md indexing.dox
 
 
 # To build documentation you must have M4 in their path.
@@ -402,8 +403,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -522,7 +523,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/docs/filters.md b/docs/filters.md
index 0919206..4991841 100644
--- a/docs/filters.md
+++ b/docs/filters.md
@@ -142,10 +142,34 @@ The "-F" option can be used repeatedly as long as the variable name
 part is different. A different filter id and parameters can be
 specified for each occurrence.
 
-Note that if the input file has compressed variables, that fact
-will be invisble to nccopy because it is handled within the
-netcdf-c/hdf5 library code. This is true for any program that calls
-the netcdf-c library.
+As a rule, any input filter on an input variable will be applied
+to the equivalent output variable -- assuming the output file type
+is netcdf-4. It is, however, sometimes convenient to suppress
+output compression either totally or on a per-variable basis.
+Total suppression of output filters can be accomplished by specifying
+a special case of "-F", namely this.
+````
+nccopy -F "none" input.nc output.nc
+````
+Suppression of output filtering for a specific variable can be accomplished
+using this format.
+````
+nccopy -F "var,none" input.nc output.nc
+````
+where "var" is the fully qualified name of the variable.
+
+The rules for all possible cases of the "-F" flag are defined
+by this table.
+
+<table>
+<tr><th>-F none<th>-Fvar,...<th>Input Filter<th>Applied Output Filter
+<tr><td>true<td>unspecified<td>NA<td>unfiltered
+<tr><td>true<td>-Fvar,none<td>NA<td>unfiltered
+<tr><td>true<td>-Fvar,...<td>NA<td>use output filter
+<tr><td>false<td>unspecified<td>defined<td>use input filter
+<tr><td>false<td>-Fvar,none<td>NA<td>unfiltered
+<tr><td>false<td>-Fvar,...<td>NA<td>use output filter
+</table> 
 
 Parameter Encoding {#ParamEncode}
 ==========
@@ -416,5 +440,5 @@ References {#References}
 
 1. https://support.hdfgroup.org/HDF5/doc/Advanced/DynamicallyLoadedFilters/HDF5DynamicallyLoadedFilters.pdf
 2. https://support.hdfgroup.org/HDF5/doc/TechNotes/TechNote-HDF5-CompressionTroubleshooting.pdf
-3. https://support.hdfgroup.org/services/filters.html
+3. https://portal.hdfgroup.org/display/support/Contributions#Contributions-filters
 4. https://support.hdfgroup.org/services/contributions.html#filters
diff --git a/docs/images/Makefile.in b/docs/images/Makefile.in
index 37c2b95..1ee95d7 100644
--- a/docs/images/Makefile.in
+++ b/docs/images/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -160,7 +160,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -169,6 +168,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -207,6 +207,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -330,8 +331,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -355,7 +356,10 @@ ctags CTAGS:
 cscope cscopelist:
 
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/docs/indexing.dox b/docs/indexing.dox
new file mode 100644
index 0000000..1ff1d8a
--- /dev/null
+++ b/docs/indexing.dox
@@ -0,0 +1,218 @@
+/** \file
+
+\internal
+
+\page nchashmap Indexed Access to Metadata Objects
+
+\tableofcontents
+
+The original internal representations of metadata in memory
+relied on linear searching of lists to locate various objects
+by name or by numeric id (e.g. varid or grpid).
+
+In recent years, the flaws in that approach have become obvious
+as users create files with extremely large numbers of objects:
+group, variables, attributes, and dimensions. One case
+has 14 megabytes of metadata. Creating and (especially) later
+opening such files was exceedingly slow.
+
+This problem was partially alleviated in both netcdfd-3 (libsrc)
+and netcdf-4 (libsrc4) by adding name hashing tables.
+However, and especially for netcdf-4, linear search still prevailed.
+
+A pervasive change has been made to try to remove (almost) all
+occurrences of linear search and replace it with either hashing
+(for name-based lookup) or vectors (for numeric id-based
+lookup).  The cases left as linear search include these.
+
+1. Enum constants for an enumeration
+2. Dimensions associated with a variable
+3. Fields of Compound types
+
+This document describes the architecture and details of the netCDF
+internal object lookup mechanisms now in place.
+
+\section S1 Indexed Searches
+
+There are, as a rule, two searches that are used to locate
+metadata object: (1) search by name and (2) search by
+externally visible id (e.g. dimid or varid).
+
+Currently, and after all the metadata is read or created,
+hashing is used for locating objects by name. In all other
+cases -- apparently -- lookup is by linear search of some
+kind of linked list or a vector.
+
+It is relevant that, once created, no metadata object -- except
+attributes -- can be deleted.  They can be renamed, but that
+does not change the associated id.  Deletion only occurs when an
+error occurs in creating an object or on invoking nc_close.
+
+The numeric identifiers for dimensions, types, and groups are
+all globally unique across a file.  But note that variable id's
+are not globally unique (IMO a bad design decision) but are only
+unique within the containing group.  Thus, in order to provide a
+unique id for a variable it must be composed of the containing
+group id plus the variable id.
+
+Note also that names are unique only within a group and with respect
+to some kind of metadata. That is a group cannot have e.g. two
+dimensions with the same name. But it can have a variable and a dimension
+with the same name (as with coordinate variables).
+
+Finally, attribute names are unique only with respect to each other
+and with respect to the containing object (a variable or a group).
+
+\section S2 Basic Data Structures
+
+The basic data structures used by the new lookup mechanisms
+are described in the following sections.
+
+\subsection SS1_1 NClist
+
+With rare exceptions, vectors of objects are maintained as
+instances of NClist, which provides a dynamically extendible
+vector of pointers: pointers to metadata objects in this case.
+It is possible to append new objects or insert at a specific
+vector offset, or overwrite an existing pointer at a specific
+offset.
+
+The definition is as follows.
+
+\code
+typedef struct NClist {
+  size_t alloc;
+  size_t length;
+  void** content;
+} NClist;
+\endcode
+
+
+\subsection SS1_2 NC_hashmap
+
+The NC_hashmap type is a hash table mapping a name to a pointer.
+As a rule, the pointer points to a metadata object.  The current
+implementation supports table expansion when the # of entries in
+the table starts to get too large. Basically a simple linear
+rehash is used for collisions and no separate hash-chain is
+used.  This means that when expanded, it must be completely
+rebuilt. The performance hit for this has yet to be determined.
+
+The hashtable definition is as follows.
+
+\code
+typedef struct NC_hashmap {
+  size_t size;
+  size_t count;
+  NC_hentry* table;
+} NC_hashmap;
+\endcode
+
+where size is the current allocated size and count is the
+number of active entries in the table. The "table" field is 
+a vector of entries of this form.
+
+\code
+typedef struct NC_hentry {
+    int flags;
+    void* data;
+    size_t hashkey; /* Hash id */
+    char* key; /* actual key; do not free */
+} NC_hentry;
+\endcode
+
+The flags indicate the state of the entry and can be one of three states:
+
+1. ACTIVE - there is an object referenced in this entry
+2. DELETED - an entry was deleted, but must be marked so
+   that linear rehash will work.
+3. EMPTY - unused
+
+There is an important WARNING with respect to the "key" field.
+The key is not a copy of the object's name, but in fact is a duplicate
+pointer to that same string. This means (1) that it should never be
+free()'d and (2) if the name of the metadata object is changed, then
+it must be removed and re-inserted into the table to that the key
+points to the current name.
+
+The "data" field is of type void*. Often it is a pointer to an instance
+of a variable, or dimension, or other object. When used as part of an
+NC_listmap (see below), then the key is an integer index into the
+associated vector. In order to do this correctly, we need to rely
+on  the type "uintptr_t". It is supposed to be the case
+that a value of type uintptr_t is an integer of sufficient size to
+hold a void* pointer. Usually, but not always, this would be the same
+size as an "unsigned long" value. Using this allows the hashtable
+to store either pointers or integer indices.
+
+One further WARNING: any object that will be inserted into an NC_hashmap
+must have its name as the first field so it can be cast
+to char** for use with the hashtable.
+
+\subsection SS1_3 NC_listmap
+
+A listmap is a combination of an NClist and an NC_hashtable.
+It is used to provide name-based lookup with respect to a
+specific list of metadata objects. For example, the subgroups
+of a group are stored using a listmap, where the list is a
+vector of pointers to the subgroup objects and the hashmap
+maps the subgroup name (unique to that group, remember) to
+the corresponding index into the vector. In theory, only
+the hashmap is needed because it could be walked to get all
+of the metadata objects. However, the creation order is sometimes
+important, so that is maintained by the vector.
+This is especially important for attribute storage.
+
+Note that currently, NC_listmap is only used in libsrc4,
+but if performance issues warrant, it will also be used in
+libsrc.
+
+\section S3 Global Object Access
+
+As mentioned, dimension, group, and type external id's (dimid,
+grpid, typeid) are unique across the whole file. It is therefore
+convenient to store in memory a per-file vector for each object
+type such that the external id of the object is the same as the
+position of that object in the corresponding per-file
+vector. This maked lookup by external id efficient.
+Note that this is was already the case for netcdf-3 (libsrc) so
+this is a change for libsrc4 only.
+
+The global set of dimensions, types, and groups is maintained by
+three instances of NClist in the NC_HDF5_FILE_INFO structure:
+alldims, alltypes, and allgroups.
+The position of the object within the corresponding list determines
+the object's external id. Thus, a position of a dimension object within the
+"alldims" field of the file structure determines its dimid. Similarly
+for types and groups.
+
+\section S4 Per-Group Object Access
+
+Each group object (NC_GRP_INFO) contains four
+instances of NC_listmap. One is for dimensions, one is for
+types, one is for subgroups, and one is for variables.  A
+listmap is used for two reasons. First, allows name-based lookup
+for these items. Second, the declaration order is maintained by
+the list within the listmap's vector. Note that the position of
+an object in a group listmap vector has no necessary
+relationship to the position of that object within the global
+vectors.  Note also that there is no global vector for variables
+because variable external ids are unique only within the
+group. In this special case, the external id for the variable is
+the same as its offset in the listmap's vector for the group.
+
+A note about typeids. Since user defined types have an external
+id starting at NC_FIRSTUSERTYPEID, we leave the global type
+vector entries 0..NC_FIRSTUSERTYPEID-1 empty.
+
+\section S5 Exceptions
+
+NC_Listmap is currently not used for enum constants and compound fields.
+Additionally, it is not used for listing the dimensions associated
+with a variable.
+
+References between meta-data objects (e.g. group parent or
+containing group) are stored directly and not using any kind
+of vector or hashtable.
+
+*/
diff --git a/docs/windows-binaries.md b/docs/windows-binaries.md
index 0392214..a6c2f8f 100644
--- a/docs/windows-binaries.md
+++ b/docs/windows-binaries.md
@@ -32,14 +32,14 @@ The included dependencies and versions are as follows:
 * `libcurl`: 7.55.1
 * `zlib`:    1.2.8
 
-## Latest Release (netCDF-C 4.6.0) {#msvc-latest-release}
+## Latest Release (netCDF-C 4.6.1) {#msvc-latest-release}
 
 Configuration		| 32-bit 						| 64-bit |
 :-------------------|:--------							|:-------|
-netCDF 3		| [netCDF4.6.0-NC3-32.exe][r1]		| [netCDF4.6.0-NC3-64.exe][r5]
-netCDF3+DAP		| [netCDF4.6.0-NC3-DAP-32.exe][r2]	| [netCDF4.6.0-NC3-DAP-64.exe][r6]
-netCDF4			| [netCDF4.6.0-NC4-32.exe][r3]		| [netCDF4.6.0-NC4-64.exe][r7]
-netCDF4+DAP		| [netCDF4.6.0-NC4-DAP-32.exe][r4]	| [netCDF4.6.0-NC4-DAP-64.exe][r8]
+netCDF 3		| [netCDF4.6.1-NC3-32.exe][r1]		| [netCDF4.6.1-NC3-64.exe][r5]
+netCDF3+DAP		| [netCDF4.6.1-NC3-DAP-32.exe][r2]	| [netCDF4.6.1-NC3-DAP-64.exe][r6]
+netCDF4			| [netCDF4.6.1-NC4-32.exe][r3]		| [netCDF4.6.1-NC4-64.exe][r7]
+netCDF4+DAP		| [netCDF4.6.1-NC4-DAP-32.exe][r4]	| [netCDF4.6.1-NC4-DAP-64.exe][r8]
 
 # Using the netCDF-C Libraries with Visual Studio {#msvc-using}
 
@@ -60,11 +60,11 @@ When installed, the netCDF libraries are placed in the specified locations, alon
 1. When building the netCDF-C libraries with netCDF4 support, using the `Debug` libraries may cause extraneous warnings. These warnings are related to cross-dll memory management, and appear to be harmless. You can safely ignore them by using the `Release` libraries. [NCF-220]
 
 
-[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC3-32.exe
-[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC3-DAP-32.exe
-[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC4-32.exe
-[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC4-DAP-32.exe
-[r5]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC3-64.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC3-DAP-64.exe
-[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC4-64.exe
-[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.0-NC4-DAP-64.exe
+[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC3-32.exe
+[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC3-DAP-32.exe
+[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC4-32.exe
+[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC4-DAP-32.exe
+[r5]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC3-64.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC3-DAP-64.exe
+[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC4-64.exe
+[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.6.1-NC4-DAP-64.exe
diff --git a/examples/C/Makefile.am b/examples/C/Makefile.am
index e39debb..77013f7 100644
--- a/examples/C/Makefile.am
+++ b/examples/C/Makefile.am
@@ -48,22 +48,10 @@ if USE_NETCDF4
 TESTS += run_examples4.sh
 endif #USE_NETCDF4
 
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
-if USE_VALGRIND_TESTS
-TESTS += run_valgrind_tests.sh
-endif # USE_VALGRIND_TESTS
-if USE_NETCDF4
-if USE_VALGRIND_TESTS
-TESTS += run_nc4_valgrind_tests.sh
-endif # USE_VALGRIND_TESTS
-endif # USE_NETCDF4
-
 # These files are created by the tests.
 CLEANFILES = *.nc
 
-EXTRA_DIST = run_valgrind_tests.sh run_nc4_valgrind_tests.sh	\
-CMakeLists.txt run_examples.sh run_examples4.sh
+EXTRA_DIST = CMakeLists.txt run_examples.sh run_examples4.sh
 
 if ENABLE_FILTER_TESTING # => shared and netcdf-4
 BUILT_SOURCES = findplugin.sh
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in
index 3d3034b..91d9d52 100644
--- a/examples/C/Makefile.in
+++ b/examples/C/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -103,8 +103,7 @@ check_PROGRAMS = simple_xy_wr$(EXEEXT) simple_xy_rd$(EXEEXT) \
 	sfc_pres_temp_wr$(EXEEXT) sfc_pres_temp_rd$(EXEEXT) \
 	pres_temp_4D_wr$(EXEEXT) pres_temp_4D_rd$(EXEEXT) \
 	$(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3)
-TESTS = run_examples.sh $(am__EXEEXT_3) $(am__append_5) \
-	$(am__append_6) $(am__append_7)
+TESTS = run_examples.sh $(am__EXEEXT_3) $(am__append_5)
 
 # To build netcdf-4, or not to build netcdf-4, that is the question...
 # These are the extra netCDF-4 examples.
@@ -119,11 +118,6 @@ TESTS = run_examples.sh $(am__EXEEXT_3) $(am__append_5) \
 @USE_PNETCDF_TRUE at am__append_3 = parallel_vara
 @USE_PNETCDF_TRUE at am__append_4 = parallel_vara
 @USE_NETCDF4_TRUE at am__append_5 = run_examples4.sh
-
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
- at USE_VALGRIND_TESTS_TRUE@am__append_6 = run_valgrind_tests.sh
- at USE_NETCDF4_TRUE@@USE_VALGRIND_TESTS_TRUE at am__append_7 = run_nc4_valgrind_tests.sh
 subdir = examples/C
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -209,7 +203,14 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/filter_example.Po \
+	./$(DEPDIR)/parallel_vara.Po ./$(DEPDIR)/pres_temp_4D_rd.Po \
+	./$(DEPDIR)/pres_temp_4D_wr.Po ./$(DEPDIR)/sfc_pres_temp_rd.Po \
+	./$(DEPDIR)/sfc_pres_temp_wr.Po ./$(DEPDIR)/simple_nc4_rd.Po \
+	./$(DEPDIR)/simple_nc4_wr.Po ./$(DEPDIR)/simple_xy_nc4_rd.Po \
+	./$(DEPDIR)/simple_xy_nc4_wr.Po ./$(DEPDIR)/simple_xy_rd.Po \
+	./$(DEPDIR)/simple_xy_wr.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -257,7 +258,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	check recheck distdir
+	check recheck distdir distdir-am
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -546,7 +547,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -555,6 +555,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -593,6 +594,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -698,9 +700,7 @@ LDADD = -lm
 
 # These files are created by the tests.
 CLEANFILES = *.nc
-EXTRA_DIST = run_valgrind_tests.sh run_nc4_valgrind_tests.sh	\
-CMakeLists.txt run_examples.sh run_examples4.sh
-
+EXTRA_DIST = CMakeLists.txt run_examples.sh run_examples4.sh
 @ENABLE_FILTER_TESTING_TRUE at BUILT_SOURCES = findplugin.sh
 DISTCLEANFILES = findplugin.sh
 all: $(BUILT_SOURCES)
@@ -725,8 +725,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -801,18 +801,24 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/filter_example.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parallel_vara.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pres_temp_4D_rd.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pres_temp_4D_wr.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sfc_pres_temp_rd.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sfc_pres_temp_wr.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_nc4_rd.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_nc4_wr.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_nc4_rd.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_nc4_wr.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_rd.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_wr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/filter_example.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parallel_vara.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pres_temp_4D_rd.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pres_temp_4D_wr.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sfc_pres_temp_rd.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sfc_pres_temp_wr.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_nc4_rd.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_nc4_wr.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_nc4_rd.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_nc4_wr.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_rd.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple_xy_wr.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1063,7 +1069,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1105,20 +1111,6 @@ run_examples4.sh.log: run_examples4.sh
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
-run_valgrind_tests.sh.log: run_valgrind_tests.sh
-	@p='run_valgrind_tests.sh'; \
-	b='run_valgrind_tests.sh'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
-run_nc4_valgrind_tests.sh.log: run_nc4_valgrind_tests.sh
-	@p='run_nc4_valgrind_tests.sh'; \
-	b='run_nc4_valgrind_tests.sh'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
 .test.log:
 	@p='$<'; \
 	$(am__set_b); \
@@ -1134,7 +1126,10 @@ run_nc4_valgrind_tests.sh.log: run_nc4_valgrind_tests.sh
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1240,7 +1235,18 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/filter_example.Po
+	-rm -f ./$(DEPDIR)/parallel_vara.Po
+	-rm -f ./$(DEPDIR)/pres_temp_4D_rd.Po
+	-rm -f ./$(DEPDIR)/pres_temp_4D_wr.Po
+	-rm -f ./$(DEPDIR)/sfc_pres_temp_rd.Po
+	-rm -f ./$(DEPDIR)/sfc_pres_temp_wr.Po
+	-rm -f ./$(DEPDIR)/simple_nc4_rd.Po
+	-rm -f ./$(DEPDIR)/simple_nc4_wr.Po
+	-rm -f ./$(DEPDIR)/simple_xy_nc4_rd.Po
+	-rm -f ./$(DEPDIR)/simple_xy_nc4_wr.Po
+	-rm -f ./$(DEPDIR)/simple_xy_rd.Po
+	-rm -f ./$(DEPDIR)/simple_xy_wr.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1286,7 +1292,18 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/filter_example.Po
+	-rm -f ./$(DEPDIR)/parallel_vara.Po
+	-rm -f ./$(DEPDIR)/pres_temp_4D_rd.Po
+	-rm -f ./$(DEPDIR)/pres_temp_4D_wr.Po
+	-rm -f ./$(DEPDIR)/sfc_pres_temp_rd.Po
+	-rm -f ./$(DEPDIR)/sfc_pres_temp_wr.Po
+	-rm -f ./$(DEPDIR)/simple_nc4_rd.Po
+	-rm -f ./$(DEPDIR)/simple_nc4_wr.Po
+	-rm -f ./$(DEPDIR)/simple_xy_nc4_rd.Po
+	-rm -f ./$(DEPDIR)/simple_xy_nc4_wr.Po
+	-rm -f ./$(DEPDIR)/simple_xy_rd.Po
+	-rm -f ./$(DEPDIR)/simple_xy_wr.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1308,20 +1325,20 @@ uninstall-am:
 .MAKE: $(am__recursive_targets) all check check-am install install-am \
 	install-strip
 
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-	check-TESTS check-am clean clean-checkPROGRAMS clean-generic \
-	clean-libtool cscopelist-am ctags ctags-am distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \
-	uninstall uninstall-am
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--depfiles check check-TESTS check-am clean \
+	clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+	ctags ctags-am distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	recheck tags tags-am uninstall uninstall-am
 
 .PRECIOUS: Makefile
 
diff --git a/examples/C/filter_example.c b/examples/C/filter_example.c
index 3c73f35..02e0056 100644
--- a/examples/C/filter_example.c
+++ b/examples/C/filter_example.c
@@ -214,7 +214,7 @@ test_bzip2(void)
     /* Show chunking */ 
     printf("show chunks:");
     for(i=0;i<actualdims;i++)
-	printf("%s%d",(i==0?" chunks=":","),chunks[i]);
+	printf("%s%ld",(i==0?" chunks=":","),(unsigned long)chunks[i]);
     printf("\n");
 
     /* prepare to write */
diff --git a/examples/C/hdf5plugins/.gitignore b/examples/C/hdf5plugins/.gitignore
new file mode 100644
index 0000000..ea69d9f
--- /dev/null
+++ b/examples/C/hdf5plugins/.gitignore
@@ -0,0 +1,11 @@
+H5Zbzip2.c
+blocksort.c
+bzlib.c
+bzlib.h
+bzlib_private.h
+compress.c
+crctable.c
+decompress.c
+h5bzip2.h
+huffman.c
+randtable.c
\ No newline at end of file
diff --git a/examples/C/hdf5plugins/CMakeLists.txt b/examples/C/hdf5plugins/CMakeLists.txt
index ea7e06d..d2a665f 100644
--- a/examples/C/hdf5plugins/CMakeLists.txt
+++ b/examples/C/hdf5plugins/CMakeLists.txt
@@ -21,12 +21,6 @@ SET_TARGET_PROPERTIES(bzip2 PROPERTIES ARCHIVE_OUTPUT_NAME "bzip2")
 SET_TARGET_PROPERTIES(bzip2 PROPERTIES RUNTIME_OUTPUT_NAME "bzip2")
 TARGET_LINK_LIBRARIES(bzip2 ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES})
 
-ADD_LIBRARY(misc MODULE ${libmisc_SOURCES})
-SET_TARGET_PROPERTIES(misc PROPERTIES LIBRARY_OUTPUT_NAME "misc")
-SET_TARGET_PROPERTIES(misc PROPERTIES ARCHIVE_OUTPUT_NAME "misc")
-SET_TARGET_PROPERTIES(misc PROPERTIES RUNTIME_OUTPUT_NAME "misc")
-TARGET_LINK_LIBRARIES(misc ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES})
-
 ENDIF(BUILD_UTILITIES)
 ENDIF(ENABLE_FILTER_TESTING)
 
diff --git a/examples/C/hdf5plugins/H5Zbzip2.c b/examples/C/hdf5plugins/H5Zbzip2.c
deleted file mode 100644
index 99c98b2..0000000
--- a/examples/C/hdf5plugins/H5Zbzip2.c
+++ /dev/null
@@ -1,181 +0,0 @@
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-#include <hdf5.h>
-/* Older versions of the hdf library may define H5PL_type_t here */
-#include <H5PLextern.h>
-
-#ifndef DLL_EXPORT
-#define DLL_EXPORT
-#endif
-
-#include "h5bzip2.h"
-
-const H5Z_class2_t H5Z_BZIP2[1] = {{
-    H5Z_CLASS_T_VERS,       /* H5Z_class_t version */
-    (H5Z_filter_t)H5Z_FILTER_BZIP2,         /* Filter id number             */
-    1,              /* encoder_present flag (set to true) */
-    1,              /* decoder_present flag (set to true) */
-    "bzip2",                  /* Filter name for debugging    */
-    (H5Z_can_apply_func_t)H5Z_bzip2_can_apply, /* The "can apply" callback  */
-    NULL,                       /* The "set local" callback     */
-    (H5Z_func_t)H5Z_filter_bzip2,         /* The actual filter function   */
-}};
-
-/* External Discovery Functions */
-H5PL_type_t
-H5PLget_plugin_type(void)
-{
-    return H5PL_TYPE_FILTER;
-}
-
-const void*
-H5PLget_plugin_info(void)
-{
-    return H5Z_BZIP2;
-}
-
-/* Make this explicit */
-/*
- * The "can_apply" callback returns positive a valid combination, zero for an
- * invalid combination and negative for an error.
- */
-htri_t
-H5Z_bzip2_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id)
-{
-    return 1; /* Assume it can always apply */
-}
-
-size_t H5Z_filter_bzip2(unsigned int flags, size_t cd_nelmts,
-                     const unsigned int cd_values[], size_t nbytes,
-                     size_t *buf_size, void **buf)
-{
-  char *outbuf = NULL;
-  size_t outbuflen, outdatalen;
-  int ret;
-
-  if (flags & H5Z_FLAG_REVERSE) {
-
-    /** Decompress data.
-     **
-     ** This process is troublesome since the size of uncompressed data
-     ** is unknown, so the low-level interface must be used.
-     ** Data is decompressed to the output buffer (which is sized
-     ** for the average case); if it gets full, its size is doubled
-     ** and decompression continues.  This avoids repeatedly trying to
-     ** decompress the whole block, which could be really inefficient.
-     **/
-
-    bz_stream stream;
-    char *newbuf = NULL;
-    size_t newbuflen;
-
-    /* Prepare the output buffer. */
-    outbuflen = nbytes * 3 + 1;  /* average bzip2 compression ratio is 3:1 */
-    outbuf = malloc(outbuflen);
-    if (outbuf == NULL) {
-      fprintf(stderr, "memory allocation failed for bzip2 decompression\n");
-      goto cleanupAndFail;
-    }
-
-    /* Use standard malloc()/free() for internal memory handling. */
-    stream.bzalloc = NULL;
-    stream.bzfree = NULL;
-    stream.opaque = NULL;
-
-    /* Start decompression. */
-    ret = BZ2_bzDecompressInit(&stream, 0, 0);
-    if (ret != BZ_OK) {
-      fprintf(stderr, "bzip2 decompression start failed with error %d\n", ret);
-      goto cleanupAndFail;
-    }
-
-    /* Feed data to the decompression process and get decompressed data. */
-    stream.next_out = outbuf;
-    stream.avail_out = outbuflen;
-    stream.next_in = *buf;
-    stream.avail_in = nbytes;
-    do {
-      ret = BZ2_bzDecompress(&stream);
-      if (ret < 0) {
-	fprintf(stderr, "BUG: bzip2 decompression failed with error %d\n", ret);
-	goto cleanupAndFail;
-      }
-
-      if (ret != BZ_STREAM_END && stream.avail_out == 0) {
-        /* Grow the output buffer. */
-        newbuflen = outbuflen * 2;
-        newbuf = realloc(outbuf, newbuflen);
-        if (newbuf == NULL) {
-          fprintf(stderr, "memory allocation failed for bzip2 decompression\n");
-          goto cleanupAndFail;
-        }
-        stream.next_out = newbuf + outbuflen;  /* half the new buffer behind */
-        stream.avail_out = outbuflen;  /* half the new buffer ahead */
-        outbuf = newbuf;
-        outbuflen = newbuflen;
-      }
-    } while (ret != BZ_STREAM_END);
-
-    /* End compression. */
-    outdatalen = stream.total_out_lo32;
-    ret = BZ2_bzDecompressEnd(&stream);
-    if (ret != BZ_OK) {
-      fprintf(stderr, "bzip2 compression end failed with error %d\n", ret);
-      goto cleanupAndFail;
-    }
-
-  } else {
-
-    /** Compress data.
-     **
-     ** This is quite simple, since the size of compressed data in the worst
-     ** case is known and it is not much bigger than the size of uncompressed
-     ** data.  This allows us to use the simplified one-shot interface to
-     ** compression.
-     **/
-
-    unsigned int odatalen;  /* maybe not the same size as outdatalen */
-    int blockSize100k = 9;
-
-    /* Get compression block size if present. */
-    if (cd_nelmts > 0) {
-      blockSize100k = cd_values[0];
-      if (blockSize100k < 1 || blockSize100k > 9) {
-	fprintf(stderr, "invalid compression block size: %d\n", blockSize100k);
-	goto cleanupAndFail;
-      }
-    }
-
-    /* Prepare the output buffer. */
-    outbuflen = nbytes + nbytes / 100 + 600;  /* worst case (bzip2 docs) */
-    outbuf = malloc(outbuflen);
-    if (outbuf == NULL) {
-      fprintf(stderr, "memory allocation failed for bzip2 compression\n");
-      goto cleanupAndFail;
-    }
-
-    /* Compress data. */
-    odatalen = outbuflen;
-    ret = BZ2_bzBuffToBuffCompress(outbuf, &odatalen, *buf, nbytes,
-                                   blockSize100k, 0, 0);
-    outdatalen = odatalen;
-    if (ret != BZ_OK) {
-      fprintf(stderr, "bzip2 compression failed with error %d\n", ret);
-      goto cleanupAndFail;
-    }
-  }
-
-  /* Always replace the input buffer with the output buffer. */
-  free(*buf);
-  *buf = outbuf;
-  *buf_size = outbuflen;
-  return outdatalen;
-
- cleanupAndFail:
-  if (outbuf)
-    free(outbuf);
-  return 0;
-}
diff --git a/examples/C/hdf5plugins/Makefile.am b/examples/C/hdf5plugins/Makefile.am
index ffd0667..9b82d38 100644
--- a/examples/C/hdf5plugins/Makefile.am
+++ b/examples/C/hdf5plugins/Makefile.am
@@ -21,7 +21,7 @@ DLLSRC=${PLUGINSRC} ${BZIP2SRC}
 lib_LTLIBRARIES = libbzip2.la
 
 libbzip2_la_SOURCES = ${DLLSRC}
-libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined
+libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined -rpath ${abs_builddir}
 
 endif #ENABLE_FILTER_TESTING
 EXTRA_DIST = CMakeLists.txt H5Zbzip2.c Makefile.am blocksort.c bzlib.c bzlib.h bzlib_private.h compress.c \
diff --git a/examples/C/hdf5plugins/Makefile.in b/examples/C/hdf5plugins/Makefile.in
index 5c60ebb..bbedfea 100644
--- a/examples/C/hdf5plugins/Makefile.in
+++ b/examples/C/hdf5plugins/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -167,7 +167,12 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/H5Zbzip2.Plo \
+	./$(DEPDIR)/blocksort.Plo ./$(DEPDIR)/bzlib.Plo \
+	./$(DEPDIR)/compress.Plo ./$(DEPDIR)/crctable.Plo \
+	./$(DEPDIR)/decompress.Plo ./$(DEPDIR)/huffman.Plo \
+	./$(DEPDIR)/randtable.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -252,7 +257,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -261,6 +265,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -299,6 +304,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -405,7 +411,7 @@ CLEANFILES = ${TARGETS}
 @ENABLE_FILTER_TESTING_TRUE at DLLSRC = ${PLUGINSRC} ${BZIP2SRC}
 @ENABLE_FILTER_TESTING_TRUE at lib_LTLIBRARIES = libbzip2.la
 @ENABLE_FILTER_TESTING_TRUE at libbzip2_la_SOURCES = ${DLLSRC}
- at ENABLE_FILTER_TESTING_TRUE@libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined
+ at ENABLE_FILTER_TESTING_TRUE@libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined -rpath ${abs_builddir}
 EXTRA_DIST = CMakeLists.txt H5Zbzip2.c Makefile.am blocksort.c bzlib.c bzlib.h bzlib_private.h compress.c \
 crctable.c decompress.c h5bzip2.h huffman.c randtable.c bzip2.nc
 
@@ -431,8 +437,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -488,14 +494,20 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/H5Zbzip2.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/blocksort.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzlib.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compress.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crctable.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/decompress.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/huffman.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/randtable.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/H5Zbzip2.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/blocksort.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzlib.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compress.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crctable.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/decompress.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/huffman.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/randtable.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -579,7 +591,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -656,7 +671,14 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/H5Zbzip2.Plo
+	-rm -f ./$(DEPDIR)/blocksort.Plo
+	-rm -f ./$(DEPDIR)/bzlib.Plo
+	-rm -f ./$(DEPDIR)/compress.Plo
+	-rm -f ./$(DEPDIR)/crctable.Plo
+	-rm -f ./$(DEPDIR)/decompress.Plo
+	-rm -f ./$(DEPDIR)/huffman.Plo
+	-rm -f ./$(DEPDIR)/randtable.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -702,7 +724,14 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/H5Zbzip2.Plo
+	-rm -f ./$(DEPDIR)/blocksort.Plo
+	-rm -f ./$(DEPDIR)/bzlib.Plo
+	-rm -f ./$(DEPDIR)/compress.Plo
+	-rm -f ./$(DEPDIR)/crctable.Plo
+	-rm -f ./$(DEPDIR)/decompress.Plo
+	-rm -f ./$(DEPDIR)/huffman.Plo
+	-rm -f ./$(DEPDIR)/randtable.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -723,9 +752,9 @@ uninstall-am: uninstall-libLTLIBRARIES
 
 .MAKE: all check install install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \
+	ctags ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
diff --git a/examples/C/hdf5plugins/blocksort.c b/examples/C/hdf5plugins/blocksort.c
deleted file mode 100644
index d0d662c..0000000
--- a/examples/C/hdf5plugins/blocksort.c
+++ /dev/null
@@ -1,1094 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Block sorting machinery                               ---*/
-/*---                                           blocksort.c ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#include "bzlib_private.h"
-
-/*---------------------------------------------*/
-/*--- Fallback O(N log(N)^2) sorting        ---*/
-/*--- algorithm, for repetitive blocks      ---*/
-/*---------------------------------------------*/
-
-/*---------------------------------------------*/
-static 
-__inline__
-void fallbackSimpleSort ( UInt32* fmap, 
-                          UInt32* eclass, 
-                          Int32   lo, 
-                          Int32   hi )
-{
-   Int32 i, j, tmp;
-   UInt32 ec_tmp;
-
-   if (lo == hi) return;
-
-   if (hi - lo > 3) {
-      for ( i = hi-4; i >= lo; i-- ) {
-         tmp = fmap[i];
-         ec_tmp = eclass[tmp];
-         for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 )
-            fmap[j-4] = fmap[j];
-         fmap[j-4] = tmp;
-      }
-   }
-
-   for ( i = hi-1; i >= lo; i-- ) {
-      tmp = fmap[i];
-      ec_tmp = eclass[tmp];
-      for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ )
-         fmap[j-1] = fmap[j];
-      fmap[j-1] = tmp;
-   }
-}
-
-
-/*---------------------------------------------*/
-#define fswap(zz1, zz2) \
-   { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
-
-#define fvswap(zzp1, zzp2, zzn)       \
-{                                     \
-   Int32 yyp1 = (zzp1);               \
-   Int32 yyp2 = (zzp2);               \
-   Int32 yyn  = (zzn);                \
-   while (yyn > 0) {                  \
-      fswap(fmap[yyp1], fmap[yyp2]);  \
-      yyp1++; yyp2++; yyn--;          \
-   }                                  \
-}
-
-
-#define fmin(a,b) ((a) < (b)) ? (a) : (b)
-
-#define fpush(lz,hz) { stackLo[sp] = lz; \
-                       stackHi[sp] = hz; \
-                       sp++; }
-
-#define fpop(lz,hz) { sp--;              \
-                      lz = stackLo[sp];  \
-                      hz = stackHi[sp]; }
-
-#define FALLBACK_QSORT_SMALL_THRESH 10
-#define FALLBACK_QSORT_STACK_SIZE   100
-
-
-static
-void fallbackQSort3 ( UInt32* fmap, 
-                      UInt32* eclass,
-                      Int32   loSt, 
-                      Int32   hiSt )
-{
-   Int32 unLo, unHi, ltLo, gtHi, n, m;
-   Int32 sp, lo, hi;
-   UInt32 med, r, r3;
-   Int32 stackLo[FALLBACK_QSORT_STACK_SIZE];
-   Int32 stackHi[FALLBACK_QSORT_STACK_SIZE];
-
-   r = 0;
-
-   sp = 0;
-   fpush ( loSt, hiSt );
-
-   while (sp > 0) {
-
-      AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 );
-
-      fpop ( lo, hi );
-      if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
-         fallbackSimpleSort ( fmap, eclass, lo, hi );
-         continue;
-      }
-
-      /* Random partitioning.  Median of 3 sometimes fails to
-         avoid bad cases.  Median of 9 seems to help but 
-         looks rather expensive.  This too seems to work but
-         is cheaper.  Guidance for the magic constants 
-         7621 and 32768 is taken from Sedgewick's algorithms
-         book, chapter 35.
-      */
-      r = ((r * 7621) + 1) % 32768;
-      r3 = r % 3;
-      if (r3 == 0) med = eclass[fmap[lo]]; else
-      if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else
-                   med = eclass[fmap[hi]];
-
-      unLo = ltLo = lo;
-      unHi = gtHi = hi;
-
-      while (1) {
-         while (1) {
-            if (unLo > unHi) break;
-            n = (Int32)eclass[fmap[unLo]] - (Int32)med;
-            if (n == 0) { 
-               fswap(fmap[unLo], fmap[ltLo]); 
-               ltLo++; unLo++; 
-               continue; 
-            };
-            if (n > 0) break;
-            unLo++;
-         }
-         while (1) {
-            if (unLo > unHi) break;
-            n = (Int32)eclass[fmap[unHi]] - (Int32)med;
-            if (n == 0) { 
-               fswap(fmap[unHi], fmap[gtHi]); 
-               gtHi--; unHi--; 
-               continue; 
-            };
-            if (n < 0) break;
-            unHi--;
-         }
-         if (unLo > unHi) break;
-         fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--;
-      }
-
-      AssertD ( unHi == unLo-1, "fallbackQSort3(2)" );
-
-      if (gtHi < ltLo) continue;
-
-      n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n);
-      m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m);
-
-      n = lo + unLo - ltLo - 1;
-      m = hi - (gtHi - unHi) + 1;
-
-      if (n - lo > hi - m) {
-         fpush ( lo, n );
-         fpush ( m, hi );
-      } else {
-         fpush ( m, hi );
-         fpush ( lo, n );
-      }
-   }
-}
-
-#undef fmin
-#undef fpush
-#undef fpop
-#undef fswap
-#undef fvswap
-#undef FALLBACK_QSORT_SMALL_THRESH
-#undef FALLBACK_QSORT_STACK_SIZE
-
-
-/*---------------------------------------------*/
-/* Pre:
-      nblock > 0
-      eclass exists for [0 .. nblock-1]
-      ((UChar*)eclass) [0 .. nblock-1] holds block
-      ptr exists for [0 .. nblock-1]
-
-   Post:
-      ((UChar*)eclass) [0 .. nblock-1] holds block
-      All other areas of eclass destroyed
-      fmap [0 .. nblock-1] holds sorted order
-      bhtab [ 0 .. 2+(nblock/32) ] destroyed
-*/
-
-#define       SET_BH(zz)  bhtab[(zz) >> 5] |= (1 << ((zz) & 31))
-#define     CLEAR_BH(zz)  bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31))
-#define     ISSET_BH(zz)  (bhtab[(zz) >> 5] & (1 << ((zz) & 31)))
-#define      WORD_BH(zz)  bhtab[(zz) >> 5]
-#define UNALIGNED_BH(zz)  ((zz) & 0x01f)
-
-static
-void fallbackSort ( UInt32* fmap, 
-                    UInt32* eclass, 
-                    UInt32* bhtab,
-                    Int32   nblock,
-                    Int32   verb )
-{
-   Int32 ftab[257];
-   Int32 ftabCopy[256];
-   Int32 H, i, j, k, l, r, cc, cc1;
-   Int32 nNotDone;
-   Int32 nBhtab;
-   UChar* eclass8 = (UChar*)eclass;
-
-   /*--
-      Initial 1-char radix sort to generate
-      initial fmap and initial BH bits.
-   --*/
-   if (verb >= 4)
-      VPrintf0 ( "        bucket sorting ...\n" );
-   for (i = 0; i < 257;    i++) ftab[i] = 0;
-   for (i = 0; i < nblock; i++) ftab[eclass8[i]]++;
-   for (i = 0; i < 256;    i++) ftabCopy[i] = ftab[i];
-   for (i = 1; i < 257;    i++) ftab[i] += ftab[i-1];
-
-   for (i = 0; i < nblock; i++) {
-      j = eclass8[i];
-      k = ftab[j] - 1;
-      ftab[j] = k;
-      fmap[k] = i;
-   }
-
-   nBhtab = 2 + (nblock / 32);
-   for (i = 0; i < nBhtab; i++) bhtab[i] = 0;
-   for (i = 0; i < 256; i++) SET_BH(ftab[i]);
-
-   /*--
-      Inductively refine the buckets.  Kind-of an
-      "exponential radix sort" (!), inspired by the
-      Manber-Myers suffix array construction algorithm.
-   --*/
-
-   /*-- set sentinel bits for block-end detection --*/
-   for (i = 0; i < 32; i++) { 
-      SET_BH(nblock + 2*i);
-      CLEAR_BH(nblock + 2*i + 1);
-   }
-
-   /*-- the log(N) loop --*/
-   H = 1;
-   while (1) {
-
-      if (verb >= 4) 
-         VPrintf1 ( "        depth %6d has ", H );
-
-      j = 0;
-      for (i = 0; i < nblock; i++) {
-         if (ISSET_BH(i)) j = i;
-         k = fmap[i] - H; if (k < 0) k += nblock;
-         eclass[k] = j;
-      }
-
-      nNotDone = 0;
-      r = -1;
-      while (1) {
-
-	 /*-- find the next non-singleton bucket --*/
-         k = r + 1;
-         while (ISSET_BH(k) && UNALIGNED_BH(k)) k++;
-         if (ISSET_BH(k)) {
-            while (WORD_BH(k) == 0xffffffff) k += 32;
-            while (ISSET_BH(k)) k++;
-         }
-         l = k - 1;
-         if (l >= nblock) break;
-         while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++;
-         if (!ISSET_BH(k)) {
-            while (WORD_BH(k) == 0x00000000) k += 32;
-            while (!ISSET_BH(k)) k++;
-         }
-         r = k - 1;
-         if (r >= nblock) break;
-
-         /*-- now [l, r] bracket current bucket --*/
-         if (r > l) {
-            nNotDone += (r - l + 1);
-            fallbackQSort3 ( fmap, eclass, l, r );
-
-            /*-- scan bucket and generate header bits-- */
-            cc = -1;
-            for (i = l; i <= r; i++) {
-               cc1 = eclass[fmap[i]];
-               if (cc != cc1) { SET_BH(i); cc = cc1; };
-            }
-         }
-      }
-
-      if (verb >= 4) 
-         VPrintf1 ( "%6d unresolved strings\n", nNotDone );
-
-      H *= 2;
-      if (H > nblock || nNotDone == 0) break;
-   }
-
-   /*-- 
-      Reconstruct the original block in
-      eclass8 [0 .. nblock-1], since the
-      previous phase destroyed it.
-   --*/
-   if (verb >= 4)
-      VPrintf0 ( "        reconstructing block ...\n" );
-   j = 0;
-   for (i = 0; i < nblock; i++) {
-      while (ftabCopy[j] == 0) j++;
-      ftabCopy[j]--;
-      eclass8[fmap[i]] = (UChar)j;
-   }
-   AssertH ( j < 256, 1005 );
-}
-
-#undef       SET_BH
-#undef     CLEAR_BH
-#undef     ISSET_BH
-#undef      WORD_BH
-#undef UNALIGNED_BH
-
-
-/*---------------------------------------------*/
-/*--- The main, O(N^2 log(N)) sorting       ---*/
-/*--- algorithm.  Faster for "normal"       ---*/
-/*--- non-repetitive blocks.                ---*/
-/*---------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-__inline__
-Bool mainGtU ( UInt32  i1, 
-               UInt32  i2,
-               UChar*  block, 
-               UInt16* quadrant,
-               UInt32  nblock,
-               Int32*  budget )
-{
-   Int32  k;
-   UChar  c1, c2;
-   UInt16 s1, s2;
-
-   AssertD ( i1 != i2, "mainGtU" );
-   /* 1 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 2 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 3 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 4 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 5 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 6 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 7 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 8 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 9 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 10 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 11 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-   /* 12 */
-   c1 = block[i1]; c2 = block[i2];
-   if (c1 != c2) return (c1 > c2);
-   i1++; i2++;
-
-   k = nblock + 8;
-
-   do {
-      /* 1 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-      /* 2 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-      /* 3 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-      /* 4 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-      /* 5 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-      /* 6 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-      /* 7 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-      /* 8 */
-      c1 = block[i1]; c2 = block[i2];
-      if (c1 != c2) return (c1 > c2);
-      s1 = quadrant[i1]; s2 = quadrant[i2];
-      if (s1 != s2) return (s1 > s2);
-      i1++; i2++;
-
-      if (i1 >= nblock) i1 -= nblock;
-      if (i2 >= nblock) i2 -= nblock;
-
-      k -= 8;
-      (*budget)--;
-   }
-      while (k >= 0);
-
-   return False;
-}
-
-
-/*---------------------------------------------*/
-/*--
-   Knuth's increments seem to work better
-   than Incerpi-Sedgewick here.  Possibly
-   because the number of elems to sort is
-   usually small, typically <= 20.
---*/
-static
-Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280,
-                   9841, 29524, 88573, 265720,
-                   797161, 2391484 };
-
-static
-void mainSimpleSort ( UInt32* ptr,
-                      UChar*  block,
-                      UInt16* quadrant,
-                      Int32   nblock,
-                      Int32   lo, 
-                      Int32   hi, 
-                      Int32   d,
-                      Int32*  budget )
-{
-   Int32 i, j, h, bigN, hp;
-   UInt32 v;
-
-   bigN = hi - lo + 1;
-   if (bigN < 2) return;
-
-   hp = 0;
-   while (incs[hp] < bigN) hp++;
-   hp--;
-
-   for (; hp >= 0; hp--) {
-      h = incs[hp];
-
-      i = lo + h;
-      while (True) {
-
-         /*-- copy 1 --*/
-         if (i > hi) break;
-         v = ptr[i];
-         j = i;
-         while ( mainGtU ( 
-                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
-                 ) ) {
-            ptr[j] = ptr[j-h];
-            j = j - h;
-            if (j <= (lo + h - 1)) break;
-         }
-         ptr[j] = v;
-         i++;
-
-         /*-- copy 2 --*/
-         if (i > hi) break;
-         v = ptr[i];
-         j = i;
-         while ( mainGtU ( 
-                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
-                 ) ) {
-            ptr[j] = ptr[j-h];
-            j = j - h;
-            if (j <= (lo + h - 1)) break;
-         }
-         ptr[j] = v;
-         i++;
-
-         /*-- copy 3 --*/
-         if (i > hi) break;
-         v = ptr[i];
-         j = i;
-         while ( mainGtU ( 
-                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
-                 ) ) {
-            ptr[j] = ptr[j-h];
-            j = j - h;
-            if (j <= (lo + h - 1)) break;
-         }
-         ptr[j] = v;
-         i++;
-
-         if (*budget < 0) return;
-      }
-   }
-}
-
-
-/*---------------------------------------------*/
-/*--
-   The following is an implementation of
-   an elegant 3-way quicksort for strings,
-   described in a paper "Fast Algorithms for
-   Sorting and Searching Strings", by Robert
-   Sedgewick and Jon L. Bentley.
---*/
-
-#define mswap(zz1, zz2) \
-   { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
-
-#define mvswap(zzp1, zzp2, zzn)       \
-{                                     \
-   Int32 yyp1 = (zzp1);               \
-   Int32 yyp2 = (zzp2);               \
-   Int32 yyn  = (zzn);                \
-   while (yyn > 0) {                  \
-      mswap(ptr[yyp1], ptr[yyp2]);    \
-      yyp1++; yyp2++; yyn--;          \
-   }                                  \
-}
-
-static 
-__inline__
-UChar mmed3 ( UChar a, UChar b, UChar c )
-{
-   UChar t;
-   if (a > b) { t = a; a = b; b = t; };
-   if (b > c) { 
-      b = c;
-      if (a > b) b = a;
-   }
-   return b;
-}
-
-#define mmin(a,b) ((a) < (b)) ? (a) : (b)
-
-#define mpush(lz,hz,dz) { stackLo[sp] = lz; \
-                          stackHi[sp] = hz; \
-                          stackD [sp] = dz; \
-                          sp++; }
-
-#define mpop(lz,hz,dz) { sp--;             \
-                         lz = stackLo[sp]; \
-                         hz = stackHi[sp]; \
-                         dz = stackD [sp]; }
-
-
-#define mnextsize(az) (nextHi[az]-nextLo[az])
-
-#define mnextswap(az,bz)                                        \
-   { Int32 tz;                                                  \
-     tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \
-     tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \
-     tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; }
-
-
-#define MAIN_QSORT_SMALL_THRESH 20
-#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT)
-#define MAIN_QSORT_STACK_SIZE 100
-
-static
-void mainQSort3 ( UInt32* ptr,
-                  UChar*  block,
-                  UInt16* quadrant,
-                  Int32   nblock,
-                  Int32   loSt, 
-                  Int32   hiSt, 
-                  Int32   dSt,
-                  Int32*  budget )
-{
-   Int32 unLo, unHi, ltLo, gtHi, n, m, med;
-   Int32 sp, lo, hi, d;
-
-   Int32 stackLo[MAIN_QSORT_STACK_SIZE];
-   Int32 stackHi[MAIN_QSORT_STACK_SIZE];
-   Int32 stackD [MAIN_QSORT_STACK_SIZE];
-
-   Int32 nextLo[3];
-   Int32 nextHi[3];
-   Int32 nextD [3];
-
-   sp = 0;
-   mpush ( loSt, hiSt, dSt );
-
-   while (sp > 0) {
-
-      AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 );
-
-      mpop ( lo, hi, d );
-      if (hi - lo < MAIN_QSORT_SMALL_THRESH || 
-          d > MAIN_QSORT_DEPTH_THRESH) {
-         mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget );
-         if (*budget < 0) return;
-         continue;
-      }
-
-      med = (Int32) 
-            mmed3 ( block[ptr[ lo         ]+d],
-                    block[ptr[ hi         ]+d],
-                    block[ptr[ (lo+hi)>>1 ]+d] );
-
-      unLo = ltLo = lo;
-      unHi = gtHi = hi;
-
-      while (True) {
-         while (True) {
-            if (unLo > unHi) break;
-            n = ((Int32)block[ptr[unLo]+d]) - med;
-            if (n == 0) { 
-               mswap(ptr[unLo], ptr[ltLo]); 
-               ltLo++; unLo++; continue; 
-            };
-            if (n >  0) break;
-            unLo++;
-         }
-         while (True) {
-            if (unLo > unHi) break;
-            n = ((Int32)block[ptr[unHi]+d]) - med;
-            if (n == 0) { 
-               mswap(ptr[unHi], ptr[gtHi]); 
-               gtHi--; unHi--; continue; 
-            };
-            if (n <  0) break;
-            unHi--;
-         }
-         if (unLo > unHi) break;
-         mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--;
-      }
-
-      AssertD ( unHi == unLo-1, "mainQSort3(2)" );
-
-      if (gtHi < ltLo) {
-         mpush(lo, hi, d+1 );
-         continue;
-      }
-
-      n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n);
-      m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m);
-
-      n = lo + unLo - ltLo - 1;
-      m = hi - (gtHi - unHi) + 1;
-
-      nextLo[0] = lo;  nextHi[0] = n;   nextD[0] = d;
-      nextLo[1] = m;   nextHi[1] = hi;  nextD[1] = d;
-      nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1;
-
-      if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
-      if (mnextsize(1) < mnextsize(2)) mnextswap(1,2);
-      if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
-
-      AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" );
-      AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" );
-
-      mpush (nextLo[0], nextHi[0], nextD[0]);
-      mpush (nextLo[1], nextHi[1], nextD[1]);
-      mpush (nextLo[2], nextHi[2], nextD[2]);
-   }
-}
-
-#undef mswap
-#undef mvswap
-#undef mpush
-#undef mpop
-#undef mmin
-#undef mnextsize
-#undef mnextswap
-#undef MAIN_QSORT_SMALL_THRESH
-#undef MAIN_QSORT_DEPTH_THRESH
-#undef MAIN_QSORT_STACK_SIZE
-
-
-/*---------------------------------------------*/
-/* Pre:
-      nblock > N_OVERSHOOT
-      block32 exists for [0 .. nblock-1 +N_OVERSHOOT]
-      ((UChar*)block32) [0 .. nblock-1] holds block
-      ptr exists for [0 .. nblock-1]
-
-   Post:
-      ((UChar*)block32) [0 .. nblock-1] holds block
-      All other areas of block32 destroyed
-      ftab [0 .. 65536 ] destroyed
-      ptr [0 .. nblock-1] holds sorted order
-      if (*budget < 0), sorting was abandoned
-*/
-
-#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8])
-#define SETMASK (1 << 21)
-#define CLEARMASK (~(SETMASK))
-
-static
-void mainSort ( UInt32* ptr, 
-                UChar*  block,
-                UInt16* quadrant, 
-                UInt32* ftab,
-                Int32   nblock,
-                Int32   verb,
-                Int32*  budget )
-{
-   Int32  i, j, k, ss, sb;
-   Int32  runningOrder[256];
-   Bool   bigDone[256];
-   Int32  copyStart[256];
-   Int32  copyEnd  [256];
-   UChar  c1;
-   Int32  numQSorted;
-   UInt16 s;
-   if (verb >= 4) VPrintf0 ( "        main sort initialise ...\n" );
-
-   /*-- set up the 2-byte frequency table --*/
-   for (i = 65536; i >= 0; i--) ftab[i] = 0;
-
-   j = block[0] << 8;
-   i = nblock-1;
-   for (; i >= 3; i -= 4) {
-      quadrant[i] = 0;
-      j = (j >> 8) | ( ((UInt16)block[i]) << 8);
-      ftab[j]++;
-      quadrant[i-1] = 0;
-      j = (j >> 8) | ( ((UInt16)block[i-1]) << 8);
-      ftab[j]++;
-      quadrant[i-2] = 0;
-      j = (j >> 8) | ( ((UInt16)block[i-2]) << 8);
-      ftab[j]++;
-      quadrant[i-3] = 0;
-      j = (j >> 8) | ( ((UInt16)block[i-3]) << 8);
-      ftab[j]++;
-   }
-   for (; i >= 0; i--) {
-      quadrant[i] = 0;
-      j = (j >> 8) | ( ((UInt16)block[i]) << 8);
-      ftab[j]++;
-   }
-
-   /*-- (emphasises close relationship of block & quadrant) --*/
-   for (i = 0; i < BZ_N_OVERSHOOT; i++) {
-      block   [nblock+i] = block[i];
-      quadrant[nblock+i] = 0;
-   }
-
-   if (verb >= 4) VPrintf0 ( "        bucket sorting ...\n" );
-
-   /*-- Complete the initial radix sort --*/
-   for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1];
-
-   s = block[0] << 8;
-   i = nblock-1;
-   for (; i >= 3; i -= 4) {
-      s = (s >> 8) | (block[i] << 8);
-      j = ftab[s] -1;
-      ftab[s] = j;
-      ptr[j] = i;
-      s = (s >> 8) | (block[i-1] << 8);
-      j = ftab[s] -1;
-      ftab[s] = j;
-      ptr[j] = i-1;
-      s = (s >> 8) | (block[i-2] << 8);
-      j = ftab[s] -1;
-      ftab[s] = j;
-      ptr[j] = i-2;
-      s = (s >> 8) | (block[i-3] << 8);
-      j = ftab[s] -1;
-      ftab[s] = j;
-      ptr[j] = i-3;
-   }
-   for (; i >= 0; i--) {
-      s = (s >> 8) | (block[i] << 8);
-      j = ftab[s] -1;
-      ftab[s] = j;
-      ptr[j] = i;
-   }
-
-   /*--
-      Now ftab contains the first loc of every small bucket.
-      Calculate the running order, from smallest to largest
-      big bucket.
-   --*/
-   for (i = 0; i <= 255; i++) {
-      bigDone     [i] = False;
-      runningOrder[i] = i;
-   }
-
-   {
-      Int32 vv;
-      Int32 h = 1;
-      do h = 3 * h + 1; while (h <= 256);
-      do {
-         h = h / 3;
-         for (i = h; i <= 255; i++) {
-            vv = runningOrder[i];
-            j = i;
-            while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) {
-               runningOrder[j] = runningOrder[j-h];
-               j = j - h;
-               if (j <= (h - 1)) goto zero;
-            }
-            zero:
-            runningOrder[j] = vv;
-         }
-      } while (h != 1);
-   }
-
-   /*--
-      The main sorting loop.
-   --*/
-
-   numQSorted = 0;
-
-   for (i = 0; i <= 255; i++) {
-
-      /*--
-         Process big buckets, starting with the least full.
-         Basically this is a 3-step process in which we call
-         mainQSort3 to sort the small buckets [ss, j], but
-         also make a big effort to avoid the calls if we can.
-      --*/
-      ss = runningOrder[i];
-
-      /*--
-         Step 1:
-         Complete the big bucket [ss] by quicksorting
-         any unsorted small buckets [ss, j], for j != ss.  
-         Hopefully previous pointer-scanning phases have already
-         completed many of the small buckets [ss, j], so
-         we don't have to sort them at all.
-      --*/
-      for (j = 0; j <= 255; j++) {
-         if (j != ss) {
-            sb = (ss << 8) + j;
-            if ( ! (ftab[sb] & SETMASK) ) {
-               Int32 lo = ftab[sb]   & CLEARMASK;
-               Int32 hi = (ftab[sb+1] & CLEARMASK) - 1;
-               if (hi > lo) {
-                  if (verb >= 4)
-                     VPrintf4 ( "        qsort [0x%x, 0x%x]   "
-                                "done %d   this %d\n",
-                                ss, j, numQSorted, hi - lo + 1 );
-                  mainQSort3 ( 
-                     ptr, block, quadrant, nblock, 
-                     lo, hi, BZ_N_RADIX, budget 
-                  );   
-                  numQSorted += (hi - lo + 1);
-                  if (*budget < 0) return;
-               }
-            }
-            ftab[sb] |= SETMASK;
-         }
-      }
-
-      AssertH ( !bigDone[ss], 1006 );
-
-      /*--
-         Step 2:
-         Now scan this big bucket [ss] so as to synthesise the
-         sorted order for small buckets [t, ss] for all t,
-         including, magically, the bucket [ss,ss] too.
-         This will avoid doing Real Work in subsequent Step 1's.
-      --*/
-      {
-         for (j = 0; j <= 255; j++) {
-            copyStart[j] =  ftab[(j << 8) + ss]     & CLEARMASK;
-            copyEnd  [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1;
-         }
-         for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) {
-            k = ptr[j]-1; if (k < 0) k += nblock;
-            c1 = block[k];
-            if (!bigDone[c1])
-               ptr[ copyStart[c1]++ ] = k;
-         }
-         for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) {
-            k = ptr[j]-1; if (k < 0) k += nblock;
-            c1 = block[k];
-            if (!bigDone[c1]) 
-               ptr[ copyEnd[c1]-- ] = k;
-         }
-      }
-
-      AssertH ( (copyStart[ss]-1 == copyEnd[ss])
-                || 
-                /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1.
-                   Necessity for this case is demonstrated by compressing 
-                   a sequence of approximately 48.5 million of character 
-                   251; 1.0.0/1.0.1 will then die here. */
-                (copyStart[ss] == 0 && copyEnd[ss] == nblock-1),
-                1007 )
-
-      for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK;
-
-      /*--
-         Step 3:
-         The [ss] big bucket is now done.  Record this fact,
-         and update the quadrant descriptors.  Remember to
-         update quadrants in the overshoot area too, if
-         necessary.  The "if (i < 255)" test merely skips
-         this updating for the last bucket processed, since
-         updating for the last bucket is pointless.
-
-         The quadrant array provides a way to incrementally
-         cache sort orderings, as they appear, so as to 
-         make subsequent comparisons in fullGtU() complete
-         faster.  For repetitive blocks this makes a big
-         difference (but not big enough to be able to avoid
-         the fallback sorting mechanism, exponential radix sort).
-
-         The precise meaning is: at all times:
-
-            for 0 <= i < nblock and 0 <= j <= nblock
-
-            if block[i] != block[j], 
-
-               then the relative values of quadrant[i] and 
-                    quadrant[j] are meaningless.
-
-               else {
-                  if quadrant[i] < quadrant[j]
-                     then the string starting at i lexicographically
-                     precedes the string starting at j
-
-                  else if quadrant[i] > quadrant[j]
-                     then the string starting at j lexicographically
-                     precedes the string starting at i
-
-                  else
-                     the relative ordering of the strings starting
-                     at i and j has not yet been determined.
-               }
-      --*/
-      bigDone[ss] = True;
-
-      if (i < 255) {
-         Int32 bbStart  = ftab[ss << 8] & CLEARMASK;
-         Int32 bbSize   = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart;
-         Int32 shifts   = 0;
-
-         while ((bbSize >> shifts) > 65534) shifts++;
-
-         for (j = bbSize-1; j >= 0; j--) {
-            Int32 a2update     = ptr[bbStart + j];
-            UInt16 qVal        = (UInt16)(j >> shifts);
-            quadrant[a2update] = qVal;
-            if (a2update < BZ_N_OVERSHOOT)
-               quadrant[a2update + nblock] = qVal;
-         }
-         AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 );
-      }
-
-   }
-
-   if (verb >= 4)
-      VPrintf3 ( "        %d pointers, %d sorted, %d scanned\n",
-                 nblock, numQSorted, nblock - numQSorted );
-}
-
-#undef BIGFREQ
-#undef SETMASK
-#undef CLEARMASK
-
-
-/*---------------------------------------------*/
-/* Pre:
-      nblock > 0
-      arr2 exists for [0 .. nblock-1 +N_OVERSHOOT]
-      ((UChar*)arr2)  [0 .. nblock-1] holds block
-      arr1 exists for [0 .. nblock-1]
-
-   Post:
-      ((UChar*)arr2) [0 .. nblock-1] holds block
-      All other areas of block destroyed
-      ftab [ 0 .. 65536 ] destroyed
-      arr1 [0 .. nblock-1] holds sorted order
-*/
-void BZ2_blockSort ( EState* s )
-{
-   UInt32* ptr    = s->ptr; 
-   UChar*  block  = s->block;
-   UInt32* ftab   = s->ftab;
-   Int32   nblock = s->nblock;
-   Int32   verb   = s->verbosity;
-   Int32   wfact  = s->workFactor;
-   UInt16* quadrant;
-   Int32   budget;
-   Int32   budgetInit;
-   Int32   i;
-
-   if (nblock < 10000) {
-      fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
-   } else {
-      /* Calculate the location for quadrant, remembering to get
-         the alignment right.  Assumes that &(block[0]) is at least
-         2-byte aligned -- this should be ok since block is really
-         the first section of arr2.
-      */
-      i = nblock+BZ_N_OVERSHOOT;
-      if (i & 1) i++;
-      quadrant = (UInt16*)(&(block[i]));
-
-      /* (wfact-1) / 3 puts the default-factor-30
-         transition point at very roughly the same place as 
-         with v0.1 and v0.9.0.  
-         Not that it particularly matters any more, since the
-         resulting compressed stream is now the same regardless
-         of whether or not we use the main sort or fallback sort.
-      */
-      if (wfact < 1  ) wfact = 1;
-      if (wfact > 100) wfact = 100;
-      budgetInit = nblock * ((wfact-1) / 3);
-      budget = budgetInit;
-
-      mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget );
-      if (verb >= 3) 
-         VPrintf3 ( "      %d work, %d block, ratio %5.2f\n",
-                    budgetInit - budget,
-                    nblock, 
-                    (float)(budgetInit - budget) /
-                    (float)(nblock==0 ? 1 : nblock) ); 
-      if (budget < 0) {
-         if (verb >= 2) 
-            VPrintf0 ( "    too repetitive; using fallback"
-                       " sorting algorithm\n" );
-         fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
-      }
-   }
-
-   s->origPtr = -1;
-   for (i = 0; i < s->nblock; i++)
-      if (ptr[i] == 0)
-         { s->origPtr = i; break; };
-
-   AssertH( s->origPtr != -1, 1003 );
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                       blocksort.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/bzlib.c b/examples/C/hdf5plugins/bzlib.c
deleted file mode 100644
index bd358a7..0000000
--- a/examples/C/hdf5plugins/bzlib.c
+++ /dev/null
@@ -1,1572 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Library top-level functions.                          ---*/
-/*---                                               bzlib.c ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-/* CHANGES
-   0.9.0    -- original version.
-   0.9.0a/b -- no changes in this file.
-   0.9.0c   -- made zero-length BZ_FLUSH work correctly in bzCompress().
-     fixed bzWrite/bzRead to ignore zero-length requests.
-     fixed bzread to correctly handle read requests after EOF.
-     wrong parameter order in call to bzDecompressInit in
-     bzBuffToBuffDecompress.  Fixed.
-*/
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-/*--- Compression stuff                           ---*/
-/*---------------------------------------------------*/
-
-
-/*---------------------------------------------------*/
-#ifndef BZ_NO_STDIO
-void BZ2_bz__AssertH__fail ( int errcode )
-{
-   fprintf(stderr, 
-      "\n\nbzip2/libbzip2: internal error number %d.\n"
-      "This is a bug in bzip2/libbzip2, %s.\n"
-      "Please report it to me at: jseward at bzip.org.  If this happened\n"
-      "when you were using some program which uses libbzip2 as a\n"
-      "component, you should also report this bug to the author(s)\n"
-      "of that program.  Please make an effort to report this bug;\n"
-      "timely and accurate bug reports eventually lead to higher\n"
-      "quality software.  Thanks.  Julian Seward, 10 December 2007.\n\n",
-      errcode,
-      BZ2_bzlibVersion()
-   );
-
-   if (errcode == 1007) {
-   fprintf(stderr,
-      "\n*** A special note about internal error number 1007 ***\n"
-      "\n"
-      "Experience suggests that a common cause of i.e. 1007\n"
-      "is unreliable memory or other hardware.  The 1007 assertion\n"
-      "just happens to cross-check the results of huge numbers of\n"
-      "memory reads/writes, and so acts (unintendedly) as a stress\n"
-      "test of your memory system.\n"
-      "\n"
-      "I suggest the following: try compressing the file again,\n"
-      "possibly monitoring progress in detail with the -vv flag.\n"
-      "\n"
-      "* If the error cannot be reproduced, and/or happens at different\n"
-      "  points in compression, you may have a flaky memory system.\n"
-      "  Try a memory-test program.  I have used Memtest86\n"
-      "  (www.memtest86.com).  At the time of writing it is free (GPLd).\n"
-      "  Memtest86 tests memory much more thorougly than your BIOSs\n"
-      "  power-on test, and may find failures that the BIOS doesn't.\n"
-      "\n"
-      "* If the error can be repeatably reproduced, this is a bug in\n"
-      "  bzip2, and I would very much like to hear about it.  Please\n"
-      "  let me know, and, ideally, save a copy of the file causing the\n"
-      "  problem -- without which I will be unable to investigate it.\n"
-      "\n"
-   );
-   }
-
-   exit(3);
-}
-#endif
-
-
-/*---------------------------------------------------*/
-static
-int bz_config_ok ( void )
-{
-   if (sizeof(int)   != 4) return 0;
-   if (sizeof(short) != 2) return 0;
-   if (sizeof(char)  != 1) return 0;
-   return 1;
-}
-
-
-/*---------------------------------------------------*/
-static
-void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
-{
-   void* v = malloc ( items * size );
-   return v;
-}
-
-static
-void default_bzfree ( void* opaque, void* addr )
-{
-   if (addr != NULL) free ( addr );
-}
-
-
-/*---------------------------------------------------*/
-static
-void prepare_new_block ( EState* s )
-{
-   Int32 i;
-   s->nblock = 0;
-   s->numZ = 0;
-   s->state_out_pos = 0;
-   BZ_INITIALISE_CRC ( s->blockCRC );
-   for (i = 0; i < 256; i++) s->inUse[i] = False;
-   s->blockNo++;
-}
-
-
-/*---------------------------------------------------*/
-static
-void init_RL ( EState* s )
-{
-   s->state_in_ch  = 256;
-   s->state_in_len = 0;
-}
-
-
-static
-Bool isempty_RL ( EState* s )
-{
-   if (s->state_in_ch < 256 && s->state_in_len > 0)
-      return False; else
-      return True;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompressInit) 
-                    ( bz_stream* strm, 
-                     int        blockSize100k,
-                     int        verbosity,
-                     int        workFactor )
-{
-   Int32   n;
-   EState* s;
-
-   if (!bz_config_ok()) return BZ_CONFIG_ERROR;
-
-   if (strm == NULL || 
-       blockSize100k < 1 || blockSize100k > 9 ||
-       workFactor < 0 || workFactor > 250)
-     return BZ_PARAM_ERROR;
-
-   if (workFactor == 0) workFactor = 30;
-   if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
-   if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
-
-   s = BZALLOC( sizeof(EState) );
-   if (s == NULL) return BZ_MEM_ERROR;
-   s->strm = strm;
-
-   s->arr1 = NULL;
-   s->arr2 = NULL;
-   s->ftab = NULL;
-
-   n       = 100000 * blockSize100k;
-   s->arr1 = BZALLOC( n                  * sizeof(UInt32) );
-   s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
-   s->ftab = BZALLOC( 65537              * sizeof(UInt32) );
-
-   if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
-      if (s->arr1 != NULL) BZFREE(s->arr1);
-      if (s->arr2 != NULL) BZFREE(s->arr2);
-      if (s->ftab != NULL) BZFREE(s->ftab);
-      if (s       != NULL) BZFREE(s);
-      return BZ_MEM_ERROR;
-   }
-
-   s->blockNo           = 0;
-   s->state             = BZ_S_INPUT;
-   s->mode              = BZ_M_RUNNING;
-   s->combinedCRC       = 0;
-   s->blockSize100k     = blockSize100k;
-   s->nblockMAX         = 100000 * blockSize100k - 19;
-   s->verbosity         = verbosity;
-   s->workFactor        = workFactor;
-
-   s->block             = (UChar*)s->arr2;
-   s->mtfv              = (UInt16*)s->arr1;
-   s->zbits             = NULL;
-   s->ptr               = (UInt32*)s->arr1;
-
-   strm->state          = s;
-   strm->total_in_lo32  = 0;
-   strm->total_in_hi32  = 0;
-   strm->total_out_lo32 = 0;
-   strm->total_out_hi32 = 0;
-   init_RL ( s );
-   prepare_new_block ( s );
-   return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-static
-void add_pair_to_block ( EState* s )
-{
-   Int32 i;
-   UChar ch = (UChar)(s->state_in_ch);
-   for (i = 0; i < s->state_in_len; i++) {
-      BZ_UPDATE_CRC( s->blockCRC, ch );
-   }
-   s->inUse[s->state_in_ch] = True;
-   switch (s->state_in_len) {
-      case 1:
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         break;
-      case 2:
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         break;
-      case 3:
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         break;
-      default:
-         s->inUse[s->state_in_len-4] = True;
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         s->block[s->nblock] = (UChar)ch; s->nblock++;
-         s->block[s->nblock] = ((UChar)(s->state_in_len-4));
-         s->nblock++;
-         break;
-   }
-}
-
-
-/*---------------------------------------------------*/
-static
-void flush_RL ( EState* s )
-{
-   if (s->state_in_ch < 256) add_pair_to_block ( s );
-   init_RL ( s );
-}
-
-
-/*---------------------------------------------------*/
-#define ADD_CHAR_TO_BLOCK(zs,zchh0)               \
-{                                                 \
-   UInt32 zchh = (UInt32)(zchh0);                 \
-   /*-- fast track the common case --*/           \
-   if (zchh != zs->state_in_ch &&                 \
-       zs->state_in_len == 1) {                   \
-      UChar ch = (UChar)(zs->state_in_ch);        \
-      BZ_UPDATE_CRC( zs->blockCRC, ch );          \
-      zs->inUse[zs->state_in_ch] = True;          \
-      zs->block[zs->nblock] = (UChar)ch;          \
-      zs->nblock++;                               \
-      zs->state_in_ch = zchh;                     \
-   }                                              \
-   else                                           \
-   /*-- general, uncommon cases --*/              \
-   if (zchh != zs->state_in_ch ||                 \
-      zs->state_in_len == 255) {                  \
-      if (zs->state_in_ch < 256)                  \
-         add_pair_to_block ( zs );                \
-      zs->state_in_ch = zchh;                     \
-      zs->state_in_len = 1;                       \
-   } else {                                       \
-      zs->state_in_len++;                         \
-   }                                              \
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool copy_input_until_stop ( EState* s )
-{
-   Bool progress_in = False;
-
-   if (s->mode == BZ_M_RUNNING) {
-
-      /*-- fast track the common case --*/
-      while (True) {
-         /*-- block full? --*/
-         if (s->nblock >= s->nblockMAX) break;
-         /*-- no input? --*/
-         if (s->strm->avail_in == 0) break;
-         progress_in = True;
-         ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); 
-         s->strm->next_in++;
-         s->strm->avail_in--;
-         s->strm->total_in_lo32++;
-         if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
-      }
-
-   } else {
-
-      /*-- general, uncommon case --*/
-      while (True) {
-         /*-- block full? --*/
-         if (s->nblock >= s->nblockMAX) break;
-         /*-- no input? --*/
-         if (s->strm->avail_in == 0) break;
-         /*-- flush/finish end? --*/
-         if (s->avail_in_expect == 0) break;
-         progress_in = True;
-         ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); 
-         s->strm->next_in++;
-         s->strm->avail_in--;
-         s->strm->total_in_lo32++;
-         if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
-         s->avail_in_expect--;
-      }
-   }
-   return progress_in;
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool copy_output_until_stop ( EState* s )
-{
-   Bool progress_out = False;
-
-   while (True) {
-
-      /*-- no output space? --*/
-      if (s->strm->avail_out == 0) break;
-
-      /*-- block done? --*/
-      if (s->state_out_pos >= s->numZ) break;
-
-      progress_out = True;
-      *(s->strm->next_out) = s->zbits[s->state_out_pos];
-      s->state_out_pos++;
-      s->strm->avail_out--;
-      s->strm->next_out++;
-      s->strm->total_out_lo32++;
-      if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
-   }
-
-   return progress_out;
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool handle_compress ( bz_stream* strm )
-{
-   Bool progress_in  = False;
-   Bool progress_out = False;
-   EState* s = strm->state;
-   
-   while (True) {
-
-      if (s->state == BZ_S_OUTPUT) {
-         progress_out |= copy_output_until_stop ( s );
-         if (s->state_out_pos < s->numZ) break;
-         if (s->mode == BZ_M_FINISHING && 
-             s->avail_in_expect == 0 &&
-             isempty_RL(s)) break;
-         prepare_new_block ( s );
-         s->state = BZ_S_INPUT;
-         if (s->mode == BZ_M_FLUSHING && 
-             s->avail_in_expect == 0 &&
-             isempty_RL(s)) break;
-      }
-
-      if (s->state == BZ_S_INPUT) {
-         progress_in |= copy_input_until_stop ( s );
-         if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) {
-            flush_RL ( s );
-            BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) );
-            s->state = BZ_S_OUTPUT;
-         }
-         else
-         if (s->nblock >= s->nblockMAX) {
-            BZ2_compressBlock ( s, False );
-            s->state = BZ_S_OUTPUT;
-         }
-         else
-         if (s->strm->avail_in == 0) {
-            break;
-         }
-      }
-
-   }
-
-   return progress_in || progress_out;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
-{
-   Bool progress;
-   EState* s;
-   if (strm == NULL) return BZ_PARAM_ERROR;
-   s = strm->state;
-   if (s == NULL) return BZ_PARAM_ERROR;
-   if (s->strm != strm) return BZ_PARAM_ERROR;
-
-   preswitch:
-   switch (s->mode) {
-
-      case BZ_M_IDLE:
-         return BZ_SEQUENCE_ERROR;
-
-      case BZ_M_RUNNING:
-         if (action == BZ_RUN) {
-            progress = handle_compress ( strm );
-            return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
-         } 
-         else
-	 if (action == BZ_FLUSH) {
-            s->avail_in_expect = strm->avail_in;
-            s->mode = BZ_M_FLUSHING;
-            goto preswitch;
-         }
-         else
-         if (action == BZ_FINISH) {
-            s->avail_in_expect = strm->avail_in;
-            s->mode = BZ_M_FINISHING;
-            goto preswitch;
-         }
-         else 
-            return BZ_PARAM_ERROR;
-
-      case BZ_M_FLUSHING:
-         if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR;
-         if (s->avail_in_expect != s->strm->avail_in) 
-            return BZ_SEQUENCE_ERROR;
-         progress = handle_compress ( strm );
-         if (s->avail_in_expect > 0 || !isempty_RL(s) ||
-             s->state_out_pos < s->numZ) return BZ_FLUSH_OK;
-         s->mode = BZ_M_RUNNING;
-         return BZ_RUN_OK;
-
-      case BZ_M_FINISHING:
-         if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR;
-         if (s->avail_in_expect != s->strm->avail_in) 
-            return BZ_SEQUENCE_ERROR;
-         progress = handle_compress ( strm );
-         if (!progress) return BZ_SEQUENCE_ERROR;
-         if (s->avail_in_expect > 0 || !isempty_RL(s) ||
-             s->state_out_pos < s->numZ) return BZ_FINISH_OK;
-         s->mode = BZ_M_IDLE;
-         return BZ_STREAM_END;
-   }
-   return BZ_OK; /*--not reached--*/
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompressEnd)  ( bz_stream *strm )
-{
-   EState* s;
-   if (strm == NULL) return BZ_PARAM_ERROR;
-   s = strm->state;
-   if (s == NULL) return BZ_PARAM_ERROR;
-   if (s->strm != strm) return BZ_PARAM_ERROR;
-
-   if (s->arr1 != NULL) BZFREE(s->arr1);
-   if (s->arr2 != NULL) BZFREE(s->arr2);
-   if (s->ftab != NULL) BZFREE(s->ftab);
-   BZFREE(strm->state);
-
-   strm->state = NULL;   
-
-   return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-/*--- Decompression stuff                         ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressInit) 
-                     ( bz_stream* strm, 
-                       int        verbosity,
-                       int        small )
-{
-   DState* s;
-
-   if (!bz_config_ok()) return BZ_CONFIG_ERROR;
-
-   if (strm == NULL) return BZ_PARAM_ERROR;
-   if (small != 0 && small != 1) return BZ_PARAM_ERROR;
-   if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR;
-
-   if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
-   if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
-
-   s = BZALLOC( sizeof(DState) );
-   if (s == NULL) return BZ_MEM_ERROR;
-   s->strm                  = strm;
-   strm->state              = s;
-   s->state                 = BZ_X_MAGIC_1;
-   s->bsLive                = 0;
-   s->bsBuff                = 0;
-   s->calculatedCombinedCRC = 0;
-   strm->total_in_lo32      = 0;
-   strm->total_in_hi32      = 0;
-   strm->total_out_lo32     = 0;
-   strm->total_out_hi32     = 0;
-   s->smallDecompress       = (Bool)small;
-   s->ll4                   = NULL;
-   s->ll16                  = NULL;
-   s->tt                    = NULL;
-   s->currBlockNo           = 0;
-   s->verbosity             = verbosity;
-
-   return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-/* Return  True iff data corruption is discovered.
-   Returns False if there is no problem.
-*/
-static
-Bool unRLE_obuf_to_output_FAST ( DState* s )
-{
-   UChar k1;
-
-   if (s->blockRandomised) {
-
-      while (True) {
-         /* try to finish existing run */
-         while (True) {
-            if (s->strm->avail_out == 0) return False;
-            if (s->state_out_len == 0) break;
-            *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
-            BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
-            s->state_out_len--;
-            s->strm->next_out++;
-            s->strm->avail_out--;
-            s->strm->total_out_lo32++;
-            if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
-         }
-
-         /* can a new run be started? */
-         if (s->nblock_used == s->save_nblock+1) return False;
-               
-         /* Only caused by corrupt data stream? */
-         if (s->nblock_used > s->save_nblock+1)
-            return True;
-   
-         s->state_out_len = 1;
-         s->state_out_ch = s->k0;
-         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         s->state_out_len = 2;
-         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         s->state_out_len = 3;
-         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         s->state_out_len = ((Int32)k1) + 4;
-         BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; 
-         s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
-      }
-
-   } else {
-
-      /* restore */
-      UInt32        c_calculatedBlockCRC = s->calculatedBlockCRC;
-      UChar         c_state_out_ch       = s->state_out_ch;
-      Int32         c_state_out_len      = s->state_out_len;
-      Int32         c_nblock_used        = s->nblock_used;
-      Int32         c_k0                 = s->k0;
-      UInt32*       c_tt                 = s->tt;
-      UInt32        c_tPos               = s->tPos;
-      char*         cs_next_out          = s->strm->next_out;
-      unsigned int  cs_avail_out         = s->strm->avail_out;
-      Int32         ro_blockSize100k     = s->blockSize100k;
-      /* end restore */
-
-      UInt32       avail_out_INIT = cs_avail_out;
-      Int32        s_save_nblockPP = s->save_nblock+1;
-      unsigned int total_out_lo32_old;
-
-      while (True) {
-
-         /* try to finish existing run */
-         if (c_state_out_len > 0) {
-            while (True) {
-               if (cs_avail_out == 0) goto return_notr;
-               if (c_state_out_len == 1) break;
-               *( (UChar*)(cs_next_out) ) = c_state_out_ch;
-               BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
-               c_state_out_len--;
-               cs_next_out++;
-               cs_avail_out--;
-            }
-            s_state_out_len_eq_one:
-            {
-               if (cs_avail_out == 0) { 
-                  c_state_out_len = 1; goto return_notr;
-               };
-               *( (UChar*)(cs_next_out) ) = c_state_out_ch;
-               BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
-               cs_next_out++;
-               cs_avail_out--;
-            }
-         }   
-         /* Only caused by corrupt data stream? */
-         if (c_nblock_used > s_save_nblockPP)
-            return True;
-
-         /* can a new run be started? */
-         if (c_nblock_used == s_save_nblockPP) {
-            c_state_out_len = 0; goto return_notr;
-         };   
-         c_state_out_ch = c_k0;
-         BZ_GET_FAST_C(k1); c_nblock_used++;
-         if (k1 != c_k0) { 
-            c_k0 = k1; goto s_state_out_len_eq_one; 
-         };
-         if (c_nblock_used == s_save_nblockPP) 
-            goto s_state_out_len_eq_one;
-   
-         c_state_out_len = 2;
-         BZ_GET_FAST_C(k1); c_nblock_used++;
-         if (c_nblock_used == s_save_nblockPP) continue;
-         if (k1 != c_k0) { c_k0 = k1; continue; };
-   
-         c_state_out_len = 3;
-         BZ_GET_FAST_C(k1); c_nblock_used++;
-         if (c_nblock_used == s_save_nblockPP) continue;
-         if (k1 != c_k0) { c_k0 = k1; continue; };
-   
-         BZ_GET_FAST_C(k1); c_nblock_used++;
-         c_state_out_len = ((Int32)k1) + 4;
-         BZ_GET_FAST_C(c_k0); c_nblock_used++;
-      }
-
-      return_notr:
-      total_out_lo32_old = s->strm->total_out_lo32;
-      s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out);
-      if (s->strm->total_out_lo32 < total_out_lo32_old)
-         s->strm->total_out_hi32++;
-
-      /* save */
-      s->calculatedBlockCRC = c_calculatedBlockCRC;
-      s->state_out_ch       = c_state_out_ch;
-      s->state_out_len      = c_state_out_len;
-      s->nblock_used        = c_nblock_used;
-      s->k0                 = c_k0;
-      s->tt                 = c_tt;
-      s->tPos               = c_tPos;
-      s->strm->next_out     = cs_next_out;
-      s->strm->avail_out    = cs_avail_out;
-      /* end save */
-   }
-   return False;
-}
-
-
-
-/*---------------------------------------------------*/
-__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
-{
-   Int32 nb, na, mid;
-   nb = 0;
-   na = 256;
-   do {
-      mid = (nb + na) >> 1;
-      if (indx >= cftab[mid]) nb = mid; else na = mid;
-   }
-   while (na - nb != 1);
-   return nb;
-}
-
-
-/*---------------------------------------------------*/
-/* Return  True iff data corruption is discovered.
-   Returns False if there is no problem.
-*/
-static
-Bool unRLE_obuf_to_output_SMALL ( DState* s )
-{
-   UChar k1;
-
-   if (s->blockRandomised) {
-
-      while (True) {
-         /* try to finish existing run */
-         while (True) {
-            if (s->strm->avail_out == 0) return False;
-            if (s->state_out_len == 0) break;
-            *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
-            BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
-            s->state_out_len--;
-            s->strm->next_out++;
-            s->strm->avail_out--;
-            s->strm->total_out_lo32++;
-            if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
-         }
-   
-         /* can a new run be started? */
-         if (s->nblock_used == s->save_nblock+1) return False;
-
-         /* Only caused by corrupt data stream? */
-         if (s->nblock_used > s->save_nblock+1)
-            return True;
-   
-         s->state_out_len = 1;
-         s->state_out_ch = s->k0;
-         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         s->state_out_len = 2;
-         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         s->state_out_len = 3;
-         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
-         k1 ^= BZ_RAND_MASK; s->nblock_used++;
-         s->state_out_len = ((Int32)k1) + 4;
-         BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; 
-         s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
-      }
-
-   } else {
-
-      while (True) {
-         /* try to finish existing run */
-         while (True) {
-            if (s->strm->avail_out == 0) return False;
-            if (s->state_out_len == 0) break;
-            *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
-            BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
-            s->state_out_len--;
-            s->strm->next_out++;
-            s->strm->avail_out--;
-            s->strm->total_out_lo32++;
-            if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
-         }
-   
-         /* can a new run be started? */
-         if (s->nblock_used == s->save_nblock+1) return False;
-
-         /* Only caused by corrupt data stream? */
-         if (s->nblock_used > s->save_nblock+1)
-            return True;
-   
-         s->state_out_len = 1;
-         s->state_out_ch = s->k0;
-         BZ_GET_SMALL(k1); s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         s->state_out_len = 2;
-         BZ_GET_SMALL(k1); s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         s->state_out_len = 3;
-         BZ_GET_SMALL(k1); s->nblock_used++;
-         if (s->nblock_used == s->save_nblock+1) continue;
-         if (k1 != s->k0) { s->k0 = k1; continue; };
-   
-         BZ_GET_SMALL(k1); s->nblock_used++;
-         s->state_out_len = ((Int32)k1) + 4;
-         BZ_GET_SMALL(s->k0); s->nblock_used++;
-      }
-
-   }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
-{
-   Bool    corrupt;
-   DState* s;
-   if (strm == NULL) return BZ_PARAM_ERROR;
-   s = strm->state;
-   if (s == NULL) return BZ_PARAM_ERROR;
-   if (s->strm != strm) return BZ_PARAM_ERROR;
-
-   while (True) {
-      if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
-      if (s->state == BZ_X_OUTPUT) {
-         if (s->smallDecompress)
-            corrupt = unRLE_obuf_to_output_SMALL ( s ); else
-            corrupt = unRLE_obuf_to_output_FAST  ( s );
-         if (corrupt) return BZ_DATA_ERROR;
-         if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
-            BZ_FINALISE_CRC ( s->calculatedBlockCRC );
-            if (s->verbosity >= 3) 
-               VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, 
-                          s->calculatedBlockCRC );
-            if (s->verbosity >= 2) VPrintf0 ( "]" );
-            if (s->calculatedBlockCRC != s->storedBlockCRC)
-               return BZ_DATA_ERROR;
-            s->calculatedCombinedCRC 
-               = (s->calculatedCombinedCRC << 1) | 
-                    (s->calculatedCombinedCRC >> 31);
-            s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
-            s->state = BZ_X_BLKHDR_1;
-         } else {
-            return BZ_OK;
-         }
-      }
-      if (s->state >= BZ_X_MAGIC_1) {
-         Int32 r = BZ2_decompress ( s );
-         if (r == BZ_STREAM_END) {
-            if (s->verbosity >= 3)
-               VPrintf2 ( "\n    combined CRCs: stored = 0x%08x, computed = 0x%08x", 
-                          s->storedCombinedCRC, s->calculatedCombinedCRC );
-            if (s->calculatedCombinedCRC != s->storedCombinedCRC)
-               return BZ_DATA_ERROR;
-            return r;
-         }
-         if (s->state != BZ_X_OUTPUT) return r;
-      }
-   }
-
-   AssertH ( 0, 6001 );
-
-   return 0;  /*NOTREACHED*/
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressEnd)  ( bz_stream *strm )
-{
-   DState* s;
-   if (strm == NULL) return BZ_PARAM_ERROR;
-   s = strm->state;
-   if (s == NULL) return BZ_PARAM_ERROR;
-   if (s->strm != strm) return BZ_PARAM_ERROR;
-
-   if (s->tt   != NULL) BZFREE(s->tt);
-   if (s->ll16 != NULL) BZFREE(s->ll16);
-   if (s->ll4  != NULL) BZFREE(s->ll4);
-
-   BZFREE(strm->state);
-   strm->state = NULL;
-
-   return BZ_OK;
-}
-
-
-#ifndef BZ_NO_STDIO
-/*---------------------------------------------------*/
-/*--- File I/O stuff                              ---*/
-/*---------------------------------------------------*/
-
-#define BZ_SETERR(eee)                    \
-{                                         \
-   if (bzerror != NULL) *bzerror = eee;   \
-   if (bzf != NULL) bzf->lastErr = eee;   \
-}
-
-typedef 
-   struct {
-      FILE*     handle;
-      Char      buf[BZ_MAX_UNUSED];
-      Int32     bufN;
-      Bool      writing;
-      bz_stream strm;
-      Int32     lastErr;
-      Bool      initialisedOk;
-   }
-   bzFile;
-
-
-/*---------------------------------------------*/
-static Bool myfeof ( FILE* f )
-{
-   Int32 c = fgetc ( f );
-   if (c == EOF) return True;
-   ungetc ( c, f );
-   return False;
-}
-
-
-/*---------------------------------------------------*/
-BZFILE* BZ_API(BZ2_bzWriteOpen) 
-                    ( int*  bzerror,      
-                      FILE* f, 
-                      int   blockSize100k, 
-                      int   verbosity,
-                      int   workFactor )
-{
-   Int32   ret;
-   bzFile* bzf = NULL;
-
-   BZ_SETERR(BZ_OK);
-
-   if (f == NULL ||
-       (blockSize100k < 1 || blockSize100k > 9) ||
-       (workFactor < 0 || workFactor > 250) ||
-       (verbosity < 0 || verbosity > 4))
-      { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
-
-   if (ferror(f))
-      { BZ_SETERR(BZ_IO_ERROR); return NULL; };
-
-   bzf = malloc ( sizeof(bzFile) );
-   if (bzf == NULL)
-      { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
-
-   BZ_SETERR(BZ_OK);
-   bzf->initialisedOk = False;
-   bzf->bufN          = 0;
-   bzf->handle        = f;
-   bzf->writing       = True;
-   bzf->strm.bzalloc  = NULL;
-   bzf->strm.bzfree   = NULL;
-   bzf->strm.opaque   = NULL;
-
-   if (workFactor == 0) workFactor = 30;
-   ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, 
-                              verbosity, workFactor );
-   if (ret != BZ_OK)
-      { BZ_SETERR(ret); free(bzf); return NULL; };
-
-   bzf->strm.avail_in = 0;
-   bzf->initialisedOk = True;
-   return bzf;   
-}
-
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzWrite)
-             ( int*    bzerror, 
-               BZFILE* b, 
-               void*   buf, 
-               int     len )
-{
-   Int32 n, n2, ret;
-   bzFile* bzf = (bzFile*)b;
-
-   BZ_SETERR(BZ_OK);
-   if (bzf == NULL || buf == NULL || len < 0)
-      { BZ_SETERR(BZ_PARAM_ERROR); return; };
-   if (!(bzf->writing))
-      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
-   if (ferror(bzf->handle))
-      { BZ_SETERR(BZ_IO_ERROR); return; };
-
-   if (len == 0)
-      { BZ_SETERR(BZ_OK); return; };
-
-   bzf->strm.avail_in = len;
-   bzf->strm.next_in  = buf;
-
-   while (True) {
-      bzf->strm.avail_out = BZ_MAX_UNUSED;
-      bzf->strm.next_out = bzf->buf;
-      ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN );
-      if (ret != BZ_RUN_OK)
-         { BZ_SETERR(ret); return; };
-
-      if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
-         n = BZ_MAX_UNUSED - bzf->strm.avail_out;
-         n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), 
-                       n, bzf->handle );
-         if (n != n2 || ferror(bzf->handle))
-            { BZ_SETERR(BZ_IO_ERROR); return; };
-      }
-
-      if (bzf->strm.avail_in == 0)
-         { BZ_SETERR(BZ_OK); return; };
-   }
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzWriteClose)
-                  ( int*          bzerror, 
-                    BZFILE*       b, 
-                    int           abandon,
-                    unsigned int* nbytes_in,
-                    unsigned int* nbytes_out )
-{
-   BZ2_bzWriteClose64 ( bzerror, b, abandon, 
-                        nbytes_in, NULL, nbytes_out, NULL );
-}
-
-
-void BZ_API(BZ2_bzWriteClose64)
-                  ( int*          bzerror, 
-                    BZFILE*       b, 
-                    int           abandon,
-                    unsigned int* nbytes_in_lo32,
-                    unsigned int* nbytes_in_hi32,
-                    unsigned int* nbytes_out_lo32,
-                    unsigned int* nbytes_out_hi32 )
-{
-   Int32   n, n2, ret;
-   bzFile* bzf = (bzFile*)b;
-
-   if (bzf == NULL)
-      { BZ_SETERR(BZ_OK); return; };
-   if (!(bzf->writing))
-      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
-   if (ferror(bzf->handle))
-      { BZ_SETERR(BZ_IO_ERROR); return; };
-
-   if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0;
-   if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0;
-   if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0;
-   if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0;
-
-   if ((!abandon) && bzf->lastErr == BZ_OK) {
-      while (True) {
-         bzf->strm.avail_out = BZ_MAX_UNUSED;
-         bzf->strm.next_out = bzf->buf;
-         ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH );
-         if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END)
-            { BZ_SETERR(ret); return; };
-
-         if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
-            n = BZ_MAX_UNUSED - bzf->strm.avail_out;
-            n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), 
-                          n, bzf->handle );
-            if (n != n2 || ferror(bzf->handle))
-               { BZ_SETERR(BZ_IO_ERROR); return; };
-         }
-
-         if (ret == BZ_STREAM_END) break;
-      }
-   }
-
-   if ( !abandon && !ferror ( bzf->handle ) ) {
-      fflush ( bzf->handle );
-      if (ferror(bzf->handle))
-         { BZ_SETERR(BZ_IO_ERROR); return; };
-   }
-
-   if (nbytes_in_lo32 != NULL)
-      *nbytes_in_lo32 = bzf->strm.total_in_lo32;
-   if (nbytes_in_hi32 != NULL)
-      *nbytes_in_hi32 = bzf->strm.total_in_hi32;
-   if (nbytes_out_lo32 != NULL)
-      *nbytes_out_lo32 = bzf->strm.total_out_lo32;
-   if (nbytes_out_hi32 != NULL)
-      *nbytes_out_hi32 = bzf->strm.total_out_hi32;
-
-   BZ_SETERR(BZ_OK);
-   BZ2_bzCompressEnd ( &(bzf->strm) );
-   free ( bzf );
-}
-
-
-/*---------------------------------------------------*/
-BZFILE* BZ_API(BZ2_bzReadOpen) 
-                   ( int*  bzerror, 
-                     FILE* f, 
-                     int   verbosity,
-                     int   small,
-                     void* unused,
-                     int   nUnused )
-{
-   bzFile* bzf = NULL;
-   int     ret;
-
-   BZ_SETERR(BZ_OK);
-
-   if (f == NULL || 
-       (small != 0 && small != 1) ||
-       (verbosity < 0 || verbosity > 4) ||
-       (unused == NULL && nUnused != 0) ||
-       (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED)))
-      { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
-
-   if (ferror(f))
-      { BZ_SETERR(BZ_IO_ERROR); return NULL; };
-
-   bzf = malloc ( sizeof(bzFile) );
-   if (bzf == NULL) 
-      { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
-
-   BZ_SETERR(BZ_OK);
-
-   bzf->initialisedOk = False;
-   bzf->handle        = f;
-   bzf->bufN          = 0;
-   bzf->writing       = False;
-   bzf->strm.bzalloc  = NULL;
-   bzf->strm.bzfree   = NULL;
-   bzf->strm.opaque   = NULL;
-   
-   while (nUnused > 0) {
-      bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
-      unused = ((void*)( 1 + ((UChar*)(unused))  ));
-      nUnused--;
-   }
-
-   ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
-   if (ret != BZ_OK)
-      { BZ_SETERR(ret); free(bzf); return NULL; };
-
-   bzf->strm.avail_in = bzf->bufN;
-   bzf->strm.next_in  = bzf->buf;
-
-   bzf->initialisedOk = True;
-   return bzf;   
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
-{
-   bzFile* bzf = (bzFile*)b;
-
-   BZ_SETERR(BZ_OK);
-   if (bzf == NULL)
-      { BZ_SETERR(BZ_OK); return; };
-
-   if (bzf->writing)
-      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
-
-   if (bzf->initialisedOk)
-      (void)BZ2_bzDecompressEnd ( &(bzf->strm) );
-   free ( bzf );
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzRead) 
-           ( int*    bzerror, 
-             BZFILE* b, 
-             void*   buf, 
-             int     len )
-{
-   Int32   n, ret;
-   bzFile* bzf = (bzFile*)b;
-
-   BZ_SETERR(BZ_OK);
-
-   if (bzf == NULL || buf == NULL || len < 0)
-      { BZ_SETERR(BZ_PARAM_ERROR); return 0; };
-
-   if (bzf->writing)
-      { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; };
-
-   if (len == 0)
-      { BZ_SETERR(BZ_OK); return 0; };
-
-   bzf->strm.avail_out = len;
-   bzf->strm.next_out = buf;
-
-   while (True) {
-
-      if (ferror(bzf->handle)) 
-         { BZ_SETERR(BZ_IO_ERROR); return 0; };
-
-      if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
-         n = fread ( bzf->buf, sizeof(UChar), 
-                     BZ_MAX_UNUSED, bzf->handle );
-         if (ferror(bzf->handle))
-            { BZ_SETERR(BZ_IO_ERROR); return 0; };
-         bzf->bufN = n;
-         bzf->strm.avail_in = bzf->bufN;
-         bzf->strm.next_in = bzf->buf;
-      }
-
-      ret = BZ2_bzDecompress ( &(bzf->strm) );
-
-      if (ret != BZ_OK && ret != BZ_STREAM_END)
-         { BZ_SETERR(ret); return 0; };
-
-      if (ret == BZ_OK && myfeof(bzf->handle) && 
-          bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
-         { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; };
-
-      if (ret == BZ_STREAM_END)
-         { BZ_SETERR(BZ_STREAM_END);
-           return len - bzf->strm.avail_out; };
-      if (bzf->strm.avail_out == 0)
-         { BZ_SETERR(BZ_OK); return len; };
-      
-   }
-
-   return 0; /*not reached*/
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadGetUnused) 
-                     ( int*    bzerror, 
-                       BZFILE* b, 
-                       void**  unused, 
-                       int*    nUnused )
-{
-   bzFile* bzf = (bzFile*)b;
-   if (bzf == NULL)
-      { BZ_SETERR(BZ_PARAM_ERROR); return; };
-   if (bzf->lastErr != BZ_STREAM_END)
-      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
-   if (unused == NULL || nUnused == NULL)
-      { BZ_SETERR(BZ_PARAM_ERROR); return; };
-
-   BZ_SETERR(BZ_OK);
-   *nUnused = bzf->strm.avail_in;
-   *unused = bzf->strm.next_in;
-}
-#endif
-
-
-/*---------------------------------------------------*/
-/*--- Misc convenience stuff                      ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzBuffToBuffCompress) 
-                         ( char*         dest, 
-                           unsigned int* destLen,
-                           char*         source, 
-                           unsigned int  sourceLen,
-                           int           blockSize100k, 
-                           int           verbosity, 
-                           int           workFactor )
-{
-   bz_stream strm;
-   int ret;
-
-   if (dest == NULL || destLen == NULL || 
-       source == NULL ||
-       blockSize100k < 1 || blockSize100k > 9 ||
-       verbosity < 0 || verbosity > 4 ||
-       workFactor < 0 || workFactor > 250) 
-      return BZ_PARAM_ERROR;
-
-   if (workFactor == 0) workFactor = 30;
-   strm.bzalloc = NULL;
-   strm.bzfree = NULL;
-   strm.opaque = NULL;
-   ret = BZ2_bzCompressInit ( &strm, blockSize100k, 
-                              verbosity, workFactor );
-   if (ret != BZ_OK) return ret;
-
-   strm.next_in = source;
-   strm.next_out = dest;
-   strm.avail_in = sourceLen;
-   strm.avail_out = *destLen;
-
-   ret = BZ2_bzCompress ( &strm, BZ_FINISH );
-   if (ret == BZ_FINISH_OK) goto output_overflow;
-   if (ret != BZ_STREAM_END) goto errhandler;
-
-   /* normal termination */
-   *destLen -= strm.avail_out;   
-   BZ2_bzCompressEnd ( &strm );
-   return BZ_OK;
-
-   output_overflow:
-   BZ2_bzCompressEnd ( &strm );
-   return BZ_OUTBUFF_FULL;
-
-   errhandler:
-   BZ2_bzCompressEnd ( &strm );
-   return ret;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzBuffToBuffDecompress) 
-                           ( char*         dest, 
-                             unsigned int* destLen,
-                             char*         source, 
-                             unsigned int  sourceLen,
-                             int           small,
-                             int           verbosity )
-{
-   bz_stream strm;
-   int ret;
-
-   if (dest == NULL || destLen == NULL || 
-       source == NULL ||
-       (small != 0 && small != 1) ||
-       verbosity < 0 || verbosity > 4) 
-          return BZ_PARAM_ERROR;
-
-   strm.bzalloc = NULL;
-   strm.bzfree = NULL;
-   strm.opaque = NULL;
-   ret = BZ2_bzDecompressInit ( &strm, verbosity, small );
-   if (ret != BZ_OK) return ret;
-
-   strm.next_in = source;
-   strm.next_out = dest;
-   strm.avail_in = sourceLen;
-   strm.avail_out = *destLen;
-
-   ret = BZ2_bzDecompress ( &strm );
-   if (ret == BZ_OK) goto output_overflow_or_eof;
-   if (ret != BZ_STREAM_END) goto errhandler;
-
-   /* normal termination */
-   *destLen -= strm.avail_out;
-   BZ2_bzDecompressEnd ( &strm );
-   return BZ_OK;
-
-   output_overflow_or_eof:
-   if (strm.avail_out > 0) {
-      BZ2_bzDecompressEnd ( &strm );
-      return BZ_UNEXPECTED_EOF;
-   } else {
-      BZ2_bzDecompressEnd ( &strm );
-      return BZ_OUTBUFF_FULL;
-   };      
-
-   errhandler:
-   BZ2_bzDecompressEnd ( &strm );
-   return ret; 
-}
-
-
-/*---------------------------------------------------*/
-/*--
-   Code contributed by Yoshioka Tsuneo (tsuneo at rr.iij4u.or.jp)
-   to support better zlib compatibility.
-   This code is not _officially_ part of libbzip2 (yet);
-   I haven't tested it, documented it, or considered the
-   threading-safeness of it.
-   If this code breaks, please contact both Yoshioka and me.
---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-/*--
-   return version like "0.9.5d, 4-Sept-1999".
---*/
-const char * BZ_API(BZ2_bzlibVersion)(void)
-{
-   return BZ_VERSION;
-}
-
-
-#ifndef BZ_NO_STDIO
-/*---------------------------------------------------*/
-
-#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
-#   include <fcntl.h>
-#   include <io.h>
-#   define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)
-#else
-#   define SET_BINARY_MODE(file)
-#endif
-static
-BZFILE * bzopen_or_bzdopen
-               ( const char *path,   /* no use when bzdopen */
-                 int fd,             /* no use when bzdopen */
-                 const char *mode,
-                 int open_mode)      /* bzopen: 0, bzdopen:1 */
-{
-   int    bzerr;
-   char   unused[BZ_MAX_UNUSED];
-   int    blockSize100k = 9;
-   int    writing       = 0;
-   char   mode2[10]     = "";
-   FILE   *fp           = NULL;
-   BZFILE *bzfp         = NULL;
-   int    verbosity     = 0;
-   int    workFactor    = 30;
-   int    smallMode     = 0;
-   int    nUnused       = 0; 
-
-   if (mode == NULL) return NULL;
-   while (*mode) {
-      switch (*mode) {
-      case 'r':
-         writing = 0; break;
-      case 'w':
-         writing = 1; break;
-      case 's':
-         smallMode = 1; break;
-      default:
-         if (isdigit((int)(*mode))) {
-            blockSize100k = *mode-BZ_HDR_0;
-         }
-      }
-      mode++;
-   }
-   strcat(mode2, writing ? "w" : "r" );
-   strcat(mode2,"b");   /* binary mode */
-
-   if (open_mode==0) {
-      if (path==NULL || strcmp(path,"")==0) {
-        fp = (writing ? stdout : stdin);
-        SET_BINARY_MODE(fp);
-      } else {
-        fp = fopen(path,mode2);
-      }
-   } else {
-#ifdef BZ_STRICT_ANSI
-      fp = NULL;
-#else
-      fp = fdopen(fd,mode2);
-#endif
-   }
-   if (fp == NULL) return NULL;
-
-   if (writing) {
-      /* Guard against total chaos and anarchy -- JRS */
-      if (blockSize100k < 1) blockSize100k = 1;
-      if (blockSize100k > 9) blockSize100k = 9; 
-      bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
-                             verbosity,workFactor);
-   } else {
-      bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
-                            unused,nUnused);
-   }
-   if (bzfp == NULL) {
-      if (fp != stdin && fp != stdout) fclose(fp);
-      return NULL;
-   }
-   return bzfp;
-}
-
-
-/*---------------------------------------------------*/
-/*--
-   open file for read or write.
-      ex) bzopen("file","w9")
-      case path="" or NULL => use stdin or stdout.
---*/
-BZFILE * BZ_API(BZ2_bzopen)
-               ( const char *path,
-                 const char *mode )
-{
-   return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0);
-}
-
-
-/*---------------------------------------------------*/
-BZFILE * BZ_API(BZ2_bzdopen)
-               ( int fd,
-                 const char *mode )
-{
-   return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1);
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
-{
-   int bzerr, nread;
-   if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0;
-   nread = BZ2_bzRead(&bzerr,b,buf,len);
-   if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) {
-      return nread;
-   } else {
-      return -1;
-   }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
-{
-   int bzerr;
-
-   BZ2_bzWrite(&bzerr,b,buf,len);
-   if(bzerr == BZ_OK){
-      return len;
-   }else{
-      return -1;
-   }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzflush) (BZFILE *b)
-{
-   /* do nothing now... */
-   return 0;
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzclose) (BZFILE* b)
-{
-   int bzerr;
-   FILE *fp;
-   
-   if (b==NULL) {return;}
-   fp = ((bzFile *)b)->handle;
-   if(((bzFile*)b)->writing){
-      BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
-      if(bzerr != BZ_OK){
-         BZ2_bzWriteClose(NULL,b,1,NULL,NULL);
-      }
-   }else{
-      BZ2_bzReadClose(&bzerr,b);
-   }
-   if(fp!=stdin && fp!=stdout){
-      fclose(fp);
-   }
-}
-
-
-/*---------------------------------------------------*/
-/*--
-   return last error code 
---*/
-static const char *bzerrorstrings[] = {
-       "OK"
-      ,"SEQUENCE_ERROR"
-      ,"PARAM_ERROR"
-      ,"MEM_ERROR"
-      ,"DATA_ERROR"
-      ,"DATA_ERROR_MAGIC"
-      ,"IO_ERROR"
-      ,"UNEXPECTED_EOF"
-      ,"OUTBUFF_FULL"
-      ,"CONFIG_ERROR"
-      ,"???"   /* for future */
-      ,"???"   /* for future */
-      ,"???"   /* for future */
-      ,"???"   /* for future */
-      ,"???"   /* for future */
-      ,"???"   /* for future */
-};
-
-
-const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
-{
-   int err = ((bzFile *)b)->lastErr;
-
-   if(err>0) err = 0;
-   *errnum = err;
-   return bzerrorstrings[err*-1];
-}
-#endif
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                           bzlib.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/bzlib.h b/examples/C/hdf5plugins/bzlib.h
deleted file mode 100644
index 8277123..0000000
--- a/examples/C/hdf5plugins/bzlib.h
+++ /dev/null
@@ -1,282 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Public header file for the library.                   ---*/
-/*---                                               bzlib.h ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#ifndef _BZLIB_H
-#define _BZLIB_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BZ_RUN               0
-#define BZ_FLUSH             1
-#define BZ_FINISH            2
-
-#define BZ_OK                0
-#define BZ_RUN_OK            1
-#define BZ_FLUSH_OK          2
-#define BZ_FINISH_OK         3
-#define BZ_STREAM_END        4
-#define BZ_SEQUENCE_ERROR    (-1)
-#define BZ_PARAM_ERROR       (-2)
-#define BZ_MEM_ERROR         (-3)
-#define BZ_DATA_ERROR        (-4)
-#define BZ_DATA_ERROR_MAGIC  (-5)
-#define BZ_IO_ERROR          (-6)
-#define BZ_UNEXPECTED_EOF    (-7)
-#define BZ_OUTBUFF_FULL      (-8)
-#define BZ_CONFIG_ERROR      (-9)
-
-typedef 
-   struct {
-      char *next_in;
-      unsigned int avail_in;
-      unsigned int total_in_lo32;
-      unsigned int total_in_hi32;
-
-      char *next_out;
-      unsigned int avail_out;
-      unsigned int total_out_lo32;
-      unsigned int total_out_hi32;
-
-      void *state;
-
-      void *(*bzalloc)(void *,int,int);
-      void (*bzfree)(void *,void *);
-      void *opaque;
-   } 
-   bz_stream;
-
-
-#ifndef BZ_IMPORT
-#define BZ_EXPORT
-#endif
-
-#ifndef BZ_NO_STDIO
-/* Need a definitition for FILE */
-#include <stdio.h>
-#endif
-
-#ifdef _WIN32
-#   include <windows.h>
-#   ifdef small
-      /* windows.h define small to char */
-#      undef small
-#   endif
-#   ifdef BZ_EXPORT
-#   define BZ_API(func) WINAPI func
-#   define BZ_EXTERN extern
-#   else
-   /* import windows dll dynamically */
-#   define BZ_API(func) (WINAPI * func)
-#   define BZ_EXTERN
-#   endif
-#else
-#   define BZ_API(func) func
-#   define BZ_EXTERN extern
-#endif
-
-
-/*-- Core (low-level) library functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
-      bz_stream* strm, 
-      int        blockSize100k, 
-      int        verbosity, 
-      int        workFactor 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
-      bz_stream* strm, 
-      int action 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 
-      bz_stream* strm 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 
-      bz_stream *strm, 
-      int       verbosity, 
-      int       small
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
-      bz_stream* strm 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 
-      bz_stream *strm 
-   );
-
-
-
-/*-- High(er) level library functions --*/
-
-#ifndef BZ_NO_STDIO
-#define BZ_MAX_UNUSED 5000
-
-typedef void BZFILE;
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 
-      int*  bzerror,   
-      FILE* f, 
-      int   verbosity, 
-      int   small,
-      void* unused,    
-      int   nUnused 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 
-      int*    bzerror, 
-      BZFILE* b 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 
-      int*    bzerror, 
-      BZFILE* b, 
-      void**  unused,  
-      int*    nUnused 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzRead) ( 
-      int*    bzerror, 
-      BZFILE* b, 
-      void*   buf, 
-      int     len 
-   );
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 
-      int*  bzerror,      
-      FILE* f, 
-      int   blockSize100k, 
-      int   verbosity, 
-      int   workFactor 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 
-      int*    bzerror, 
-      BZFILE* b, 
-      void*   buf, 
-      int     len 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 
-      int*          bzerror, 
-      BZFILE*       b, 
-      int           abandon, 
-      unsigned int* nbytes_in, 
-      unsigned int* nbytes_out 
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 
-      int*          bzerror, 
-      BZFILE*       b, 
-      int           abandon, 
-      unsigned int* nbytes_in_lo32, 
-      unsigned int* nbytes_in_hi32, 
-      unsigned int* nbytes_out_lo32, 
-      unsigned int* nbytes_out_hi32
-   );
-#endif
-
-
-/*-- Utility functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 
-      char*         dest, 
-      unsigned int* destLen,
-      char*         source, 
-      unsigned int  sourceLen,
-      int           blockSize100k, 
-      int           verbosity, 
-      int           workFactor 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 
-      char*         dest, 
-      unsigned int* destLen,
-      char*         source, 
-      unsigned int  sourceLen,
-      int           small, 
-      int           verbosity 
-   );
-
-
-/*--
-   Code contributed by Yoshioka Tsuneo (tsuneo at rr.iij4u.or.jp)
-   to support better zlib compatibility.
-   This code is not _officially_ part of libbzip2 (yet);
-   I haven't tested it, documented it, or considered the
-   threading-safeness of it.
-   If this code breaks, please contact both Yoshioka and me.
---*/
-
-BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
-      void
-   );
-
-#ifndef BZ_NO_STDIO
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
-      const char *path,
-      const char *mode
-   );
-
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
-      int        fd,
-      const char *mode
-   );
-         
-BZ_EXTERN int BZ_API(BZ2_bzread) (
-      BZFILE* b, 
-      void* buf, 
-      int len 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzwrite) (
-      BZFILE* b, 
-      void*   buf, 
-      int     len 
-   );
-
-BZ_EXTERN int BZ_API(BZ2_bzflush) (
-      BZFILE* b
-   );
-
-BZ_EXTERN void BZ_API(BZ2_bzclose) (
-      BZFILE* b
-   );
-
-BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
-      BZFILE *b, 
-      int    *errnum
-   );
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*-------------------------------------------------------------*/
-/*--- end                                           bzlib.h ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/bzlib_private.h b/examples/C/hdf5plugins/bzlib_private.h
deleted file mode 100644
index 5d0217f..0000000
--- a/examples/C/hdf5plugins/bzlib_private.h
+++ /dev/null
@@ -1,509 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Private header file for the library.                  ---*/
-/*---                                       bzlib_private.h ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#ifndef _BZLIB_PRIVATE_H
-#define _BZLIB_PRIVATE_H
-
-#include <stdlib.h>
-
-#ifndef BZ_NO_STDIO
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#endif
-
-#include "bzlib.h"
-
-
-
-/*-- General stuff. --*/
-
-#define BZ_VERSION  "1.0.6, 6-Sept-2010"
-
-typedef char            Char;
-typedef unsigned char   Bool;
-typedef unsigned char   UChar;
-typedef int             Int32;
-typedef unsigned int    UInt32;
-typedef short           Int16;
-typedef unsigned short  UInt16;
-
-#define True  ((Bool)1)
-#define False ((Bool)0)
-
-#ifndef __GNUC__
-#define __inline__  /* */
-#endif 
-
-#ifndef BZ_NO_STDIO
-
-extern void BZ2_bz__AssertH__fail ( int errcode );
-#define AssertH(cond,errcode) \
-   { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
-
-#if BZ_DEBUG
-#define AssertD(cond,msg) \
-   { if (!(cond)) {       \
-      fprintf ( stderr,   \
-        "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
-      exit(1); \
-   }}
-#else
-#define AssertD(cond,msg) /* */
-#endif
-
-#define VPrintf0(zf) \
-   fprintf(stderr,zf)
-#define VPrintf1(zf,za1) \
-   fprintf(stderr,zf,za1)
-#define VPrintf2(zf,za1,za2) \
-   fprintf(stderr,zf,za1,za2)
-#define VPrintf3(zf,za1,za2,za3) \
-   fprintf(stderr,zf,za1,za2,za3)
-#define VPrintf4(zf,za1,za2,za3,za4) \
-   fprintf(stderr,zf,za1,za2,za3,za4)
-#define VPrintf5(zf,za1,za2,za3,za4,za5) \
-   fprintf(stderr,zf,za1,za2,za3,za4,za5)
-
-#else
-
-extern void bz_internal_error ( int errcode );
-#define AssertH(cond,errcode) \
-   { if (!(cond)) bz_internal_error ( errcode ); }
-#define AssertD(cond,msg)                do { } while (0)
-#define VPrintf0(zf)                     do { } while (0)
-#define VPrintf1(zf,za1)                 do { } while (0)
-#define VPrintf2(zf,za1,za2)             do { } while (0)
-#define VPrintf3(zf,za1,za2,za3)         do { } while (0)
-#define VPrintf4(zf,za1,za2,za3,za4)     do { } while (0)
-#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0)
-
-#endif
-
-
-#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1)
-#define BZFREE(ppp)  (strm->bzfree)(strm->opaque,(ppp))
-
-
-/*-- Header bytes. --*/
-
-#define BZ_HDR_B 0x42   /* 'B' */
-#define BZ_HDR_Z 0x5a   /* 'Z' */
-#define BZ_HDR_h 0x68   /* 'h' */
-#define BZ_HDR_0 0x30   /* '0' */
-  
-/*-- Constants for the back end. --*/
-
-#define BZ_MAX_ALPHA_SIZE 258
-#define BZ_MAX_CODE_LEN    23
-
-#define BZ_RUNA 0
-#define BZ_RUNB 1
-
-#define BZ_N_GROUPS 6
-#define BZ_G_SIZE   50
-#define BZ_N_ITERS  4
-
-#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE))
-
-
-
-/*-- Stuff for randomising repetitive blocks. --*/
-
-extern Int32 BZ2_rNums[512];
-
-#define BZ_RAND_DECLS                          \
-   Int32 rNToGo;                               \
-   Int32 rTPos                                 \
-
-#define BZ_RAND_INIT_MASK                      \
-   s->rNToGo = 0;                              \
-   s->rTPos  = 0                               \
-
-#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0)
-
-#define BZ_RAND_UPD_MASK                       \
-   if (s->rNToGo == 0) {                       \
-      s->rNToGo = BZ2_rNums[s->rTPos];         \
-      s->rTPos++;                              \
-      if (s->rTPos == 512) s->rTPos = 0;       \
-   }                                           \
-   s->rNToGo--;
-
-
-
-/*-- Stuff for doing CRCs. --*/
-
-extern UInt32 BZ2_crc32Table[256];
-
-#define BZ_INITIALISE_CRC(crcVar)              \
-{                                              \
-   crcVar = 0xffffffffL;                       \
-}
-
-#define BZ_FINALISE_CRC(crcVar)                \
-{                                              \
-   crcVar = ~(crcVar);                         \
-}
-
-#define BZ_UPDATE_CRC(crcVar,cha)              \
-{                                              \
-   crcVar = (crcVar << 8) ^                    \
-            BZ2_crc32Table[(crcVar >> 24) ^    \
-                           ((UChar)cha)];      \
-}
-
-
-
-/*-- States and modes for compression. --*/
-
-#define BZ_M_IDLE      1
-#define BZ_M_RUNNING   2
-#define BZ_M_FLUSHING  3
-#define BZ_M_FINISHING 4
-
-#define BZ_S_OUTPUT    1
-#define BZ_S_INPUT     2
-
-#define BZ_N_RADIX 2
-#define BZ_N_QSORT 12
-#define BZ_N_SHELL 18
-#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2)
-
-
-
-
-/*-- Structure holding all the compression-side stuff. --*/
-
-typedef
-   struct {
-      /* pointer back to the struct bz_stream */
-      bz_stream* strm;
-
-      /* mode this stream is in, and whether inputting */
-      /* or outputting data */
-      Int32    mode;
-      Int32    state;
-
-      /* remembers avail_in when flush/finish requested */
-      UInt32   avail_in_expect;
-
-      /* for doing the block sorting */
-      UInt32*  arr1;
-      UInt32*  arr2;
-      UInt32*  ftab;
-      Int32    origPtr;
-
-      /* aliases for arr1 and arr2 */
-      UInt32*  ptr;
-      UChar*   block;
-      UInt16*  mtfv;
-      UChar*   zbits;
-
-      /* for deciding when to use the fallback sorting algorithm */
-      Int32    workFactor;
-
-      /* run-length-encoding of the input */
-      UInt32   state_in_ch;
-      Int32    state_in_len;
-      BZ_RAND_DECLS;
-
-      /* input and output limits and current posns */
-      Int32    nblock;
-      Int32    nblockMAX;
-      Int32    numZ;
-      Int32    state_out_pos;
-
-      /* map of bytes used in block */
-      Int32    nInUse;
-      Bool     inUse[256];
-      UChar    unseqToSeq[256];
-
-      /* the buffer for bit stream creation */
-      UInt32   bsBuff;
-      Int32    bsLive;
-
-      /* block and combined CRCs */
-      UInt32   blockCRC;
-      UInt32   combinedCRC;
-
-      /* misc administratium */
-      Int32    verbosity;
-      Int32    blockNo;
-      Int32    blockSize100k;
-
-      /* stuff for coding the MTF values */
-      Int32    nMTF;
-      Int32    mtfFreq    [BZ_MAX_ALPHA_SIZE];
-      UChar    selector   [BZ_MAX_SELECTORS];
-      UChar    selectorMtf[BZ_MAX_SELECTORS];
-
-      UChar    len     [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-      Int32    code    [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-      Int32    rfreq   [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-      /* second dimension: only 3 needed; 4 makes index calculations faster */
-      UInt32   len_pack[BZ_MAX_ALPHA_SIZE][4];
-
-   }
-   EState;
-
-
-
-/*-- externs for compression. --*/
-
-extern void 
-BZ2_blockSort ( EState* );
-
-extern void 
-BZ2_compressBlock ( EState*, Bool );
-
-extern void 
-BZ2_bsInitWrite ( EState* );
-
-extern void 
-BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
-
-extern void 
-BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
-
-
-
-/*-- states for decompression. --*/
-
-#define BZ_X_IDLE        1
-#define BZ_X_OUTPUT      2
-
-#define BZ_X_MAGIC_1     10
-#define BZ_X_MAGIC_2     11
-#define BZ_X_MAGIC_3     12
-#define BZ_X_MAGIC_4     13
-#define BZ_X_BLKHDR_1    14
-#define BZ_X_BLKHDR_2    15
-#define BZ_X_BLKHDR_3    16
-#define BZ_X_BLKHDR_4    17
-#define BZ_X_BLKHDR_5    18
-#define BZ_X_BLKHDR_6    19
-#define BZ_X_BCRC_1      20
-#define BZ_X_BCRC_2      21
-#define BZ_X_BCRC_3      22
-#define BZ_X_BCRC_4      23
-#define BZ_X_RANDBIT     24
-#define BZ_X_ORIGPTR_1   25
-#define BZ_X_ORIGPTR_2   26
-#define BZ_X_ORIGPTR_3   27
-#define BZ_X_MAPPING_1   28
-#define BZ_X_MAPPING_2   29
-#define BZ_X_SELECTOR_1  30
-#define BZ_X_SELECTOR_2  31
-#define BZ_X_SELECTOR_3  32
-#define BZ_X_CODING_1    33
-#define BZ_X_CODING_2    34
-#define BZ_X_CODING_3    35
-#define BZ_X_MTF_1       36
-#define BZ_X_MTF_2       37
-#define BZ_X_MTF_3       38
-#define BZ_X_MTF_4       39
-#define BZ_X_MTF_5       40
-#define BZ_X_MTF_6       41
-#define BZ_X_ENDHDR_2    42
-#define BZ_X_ENDHDR_3    43
-#define BZ_X_ENDHDR_4    44
-#define BZ_X_ENDHDR_5    45
-#define BZ_X_ENDHDR_6    46
-#define BZ_X_CCRC_1      47
-#define BZ_X_CCRC_2      48
-#define BZ_X_CCRC_3      49
-#define BZ_X_CCRC_4      50
-
-
-
-/*-- Constants for the fast MTF decoder. --*/
-
-#define MTFA_SIZE 4096
-#define MTFL_SIZE 16
-
-
-
-/*-- Structure holding all the decompression-side stuff. --*/
-
-typedef
-   struct {
-      /* pointer back to the struct bz_stream */
-      bz_stream* strm;
-
-      /* state indicator for this stream */
-      Int32    state;
-
-      /* for doing the final run-length decoding */
-      UChar    state_out_ch;
-      Int32    state_out_len;
-      Bool     blockRandomised;
-      BZ_RAND_DECLS;
-
-      /* the buffer for bit stream reading */
-      UInt32   bsBuff;
-      Int32    bsLive;
-
-      /* misc administratium */
-      Int32    blockSize100k;
-      Bool     smallDecompress;
-      Int32    currBlockNo;
-      Int32    verbosity;
-
-      /* for undoing the Burrows-Wheeler transform */
-      Int32    origPtr;
-      UInt32   tPos;
-      Int32    k0;
-      Int32    unzftab[256];
-      Int32    nblock_used;
-      Int32    cftab[257];
-      Int32    cftabCopy[257];
-
-      /* for undoing the Burrows-Wheeler transform (FAST) */
-      UInt32   *tt;
-
-      /* for undoing the Burrows-Wheeler transform (SMALL) */
-      UInt16   *ll16;
-      UChar    *ll4;
-
-      /* stored and calculated CRCs */
-      UInt32   storedBlockCRC;
-      UInt32   storedCombinedCRC;
-      UInt32   calculatedBlockCRC;
-      UInt32   calculatedCombinedCRC;
-
-      /* map of bytes used in block */
-      Int32    nInUse;
-      Bool     inUse[256];
-      Bool     inUse16[16];
-      UChar    seqToUnseq[256];
-
-      /* for decoding the MTF values */
-      UChar    mtfa   [MTFA_SIZE];
-      Int32    mtfbase[256 / MTFL_SIZE];
-      UChar    selector   [BZ_MAX_SELECTORS];
-      UChar    selectorMtf[BZ_MAX_SELECTORS];
-      UChar    len  [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-
-      Int32    limit  [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-      Int32    base   [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-      Int32    perm   [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-      Int32    minLens[BZ_N_GROUPS];
-
-      /* save area for scalars in the main decompress code */
-      Int32    save_i;
-      Int32    save_j;
-      Int32    save_t;
-      Int32    save_alphaSize;
-      Int32    save_nGroups;
-      Int32    save_nSelectors;
-      Int32    save_EOB;
-      Int32    save_groupNo;
-      Int32    save_groupPos;
-      Int32    save_nextSym;
-      Int32    save_nblockMAX;
-      Int32    save_nblock;
-      Int32    save_es;
-      Int32    save_N;
-      Int32    save_curr;
-      Int32    save_zt;
-      Int32    save_zn; 
-      Int32    save_zvec;
-      Int32    save_zj;
-      Int32    save_gSel;
-      Int32    save_gMinlen;
-      Int32*   save_gLimit;
-      Int32*   save_gBase;
-      Int32*   save_gPerm;
-
-   }
-   DState;
-
-
-
-/*-- Macros for decompression. --*/
-
-#define BZ_GET_FAST(cccc)                     \
-    /* c_tPos is unsigned, hence test < 0 is pointless. */ \
-    if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
-    s->tPos = s->tt[s->tPos];                 \
-    cccc = (UChar)(s->tPos & 0xff);           \
-    s->tPos >>= 8;
-
-#define BZ_GET_FAST_C(cccc)                   \
-    /* c_tPos is unsigned, hence test < 0 is pointless. */ \
-    if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \
-    c_tPos = c_tt[c_tPos];                    \
-    cccc = (UChar)(c_tPos & 0xff);            \
-    c_tPos >>= 8;
-
-#define SET_LL4(i,n)                                          \
-   { if (((i) & 0x1) == 0)                                    \
-        s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else    \
-        s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4);  \
-   }
-
-#define GET_LL4(i)                             \
-   ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF)
-
-#define SET_LL(i,n)                          \
-   { s->ll16[i] = (UInt16)(n & 0x0000ffff);  \
-     SET_LL4(i, n >> 16);                    \
-   }
-
-#define GET_LL(i) \
-   (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16))
-
-#define BZ_GET_SMALL(cccc)                            \
-    /* c_tPos is unsigned, hence test < 0 is pointless. */ \
-    if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
-    cccc = BZ2_indexIntoF ( s->tPos, s->cftab );    \
-    s->tPos = GET_LL(s->tPos);
-
-
-/*-- externs for decompression. --*/
-
-extern Int32 
-BZ2_indexIntoF ( Int32, Int32* );
-
-extern Int32 
-BZ2_decompress ( DState* );
-
-extern void 
-BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
-                           Int32,  Int32, Int32 );
-
-
-#endif
-
-
-/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
-
-#ifdef BZ_NO_STDIO
-#ifndef NULL
-#define NULL 0
-#endif
-#endif
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                   bzlib_private.h ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/compress.c b/examples/C/hdf5plugins/compress.c
deleted file mode 100644
index caf7696..0000000
--- a/examples/C/hdf5plugins/compress.c
+++ /dev/null
@@ -1,672 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Compression machinery (not incl block sorting)        ---*/
-/*---                                            compress.c ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-/* CHANGES
-    0.9.0    -- original version.
-    0.9.0a/b -- no changes in this file.
-    0.9.0c   -- changed setting of nGroups in sendMTFValues() 
-                so as to do a bit better on small files
-*/
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-/*--- Bit stream I/O                              ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-void BZ2_bsInitWrite ( EState* s )
-{
-   s->bsLive = 0;
-   s->bsBuff = 0;
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsFinishWrite ( EState* s )
-{
-   while (s->bsLive > 0) {
-      s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24);
-      s->numZ++;
-      s->bsBuff <<= 8;
-      s->bsLive -= 8;
-   }
-}
-
-
-/*---------------------------------------------------*/
-#define bsNEEDW(nz)                           \
-{                                             \
-   while (s->bsLive >= 8) {                   \
-      s->zbits[s->numZ]                       \
-         = (UChar)(s->bsBuff >> 24);          \
-      s->numZ++;                              \
-      s->bsBuff <<= 8;                        \
-      s->bsLive -= 8;                         \
-   }                                          \
-}
-
-
-/*---------------------------------------------------*/
-static
-__inline__
-void bsW ( EState* s, Int32 n, UInt32 v )
-{
-   bsNEEDW ( n );
-   s->bsBuff |= (v << (32 - s->bsLive - n));
-   s->bsLive += n;
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsPutUInt32 ( EState* s, UInt32 u )
-{
-   bsW ( s, 8, (u >> 24) & 0xffL );
-   bsW ( s, 8, (u >> 16) & 0xffL );
-   bsW ( s, 8, (u >>  8) & 0xffL );
-   bsW ( s, 8,  u        & 0xffL );
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsPutUChar ( EState* s, UChar c )
-{
-   bsW( s, 8, (UInt32)c );
-}
-
-
-/*---------------------------------------------------*/
-/*--- The back end proper                         ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-static
-void makeMaps_e ( EState* s )
-{
-   Int32 i;
-   s->nInUse = 0;
-   for (i = 0; i < 256; i++)
-      if (s->inUse[i]) {
-         s->unseqToSeq[i] = s->nInUse;
-         s->nInUse++;
-      }
-}
-
-
-/*---------------------------------------------------*/
-static
-void generateMTFValues ( EState* s )
-{
-   UChar   yy[256];
-   Int32   i, j;
-   Int32   zPend;
-   Int32   wr;
-   Int32   EOB;
-
-   /* 
-      After sorting (eg, here),
-         s->arr1 [ 0 .. s->nblock-1 ] holds sorted order,
-         and
-         ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] 
-         holds the original block data.
-
-      The first thing to do is generate the MTF values,
-      and put them in
-         ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ].
-      Because there are strictly fewer or equal MTF values
-      than block values, ptr values in this area are overwritten
-      with MTF values only when they are no longer needed.
-
-      The final compressed bitstream is generated into the
-      area starting at
-         (UChar*) (&((UChar*)s->arr2)[s->nblock])
-
-      These storage aliases are set up in bzCompressInit(),
-      except for the last one, which is arranged in 
-      compressBlock().
-   */
-   UInt32* ptr   = s->ptr;
-   UChar* block  = s->block;
-   UInt16* mtfv  = s->mtfv;
-
-   makeMaps_e ( s );
-   EOB = s->nInUse+1;
-
-   for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0;
-
-   wr = 0;
-   zPend = 0;
-   for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i;
-
-   for (i = 0; i < s->nblock; i++) {
-      UChar ll_i;
-      AssertD ( wr <= i, "generateMTFValues(1)" );
-      j = ptr[i]-1; if (j < 0) j += s->nblock;
-      ll_i = s->unseqToSeq[block[j]];
-      AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
-
-      if (yy[0] == ll_i) { 
-         zPend++;
-      } else {
-
-         if (zPend > 0) {
-            zPend--;
-            while (True) {
-               if (zPend & 1) {
-                  mtfv[wr] = BZ_RUNB; wr++; 
-                  s->mtfFreq[BZ_RUNB]++; 
-               } else {
-                  mtfv[wr] = BZ_RUNA; wr++; 
-                  s->mtfFreq[BZ_RUNA]++; 
-               }
-               if (zPend < 2) break;
-               zPend = (zPend - 2) / 2;
-            };
-            zPend = 0;
-         }
-         {
-            register UChar  rtmp;
-            register UChar* ryy_j;
-            register UChar  rll_i;
-            rtmp  = yy[1];
-            yy[1] = yy[0];
-            ryy_j = &(yy[1]);
-            rll_i = ll_i;
-            while ( rll_i != rtmp ) {
-               register UChar rtmp2;
-               ryy_j++;
-               rtmp2  = rtmp;
-               rtmp   = *ryy_j;
-               *ryy_j = rtmp2;
-            };
-            yy[0] = rtmp;
-            j = ryy_j - &(yy[0]);
-            mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++;
-         }
-
-      }
-   }
-
-   if (zPend > 0) {
-      zPend--;
-      while (True) {
-         if (zPend & 1) {
-            mtfv[wr] = BZ_RUNB; wr++; 
-            s->mtfFreq[BZ_RUNB]++; 
-         } else {
-            mtfv[wr] = BZ_RUNA; wr++; 
-            s->mtfFreq[BZ_RUNA]++; 
-         }
-         if (zPend < 2) break;
-         zPend = (zPend - 2) / 2;
-      };
-      zPend = 0;
-   }
-
-   mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++;
-
-   s->nMTF = wr;
-}
-
-
-/*---------------------------------------------------*/
-#define BZ_LESSER_ICOST  0
-#define BZ_GREATER_ICOST 15
-
-static
-void sendMTFValues ( EState* s )
-{
-   Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
-   Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
-   Int32 nGroups, nBytes;
-
-   /*--
-   UChar  len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-   is a global since the decoder also needs it.
-
-   Int32  code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-   Int32  rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-   are also globals only used in this proc.
-   Made global to keep stack frame size small.
-   --*/
-
-
-   UInt16 cost[BZ_N_GROUPS];
-   Int32  fave[BZ_N_GROUPS];
-
-   UInt16* mtfv = s->mtfv;
-
-   if (s->verbosity >= 3)
-      VPrintf3( "      %d in block, %d after MTF & 1-2 coding, "
-                "%d+2 syms in use\n", 
-                s->nblock, s->nMTF, s->nInUse );
-
-   alphaSize = s->nInUse+2;
-   for (t = 0; t < BZ_N_GROUPS; t++)
-      for (v = 0; v < alphaSize; v++)
-         s->len[t][v] = BZ_GREATER_ICOST;
-
-   /*--- Decide how many coding tables to use ---*/
-   AssertH ( s->nMTF > 0, 3001 );
-   if (s->nMTF < 200)  nGroups = 2; else
-   if (s->nMTF < 600)  nGroups = 3; else
-   if (s->nMTF < 1200) nGroups = 4; else
-   if (s->nMTF < 2400) nGroups = 5; else
-                       nGroups = 6;
-
-   /*--- Generate an initial set of coding tables ---*/
-   { 
-      Int32 nPart, remF, tFreq, aFreq;
-
-      nPart = nGroups;
-      remF  = s->nMTF;
-      gs = 0;
-      while (nPart > 0) {
-         tFreq = remF / nPart;
-         ge = gs-1;
-         aFreq = 0;
-         while (aFreq < tFreq && ge < alphaSize-1) {
-            ge++;
-            aFreq += s->mtfFreq[ge];
-         }
-
-         if (ge > gs 
-             && nPart != nGroups && nPart != 1 
-             && ((nGroups-nPart) % 2 == 1)) {
-            aFreq -= s->mtfFreq[ge];
-            ge--;
-         }
-
-         if (s->verbosity >= 3)
-            VPrintf5( "      initial group %d, [%d .. %d], "
-                      "has %d syms (%4.1f%%)\n",
-                      nPart, gs, ge, aFreq, 
-                      (100.0 * (float)aFreq) / (float)(s->nMTF) );
- 
-         for (v = 0; v < alphaSize; v++)
-            if (v >= gs && v <= ge) 
-               s->len[nPart-1][v] = BZ_LESSER_ICOST; else
-               s->len[nPart-1][v] = BZ_GREATER_ICOST;
- 
-         nPart--;
-         gs = ge+1;
-         remF -= aFreq;
-      }
-   }
-
-   /*--- 
-      Iterate up to BZ_N_ITERS times to improve the tables.
-   ---*/
-   for (iter = 0; iter < BZ_N_ITERS; iter++) {
-
-      for (t = 0; t < nGroups; t++) fave[t] = 0;
-
-      for (t = 0; t < nGroups; t++)
-         for (v = 0; v < alphaSize; v++)
-            s->rfreq[t][v] = 0;
-
-      /*---
-        Set up an auxiliary length table which is used to fast-track
-	the common case (nGroups == 6). 
-      ---*/
-      if (nGroups == 6) {
-         for (v = 0; v < alphaSize; v++) {
-            s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
-            s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
-            s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
-	 }
-      }
-
-      nSelectors = 0;
-      totc = 0;
-      gs = 0;
-      while (True) {
-
-         /*--- Set group start & end marks. --*/
-         if (gs >= s->nMTF) break;
-         ge = gs + BZ_G_SIZE - 1; 
-         if (ge >= s->nMTF) ge = s->nMTF-1;
-
-         /*-- 
-            Calculate the cost of this group as coded
-            by each of the coding tables.
-         --*/
-         for (t = 0; t < nGroups; t++) cost[t] = 0;
-
-         if (nGroups == 6 && 50 == ge-gs+1) {
-            /*--- fast track the common case ---*/
-            register UInt32 cost01, cost23, cost45;
-            register UInt16 icv;
-            cost01 = cost23 = cost45 = 0;
-
-#           define BZ_ITER(nn)                \
-               icv = mtfv[gs+(nn)];           \
-               cost01 += s->len_pack[icv][0]; \
-               cost23 += s->len_pack[icv][1]; \
-               cost45 += s->len_pack[icv][2]; \
-
-            BZ_ITER(0);  BZ_ITER(1);  BZ_ITER(2);  BZ_ITER(3);  BZ_ITER(4);
-            BZ_ITER(5);  BZ_ITER(6);  BZ_ITER(7);  BZ_ITER(8);  BZ_ITER(9);
-            BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14);
-            BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19);
-            BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24);
-            BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29);
-            BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34);
-            BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39);
-            BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44);
-            BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49);
-
-#           undef BZ_ITER
-
-            cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16;
-            cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16;
-            cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
-
-         } else {
-	    /*--- slow version which correctly handles all situations ---*/
-            for (i = gs; i <= ge; i++) { 
-               UInt16 icv = mtfv[i];
-               for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
-            }
-         }
- 
-         /*-- 
-            Find the coding table which is best for this group,
-            and record its identity in the selector table.
-         --*/
-         bc = 999999999; bt = -1;
-         for (t = 0; t < nGroups; t++)
-            if (cost[t] < bc) { bc = cost[t]; bt = t; };
-         totc += bc;
-         fave[bt]++;
-         s->selector[nSelectors] = bt;
-         nSelectors++;
-
-         /*-- 
-            Increment the symbol frequencies for the selected table.
-          --*/
-         if (nGroups == 6 && 50 == ge-gs+1) {
-            /*--- fast track the common case ---*/
-
-#           define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++
-
-            BZ_ITUR(0);  BZ_ITUR(1);  BZ_ITUR(2);  BZ_ITUR(3);  BZ_ITUR(4);
-            BZ_ITUR(5);  BZ_ITUR(6);  BZ_ITUR(7);  BZ_ITUR(8);  BZ_ITUR(9);
-            BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14);
-            BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19);
-            BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24);
-            BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29);
-            BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34);
-            BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39);
-            BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44);
-            BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49);
-
-#           undef BZ_ITUR
-
-         } else {
-	    /*--- slow version which correctly handles all situations ---*/
-            for (i = gs; i <= ge; i++)
-               s->rfreq[bt][ mtfv[i] ]++;
-         }
-
-         gs = ge+1;
-      }
-      if (s->verbosity >= 3) {
-         VPrintf2 ( "      pass %d: size is %d, grp uses are ", 
-                   iter+1, totc/8 );
-         for (t = 0; t < nGroups; t++)
-            VPrintf1 ( "%d ", fave[t] );
-         VPrintf0 ( "\n" );
-      }
-
-      /*--
-        Recompute the tables based on the accumulated frequencies.
-      --*/
-      /* maxLen was changed from 20 to 17 in bzip2-1.0.3.  See 
-         comment in huffman.c for details. */
-      for (t = 0; t < nGroups; t++)
-         BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), 
-                                 alphaSize, 17 /*20*/ );
-   }
-
-
-   AssertH( nGroups < 8, 3002 );
-   AssertH( nSelectors < 32768 &&
-            nSelectors <= (2 + (900000 / BZ_G_SIZE)),
-            3003 );
-
-
-   /*--- Compute MTF values for the selectors. ---*/
-   {
-      UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp;
-      for (i = 0; i < nGroups; i++) pos[i] = i;
-      for (i = 0; i < nSelectors; i++) {
-         ll_i = s->selector[i];
-         j = 0;
-         tmp = pos[j];
-         while ( ll_i != tmp ) {
-            j++;
-            tmp2 = tmp;
-            tmp = pos[j];
-            pos[j] = tmp2;
-         };
-         pos[0] = tmp;
-         s->selectorMtf[i] = j;
-      }
-   };
-
-   /*--- Assign actual codes for the tables. --*/
-   for (t = 0; t < nGroups; t++) {
-      minLen = 32;
-      maxLen = 0;
-      for (i = 0; i < alphaSize; i++) {
-         if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
-         if (s->len[t][i] < minLen) minLen = s->len[t][i];
-      }
-      AssertH ( !(maxLen > 17 /*20*/ ), 3004 );
-      AssertH ( !(minLen < 1),  3005 );
-      BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), 
-                          minLen, maxLen, alphaSize );
-   }
-
-   /*--- Transmit the mapping table. ---*/
-   { 
-      Bool inUse16[16];
-      for (i = 0; i < 16; i++) {
-          inUse16[i] = False;
-          for (j = 0; j < 16; j++)
-             if (s->inUse[i * 16 + j]) inUse16[i] = True;
-      }
-     
-      nBytes = s->numZ;
-      for (i = 0; i < 16; i++)
-         if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0);
-
-      for (i = 0; i < 16; i++)
-         if (inUse16[i])
-            for (j = 0; j < 16; j++) {
-               if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0);
-            }
-
-      if (s->verbosity >= 3) 
-         VPrintf1( "      bytes: mapping %d, ", s->numZ-nBytes );
-   }
-
-   /*--- Now the selectors. ---*/
-   nBytes = s->numZ;
-   bsW ( s, 3, nGroups );
-   bsW ( s, 15, nSelectors );
-   for (i = 0; i < nSelectors; i++) { 
-      for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1);
-      bsW(s,1,0);
-   }
-   if (s->verbosity >= 3)
-      VPrintf1( "selectors %d, ", s->numZ-nBytes );
-
-   /*--- Now the coding tables. ---*/
-   nBytes = s->numZ;
-
-   for (t = 0; t < nGroups; t++) {
-      Int32 curr = s->len[t][0];
-      bsW ( s, 5, curr );
-      for (i = 0; i < alphaSize; i++) {
-         while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ };
-         while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ };
-         bsW ( s, 1, 0 );
-      }
-   }
-
-   if (s->verbosity >= 3)
-      VPrintf1 ( "code lengths %d, ", s->numZ-nBytes );
-
-   /*--- And finally, the block data proper ---*/
-   nBytes = s->numZ;
-   selCtr = 0;
-   gs = 0;
-   while (True) {
-      if (gs >= s->nMTF) break;
-      ge = gs + BZ_G_SIZE - 1; 
-      if (ge >= s->nMTF) ge = s->nMTF-1;
-      AssertH ( s->selector[selCtr] < nGroups, 3006 );
-
-      if (nGroups == 6 && 50 == ge-gs+1) {
-            /*--- fast track the common case ---*/
-            UInt16 mtfv_i;
-            UChar* s_len_sel_selCtr 
-               = &(s->len[s->selector[selCtr]][0]);
-            Int32* s_code_sel_selCtr
-               = &(s->code[s->selector[selCtr]][0]);
-
-#           define BZ_ITAH(nn)                      \
-               mtfv_i = mtfv[gs+(nn)];              \
-               bsW ( s,                             \
-                     s_len_sel_selCtr[mtfv_i],      \
-                     s_code_sel_selCtr[mtfv_i] )
-
-            BZ_ITAH(0);  BZ_ITAH(1);  BZ_ITAH(2);  BZ_ITAH(3);  BZ_ITAH(4);
-            BZ_ITAH(5);  BZ_ITAH(6);  BZ_ITAH(7);  BZ_ITAH(8);  BZ_ITAH(9);
-            BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14);
-            BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19);
-            BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24);
-            BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29);
-            BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34);
-            BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39);
-            BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44);
-            BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49);
-
-#           undef BZ_ITAH
-
-      } else {
-	 /*--- slow version which correctly handles all situations ---*/
-         for (i = gs; i <= ge; i++) {
-            bsW ( s, 
-                  s->len  [s->selector[selCtr]] [mtfv[i]],
-                  s->code [s->selector[selCtr]] [mtfv[i]] );
-         }
-      }
-
-
-      gs = ge+1;
-      selCtr++;
-   }
-   AssertH( selCtr == nSelectors, 3007 );
-
-   if (s->verbosity >= 3)
-      VPrintf1( "codes %d\n", s->numZ-nBytes );
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_compressBlock ( EState* s, Bool is_last_block )
-{
-   if (s->nblock > 0) {
-
-      BZ_FINALISE_CRC ( s->blockCRC );
-      s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31);
-      s->combinedCRC ^= s->blockCRC;
-      if (s->blockNo > 1) s->numZ = 0;
-
-      if (s->verbosity >= 2)
-         VPrintf4( "    block %d: crc = 0x%08x, "
-                   "combined CRC = 0x%08x, size = %d\n",
-                   s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );
-
-      BZ2_blockSort ( s );
-   }
-
-   s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]);
-
-   /*-- If this is the first block, create the stream header. --*/
-   if (s->blockNo == 1) {
-      BZ2_bsInitWrite ( s );
-      bsPutUChar ( s, BZ_HDR_B );
-      bsPutUChar ( s, BZ_HDR_Z );
-      bsPutUChar ( s, BZ_HDR_h );
-      bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) );
-   }
-
-   if (s->nblock > 0) {
-
-      bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 );
-      bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 );
-      bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 );
-
-      /*-- Now the block's CRC, so it is in a known place. --*/
-      bsPutUInt32 ( s, s->blockCRC );
-
-      /*-- 
-         Now a single bit indicating (non-)randomisation. 
-         As of version 0.9.5, we use a better sorting algorithm
-         which makes randomisation unnecessary.  So always set
-         the randomised bit to 'no'.  Of course, the decoder
-         still needs to be able to handle randomised blocks
-         so as to maintain backwards compatibility with
-         older versions of bzip2.
-      --*/
-      bsW(s,1,0);
-
-      bsW ( s, 24, s->origPtr );
-      generateMTFValues ( s );
-      sendMTFValues ( s );
-   }
-
-
-   /*-- If this is the last block, add the stream trailer. --*/
-   if (is_last_block) {
-
-      bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 );
-      bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 );
-      bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
-      bsPutUInt32 ( s, s->combinedCRC );
-      if (s->verbosity >= 2)
-         VPrintf1( "    final combined CRC = 0x%08x\n   ", s->combinedCRC );
-      bsFinishWrite ( s );
-   }
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                        compress.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/crctable.c b/examples/C/hdf5plugins/crctable.c
deleted file mode 100644
index 1fea7e9..0000000
--- a/examples/C/hdf5plugins/crctable.c
+++ /dev/null
@@ -1,104 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Table for doing CRCs                                  ---*/
-/*---                                            crctable.c ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#include "bzlib_private.h"
-
-/*--
-  I think this is an implementation of the AUTODIN-II,
-  Ethernet & FDDI 32-bit CRC standard.  Vaguely derived
-  from code by Rob Warnock, in Section 51 of the
-  comp.compression FAQ.
---*/
-
-UInt32 BZ2_crc32Table[256] = {
-
-   /*-- Ugly, innit? --*/
-
-   0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L,
-   0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L,
-   0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L,
-   0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL,
-   0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L,
-   0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L,
-   0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L,
-   0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL,
-   0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L,
-   0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L,
-   0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L,
-   0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL,
-   0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L,
-   0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L,
-   0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L,
-   0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL,
-   0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL,
-   0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L,
-   0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L,
-   0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL,
-   0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL,
-   0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L,
-   0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L,
-   0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL,
-   0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL,
-   0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L,
-   0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L,
-   0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL,
-   0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL,
-   0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L,
-   0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L,
-   0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL,
-   0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L,
-   0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL,
-   0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL,
-   0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L,
-   0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L,
-   0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL,
-   0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL,
-   0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L,
-   0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L,
-   0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL,
-   0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL,
-   0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L,
-   0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L,
-   0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL,
-   0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL,
-   0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L,
-   0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L,
-   0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL,
-   0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L,
-   0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L,
-   0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L,
-   0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL,
-   0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L,
-   0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L,
-   0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L,
-   0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL,
-   0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L,
-   0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L,
-   0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L,
-   0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL,
-   0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L,
-   0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L
-};
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                        crctable.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/decompress.c b/examples/C/hdf5plugins/decompress.c
deleted file mode 100644
index 311f566..0000000
--- a/examples/C/hdf5plugins/decompress.c
+++ /dev/null
@@ -1,646 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Decompression machinery                               ---*/
-/*---                                          decompress.c ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-static
-void makeMaps_d ( DState* s )
-{
-   Int32 i;
-   s->nInUse = 0;
-   for (i = 0; i < 256; i++)
-      if (s->inUse[i]) {
-         s->seqToUnseq[s->nInUse] = i;
-         s->nInUse++;
-      }
-}
-
-
-/*---------------------------------------------------*/
-#define RETURN(rrr)                               \
-   { retVal = rrr; goto save_state_and_return; };
-
-#define GET_BITS(lll,vvv,nnn)                     \
-   case lll: s->state = lll;                      \
-   while (True) {                                 \
-      if (s->bsLive >= nnn) {                     \
-         UInt32 v;                                \
-         v = (s->bsBuff >>                        \
-             (s->bsLive-nnn)) & ((1 << nnn)-1);   \
-         s->bsLive -= nnn;                        \
-         vvv = v;                                 \
-         break;                                   \
-      }                                           \
-      if (s->strm->avail_in == 0) RETURN(BZ_OK);  \
-      s->bsBuff                                   \
-         = (s->bsBuff << 8) |                     \
-           ((UInt32)                              \
-              (*((UChar*)(s->strm->next_in))));   \
-      s->bsLive += 8;                             \
-      s->strm->next_in++;                         \
-      s->strm->avail_in--;                        \
-      s->strm->total_in_lo32++;                   \
-      if (s->strm->total_in_lo32 == 0)            \
-         s->strm->total_in_hi32++;                \
-   }
-
-#define GET_UCHAR(lll,uuu)                        \
-   GET_BITS(lll,uuu,8)
-
-#define GET_BIT(lll,uuu)                          \
-   GET_BITS(lll,uuu,1)
-
-/*---------------------------------------------------*/
-#define GET_MTF_VAL(label1,label2,lval)           \
-{                                                 \
-   if (groupPos == 0) {                           \
-      groupNo++;                                  \
-      if (groupNo >= nSelectors)                  \
-         RETURN(BZ_DATA_ERROR);                   \
-      groupPos = BZ_G_SIZE;                       \
-      gSel = s->selector[groupNo];                \
-      gMinlen = s->minLens[gSel];                 \
-      gLimit = &(s->limit[gSel][0]);              \
-      gPerm = &(s->perm[gSel][0]);                \
-      gBase = &(s->base[gSel][0]);                \
-   }                                              \
-   groupPos--;                                    \
-   zn = gMinlen;                                  \
-   GET_BITS(label1, zvec, zn);                    \
-   while (1) {                                    \
-      if (zn > 20 /* the longest code */)         \
-         RETURN(BZ_DATA_ERROR);                   \
-      if (zvec <= gLimit[zn]) break;              \
-      zn++;                                       \
-      GET_BIT(label2, zj);                        \
-      zvec = (zvec << 1) | zj;                    \
-   };                                             \
-   if (zvec - gBase[zn] < 0                       \
-       || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE)  \
-      RETURN(BZ_DATA_ERROR);                      \
-   lval = gPerm[zvec - gBase[zn]];                \
-}
-
-
-/*---------------------------------------------------*/
-Int32 BZ2_decompress ( DState* s )
-{
-   UChar      uc;
-   Int32      retVal;
-   Int32      minLen, maxLen;
-   bz_stream* strm = s->strm;
-
-   /* stuff that needs to be saved/restored */
-   Int32  i;
-   Int32  j;
-   Int32  t;
-   Int32  alphaSize;
-   Int32  nGroups;
-   Int32  nSelectors;
-   Int32  EOB;
-   Int32  groupNo;
-   Int32  groupPos;
-   Int32  nextSym;
-   Int32  nblockMAX;
-   Int32  nblock;
-   Int32  es;
-   Int32  N;
-   Int32  curr;
-   Int32  zt;
-   Int32  zn; 
-   Int32  zvec;
-   Int32  zj;
-   Int32  gSel;
-   Int32  gMinlen;
-   Int32* gLimit;
-   Int32* gBase;
-   Int32* gPerm;
-
-   if (s->state == BZ_X_MAGIC_1) {
-      /*initialise the save area*/
-      s->save_i           = 0;
-      s->save_j           = 0;
-      s->save_t           = 0;
-      s->save_alphaSize   = 0;
-      s->save_nGroups     = 0;
-      s->save_nSelectors  = 0;
-      s->save_EOB         = 0;
-      s->save_groupNo     = 0;
-      s->save_groupPos    = 0;
-      s->save_nextSym     = 0;
-      s->save_nblockMAX   = 0;
-      s->save_nblock      = 0;
-      s->save_es          = 0;
-      s->save_N           = 0;
-      s->save_curr        = 0;
-      s->save_zt          = 0;
-      s->save_zn          = 0;
-      s->save_zvec        = 0;
-      s->save_zj          = 0;
-      s->save_gSel        = 0;
-      s->save_gMinlen     = 0;
-      s->save_gLimit      = NULL;
-      s->save_gBase       = NULL;
-      s->save_gPerm       = NULL;
-   }
-
-   /*restore from the save area*/
-   i           = s->save_i;
-   j           = s->save_j;
-   t           = s->save_t;
-   alphaSize   = s->save_alphaSize;
-   nGroups     = s->save_nGroups;
-   nSelectors  = s->save_nSelectors;
-   EOB         = s->save_EOB;
-   groupNo     = s->save_groupNo;
-   groupPos    = s->save_groupPos;
-   nextSym     = s->save_nextSym;
-   nblockMAX   = s->save_nblockMAX;
-   nblock      = s->save_nblock;
-   es          = s->save_es;
-   N           = s->save_N;
-   curr        = s->save_curr;
-   zt          = s->save_zt;
-   zn          = s->save_zn; 
-   zvec        = s->save_zvec;
-   zj          = s->save_zj;
-   gSel        = s->save_gSel;
-   gMinlen     = s->save_gMinlen;
-   gLimit      = s->save_gLimit;
-   gBase       = s->save_gBase;
-   gPerm       = s->save_gPerm;
-
-   retVal = BZ_OK;
-
-   switch (s->state) {
-
-      GET_UCHAR(BZ_X_MAGIC_1, uc);
-      if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC);
-
-      GET_UCHAR(BZ_X_MAGIC_2, uc);
-      if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC);
-
-      GET_UCHAR(BZ_X_MAGIC_3, uc)
-      if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC);
-
-      GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8)
-      if (s->blockSize100k < (BZ_HDR_0 + 1) || 
-          s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC);
-      s->blockSize100k -= BZ_HDR_0;
-
-      if (s->smallDecompress) {
-         s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
-         s->ll4  = BZALLOC( 
-                      ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) 
-                   );
-         if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);
-      } else {
-         s->tt  = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) );
-         if (s->tt == NULL) RETURN(BZ_MEM_ERROR);
-      }
-
-      GET_UCHAR(BZ_X_BLKHDR_1, uc);
-
-      if (uc == 0x17) goto endhdr_2;
-      if (uc != 0x31) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_BLKHDR_2, uc);
-      if (uc != 0x41) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_BLKHDR_3, uc);
-      if (uc != 0x59) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_BLKHDR_4, uc);
-      if (uc != 0x26) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_BLKHDR_5, uc);
-      if (uc != 0x53) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_BLKHDR_6, uc);
-      if (uc != 0x59) RETURN(BZ_DATA_ERROR);
-
-      s->currBlockNo++;
-      if (s->verbosity >= 2)
-         VPrintf1 ( "\n    [%d: huff+mtf ", s->currBlockNo );
- 
-      s->storedBlockCRC = 0;
-      GET_UCHAR(BZ_X_BCRC_1, uc);
-      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
-      GET_UCHAR(BZ_X_BCRC_2, uc);
-      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
-      GET_UCHAR(BZ_X_BCRC_3, uc);
-      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
-      GET_UCHAR(BZ_X_BCRC_4, uc);
-      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
-
-      GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1);
-
-      s->origPtr = 0;
-      GET_UCHAR(BZ_X_ORIGPTR_1, uc);
-      s->origPtr = (s->origPtr << 8) | ((Int32)uc);
-      GET_UCHAR(BZ_X_ORIGPTR_2, uc);
-      s->origPtr = (s->origPtr << 8) | ((Int32)uc);
-      GET_UCHAR(BZ_X_ORIGPTR_3, uc);
-      s->origPtr = (s->origPtr << 8) | ((Int32)uc);
-
-      if (s->origPtr < 0)
-         RETURN(BZ_DATA_ERROR);
-      if (s->origPtr > 10 + 100000*s->blockSize100k) 
-         RETURN(BZ_DATA_ERROR);
-
-      /*--- Receive the mapping table ---*/
-      for (i = 0; i < 16; i++) {
-         GET_BIT(BZ_X_MAPPING_1, uc);
-         if (uc == 1) 
-            s->inUse16[i] = True; else 
-            s->inUse16[i] = False;
-      }
-
-      for (i = 0; i < 256; i++) s->inUse[i] = False;
-
-      for (i = 0; i < 16; i++)
-         if (s->inUse16[i])
-            for (j = 0; j < 16; j++) {
-               GET_BIT(BZ_X_MAPPING_2, uc);
-               if (uc == 1) s->inUse[i * 16 + j] = True;
-            }
-      makeMaps_d ( s );
-      if (s->nInUse == 0) RETURN(BZ_DATA_ERROR);
-      alphaSize = s->nInUse+2;
-
-      /*--- Now the selectors ---*/
-      GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
-      if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
-      GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
-      if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
-      for (i = 0; i < nSelectors; i++) {
-         j = 0;
-         while (True) {
-            GET_BIT(BZ_X_SELECTOR_3, uc);
-            if (uc == 0) break;
-            j++;
-            if (j >= nGroups) RETURN(BZ_DATA_ERROR);
-         }
-         s->selectorMtf[i] = j;
-      }
-
-      /*--- Undo the MTF values for the selectors. ---*/
-      {
-         UChar pos[BZ_N_GROUPS], tmp, v;
-         for (v = 0; v < nGroups; v++) pos[v] = v;
-   
-         for (i = 0; i < nSelectors; i++) {
-            v = s->selectorMtf[i];
-            tmp = pos[v];
-            while (v > 0) { pos[v] = pos[v-1]; v--; }
-            pos[0] = tmp;
-            s->selector[i] = tmp;
-         }
-      }
-
-      /*--- Now the coding tables ---*/
-      for (t = 0; t < nGroups; t++) {
-         GET_BITS(BZ_X_CODING_1, curr, 5);
-         for (i = 0; i < alphaSize; i++) {
-            while (True) {
-               if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR);
-               GET_BIT(BZ_X_CODING_2, uc);
-               if (uc == 0) break;
-               GET_BIT(BZ_X_CODING_3, uc);
-               if (uc == 0) curr++; else curr--;
-            }
-            s->len[t][i] = curr;
-         }
-      }
-
-      /*--- Create the Huffman decoding tables ---*/
-      for (t = 0; t < nGroups; t++) {
-         minLen = 32;
-         maxLen = 0;
-         for (i = 0; i < alphaSize; i++) {
-            if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
-            if (s->len[t][i] < minLen) minLen = s->len[t][i];
-         }
-         BZ2_hbCreateDecodeTables ( 
-            &(s->limit[t][0]), 
-            &(s->base[t][0]), 
-            &(s->perm[t][0]), 
-            &(s->len[t][0]),
-            minLen, maxLen, alphaSize
-         );
-         s->minLens[t] = minLen;
-      }
-
-      /*--- Now the MTF values ---*/
-
-      EOB      = s->nInUse+1;
-      nblockMAX = 100000 * s->blockSize100k;
-      groupNo  = -1;
-      groupPos = 0;
-
-      for (i = 0; i <= 255; i++) s->unzftab[i] = 0;
-
-      /*-- MTF init --*/
-      {
-         Int32 ii, jj, kk;
-         kk = MTFA_SIZE-1;
-         for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) {
-            for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
-               s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj);
-               kk--;
-            }
-            s->mtfbase[ii] = kk + 1;
-         }
-      }
-      /*-- end MTF init --*/
-
-      nblock = 0;
-      GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym);
-
-      while (True) {
-
-         if (nextSym == EOB) break;
-
-         if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
-
-            es = -1;
-            N = 1;
-            do {
-               /* Check that N doesn't get too big, so that es doesn't
-                  go negative.  The maximum value that can be
-                  RUNA/RUNB encoded is equal to the block size (post
-                  the initial RLE), viz, 900k, so bounding N at 2
-                  million should guard against overflow without
-                  rejecting any legitimate inputs. */
-               if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
-               if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
-               if (nextSym == BZ_RUNB) es = es + (1+1) * N;
-               N = N * 2;
-               GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym);
-            }
-               while (nextSym == BZ_RUNA || nextSym == BZ_RUNB);
-
-            es++;
-            uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ];
-            s->unzftab[uc] += es;
-
-            if (s->smallDecompress)
-               while (es > 0) {
-                  if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
-                  s->ll16[nblock] = (UInt16)uc;
-                  nblock++;
-                  es--;
-               }
-            else
-               while (es > 0) {
-                  if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
-                  s->tt[nblock] = (UInt32)uc;
-                  nblock++;
-                  es--;
-               };
-
-            continue;
-
-         } else {
-
-            if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
-
-            /*-- uc = MTF ( nextSym-1 ) --*/
-            {
-               Int32 ii, jj, kk, pp, lno, off;
-               UInt32 nn;
-               nn = (UInt32)(nextSym - 1);
-
-               if (nn < MTFL_SIZE) {
-                  /* avoid general-case expense */
-                  pp = s->mtfbase[0];
-                  uc = s->mtfa[pp+nn];
-                  while (nn > 3) {
-                     Int32 z = pp+nn;
-                     s->mtfa[(z)  ] = s->mtfa[(z)-1];
-                     s->mtfa[(z)-1] = s->mtfa[(z)-2];
-                     s->mtfa[(z)-2] = s->mtfa[(z)-3];
-                     s->mtfa[(z)-3] = s->mtfa[(z)-4];
-                     nn -= 4;
-                  }
-                  while (nn > 0) { 
-                     s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; 
-                  };
-                  s->mtfa[pp] = uc;
-               } else { 
-                  /* general case */
-                  lno = nn / MTFL_SIZE;
-                  off = nn % MTFL_SIZE;
-                  pp = s->mtfbase[lno] + off;
-                  uc = s->mtfa[pp];
-                  while (pp > s->mtfbase[lno]) { 
-                     s->mtfa[pp] = s->mtfa[pp-1]; pp--; 
-                  };
-                  s->mtfbase[lno]++;
-                  while (lno > 0) {
-                     s->mtfbase[lno]--;
-                     s->mtfa[s->mtfbase[lno]] 
-                        = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1];
-                     lno--;
-                  }
-                  s->mtfbase[0]--;
-                  s->mtfa[s->mtfbase[0]] = uc;
-                  if (s->mtfbase[0] == 0) {
-                     kk = MTFA_SIZE-1;
-                     for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
-                        for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
-                           s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
-                           kk--;
-                        }
-                        s->mtfbase[ii] = kk + 1;
-                     }
-                  }
-               }
-            }
-            /*-- end uc = MTF ( nextSym-1 ) --*/
-
-            s->unzftab[s->seqToUnseq[uc]]++;
-            if (s->smallDecompress)
-               s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else
-               s->tt[nblock]   = (UInt32)(s->seqToUnseq[uc]);
-            nblock++;
-
-            GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym);
-            continue;
-         }
-      }
-
-      /* Now we know what nblock is, we can do a better sanity
-         check on s->origPtr.
-      */
-      if (s->origPtr < 0 || s->origPtr >= nblock)
-         RETURN(BZ_DATA_ERROR);
-
-      /*-- Set up cftab to facilitate generation of T^(-1) --*/
-      /* Check: unzftab entries in range. */
-      for (i = 0; i <= 255; i++) {
-         if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
-            RETURN(BZ_DATA_ERROR);
-      }
-      /* Actually generate cftab. */
-      s->cftab[0] = 0;
-      for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
-      for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
-      /* Check: cftab entries in range. */
-      for (i = 0; i <= 256; i++) {
-         if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
-            /* s->cftab[i] can legitimately be == nblock */
-            RETURN(BZ_DATA_ERROR);
-         }
-      }
-      /* Check: cftab entries non-descending. */
-      for (i = 1; i <= 256; i++) {
-         if (s->cftab[i-1] > s->cftab[i]) {
-            RETURN(BZ_DATA_ERROR);
-         }
-      }
-
-      s->state_out_len = 0;
-      s->state_out_ch  = 0;
-      BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
-      s->state = BZ_X_OUTPUT;
-      if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
-
-      if (s->smallDecompress) {
-
-         /*-- Make a copy of cftab, used in generation of T --*/
-         for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i];
-
-         /*-- compute the T vector --*/
-         for (i = 0; i < nblock; i++) {
-            uc = (UChar)(s->ll16[i]);
-            SET_LL(i, s->cftabCopy[uc]);
-            s->cftabCopy[uc]++;
-         }
-
-         /*-- Compute T^(-1) by pointer reversal on T --*/
-         i = s->origPtr;
-         j = GET_LL(i);
-         do {
-            Int32 tmp = GET_LL(j);
-            SET_LL(j, i);
-            i = j;
-            j = tmp;
-         }
-            while (i != s->origPtr);
-
-         s->tPos = s->origPtr;
-         s->nblock_used = 0;
-         if (s->blockRandomised) {
-            BZ_RAND_INIT_MASK;
-            BZ_GET_SMALL(s->k0); s->nblock_used++;
-            BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; 
-         } else {
-            BZ_GET_SMALL(s->k0); s->nblock_used++;
-         }
-
-      } else {
-
-         /*-- compute the T^(-1) vector --*/
-         for (i = 0; i < nblock; i++) {
-            uc = (UChar)(s->tt[i] & 0xff);
-            s->tt[s->cftab[uc]] |= (i << 8);
-            s->cftab[uc]++;
-         }
-
-         s->tPos = s->tt[s->origPtr] >> 8;
-         s->nblock_used = 0;
-         if (s->blockRandomised) {
-            BZ_RAND_INIT_MASK;
-            BZ_GET_FAST(s->k0); s->nblock_used++;
-            BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; 
-         } else {
-            BZ_GET_FAST(s->k0); s->nblock_used++;
-         }
-
-      }
-
-      RETURN(BZ_OK);
-
-
-
-    endhdr_2:
-
-      GET_UCHAR(BZ_X_ENDHDR_2, uc);
-      if (uc != 0x72) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_ENDHDR_3, uc);
-      if (uc != 0x45) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_ENDHDR_4, uc);
-      if (uc != 0x38) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_ENDHDR_5, uc);
-      if (uc != 0x50) RETURN(BZ_DATA_ERROR);
-      GET_UCHAR(BZ_X_ENDHDR_6, uc);
-      if (uc != 0x90) RETURN(BZ_DATA_ERROR);
-
-      s->storedCombinedCRC = 0;
-      GET_UCHAR(BZ_X_CCRC_1, uc);
-      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
-      GET_UCHAR(BZ_X_CCRC_2, uc);
-      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
-      GET_UCHAR(BZ_X_CCRC_3, uc);
-      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
-      GET_UCHAR(BZ_X_CCRC_4, uc);
-      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
-
-      s->state = BZ_X_IDLE;
-      RETURN(BZ_STREAM_END);
-
-      default: AssertH ( False, 4001 );
-   }
-
-   AssertH ( False, 4002 );
-
-   save_state_and_return:
-
-   s->save_i           = i;
-   s->save_j           = j;
-   s->save_t           = t;
-   s->save_alphaSize   = alphaSize;
-   s->save_nGroups     = nGroups;
-   s->save_nSelectors  = nSelectors;
-   s->save_EOB         = EOB;
-   s->save_groupNo     = groupNo;
-   s->save_groupPos    = groupPos;
-   s->save_nextSym     = nextSym;
-   s->save_nblockMAX   = nblockMAX;
-   s->save_nblock      = nblock;
-   s->save_es          = es;
-   s->save_N           = N;
-   s->save_curr        = curr;
-   s->save_zt          = zt;
-   s->save_zn          = zn;
-   s->save_zvec        = zvec;
-   s->save_zj          = zj;
-   s->save_gSel        = gSel;
-   s->save_gMinlen     = gMinlen;
-   s->save_gLimit      = gLimit;
-   s->save_gBase       = gBase;
-   s->save_gPerm       = gPerm;
-
-   return retVal;   
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                      decompress.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/h5bzip2.h b/examples/C/hdf5plugins/h5bzip2.h
deleted file mode 100644
index 8a9a06c..0000000
--- a/examples/C/hdf5plugins/h5bzip2.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef H5BZIP2_H
-#define H5BZIP2_H
-
-#include "bzlib.h"
-
-#ifdef _MSC_VER
-  #ifdef DLL_EXPORT /* define when building the library */
-    #define DECLSPEC __declspec(dllexport)
-  #else
-    #define DECLSPEC __declspec(dllimport)
-  #endif
-#else
-  #define DECLSPEC extern
-#endif
-
-/* use an integer greater than 256 to be id of the registered filter. */
-#define H5Z_FILTER_BZIP2 307
-
-/* declare the hdf5 interface */
-DECLSPEC H5PL_type_t H5PLget_plugin_type(void);
-DECLSPEC const void* H5PLget_plugin_info(void);
-DECLSPEC const H5Z_class2_t H5Z_BZIP2[1]; 
-
-/* Declare  filter specific functions */
-DECLSPEC htri_t H5Z_bzip2_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id);
-DECLSPEC size_t H5Z_filter_bzip2(unsigned flags,size_t cd_nelmts,const unsigned cd_values[],
-                    size_t nbytes,size_t *buf_size,void**buf);
-
-#endif /*H5BZIP2_H*/
-
diff --git a/examples/C/hdf5plugins/huffman.c b/examples/C/hdf5plugins/huffman.c
deleted file mode 100644
index 2283fdb..0000000
--- a/examples/C/hdf5plugins/huffman.c
+++ /dev/null
@@ -1,205 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Huffman coding low-level stuff                        ---*/
-/*---                                             huffman.c ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#include "bzlib_private.h"
-
-/*---------------------------------------------------*/
-#define WEIGHTOF(zz0)  ((zz0) & 0xffffff00)
-#define DEPTHOF(zz1)   ((zz1) & 0x000000ff)
-#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3))
-
-#define ADDWEIGHTS(zw1,zw2)                           \
-   (WEIGHTOF(zw1)+WEIGHTOF(zw2)) |                    \
-   (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))
-
-#define UPHEAP(z)                                     \
-{                                                     \
-   Int32 zz, tmp;                                     \
-   zz = z; tmp = heap[zz];                            \
-   while (weight[tmp] < weight[heap[zz >> 1]]) {      \
-      heap[zz] = heap[zz >> 1];                       \
-      zz >>= 1;                                       \
-   }                                                  \
-   heap[zz] = tmp;                                    \
-}
-
-#define DOWNHEAP(z)                                   \
-{                                                     \
-   Int32 zz, yy, tmp;                                 \
-   zz = z; tmp = heap[zz];                            \
-   while (True) {                                     \
-      yy = zz << 1;                                   \
-      if (yy > nHeap) break;                          \
-      if (yy < nHeap &&                               \
-          weight[heap[yy+1]] < weight[heap[yy]])      \
-         yy++;                                        \
-      if (weight[tmp] < weight[heap[yy]]) break;      \
-      heap[zz] = heap[yy];                            \
-      zz = yy;                                        \
-   }                                                  \
-   heap[zz] = tmp;                                    \
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbMakeCodeLengths ( UChar *len, 
-                             Int32 *freq,
-                             Int32 alphaSize,
-                             Int32 maxLen )
-{
-   /*--
-      Nodes and heap entries run from 1.  Entry 0
-      for both the heap and nodes is a sentinel.
-   --*/
-   Int32 nNodes, nHeap, n1, n2, i, j, k;
-   Bool  tooLong;
-
-   Int32 heap   [ BZ_MAX_ALPHA_SIZE + 2 ];
-   Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ];
-   Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; 
-
-   for (i = 0; i < alphaSize; i++)
-      weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
-
-   while (True) {
-
-      nNodes = alphaSize;
-      nHeap = 0;
-
-      heap[0] = 0;
-      weight[0] = 0;
-      parent[0] = -2;
-
-      for (i = 1; i <= alphaSize; i++) {
-         parent[i] = -1;
-         nHeap++;
-         heap[nHeap] = i;
-         UPHEAP(nHeap);
-      }
-
-      AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 );
-   
-      while (nHeap > 1) {
-         n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
-         n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
-         nNodes++;
-         parent[n1] = parent[n2] = nNodes;
-         weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]);
-         parent[nNodes] = -1;
-         nHeap++;
-         heap[nHeap] = nNodes;
-         UPHEAP(nHeap);
-      }
-
-      AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 );
-
-      tooLong = False;
-      for (i = 1; i <= alphaSize; i++) {
-         j = 0;
-         k = i;
-         while (parent[k] >= 0) { k = parent[k]; j++; }
-         len[i-1] = j;
-         if (j > maxLen) tooLong = True;
-      }
-      
-      if (! tooLong) break;
-
-      /* 17 Oct 04: keep-going condition for the following loop used
-         to be 'i < alphaSize', which missed the last element,
-         theoretically leading to the possibility of the compressor
-         looping.  However, this count-scaling step is only needed if
-         one of the generated Huffman code words is longer than
-         maxLen, which up to and including version 1.0.2 was 20 bits,
-         which is extremely unlikely.  In version 1.0.3 maxLen was
-         changed to 17 bits, which has minimal effect on compression
-         ratio, but does mean this scaling step is used from time to
-         time, enough to verify that it works.
-
-         This means that bzip2-1.0.3 and later will only produce
-         Huffman codes with a maximum length of 17 bits.  However, in
-         order to preserve backwards compatibility with bitstreams
-         produced by versions pre-1.0.3, the decompressor must still
-         handle lengths of up to 20. */
-
-      for (i = 1; i <= alphaSize; i++) {
-         j = weight[i] >> 8;
-         j = 1 + (j / 2);
-         weight[i] = j << 8;
-      }
-   }
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbAssignCodes ( Int32 *code,
-                         UChar *length,
-                         Int32 minLen,
-                         Int32 maxLen,
-                         Int32 alphaSize )
-{
-   Int32 n, vec, i;
-
-   vec = 0;
-   for (n = minLen; n <= maxLen; n++) {
-      for (i = 0; i < alphaSize; i++)
-         if (length[i] == n) { code[i] = vec; vec++; };
-      vec <<= 1;
-   }
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbCreateDecodeTables ( Int32 *limit,
-                                Int32 *base,
-                                Int32 *perm,
-                                UChar *length,
-                                Int32 minLen,
-                                Int32 maxLen,
-                                Int32 alphaSize )
-{
-   Int32 pp, i, j, vec;
-
-   pp = 0;
-   for (i = minLen; i <= maxLen; i++)
-      for (j = 0; j < alphaSize; j++)
-         if (length[j] == i) { perm[pp] = j; pp++; };
-
-   for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0;
-   for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
-
-   for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1];
-
-   for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0;
-   vec = 0;
-
-   for (i = minLen; i <= maxLen; i++) {
-      vec += (base[i+1] - base[i]);
-      limit[i] = vec-1;
-      vec <<= 1;
-   }
-   for (i = minLen + 1; i <= maxLen; i++)
-      base[i] = ((limit[i-1] + 1) << 1) - base[i];
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                         huffman.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/hdf5plugins/randtable.c b/examples/C/hdf5plugins/randtable.c
deleted file mode 100644
index 6d62459..0000000
--- a/examples/C/hdf5plugins/randtable.c
+++ /dev/null
@@ -1,84 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Table for randomising repetitive blocks               ---*/
-/*---                                           randtable.c ---*/
-/*-------------------------------------------------------------*/
-
-/* ------------------------------------------------------------------
-   This file is part of bzip2/libbzip2, a program and library for
-   lossless, block-sorting data compression.
-
-   bzip2/libbzip2 version 1.0.6 of 6 September 2010
-   Copyright (C) 1996-2010 Julian Seward <jseward at bzip.org>
-
-   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
-   README file.
-
-   This program is released under the terms of the license contained
-   in the file LICENSE.
-   ------------------------------------------------------------------ */
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------*/
-Int32 BZ2_rNums[512] = { 
-   619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 
-   985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 
-   733, 859, 335, 708, 621, 574, 73, 654, 730, 472, 
-   419, 436, 278, 496, 867, 210, 399, 680, 480, 51, 
-   878, 465, 811, 169, 869, 675, 611, 697, 867, 561, 
-   862, 687, 507, 283, 482, 129, 807, 591, 733, 623, 
-   150, 238, 59, 379, 684, 877, 625, 169, 643, 105, 
-   170, 607, 520, 932, 727, 476, 693, 425, 174, 647, 
-   73, 122, 335, 530, 442, 853, 695, 249, 445, 515, 
-   909, 545, 703, 919, 874, 474, 882, 500, 594, 612, 
-   641, 801, 220, 162, 819, 984, 589, 513, 495, 799, 
-   161, 604, 958, 533, 221, 400, 386, 867, 600, 782, 
-   382, 596, 414, 171, 516, 375, 682, 485, 911, 276, 
-   98, 553, 163, 354, 666, 933, 424, 341, 533, 870, 
-   227, 730, 475, 186, 263, 647, 537, 686, 600, 224, 
-   469, 68, 770, 919, 190, 373, 294, 822, 808, 206, 
-   184, 943, 795, 384, 383, 461, 404, 758, 839, 887, 
-   715, 67, 618, 276, 204, 918, 873, 777, 604, 560, 
-   951, 160, 578, 722, 79, 804, 96, 409, 713, 940, 
-   652, 934, 970, 447, 318, 353, 859, 672, 112, 785, 
-   645, 863, 803, 350, 139, 93, 354, 99, 820, 908, 
-   609, 772, 154, 274, 580, 184, 79, 626, 630, 742, 
-   653, 282, 762, 623, 680, 81, 927, 626, 789, 125, 
-   411, 521, 938, 300, 821, 78, 343, 175, 128, 250, 
-   170, 774, 972, 275, 999, 639, 495, 78, 352, 126, 
-   857, 956, 358, 619, 580, 124, 737, 594, 701, 612, 
-   669, 112, 134, 694, 363, 992, 809, 743, 168, 974, 
-   944, 375, 748, 52, 600, 747, 642, 182, 862, 81, 
-   344, 805, 988, 739, 511, 655, 814, 334, 249, 515, 
-   897, 955, 664, 981, 649, 113, 974, 459, 893, 228, 
-   433, 837, 553, 268, 926, 240, 102, 654, 459, 51, 
-   686, 754, 806, 760, 493, 403, 415, 394, 687, 700, 
-   946, 670, 656, 610, 738, 392, 760, 799, 887, 653, 
-   978, 321, 576, 617, 626, 502, 894, 679, 243, 440, 
-   680, 879, 194, 572, 640, 724, 926, 56, 204, 700, 
-   707, 151, 457, 449, 797, 195, 791, 558, 945, 679, 
-   297, 59, 87, 824, 713, 663, 412, 693, 342, 606, 
-   134, 108, 571, 364, 631, 212, 174, 643, 304, 329, 
-   343, 97, 430, 751, 497, 314, 983, 374, 822, 928, 
-   140, 206, 73, 263, 980, 736, 876, 478, 430, 305, 
-   170, 514, 364, 692, 829, 82, 855, 953, 676, 246, 
-   369, 970, 294, 750, 807, 827, 150, 790, 288, 923, 
-   804, 378, 215, 828, 592, 281, 565, 555, 710, 82, 
-   896, 831, 547, 261, 524, 462, 293, 465, 502, 56, 
-   661, 821, 976, 991, 658, 869, 905, 758, 745, 193, 
-   768, 550, 608, 933, 378, 286, 215, 979, 792, 961, 
-   61, 688, 793, 644, 986, 403, 106, 366, 905, 644, 
-   372, 567, 466, 434, 645, 210, 389, 550, 919, 135, 
-   780, 773, 635, 389, 707, 100, 626, 958, 165, 504, 
-   920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 
-   645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 
-   936, 638
-};
-
-
-/*-------------------------------------------------------------*/
-/*--- end                                       randtable.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/examples/C/run_nc4_valgrind_tests.sh b/examples/C/run_nc4_valgrind_tests.sh
deleted file mode 100755
index 42f8977..0000000
--- a/examples/C/run_nc4_valgrind_tests.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-# This shell runs the tests with valgrind, for netCDF-4.
-
-# $Id: run_valgrind_tests.sh,v 1.9 2010/01/26 20:24:18 ed Exp $
-
-set -e
-echo ""
-echo "Testing netCDF-4 test programs with valgrind..."
-
-# These are my test programs.
-list='simple_nc4_wr simple_nc4_rd simple_xy_nc4_wr '\
-'simple_xy_nc4_rd '
-
-for tst in $list; do
-    echo ""
-    cmd1="valgrind -q --error-exitcode=2 --leak-check=full ./$tst"
-    echo "$cmd1:"
-    $cmd1
-done
-
-echo "SUCCESS!!!"
-
-exit 0
diff --git a/examples/C/run_valgrind_tests.sh b/examples/C/run_valgrind_tests.sh
deleted file mode 100755
index 3b2b9cd..0000000
--- a/examples/C/run_valgrind_tests.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-# This shell runs the tests with valgrind.
-
-# $Id: run_valgrind_tests.sh,v 1.9 2010/01/26 20:24:18 ed Exp $
-
-set -e
-echo ""
-echo "Testing programs with valgrind..."
-
-# These are my test programs.
-list='simple_xy_wr simple_xy_rd sfc_pres_temp_wr '\
-'sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd '
-
-for tst in $list; do
-    echo ""
-    cmd1="valgrind -q --error-exitcode=2 --leak-check=full ./$tst"
-    echo "$cmd1:"
-    $cmd1
-done
-
-echo "SUCCESS!!!"
-
-exit 0
diff --git a/examples/CDL/Makefile.in b/examples/CDL/Makefile.in
index 78cda8f..c4a54a0 100644
--- a/examples/CDL/Makefile.in
+++ b/examples/CDL/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -364,7 +364,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -373,6 +372,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -411,6 +411,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -545,8 +546,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -690,7 +691,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: 
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -726,7 +727,10 @@ recheck: all
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 2806104..d2e0e6a 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -141,7 +141,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	distdir
+	distdir distdir-am
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -226,7 +226,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -235,6 +234,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -273,6 +273,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -398,8 +399,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -516,7 +517,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/h5_test/Makefile.am b/h5_test/Makefile.am
index 18e168b..f114d7c 100644
--- a/h5_test/Makefile.am
+++ b/h5_test/Makefile.am
@@ -38,17 +38,10 @@ check_PROGRAMS += tst_h_par
 TESTS += run_par_tests.sh
 endif
 
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
-if USE_VALGRIND_TESTS
-TESTS += run_valgrind_tests.sh
-endif # USE_VALGRIND_TESTS
-
 # We must include these files in the distribution.
-EXTRA_DIST = run_par_tests.sh run_valgrind_tests.sh		\
-ref_tst_h_compounds.h5 ref_tst_h_compounds2.h5 run_par_tests.sh	\
-run_valgrind_tests.sh ref_tst_compounds.nc h5_err_macros.h	\
-CMakeLists.txt
+EXTRA_DIST = run_par_tests.sh ref_tst_h_compounds.h5		\
+ref_tst_h_compounds2.h5 run_par_tests.sh ref_tst_compounds.nc	\
+h5_err_macros.h CMakeLists.txt
 
 # Clean up test results.
 CLEANFILES = tst_h_*.h5
diff --git a/h5_test/Makefile.in b/h5_test/Makefile.in
index aba2e6c..2e02618 100644
--- a/h5_test/Makefile.in
+++ b/h5_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -112,15 +112,11 @@ target_triplet = @target@
 # If benchmarks were turned on, build and run a bunch more tests.
 @BUILD_BENCHMARKS_TRUE at am__append_2 = tst_h_mem
 check_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_3)
-TESTS = $(am__EXEEXT_2) $(am__append_4) $(am__append_5)
+TESTS = $(am__EXEEXT_2) $(am__append_4)
 
 # The parallel program is run from a script.
 @TEST_PARALLEL4_TRUE at am__append_3 = tst_h_par
 @TEST_PARALLEL4_TRUE at am__append_4 = run_par_tests.sh
-
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
- at USE_VALGRIND_TESTS_TRUE@am__append_5 = run_valgrind_tests.sh
 subdir = h5_test
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -247,7 +243,22 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/tst_h_atts.Po \
+	./$(DEPDIR)/tst_h_atts3.Po ./$(DEPDIR)/tst_h_atts4.Po \
+	./$(DEPDIR)/tst_h_compounds.Po ./$(DEPDIR)/tst_h_compounds2.Po \
+	./$(DEPDIR)/tst_h_dimscales.Po ./$(DEPDIR)/tst_h_dimscales1.Po \
+	./$(DEPDIR)/tst_h_dimscales2.Po \
+	./$(DEPDIR)/tst_h_dimscales3.Po \
+	./$(DEPDIR)/tst_h_dimscales4.Po ./$(DEPDIR)/tst_h_enums.Po \
+	./$(DEPDIR)/tst_h_files.Po ./$(DEPDIR)/tst_h_files2.Po \
+	./$(DEPDIR)/tst_h_files4.Po ./$(DEPDIR)/tst_h_grps.Po \
+	./$(DEPDIR)/tst_h_ints.Po ./$(DEPDIR)/tst_h_mem.Po \
+	./$(DEPDIR)/tst_h_opaques.Po ./$(DEPDIR)/tst_h_par.Po \
+	./$(DEPDIR)/tst_h_strings.Po ./$(DEPDIR)/tst_h_strings1.Po \
+	./$(DEPDIR)/tst_h_strings2.Po ./$(DEPDIR)/tst_h_vars.Po \
+	./$(DEPDIR)/tst_h_vars2.Po ./$(DEPDIR)/tst_h_vars3.Po \
+	./$(DEPDIR)/tst_h_vl.Po ./$(DEPDIR)/tst_h_wrt_cmp.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -551,7 +562,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -560,6 +570,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -598,6 +609,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -710,10 +722,9 @@ H5TESTS = tst_h_files tst_h_files2 tst_h_files4 tst_h_atts tst_h_atts3 \
 	tst_h_dimscales3 tst_h_enums tst_h_dimscales4 $(am__append_2)
 
 # We must include these files in the distribution.
-EXTRA_DIST = run_par_tests.sh run_valgrind_tests.sh		\
-ref_tst_h_compounds.h5 ref_tst_h_compounds2.h5 run_par_tests.sh	\
-run_valgrind_tests.sh ref_tst_compounds.nc h5_err_macros.h	\
-CMakeLists.txt
+EXTRA_DIST = run_par_tests.sh ref_tst_h_compounds.h5		\
+ref_tst_h_compounds2.h5 run_par_tests.sh ref_tst_compounds.nc	\
+h5_err_macros.h CMakeLists.txt
 
 
 # Clean up test results.
@@ -739,8 +750,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -876,33 +887,39 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_atts.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_atts3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_atts4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_compounds.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_compounds2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales1.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_enums.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_files2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_files4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_grps.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_ints.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_mem.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_opaques.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_par.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strings.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strings1.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strings2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vars2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vars3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vl.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_wrt_cmp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_atts.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_atts3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_atts4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_compounds.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_compounds2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales1.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_dimscales4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_enums.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_files.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_files2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_files4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_grps.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_ints.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_mem.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_opaques.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_par.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strings.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strings1.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strings2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vars.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vars2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vars3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_vl.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_wrt_cmp.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1106,7 +1123,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1316,13 +1333,6 @@ run_par_tests.sh.log: run_par_tests.sh
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
-run_valgrind_tests.sh.log: run_valgrind_tests.sh
-	@p='run_valgrind_tests.sh'; \
-	b='run_valgrind_tests.sh'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
 .test.log:
 	@p='$<'; \
 	$(am__set_b); \
@@ -1338,7 +1348,10 @@ run_valgrind_tests.sh.log: run_valgrind_tests.sh
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1414,7 +1427,33 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/tst_h_atts.Po
+	-rm -f ./$(DEPDIR)/tst_h_atts3.Po
+	-rm -f ./$(DEPDIR)/tst_h_atts4.Po
+	-rm -f ./$(DEPDIR)/tst_h_compounds.Po
+	-rm -f ./$(DEPDIR)/tst_h_compounds2.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales1.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales2.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales3.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales4.Po
+	-rm -f ./$(DEPDIR)/tst_h_enums.Po
+	-rm -f ./$(DEPDIR)/tst_h_files.Po
+	-rm -f ./$(DEPDIR)/tst_h_files2.Po
+	-rm -f ./$(DEPDIR)/tst_h_files4.Po
+	-rm -f ./$(DEPDIR)/tst_h_grps.Po
+	-rm -f ./$(DEPDIR)/tst_h_ints.Po
+	-rm -f ./$(DEPDIR)/tst_h_mem.Po
+	-rm -f ./$(DEPDIR)/tst_h_opaques.Po
+	-rm -f ./$(DEPDIR)/tst_h_par.Po
+	-rm -f ./$(DEPDIR)/tst_h_strings.Po
+	-rm -f ./$(DEPDIR)/tst_h_strings1.Po
+	-rm -f ./$(DEPDIR)/tst_h_strings2.Po
+	-rm -f ./$(DEPDIR)/tst_h_vars.Po
+	-rm -f ./$(DEPDIR)/tst_h_vars2.Po
+	-rm -f ./$(DEPDIR)/tst_h_vars3.Po
+	-rm -f ./$(DEPDIR)/tst_h_vl.Po
+	-rm -f ./$(DEPDIR)/tst_h_wrt_cmp.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1460,7 +1499,33 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/tst_h_atts.Po
+	-rm -f ./$(DEPDIR)/tst_h_atts3.Po
+	-rm -f ./$(DEPDIR)/tst_h_atts4.Po
+	-rm -f ./$(DEPDIR)/tst_h_compounds.Po
+	-rm -f ./$(DEPDIR)/tst_h_compounds2.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales1.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales2.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales3.Po
+	-rm -f ./$(DEPDIR)/tst_h_dimscales4.Po
+	-rm -f ./$(DEPDIR)/tst_h_enums.Po
+	-rm -f ./$(DEPDIR)/tst_h_files.Po
+	-rm -f ./$(DEPDIR)/tst_h_files2.Po
+	-rm -f ./$(DEPDIR)/tst_h_files4.Po
+	-rm -f ./$(DEPDIR)/tst_h_grps.Po
+	-rm -f ./$(DEPDIR)/tst_h_ints.Po
+	-rm -f ./$(DEPDIR)/tst_h_mem.Po
+	-rm -f ./$(DEPDIR)/tst_h_opaques.Po
+	-rm -f ./$(DEPDIR)/tst_h_par.Po
+	-rm -f ./$(DEPDIR)/tst_h_strings.Po
+	-rm -f ./$(DEPDIR)/tst_h_strings1.Po
+	-rm -f ./$(DEPDIR)/tst_h_strings2.Po
+	-rm -f ./$(DEPDIR)/tst_h_vars.Po
+	-rm -f ./$(DEPDIR)/tst_h_vars2.Po
+	-rm -f ./$(DEPDIR)/tst_h_vars3.Po
+	-rm -f ./$(DEPDIR)/tst_h_vl.Po
+	-rm -f ./$(DEPDIR)/tst_h_wrt_cmp.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1481,16 +1546,16 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	recheck tags tags-am uninstall uninstall-am
diff --git a/h5_test/run_valgrind_tests.sh b/h5_test/run_valgrind_tests.sh
deleted file mode 100755
index 9fa2568..0000000
--- a/h5_test/run_valgrind_tests.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
-# This shell runs the tests with valgrind.
-
-set -e
-echo ""
-echo "Testing programs with valgrind..."
-
-# These are my test programs.
-list='tst_h_files tst_h_files2 tst_h_files4 tst_h_atts '\
-'tst_h_atts3 tst_h_atts4 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps '\
-'tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl '\
-'tst_h_opaques tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints '\
-'tst_h_dimscales tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 '\
-'tst_h_enums'
-
-for tst in $list; do
-    echo ""
-    cmd1="valgrind -q --error-exitcode=2 --leak-check=full ./$tst"
-    echo "$cmd1:"
-    $cmd1
-done
-
-echo "SUCCESS!!!"
-
-exit 0
diff --git a/hdf4_test/CMakeLists.txt b/hdf4_test/CMakeLists.txt
new file mode 100644
index 0000000..1d95d9b
--- /dev/null
+++ b/hdf4_test/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copy some test files from current source dir to out-of-tree build dir.
+FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.hdf4)
+FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+IF(MSVC)
+  FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
+ENDIF()
+
+IF(USE_HDF4_FILE_TESTS AND NOT MSVC)
+  build_bin_test_no_prefix(tst_interops2)
+  build_bin_test_no_prefix(tst_interops3)
+  add_bin_test(hdf4_test tst_chunk_hdf4)
+  add_bin_test(hdf4_test tst_h4_lendian)
+  add_sh_test(hdf4_test run_get_hdf4_files)
+  add_sh_test(hdf4_test run_formatx_hdf4)
+ENDIF()
+
diff --git a/hdf4_test/Makefile.am b/hdf4_test/Makefile.am
new file mode 100644
index 0000000..5bb7e82
--- /dev/null
+++ b/hdf4_test/Makefile.am
@@ -0,0 +1,37 @@
+# This is part of the netCDF package.
+# Copyright 2018 University Corporation for Atmospheric Research/Unidata
+# See COPYRIGHT file for conditions of use.
+#
+# This directory has tests for the HDF4 code. This directory will be
+# skipped if HDF4 is not enabled.
+#
+# Ed Hartnett
+
+# Put together AM_CPPFLAGS and AM_LDFLAGS.
+include $(top_srcdir)/lib_flags.am
+
+# Link to our assembled library.
+AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
+
+# These are the C tests for HDF4.
+check_PROGRAMS = tst_chunk_hdf4 tst_h4_lendian
+TESTS = tst_chunk_hdf4 tst_h4_lendian
+
+# This test script depends on ncdump and tst_interops2.c.
+if BUILD_UTILITIES
+check_PROGRAMS += tst_interops2 
+TESTS += run_formatx_hdf4.sh
+endif # BUILD_UTILITIES
+
+# This test script fetches HDF4 files from an FTP server and uses
+# program tst_interops3.c to read them.
+if USE_HDF4_FILE_TESTS
+check_PROGRAMS += tst_interops3
+TESTS += run_get_hdf4_files.sh
+endif # USE_HDF4_FILE_TESTS
+
+EXTRA_DIST = CMakeLists.txt ref_contiguous.hdf4 ref_chunked.hdf4	\
+run_get_hdf4_files.sh run_formatx_hdf4.sh
+
+CLEANFILES = *.h4 *.hdf
+
diff --git a/nctest/Makefile.in b/hdf4_test/Makefile.in
similarity index 82%
copy from nctest/Makefile.in
copy to hdf4_test/Makefile.in
index 38e84d7..77bf053 100644
--- a/nctest/Makefile.in
+++ b/hdf4_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,10 +14,14 @@
 
 @SET_MAKE@
 
-# Copyright 2005, see the COPYRIGHT file for more information.  
-
-# This file builds and runs the nctest program, which tests the netCDF
-# version 2 interface.
+# This is part of the netCDF package.
+# Copyright 2018 University Corporation for Atmospheric Research/Unidata
+# See COPYRIGHT file for conditions of use.
+#
+# This directory has tests for the HDF4 code. This directory will be
+# skipped if HDF4 is not enabled.
+#
+# Ed Hartnett
 
 # This is part of the netCDF package.
 # Copyright 2005 University Corporation for Atmospheric Research/Unidata
@@ -102,13 +106,20 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 @USE_DAP_TRUE at am__append_1 = -I${top_srcdir}/oc2
-check_PROGRAMS = $(am__EXEEXT_1)
-TESTS = $(am__EXEEXT_1) compare_test_files.sh $(am__append_2)
-
-# This will the test program with valgrind, the memory checking
-# tool. (Valgrind must be present for this to work.)
- at USE_VALGRIND_TESTS_TRUE@am__append_2 = run_valgrind_tests.sh
-subdir = nctest
+check_PROGRAMS = tst_chunk_hdf4$(EXEEXT) tst_h4_lendian$(EXEEXT) \
+	$(am__EXEEXT_1) $(am__EXEEXT_2)
+TESTS = tst_chunk_hdf4$(EXEEXT) tst_h4_lendian$(EXEEXT) \
+	$(am__append_3) $(am__append_5)
+
+# This test script depends on ncdump and tst_interops2.c.
+ at BUILD_UTILITIES_TRUE@am__append_2 = tst_interops2 
+ at BUILD_UTILITIES_TRUE@am__append_3 = run_formatx_hdf4.sh
+
+# This test script fetches HDF4 files from an FTP server and uses
+# program tst_interops3.c to read them.
+ at USE_HDF4_FILE_TESTS_TRUE@am__append_4 = tst_interops3
+ at USE_HDF4_FILE_TESTS_TRUE@am__append_5 = run_get_hdf4_files.sh
+subdir = hdf4_test
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -120,24 +131,25 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__EXEEXT_1 = nctest$(EXEEXT) tst_rename$(EXEEXT)
-am_nctest_OBJECTS = add.$(OBJEXT) atttests.$(OBJEXT) \
-	cdftests.$(OBJEXT) dimtests.$(OBJEXT) driver.$(OBJEXT) \
-	emalloc.$(OBJEXT) error.$(OBJEXT) misctest.$(OBJEXT) \
-	rec.$(OBJEXT) slabs.$(OBJEXT) val.$(OBJEXT) vardef.$(OBJEXT) \
-	varget.$(OBJEXT) vargetg.$(OBJEXT) varput.$(OBJEXT) \
-	varputg.$(OBJEXT) vartests.$(OBJEXT) vputget.$(OBJEXT) \
-	vputgetg.$(OBJEXT)
-nctest_OBJECTS = $(am_nctest_OBJECTS)
-nctest_LDADD = $(LDADD)
+CONFIG_CLEAN_VPATH_FILES = ref_chunked.hdf4 ref_contiguous.hdf4
+ at BUILD_UTILITIES_TRUE@am__EXEEXT_1 = tst_interops2$(EXEEXT)
+ at USE_HDF4_FILE_TESTS_TRUE@am__EXEEXT_2 = tst_interops3$(EXEEXT)
+tst_chunk_hdf4_SOURCES = tst_chunk_hdf4.c
+tst_chunk_hdf4_OBJECTS = tst_chunk_hdf4.$(OBJEXT)
+tst_chunk_hdf4_LDADD = $(LDADD)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-tst_rename_SOURCES = tst_rename.c
-tst_rename_OBJECTS = tst_rename.$(OBJEXT)
-tst_rename_LDADD = $(LDADD)
+tst_h4_lendian_SOURCES = tst_h4_lendian.c
+tst_h4_lendian_OBJECTS = tst_h4_lendian.$(OBJEXT)
+tst_h4_lendian_LDADD = $(LDADD)
+tst_interops2_SOURCES = tst_interops2.c
+tst_interops2_OBJECTS = tst_interops2.$(OBJEXT)
+tst_interops2_LDADD = $(LDADD)
+tst_interops3_SOURCES = tst_interops3.c
+tst_interops3_OBJECTS = tst_interops3.$(OBJEXT)
+tst_interops3_LDADD = $(LDADD)
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -152,7 +164,10 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/tst_chunk_hdf4.Po \
+	./$(DEPDIR)/tst_h4_lendian.Po ./$(DEPDIR)/tst_interops2.Po \
+	./$(DEPDIR)/tst_interops3.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -172,8 +187,10 @@ AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(nctest_SOURCES) tst_rename.c
-DIST_SOURCES = $(nctest_SOURCES) tst_rename.c
+SOURCES = tst_chunk_hdf4.c tst_h4_lendian.c tst_interops2.c \
+	tst_interops3.c
+DIST_SOURCES = tst_chunk_hdf4.c tst_h4_lendian.c tst_interops2.c \
+	tst_interops3.c
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -383,6 +400,7 @@ am__set_TESTS_bases = \
 RECHECK_LOGS = $(TEST_LOGS)
 AM_RECURSIVE_TARGETS = check recheck
 TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
 LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
 LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
 am__set_b = \
@@ -397,11 +415,13 @@ am__set_b = \
   esac
 am__test_logs1 = $(TESTS:=.log)
 am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
-TEST_LOGS = $(am__test_logs2:.sh.log=.log)
-SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
-SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
-am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
-	$(top_srcdir)/lib_flags.am $(top_srcdir)/test-driver README
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+	$(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ref_chunked.hdf4 \
+	$(srcdir)/ref_contiguous.hdf4 $(top_srcdir)/depcomp \
+	$(top_srcdir)/lib_flags.am $(top_srcdir)/test-driver
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
@@ -411,6 +431,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include $(am__append_1)
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 
 # Put together AM_CPPFLAGS and AM_LDFLAGS.
+
+# Link to our assembled library.
 AM_LDFLAGS = ${top_builddir}/liblib/libnetcdf.la
 AR = @AR@
 AUTOCONF = @AUTOCONF@
@@ -442,7 +464,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -451,6 +472,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -489,6 +511,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -588,37 +611,14 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_TESTS_ENVIRONMENT = export TOPSRCDIR=${abs_top_srcdir}; export TOPBUILDDIR=${abs_top_builddir}; 
+EXTRA_DIST = CMakeLists.txt ref_contiguous.hdf4 ref_chunked.hdf4	\
+run_get_hdf4_files.sh run_formatx_hdf4.sh
 
-# Running nctest results in a file testfile.nc, which is then checked
-# to make sure it matches testfile_nc.sav, which was generated under
-# precisely controlled conditions at the netCDF Test Facility,
-# (located in sub-basement 42 of UCAR Compound 4). testfile_nc.sav was
-# generated in a pressurized chamber that exactly simulated the
-# atmosphere on the surface of Mars.
-EXTRA_DIST = ref_nctest_classic.nc ref_nctest_64bit_offset.nc	\
-compare_test_files.sh run_valgrind_tests.sh CMakeLists.txt
-
-CLEANFILES = nctest_*.nc test2.nc temp.tmp tst_*.nc	\
-nctest_classic.cdl ref_nctest_classic.cdl
-
-
-# Run nctest and the script that compares the output with the
-# reference file.
-TESTPROGRAMS = nctest tst_rename
-
-# Note which tests depend on other tests. Necessary for make -j check.
-TEST_EXTENSIONS = .sh
-
-# These are the source files for the nctest program.
-nctest_SOURCES = add.c add.h atttests.c cdftests.c dimtests.c driver.c	\
-emalloc.c emalloc.h error.c error.h misctest.c rec.c slabs.c testcdf.h	\
-tests.h val.c val.h vardef.c varget.c vargetg.c varput.c varputg.c	\
-vartests.c vputget.c vputgetg.c
-
+CLEANFILES = *.h4 *.hdf
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .log .o .obj .sh .sh$(EXEEXT) .trs
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/lib_flags.am $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -628,16 +628,16 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign nctest/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf4_test/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign nctest/Makefile
+	  $(AUTOMAKE) --foreign hdf4_test/Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -659,13 +659,21 @@ clean-checkPROGRAMS:
 	echo " rm -f" $$list; \
 	rm -f $$list
 
-nctest$(EXEEXT): $(nctest_OBJECTS) $(nctest_DEPENDENCIES) $(EXTRA_nctest_DEPENDENCIES) 
-	@rm -f nctest$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(nctest_OBJECTS) $(nctest_LDADD) $(LIBS)
+tst_chunk_hdf4$(EXEEXT): $(tst_chunk_hdf4_OBJECTS) $(tst_chunk_hdf4_DEPENDENCIES) $(EXTRA_tst_chunk_hdf4_DEPENDENCIES) 
+	@rm -f tst_chunk_hdf4$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_chunk_hdf4_OBJECTS) $(tst_chunk_hdf4_LDADD) $(LIBS)
+
+tst_h4_lendian$(EXEEXT): $(tst_h4_lendian_OBJECTS) $(tst_h4_lendian_DEPENDENCIES) $(EXTRA_tst_h4_lendian_DEPENDENCIES) 
+	@rm -f tst_h4_lendian$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_h4_lendian_OBJECTS) $(tst_h4_lendian_LDADD) $(LIBS)
 
-tst_rename$(EXEEXT): $(tst_rename_OBJECTS) $(tst_rename_DEPENDENCIES) $(EXTRA_tst_rename_DEPENDENCIES) 
-	@rm -f tst_rename$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(tst_rename_OBJECTS) $(tst_rename_LDADD) $(LIBS)
+tst_interops2$(EXEEXT): $(tst_interops2_OBJECTS) $(tst_interops2_DEPENDENCIES) $(EXTRA_tst_interops2_DEPENDENCIES) 
+	@rm -f tst_interops2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_interops2_OBJECTS) $(tst_interops2_LDADD) $(LIBS)
+
+tst_interops3$(EXEEXT): $(tst_interops3_OBJECTS) $(tst_interops3_DEPENDENCIES) $(EXTRA_tst_interops3_DEPENDENCIES) 
+	@rm -f tst_interops3$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_interops3_OBJECTS) $(tst_interops3_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -673,26 +681,16 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/atttests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdftests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dimtests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/driver.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/emalloc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misctest.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rec.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slabs.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rename.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/val.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardef.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varget.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vargetg.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varput.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varputg.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vartests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputget.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputgetg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunk_hdf4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h4_lendian.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops3.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -896,7 +894,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -917,36 +915,53 @@ recheck: all $(check_PROGRAMS)
 	        am__force_recheck=am--force-recheck \
 	        TEST_LOGS="$$log_list"; \
 	exit $$?
-nctest.log: nctest$(EXEEXT)
-	@p='nctest$(EXEEXT)'; \
-	b='nctest'; \
+tst_chunk_hdf4.log: tst_chunk_hdf4$(EXEEXT)
+	@p='tst_chunk_hdf4$(EXEEXT)'; \
+	b='tst_chunk_hdf4'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+tst_h4_lendian.log: tst_h4_lendian$(EXEEXT)
+	@p='tst_h4_lendian$(EXEEXT)'; \
+	b='tst_h4_lendian'; \
 	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
-tst_rename.log: tst_rename$(EXEEXT)
-	@p='tst_rename$(EXEEXT)'; \
-	b='tst_rename'; \
+run_formatx_hdf4.sh.log: run_formatx_hdf4.sh
+	@p='run_formatx_hdf4.sh'; \
+	b='run_formatx_hdf4.sh'; \
 	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
-.sh.log:
+run_get_hdf4_files.sh.log: run_get_hdf4_files.sh
+	@p='run_get_hdf4_files.sh'; \
+	b='run_get_hdf4_files.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
 	@p='$<'; \
 	$(am__set_b); \
-	$(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
+	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
 	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
+	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
- at am__EXEEXT_TRUE@.sh$(EXEEXT).log:
+ at am__EXEEXT_TRUE@.test$(EXEEXT).log:
 @am__EXEEXT_TRUE@	@p='$<'; \
 @am__EXEEXT_TRUE@	$(am__set_b); \
- at am__EXEEXT_TRUE@	$(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \
+ at am__EXEEXT_TRUE@	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
 @am__EXEEXT_TRUE@	--log-file $$b.log --trs-file $$b.trs \
- at am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
+ at am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1022,7 +1037,10 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/tst_chunk_hdf4.Po
+	-rm -f ./$(DEPDIR)/tst_h4_lendian.Po
+	-rm -f ./$(DEPDIR)/tst_interops2.Po
+	-rm -f ./$(DEPDIR)/tst_interops3.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1068,7 +1086,10 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/tst_chunk_hdf4.Po
+	-rm -f ./$(DEPDIR)/tst_h4_lendian.Po
+	-rm -f ./$(DEPDIR)/tst_interops2.Po
+	-rm -f ./$(DEPDIR)/tst_interops3.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1089,16 +1110,16 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	recheck tags tags-am uninstall uninstall-am
@@ -1106,9 +1127,6 @@ uninstall-am:
 .PRECIOUS: Makefile
 
 
-# compare_test_files depends on nctest executing first.
-compare_test_files.log: nctest.log 
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/nc_test4/ref_chunked.hdf4 b/hdf4_test/ref_chunked.hdf4
similarity index 100%
rename from nc_test4/ref_chunked.hdf4
rename to hdf4_test/ref_chunked.hdf4
diff --git a/nc_test4/ref_contiguous.hdf4 b/hdf4_test/ref_contiguous.hdf4
similarity index 100%
rename from nc_test4/ref_contiguous.hdf4
rename to hdf4_test/ref_contiguous.hdf4
diff --git a/hdf4_test/run_formatx_hdf4.sh b/hdf4_test/run_formatx_hdf4.sh
new file mode 100755
index 0000000..8fc1992
--- /dev/null
+++ b/hdf4_test/run_formatx_hdf4.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# This shell script runs tst_interops2 to create a HDF4 file, and read
+# it with netCDF. Then the script runs ncdump on the HDF4 file.
+
+# Ed Hartnett
+
+if test "x$srcdir" = x ; then srcdir=`pwd`; fi
+. ../test_common.sh
+
+FILE=tst_interops2.h4
+
+ECODE=0
+
+echo ""
+echo "*** Testing extended file format output."
+set -e
+
+echo "Creating HDF4 file"
+${execdir}/tst_interops2
+
+echo "Test extended format output for a HDF4 file"
+rm -f tmp_tst_formatx_hdf4
+${NCDUMP} -K $FILE >tmp_tst_formatx_hdf4
+if ! fgrep 'HDF4 mode=00001000' <tmp_tst_formatx_hdf4 ; then
+TMP=`cat tmp_tst_formatx_hdf4`
+echo "*** Fail: extended format for an HDF4 file: result=" $TMP
+ECODE=1
+fi
+
+rm -f tmp_tst_formatx_hdf4
+
+# Exit if there was a failure.
+if test $ECODE = 1 ; then
+    exit $ECODE
+fi
+
+echo ""
+echo "*** Testing reading an individual variable from an HDF4 file."
+
+${NCDUMP} -v hdf4_dataset_type_0 $FILE
+${NCDUMP} -v hdf4_dataset_type_1 $FILE
+${NCDUMP} -v hdf4_dataset_type_2 $FILE
+${NCDUMP} -v hdf4_dataset_type_3 $FILE
+${NCDUMP} -v hdf4_dataset_type_4 $FILE
+${NCDUMP} -v hdf4_dataset_type_5 $FILE
+${NCDUMP} -v hdf4_dataset_type_6 $FILE
+${NCDUMP} -v hdf4_dataset_type_7 $FILE
+
+echo "*** Success."
+
diff --git a/nc_test4/run_get_hdf4_files.sh b/hdf4_test/run_get_hdf4_files.sh
similarity index 91%
rename from nc_test4/run_get_hdf4_files.sh
rename to hdf4_test/run_get_hdf4_files.sh
index 929878b..566dee9 100755
--- a/nc_test4/run_get_hdf4_files.sh
+++ b/hdf4_test/run_get_hdf4_files.sh
@@ -21,7 +21,7 @@ echo "Getting HDF4 test files $file_list"
 for f1 in $file_list
 do
     if ! test -f $f1; then
-	curl -O "ftp://ftp.unidata.ucar.edu/pub/netcdf/sample_data/hdf4/$f1.gz"
+	wget "ftp://ftp.unidata.ucar.edu/pub/netcdf/sample_data/hdf4/$f1.gz"
 	gunzip $f1.gz
     fi
 done
diff --git a/nc_test4/tst_chunk_hdf4.c b/hdf4_test/tst_chunk_hdf4.c
similarity index 100%
rename from nc_test4/tst_chunk_hdf4.c
rename to hdf4_test/tst_chunk_hdf4.c
diff --git a/nc_test4/tst_h4_lendian.c b/hdf4_test/tst_h4_lendian.c
similarity index 99%
rename from nc_test4/tst_h4_lendian.c
rename to hdf4_test/tst_h4_lendian.c
index e610e6b..e248aa3 100644
--- a/nc_test4/tst_h4_lendian.c
+++ b/hdf4_test/tst_h4_lendian.c
@@ -4,7 +4,6 @@
  * https://github.com/Unidata/netcdf-c/issues/113.
  */
 
-#include <stdio.h>
 #include <config.h>
 #include <unistd.h>
 #include <nc_tests.h>
diff --git a/nc_test4/tst_interops2.c b/hdf4_test/tst_interops2.c
similarity index 98%
rename from nc_test4/tst_interops2.c
rename to hdf4_test/tst_interops2.c
index d83fdb9..2b7ff26 100644
--- a/nc_test4/tst_interops2.c
+++ b/hdf4_test/tst_interops2.c
@@ -65,7 +65,7 @@ main(int argc, char **argv)
 
       /* Expected this to return NC_EPERM, but instead it returns
        * success. See github issue #744. */
-      if (nc_def_var_chunking_ints(ncid, 0, NC_CONTIGUOUS, NULL)) ERR;
+      /* if (nc_def_var_chunking_ints(ncid, 0, NC_CONTIGUOUS, NULL)) ERR; */
       
       /* Read the data through a vara function from the netCDF API. */
       if (nc_get_vara(ncid, 0, nstart, ncount, data_in)) ERR;
diff --git a/nc_test4/tst_interops3.c b/hdf4_test/tst_interops3.c
similarity index 99%
rename from nc_test4/tst_interops3.c
rename to hdf4_test/tst_interops3.c
index 4603e88..166c50c 100644
--- a/nc_test4/tst_interops3.c
+++ b/hdf4_test/tst_interops3.c
@@ -77,7 +77,6 @@ main(int argc, char **argv)
 							   "MOD29.A2000055.0005.005.2006267200024.hdf",
 							   "MYD29.A2002185.0000.005.2007160150627.hdf",
 							   "MYD29.A2009152.0000.005.2009153124331.hdf"};
-      size_t len_in;
       int expected_mode = NC_NETCDF4;
       int expected_extended_format = NC_FORMATX_NC_HDF4;
       int f;
diff --git a/include/Makefile.am b/include/Makefile.am
index 59c058a..be66f1d 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -4,6 +4,8 @@
 # This automake file generates the Makefile to build the include
 # directory.
 
+# Ed Hartnett, Dennis Heimbigner, Ward Fisher
+
 include_HEADERS = netcdf.h netcdf_meta.h
 
 if BUILD_PARALLEL
@@ -14,12 +16,12 @@ if BUILD_DISKLESS
 include_HEADERS += netcdf_mem.h
 endif
 
-noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h	\
-nclist.h ncuri.h ncutf8.h ncdispatch.h ncdimscale.h		\
-netcdf_f.h err_macros.h ncbytes.h nchashmap.h ceconstraints.h rnd.h	\
-nclog.h ncconfigure.h nc4internal.h nctime.h nc3internal.h \
-onstack.h nc_hashmap.h ncrc.h ncauth.h ncoffsets.h nctestserver.h \
-nc4dispatch.h nc3dispatch.h ncexternl.h ncwinpath.h ncfilter.h
+noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h nclist.h		\
+ncuri.h ncutf8.h ncdispatch.h ncdimscale.h netcdf_f.h err_macros.h	\
+ncbytes.h nchashmap.h ceconstraints.h rnd.h nclog.h ncconfigure.h	\
+nc4internal.h nctime.h nc3internal.h onstack.h nc_hashmap.h ncrc.h	\
+ncauth.h ncoffsets.h nctestserver.h nc4dispatch.h nc3dispatch.h		\
+ncexternl.h ncwinpath.h ncfilter.h hdf4dispatch.h nclistmap.h
 
 if USE_DAP
 noinst_HEADERS += ncdap.h
diff --git a/include/Makefile.in b/include/Makefile.in
index cdb6e5d..cc5049f 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -19,6 +19,8 @@
 # This automake file generates the Makefile to build the include
 # directory.
 
+# Ed Hartnett, Dennis Heimbigner, Ward Fisher
+
 VPATH = @srcdir@
 am__is_gnu_make = { \
   if test -z '$(MAKELEVEL)'; then \
@@ -167,7 +169,8 @@ am__noinst_HEADERS_DIST = nc_logging.h nc_tests.h fbits.h nc.h \
 	nclog.h ncconfigure.h nc4internal.h nctime.h nc3internal.h \
 	onstack.h nc_hashmap.h ncrc.h ncauth.h ncoffsets.h \
 	nctestserver.h nc4dispatch.h nc3dispatch.h ncexternl.h \
-	ncwinpath.h ncfilter.h ncdap.h ncaux.h
+	ncwinpath.h ncfilter.h hdf4dispatch.h nclistmap.h ncdap.h \
+	ncaux.h
 HEADERS = $(include_HEADERS) $(noinst_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
@@ -227,7 +230,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -236,6 +238,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -274,6 +277,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -380,7 +384,7 @@ noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h nclist.h ncuri.h \
 	ncconfigure.h nc4internal.h nctime.h nc3internal.h onstack.h \
 	nc_hashmap.h ncrc.h ncauth.h ncoffsets.h nctestserver.h \
 	nc4dispatch.h nc3dispatch.h ncexternl.h ncwinpath.h ncfilter.h \
-	$(am__append_3) $(am__append_4)
+	hdf4dispatch.h nclistmap.h $(am__append_3) $(am__append_4)
 EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in
 all: all-am
 
@@ -402,8 +406,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -496,7 +500,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/include/hdf4dispatch.h b/include/hdf4dispatch.h
new file mode 100644
index 0000000..f1cfaef
--- /dev/null
+++ b/include/hdf4dispatch.h
@@ -0,0 +1,276 @@
+/* Copyright 2018, UCAR/Unidata. See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions. */
+/**
+ * @file
+ * This header file contains the prototypes for the HDF4 versions
+ * of the netCDF functions.
+ *
+ * Ed Hartnett
+ */
+#ifndef _HDF4DISPATCH_H
+#define _HDF4DISPATCH_H
+
+#include "config.h"
+#include <stddef.h> /* size_t, ptrdiff_t */
+#include <errno.h>  /* netcdf functions sometimes return system errors */
+#include "ncdispatch.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+extern int
+HDF4_create(const char *path, int cmode,
+           size_t initialsz, int basepe, size_t *chunksizehintp,
+	   int useparallel, void* parameters,
+	   NC_Dispatch*, NC*);
+
+extern int
+HDF4_open(const char *path, int mode,
+         int basepe, size_t *chunksizehintp, 
+	 int use_parallel, void* parameters,
+	 NC_Dispatch*, NC*);
+
+extern int
+HDF4_redef(int ncid);
+
+extern int
+HDF4__enddef(int ncid, size_t h_minfree, size_t v_align,
+	size_t v_minfree, size_t r_align);
+
+extern int
+HDF4_sync(int ncid);
+
+extern int
+HDF4_abort(int ncid);
+
+extern int
+HDF4_close(int ncid);
+
+extern int
+HDF4_set_fill(int ncid, int fillmode, int *old_modep);
+
+extern int
+HDF4_set_base_pe(int ncid, int pe);
+
+extern int
+HDF4_inq_base_pe(int ncid, int *pe);
+
+extern int
+HDF4_inq_format(int ncid, int *formatp);
+
+extern int
+HDF4_inq_format_extended(int ncid, int *formatp, int *modep);
+
+extern int
+HDF4_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp);
+
+extern int
+HDF4_inq_type(int, nc_type, char *, size_t *);
+
+/* Begin _dim */
+
+extern int
+HDF4_def_dim(int ncid, const char *name, size_t len, int *idp);
+
+extern int
+HDF4_inq_dimid(int ncid, const char *name, int *idp);
+
+extern int
+HDF4_inq_dim(int ncid, int dimid, char *name, size_t *lenp);
+
+extern int
+HDF4_inq_unlimdim(int ncid, int *unlimdimidp);
+
+extern int
+HDF4_rename_dim(int ncid, int dimid, const char *name);
+
+/* End _dim */
+/* Begin _att */
+
+extern int
+HDF4_inq_att(int ncid, int varid, const char *name,
+	    nc_type *xtypep, size_t *lenp);
+
+extern int 
+HDF4_inq_attid(int ncid, int varid, const char *name, int *idp);
+
+extern int
+HDF4_inq_attname(int ncid, int varid, int attnum, char *name);
+
+extern int
+HDF4_rename_att(int ncid, int varid, const char *name, const char *newname);
+
+extern int
+HDF4_del_att(int ncid, int varid, const char*);
+
+/* End _att */
+/* Begin {put,get}_att */
+
+extern int
+HDF4_get_att(int ncid, int varid, const char *name, void *value, nc_type);
+
+extern int
+HDF4_put_att(int ncid, int varid, const char *name, nc_type datatype,
+	   size_t len, const void *value, nc_type);
+
+/* End {put,get}_att */
+/* Begin _var */
+
+extern int
+HDF4_def_var(int ncid, const char *name,
+	 nc_type xtype, int ndims, const int *dimidsp, int *varidp);
+
+extern int
+HDF4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, 
+               int *ndimsp, int *dimidsp, int *nattsp, 
+               int *shufflep, int *deflatep, int *deflate_levelp,
+               int *fletcher32p, int *contiguousp, size_t *chunksizesp, 
+               int *no_fill, void *fill_valuep, int *endiannessp, 
+	       unsigned int* idp, size_t* nparamsp, unsigned int* params
+	       );
+
+extern int
+HDF4_inq_varid(int ncid, const char *name, int *varidp);
+
+extern int
+HDF4_rename_var(int ncid, int varid, const char *name);
+
+extern int
+HDF4_put_vara(int ncid, int varid,
+   	     const size_t *start, const size_t *count,
+             const void *value, nc_type);
+
+extern int
+HDF4_get_vara(int ncid, int varid,
+	     const size_t *start, const size_t *count,
+             void *value, nc_type);
+
+/* End _var */
+
+/* netCDF4 API only */
+extern int
+HDF4_var_par_access(int, int, int);
+
+extern int
+HDF4_inq_ncid(int, const char *, int *);
+
+extern int
+HDF4_inq_grps(int, int *, int *);
+
+extern int
+HDF4_inq_grpname(int, char *);
+
+extern int
+HDF4_inq_grpname_full(int, size_t *, char *);
+
+extern int
+HDF4_inq_grp_parent(int, int *);
+
+extern int
+HDF4_inq_grp_full_ncid(int, const char *, int *);
+
+extern int
+HDF4_inq_varids(int, int * nvars, int *);
+
+extern int
+HDF4_inq_dimids(int, int * ndims, int *, int);
+
+extern int
+HDF4_inq_typeids(int, int * ntypes, int *);
+   
+extern int
+HDF4_inq_type_equal(int, nc_type, int, nc_type, int *);
+
+extern int
+HDF4_def_grp(int, const char *, int *);
+
+extern int
+HDF4_rename_grp(int, const char *);
+
+extern int
+HDF4_inq_user_type(int, nc_type, char *, size_t *, nc_type *, 
+		  size_t *, int *);
+
+extern int
+HDF4_def_compound(int, size_t, const char *, nc_type *);
+
+extern int
+HDF4_insert_compound(int, nc_type, const char *, size_t, nc_type);
+
+extern int
+HDF4_insert_array_compound(int, nc_type, const char *, size_t, 
+			  nc_type, int, const int *);
+
+extern int
+HDF4_inq_typeid(int, const char *, nc_type *);
+
+extern int
+HDF4_inq_compound_field(int, nc_type, int, char *, size_t *, 
+		       nc_type *, int *, int *);
+
+extern int
+HDF4_inq_compound_fieldindex(int, nc_type, const char *, int *);
+
+extern int
+HDF4_def_vlen(int, const char *, nc_type base_typeid, nc_type *);
+
+extern int
+HDF4_put_vlen_element(int, int, void *, size_t, const void *);
+
+extern int
+HDF4_get_vlen_element(int, int, const void *, size_t *, void *);
+
+extern int
+HDF4_def_enum(int, nc_type, const char *, nc_type *);
+
+extern int
+HDF4_insert_enum(int, nc_type, const char *, const void *);
+
+extern int
+HDF4_inq_enum_member(int, nc_type, int, char *, void *);
+
+extern int
+HDF4_inq_enum_ident(int, nc_type, long long, char *);
+
+extern int
+HDF4_def_opaque(int, size_t, const char *, nc_type *);
+
+extern int
+HDF4_def_var_deflate(int, int, int, int, int);
+
+extern int
+HDF4_def_var_fletcher32(int, int, int);
+
+extern int
+HDF4_def_var_chunking(int, int, int, const size_t *);
+
+extern int
+HDF4_def_var_fill(int, int, int, const void *);
+
+extern int
+HDF4_def_var_endian(int, int, int);
+
+extern int
+HDF4_def_var_filter(int, int, unsigned int, size_t, const unsigned int*);
+
+extern int
+HDF4_set_var_chunk_cache(int, int, size_t, size_t, float);
+
+extern int
+HDF4_get_var_chunk_cache(int, int, size_t *, size_t *, float *);
+
+extern int
+HDF4_inq_unlimdims(int, int *, int *);
+
+extern int
+HDF4_show_metadata(int);
+
+extern int 
+HDF4_initialize(void);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /*_HDF4DISPATCH_H */
diff --git a/include/nc3dispatch.h b/include/nc3dispatch.h
index 75b1a7a..b3a93f8 100644
--- a/include/nc3dispatch.h
+++ b/include/nc3dispatch.h
@@ -158,7 +158,8 @@ NC3_def_var(int ncid, const char *name,
 
 extern int
 NC3_inq_var(int ncid, int varid, char *name,
-	 nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp);
+	 nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp,
+	 int *no_fill, void *fill_valuep);
 
 extern int
 NC3_inq_varid(int ncid, const char *name, int *varidp);
@@ -166,6 +167,8 @@ NC3_inq_varid(int ncid, const char *name, int *varidp);
 extern int
 NC3_rename_var(int ncid, int varid, const char *name);
 
+extern int
+NC3_def_var_fill(int,int,int,const void*);
 
 extern int
 NC3_put_vara(int ncid, int varid,
diff --git a/include/nc3internal.h b/include/nc3internal.h
index 517af66..8d7af75 100644
--- a/include/nc3internal.h
+++ b/include/nc3internal.h
@@ -55,7 +55,7 @@ typedef enum {
 	NC_ATTRIBUTE =	12
 } NCtype;
 
-
+#ifndef NEWHASHMAP /* temporary hack until new hash is complete */
 /*! Hashmap-related structs.
   NOTE: 'data' is the dimid or varid which is non-negative.
   we store the dimid+1 so a valid entry will have
@@ -72,14 +72,14 @@ typedef struct s_hashmap {
   unsigned long size;
   unsigned long count;
 } NC_hashmap;
-
+#endif
 
 /*
  * NC dimension structure
  */
 typedef struct {
 	/* all xdr'd */
-	NC_string *name;
+	NC_string* name;
 	size_t size;
 } NC_dim;
 
@@ -124,19 +124,21 @@ elem_NC_dimarray(const NC_dimarray *ncap, size_t elem);
  */
 typedef struct {
 	size_t xsz;		/* amount of space at xvalue */
-	/* below gets xdr'd */
+ 	/* begin xdr */
 	NC_string *name;
 	nc_type type;		/* the discriminant */
 	size_t nelems;		/* length of the array */
 	void *xvalue;		/* the actual data, in external representation */
+ 	/* end xdr */
 } NC_attr;
 
 typedef struct NC_attrarray {
 	size_t nalloc;		/* number allocated >= nelems */
-	/* below gets xdr'd */
+ 	/* begin xdr */
 	/* NCtype type = NC_ATTRIBUTE */
 	size_t nelems;		/* length of the array */
 	NC_attr **value;
+ 	/* end xdr */
 } NC_attrarray;
 
 /* Begin defined in attr.c */
@@ -177,8 +179,8 @@ typedef struct NC_var {
 	size_t xsz;		/* xszof 1 element */
 	size_t *shape; /* compiled info: dim->size of each dim */
 	off_t *dsizes; /* compiled info: the right to left product of shape */
-	/* below gets xdr'd */
-	NC_string *name;
+	/* begin xdr */
+	NC_string* name;
 	/* next two: formerly NC_iarray *assoc */ /* user definition */
 	size_t ndims;	/* assoc->count */
 	int *dimids;	/* assoc->value */
@@ -186,21 +188,19 @@ typedef struct NC_var {
 	nc_type type;		/* the discriminant */
 	size_t len;		/* the total length originally allocated */
 	off_t begin;
+	/* end xdr */
+	int no_fill;		/* whether fill mode is ON or OFF */
 } NC_var;
 
 typedef struct NC_vararray {
 	size_t nalloc;		/* number allocated >= nelems */
-	/* below gets xdr'd */
+	/* begin xdr */
 	/* NCtype type = NC_VARIABLE */
 	size_t nelems;		/* length of the array */
-  NC_hashmap *hashmap;
-  NC_var **value;
+        NC_hashmap *hashmap;
+        NC_var **value;
 } NC_vararray;
 
-/* Begin defined in lookup3.c */
-
-/* End defined in lookup3.c */
-
 /* Begin defined in var.c */
 
 extern void
@@ -266,7 +266,6 @@ extern void NC_hashmapDelete(NC_hashmap*);
 
 /* end defined in nc_hashmap.c */
 
-
 #define IS_RECVAR(vp) \
 	((vp)->shape != NULL ? (*(vp)->shape == NC_UNLIMITED) : 0 )
 
@@ -427,6 +426,9 @@ nc_put_rec(int ncid, size_t recnum, void *const *datap);
 extern int
 NC_check_vlens(NC3_INFO *ncp);
 
+extern int
+NC_check_voffs(NC3_INFO *ncp);
+
 /* Define accessors for the dispatchdata */
 #define NC3_DATA(nc) ((NC3_INFO*)(nc)->dispatchdata)
 #define NC3_DATA_SET(nc,data) ((nc)->dispatchdata = (void*)(data))
diff --git a/include/nc4internal.h b/include/nc4internal.h
index 5337508..94c9e21 100644
--- a/include/nc4internal.h
+++ b/include/nc4internal.h
@@ -399,6 +399,7 @@ int nc4_type_free(NC_TYPE_INFO_T *type);
 int nc4_nc4f_list_add(NC *nc, const char *path, int mode);
 int nc4_var_add(NC_VAR_INFO_T **var);
 int nc4_var_del(NC_VAR_INFO_T *var);
+int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var);
 int nc4_dim_list_add(NC_DIM_INFO_T **list, NC_DIM_INFO_T **dim);
 int nc4_dim_list_del(NC_DIM_INFO_T **list, NC_DIM_INFO_T *dim);
 int nc4_att_list_add(NC_ATT_INFO_T **list, NC_ATT_INFO_T **att);
diff --git a/include/nc_tests.h b/include/nc_tests.h
index d89b915..2d42421 100644
--- a/include/nc_tests.h
+++ b/include/nc_tests.h
@@ -41,6 +41,7 @@
 #define ONE_TWENTY_EIGHT_MEG (SIXTEEN_MEG * 8)
 #define TEST_VAL_42 42
 #define BAD_NAME "dd//d/  "
+#define NUM_CLASSIC_TYPES 6
 #define NUM_NETCDF_TYPES 12
 /** \} */
 
diff --git a/include/ncdispatch.h b/include/ncdispatch.h
index b9bb9c0..95cf46e 100644
--- a/include/ncdispatch.h
+++ b/include/ncdispatch.h
@@ -9,7 +9,9 @@
 #ifndef _DISPATCH_H
 #define _DISPATCH_H
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -143,6 +145,12 @@ extern int NC4_initialize(void);
 extern int NC4_finalize(void);
 #endif
 
+#ifdef USE_HDF4
+extern NC_Dispatch* HDF4_dispatch_table;
+extern int HDF4_initialize(void);
+extern int HDF4_finalize(void);
+#endif
+
 /* Vectors of ones and zeros */
 extern size_t nc_sizevector0[NC_MAX_VAR_DIMS];
 extern size_t nc_sizevector1[NC_MAX_VAR_DIMS];
@@ -250,6 +258,7 @@ int (*inq_var_all)(int ncid, int varid, char *name, nc_type *xtypep,
               );
 
 int (*var_par_access)(int, int, int);
+int (*def_var_fill)(int, int, int, const void*);
 
 /* Note the following may still be invoked by netcdf client code
    even when the file is a classic file; they will just return an error or
@@ -289,7 +298,6 @@ int (*def_opaque)(int, size_t, const char*, nc_type*);
 int (*def_var_deflate)(int, int, int, int, int);
 int (*def_var_fletcher32)(int, int, int);
 int (*def_var_chunking)(int, int, int, const size_t*);
-int (*def_var_fill)(int, int, int, const void*);
 int (*def_var_endian)(int, int, int);
 int (*def_var_filter)(int, int, unsigned int, size_t, const unsigned int*);
 int (*set_var_chunk_cache)(int, int, size_t, size_t, float);
diff --git a/include/nchashmap.h b/include/nchashmap.h
index fa84e49..1f65bf0 100644
--- a/include/nchashmap.h
+++ b/include/nchashmap.h
@@ -4,58 +4,67 @@
  *   $Header$
  *********************************************************************/
 #ifndef NCHASHMAP_H
-#define NCHASHMAP_H 1
-
-#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__)
-extern "C" {
-#endif
-
-#include "nclist.h"
-
-/* Define the type of the elements in the hashmap*/
-typedef unsigned long nchashid;
-
-typedef struct NChashmap {
-  size_t alloc;
-  size_t size; /* # of pairs still in table*/
-  NClist** table;
-} NChashmap;
-
-extern int nchashnull(void*);
-
-extern NChashmap* nchashnew(void);
-extern NChashmap* nchashnew0(size_t);
-extern int nchashfree(NChashmap*);
-
-/* Insert a (ncnchashid,void*) pair into the table*/
-/* Fail if already there*/
-extern int nchashinsert(NChashmap*, nchashid nchash, void* value);
-
-/* Insert a (nchashid,void*) pair into the table*/
-/* Overwrite if already there*/
-extern int nchashreplace(NChashmap*, nchashid nchash, void* value);
-
-/* lookup a nchashid and return found/notfound*/
-extern int nchashlookup(NChashmap*, nchashid nchash, void** valuep);
-
-/* lookup a nchashid and return 0 or the value*/
-extern void* nchashget(NChashmap*, nchashid nchash);
-
-/* remove a nchashid*/
-extern int nchashremove(NChashmap*, nchashid nchash);
-
-/* Return the ith pair; order is completely arbitrary*/
-/* Can be expensive*/
-extern int nchashith(NChashmap*, int i, nchashid*, void**);
-
-extern int nchashkeys(NChashmap* hm, nchashid** keylist);
-
-/* return the # of pairs in table*/
-#define nchashsize(hm) ((hm)?(hm)->size:0)
-
-#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__)
-}
-#endif
+#define NCHASHMAP_H
+
+/*
+Data is presumed to be an index into some other table
+   Assume it can be compared using simple ==
+The key is some hash of some null terminated string.
+*/
+
+/*! Hashmap-related structs.
+  NOTES:
+  1. 'data' is the dimid or varid which is non-negative.
+  2. 'key' is a copy of the name (char*) of the corresponding object
+     (e.g. dim or var)
+  3. hashkey is a hash of key.
+*/
+typedef struct NC_hentry {
+    int flags;
+    void* data;
+    size_t hashkey; /* Hash id */
+    char* key; /* actual key; do not free */
+} NC_hentry;
+
+/*
+The hashmap object must give us the hash table (table),
+the |table| size, and the # of defined entries in the table
+*/
+typedef struct NC_hashmap {
+  size_t size; /* allocated */
+  size_t count;
+  NC_hentry* table;
+} NC_hashmap;
+
+/* defined in nc_hashmap.c */
+
+/** Creates a new hashmap near the given size. */
+extern NC_hashmap* NC_hashmapnew(size_t startsize);
+
+/** Inserts a new element into the hashmap. */
+/* Note we pass the NC_hobjecty struct by value */
+extern int NC_hashmapadd(NC_hashmap*, void* data, const char* name);
+
+/** Removes the storage for the element of the key.
+    Return 1 if found, 0 otherwise; returns the data in datap if !null
+*/
+extern int NC_hashmapremove(NC_hashmap*, const char* name, void** datap);
+
+/** Returns the data for the key.
+    Return 1 if found, 0 otherwise; returns the data in datap if !null
+*/
+extern int NC_hashmapget(NC_hashmap*, const char*, void** datap);
+
+/** Change the data for the specified key
+    Return 1 if found, 0 otherwise
+*/
+extern int NC_hashmapsetdata(NC_hashmap*, const char*, void* newdata);
+
+/** Returns the number of saved elements. */
+extern size_t NC_hashmapcount(NC_hashmap*);
+
+/** Reclaims the hashmap structure. */
+extern int NC_hashmapfree(NC_hashmap*);
 
 #endif /*NCHASHMAP_H*/
 
diff --git a/include/nclist.h b/include/nclist.h
index f176072..768750c 100644
--- a/include/nclist.h
+++ b/include/nclist.h
@@ -12,25 +12,25 @@ extern "C" {
 extern int nclistnull(void*);
 
 typedef struct NClist {
-  unsigned long alloc;
-  unsigned long length;
+  size_t alloc;
+  size_t length;
   void** content;
 } NClist;
 
 extern NClist* nclistnew(void);
 extern int nclistfree(NClist*);
 extern int nclistfreeall(NClist*);
-extern int nclistsetalloc(NClist*,unsigned long);
-extern int nclistsetlength(NClist*,unsigned long);
+extern int nclistsetalloc(NClist*,size_t);
+extern int nclistsetlength(NClist*,size_t);
 
 /* Set the ith element */
-extern int nclistset(NClist*,unsigned long,void*);
+extern int nclistset(NClist*,size_t,void*);
 /* Get value at position i */
-extern void* nclistget(NClist*,unsigned long);/* Return the ith element of l */
+extern void* nclistget(NClist*,size_t);/* Return the ith element of l */
 /* Insert at position i; will push up elements i..|seq|. */
-extern int nclistinsert(NClist*,unsigned long,void*);
+extern int nclistinsert(NClist*,size_t,void*);
 /* Remove element at position i; will move higher elements down */
-extern void* nclistremove(NClist* l, unsigned long i);
+extern void* nclistremove(NClist* l, size_t i);
 
 /* Tail operations */
 extern int nclistpush(NClist*,void*); /* Add at Tail */
diff --git a/include/nclistmap.h b/include/nclistmap.h
new file mode 100644
index 0000000..fec16e4
--- /dev/null
+++ b/include/nclistmap.h
@@ -0,0 +1,100 @@
+/*
+Copyright (c) 1998-2017 University Corporation for Atmospheric Research/Unidata
+See LICENSE.txt for license information.
+*/
+
+#ifndef NCLISTMAP_H
+#define NCLISTMAP_H
+
+#include "nclist.h"
+#include "nchashmap.h"
+
+/*
+This listmap datastructure is an ordered list of objects. It is
+used pervasively in libsrc to store metadata relationships.  The
+goal is to provide both by-name (via nc_hashmap) and indexed
+access (via NClist) to the objects in the listmap.  Using
+hashmap might be overkill for some relationships, but we can
+sort that out later.
+As a rule, we use this to store definitional relationships
+such as (in groups) dimension definitions, variable definitions, type defs
+and subgroup defs. We do not, as a rule, use this to store reference relationships
+such as the list of dimensions for a variable.
+*/
+
+/* Generic list + matching hashtable */
+typedef struct NC_listmap {
+   NClist* list;
+   NC_hashmap* map;
+} NC_listmap;
+
+/* Locate object by name in an NC_listmap */
+extern void* NC_listmap_get(NC_listmap* listmap, const char* name);
+
+/* Locate object by index in an NC_listmap */
+extern void* NC_listmap_iget(NC_listmap* listmap, size_t index);
+
+/* Get the index of an object; if not present, return 0
+   (=> you have to do your own presence check to avoid ambiguity)
+*/
+extern size_t NC_listmap_index(NC_listmap* listmap, void* obj);
+
+/* Add object to the end of an index; assume cast (char**)obj is defined */
+/* Return 1 if ok, 0 otherwise.*/
+extern int NC_listmap_add(NC_listmap* listmap, void* obj);
+
+/* Remove object from listmap; assume cast (char**)target is defined */
+/* Return 1 if ok, 0 otherwise.*/
+extern int NC_listmap_del(NC_listmap* listmap, void* target);
+
+/* Remove object from listmap by index; assume cast (char**)target is defined */
+/* Return 1 if ok, 0 otherwise.*/
+extern int NC_listmap_idel(NC_listmap* listmap, size_t index);
+
+/* Rehash object after it has been given a new name */
+/* Return 1 if ok, 0 otherwise.*/
+extern int NC_listmap_move(NC_listmap* listmap, void* obj, const char* oldname);
+
+/* Change data associated with a key */
+/* Return 1 if ok, 0 otherwise.*/
+extern int NC_listmap_setdata(NC_listmap* listmap, void* obj, void* data);
+
+/* Pseudo iterator; start index at 0, return 1 if more data, 0 if done.
+   Usage:
+      size_t iter;
+      void* data;
+      for(iter=0;NC_listmap_next(listmap,iter,&data);iter++) {f(data);}
+*/
+extern size_t NC_listmap_next(NC_listmap*, size_t iter, void** datap);
+
+/* Reverse pseudo iterator; start index at 0, return 1 if more data, 0 if done.
+   Differs from NC_listmap_next in that it iterates from last to first.
+   This means that the iter value cannot be directly used as an index
+   for e.g. NC_listmap_iget().
+   Usage:
+      size_t iter;
+      void* data;
+      for(iter=0;NC_listmap_prev(listmap,iter,&data);iter++) {f(data);}
+*/
+extern size_t NC_listmap_prev(NC_listmap* listmap, size_t iter, void** datap);
+
+/* Reset a list map without free'ing the map itself */
+/* Return 1 if ok; 0 otherwise */
+extern int NC_listmap_clear(NC_listmap* listmap);
+
+/* Initialize a list map without malloc'ing the map itself */
+/* Return 1 if ok; 0 otherwise */
+extern int NC_listmap_init(NC_listmap* listmap, size_t initsize);
+
+extern int NC_listmap_verify(NC_listmap* lm, int dump);
+
+/* Inline functions */
+
+/* Test if map has been initialized */
+#define NC_listmap_initialized(listmap) ((listmap)->list != NULL)
+
+/* Get number of entries in a listmap */
+/* size_t NC_listmap_size(NC_listmap* listmap) */
+#define NC_listmap_size(listmap) ((listmap)==NULL?0:(nclistlength((listmap)->list)))
+
+#endif /*NCLISTMAP_H*/
diff --git a/include/netcdf.h b/include/netcdf.h
index 6d9ca15..bae3e40 100644
--- a/include/netcdf.h
+++ b/include/netcdf.h
@@ -255,7 +255,7 @@ created with the ::NC_CLASSIC_MODEL flag.
 
 As a rule, NC_MAX_VAR_DIMS <= NC_MAX_DIMS.
 
-NOTE: The NC_MAX_DIMS, NC_MAX_ATTRS, and NC_MAX_VARS limits 
+NOTE: The NC_MAX_DIMS, NC_MAX_ATTRS, and NC_MAX_VARS limits
       are *not* enforced after version 4.5.0
 */
 /**@{*/
@@ -418,6 +418,7 @@ by the desired type. */
 /* Misc. additional errors */
 #define NC_ENOTFOUND     (-90)      /**< No such file */
 #define NC_ECANTREMOVE   (-91)      /**< Can't remove file */
+#define NC_EINTERNAL     (-92)      /**< NetCDF Library Internal Error */
 
 /* The following was added in support of netcdf-4. Make all netcdf-4
    error codes < -100 so that errors can be added to netcdf-3 if
@@ -1829,7 +1830,7 @@ EXTERNL int ncerr;
 #define NC_VERBOSE      2  /**< For V2 API, be verbose on error. */
 
 /** V2 API error handling. Default is (NC_FATAL | NC_VERBOSE). */
-EXTERNL int ncopts;     
+EXTERNL int ncopts;
 
 EXTERNL void
 nc_advise(const char *cdf_routine_name, int err, const char *fmt,...);
@@ -1977,4 +1978,6 @@ nc_finalize();
 #define NC_HAVE_INQ_FORMAT_EXTENDED /*!< inq_format_extended() support. */
 #endif
 
+#define NC_HAVE_META_H
+
 #endif /* _NETCDF_ */
diff --git a/include/netcdf_meta.h.in b/include/netcdf_meta.h.in
index 0326d0f..94e261c 100644
--- a/include/netcdf_meta.h.in
+++ b/include/netcdf_meta.h.in
@@ -52,6 +52,6 @@
 /or pnetcdf. */
 
 #define NC_HAS_CDF5      @NC_HAS_CDF5@  /*!< CDF5 support. */
-
+#define NC_HAS_ERANGE_FILL @NC_HAS_ERANGE_FILL@ /*!< ERANGE_FILL Support */
 
 #endif
diff --git a/include/onstack.h b/include/onstack.h
index a85e00b..29d84d8 100644
--- a/include/onstack.h
+++ b/include/onstack.h
@@ -37,7 +37,7 @@
 # define alloca __builtin_alloca
 # endif
 #else
-# if HAVE_ALLOCA_H
+# ifdef HAVE_ALLOCA_H
 #  include <alloca.h>
 # elif defined(_AIX)
 #  pragma alloca
diff --git a/install-sh b/install-sh
index 0360b79..8175c64 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2016-01-11.22; # UTC
+scriptversion=2018-03-11.20; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -271,15 +271,18 @@ do
     fi
     dst=$dst_arg
 
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
+    # If destination is a directory, append the input filename.
     if test -d "$dst"; then
       if test "$is_target_a_directory" = never; then
         echo "$0: $dst_arg: Is a directory" >&2
         exit 1
       fi
       dstdir=$dst
-      dst=$dstdir/`basename "$src"`
+      dstbase=`basename "$src"`
+      case $dst in
+	*/) dst=$dst$dstbase;;
+	*)  dst=$dst/$dstbase;;
+      esac
       dstdir_status=0
     else
       dstdir=`dirname "$dst"`
@@ -288,6 +291,11 @@ do
     fi
   fi
 
+  case $dstdir in
+    */) dstdirslash=$dstdir;;
+    *)  dstdirslash=$dstdir/;;
+  esac
+
   obsolete_mkdir_used=false
 
   if test $dstdir_status != 0; then
@@ -324,34 +332,43 @@ do
             # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
             ;;
           *)
+            # Note that $RANDOM variable is not portable (e.g. dash);  Use it
+            # here however when possible just to lower collision chance.
             tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
 
+            trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+            # Because "mkdir -p" follows existing symlinks and we likely work
+            # directly in world-writeable /tmp, make sure that the '$tmpdir'
+            # directory is successfully created first before we actually test
+            # 'mkdir -p' feature.
             if (umask $mkdir_umask &&
-                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+                $mkdirprog $mkdir_mode "$tmpdir" &&
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
             then
               if test -z "$dir_arg" || {
                    # Check for POSIX incompatibilities with -m.
                    # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
                    # other-writable bit of parent directory when it shouldn't.
                    # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                   test_tmpdir="$tmpdir/a"
+                   ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
                    case $ls_ld_tmpdir in
                      d????-?r-*) different_mode=700;;
                      d????-?--*) different_mode=755;;
                      *) false;;
                    esac &&
-                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                   $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+                     ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
                      test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
                    }
                  }
               then posix_mkdir=:
               fi
-              rmdir "$tmpdir/d" "$tmpdir"
+              rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
             else
               # Remove any dirs left behind by ancient mkdir implementations.
-              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+              rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
             fi
             trap '' 0;;
         esac;;
@@ -427,8 +444,8 @@ do
   else
 
     # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
+    dsttmp=${dstdirslash}_inst.$$_
+    rmtmp=${dstdirslash}_rm.$$_
 
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
@@ -493,7 +510,7 @@ do
 done
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/libdap2/Makefile.in b/libdap2/Makefile.in
index 4d98cd5..2e02aab 100644
--- a/libdap2/Makefile.in
+++ b/libdap2/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -159,7 +159,23 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/libdap2_la-cache.Plo \
+	./$(DEPDIR)/libdap2_la-cdf.Plo \
+	./$(DEPDIR)/libdap2_la-constraints.Plo \
+	./$(DEPDIR)/libdap2_la-dapattr.Plo \
+	./$(DEPDIR)/libdap2_la-dapcvt.Plo \
+	./$(DEPDIR)/libdap2_la-dapdebug.Plo \
+	./$(DEPDIR)/libdap2_la-dapdump.Plo \
+	./$(DEPDIR)/libdap2_la-dapodom.Plo \
+	./$(DEPDIR)/libdap2_la-daputil.Plo \
+	./$(DEPDIR)/libdap2_la-dceconstraints.Plo \
+	./$(DEPDIR)/libdap2_la-dcelex.Plo \
+	./$(DEPDIR)/libdap2_la-dceparse.Plo \
+	./$(DEPDIR)/libdap2_la-dcetab.Plo \
+	./$(DEPDIR)/libdap2_la-getvara.Plo \
+	./$(DEPDIR)/libdap2_la-ncd2dispatch.Plo \
+	./$(DEPDIR)/libdap2_la-ncdaperr.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -245,7 +261,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -254,6 +269,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -292,6 +308,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -450,8 +467,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -484,22 +501,28 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-cache.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-cdf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-constraints.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapattr.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapcvt.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapdebug.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapdump.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapodom.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-daputil.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dceconstraints.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dcelex.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dceparse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dcetab.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-getvara.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-ncd2dispatch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-ncdaperr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-cache.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-cdf.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-constraints.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapattr.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapcvt.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapdebug.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapdump.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dapodom.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-daputil.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dceconstraints.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dcelex.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dceparse.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-dcetab.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-getvara.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-ncd2dispatch.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap2_la-ncdaperr.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -695,7 +718,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -768,7 +794,22 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libdap2_la-cache.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-cdf.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-constraints.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapattr.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapcvt.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapdebug.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapdump.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapodom.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-daputil.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dceconstraints.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dcelex.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dceparse.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dcetab.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-getvara.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-ncd2dispatch.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-ncdaperr.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -814,7 +855,22 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libdap2_la-cache.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-cdf.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-constraints.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapattr.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapcvt.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapdebug.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapdump.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dapodom.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-daputil.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dceconstraints.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dcelex.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dceparse.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-dcetab.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-getvara.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-ncd2dispatch.Plo
+	-rm -f ./$(DEPDIR)/libdap2_la-ncdaperr.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -835,16 +891,16 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
diff --git a/libdap2/dapdump.c b/libdap2/dapdump.c
index 51e5d9f..e66ea3d 100644
--- a/libdap2/dapdump.c
+++ b/libdap2/dapdump.c
@@ -440,7 +440,7 @@ dumpnode(CDFnode* node)
     ncbytescat(buf,tmp);
     snprintf(tmp,sizeof(tmp),"ncfullname=%s\n",node->ncfullname);
     ncbytescat(buf,tmp);
-    snprintf(tmp,sizeof(tmp),"|subnodes|=%ld\n",nclistlength(node->subnodes));
+    snprintf(tmp,sizeof(tmp),"|subnodes|=%u\n",(unsigned)nclistlength(node->subnodes));
     ncbytescat(buf,tmp);
     snprintf(tmp,sizeof(tmp),"externaltype=%d\n",node->externaltype);
     ncbytescat(buf,tmp);
@@ -459,7 +459,7 @@ dumpnode(CDFnode* node)
     snprintf(tmp,sizeof(tmp),"attachment=%s\n",
 		(node->attachment?node->attachment->ocname:"null"));
     ncbytescat(buf,tmp);
-    snprintf(tmp,sizeof(tmp),"rank=%lu\n",nclistlength(node->array.dimset0));
+    snprintf(tmp,sizeof(tmp),"rank=%u\n",(unsigned)nclistlength(node->array.dimset0));
     ncbytescat(buf,tmp);
     for(i=0;i<nclistlength(node->array.dimset0);i++) {
 	CDFnode* dim = (CDFnode*)nclistget(node->array.dimset0,i);
diff --git a/libdap2/dapincludes.h b/libdap2/dapincludes.h
index 0b842da..6fe1d79 100644
--- a/libdap2/dapincludes.h
+++ b/libdap2/dapincludes.h
@@ -17,7 +17,6 @@
 
 #include "ncbytes.h"
 #include "nclist.h"
-#include "nchashmap.h"
 #include "nclog.h"
 #include "ncuri.h"
 
diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c
index eb8a2b7..26cad35 100644
--- a/libdap2/ncd2dispatch.c
+++ b/libdap2/ncd2dispatch.c
@@ -137,6 +137,7 @@ NCDEFAULT_put_varm,
 NCD2_inq_var_all,
 
 NCD2_var_par_access,
+NCD2_def_var_fill,
 
 #ifdef USE_NETCDF4
 NCD2_show_metadata,
@@ -172,7 +173,6 @@ NCD2_def_opaque,
 NCD2_def_var_deflate,
 NCD2_def_var_fletcher32,
 NCD2_def_var_chunking,
-NCD2_def_var_fill,
 NCD2_def_var_endian,
 NCD2_def_var_filter,
 NCD2_set_var_chunk_cache,
@@ -2434,6 +2434,15 @@ NCD2_var_par_access(int ncid, int p2, int p3)
     return THROW(NC_ENOPAR);
 }
 
+int
+NCD2_def_var_fill(int ncid, int p2, int p3, const void* p4)
+{
+    NC* drno;
+    int ret;
+    if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
+    ret = nc_def_var_fill(getnc3id(drno), p2, p3, p4);
+    return THROW(ret);
+}
 
 #ifdef USE_NETCDF4
 
@@ -2764,16 +2773,6 @@ NCD2_def_var_chunking(int ncid, int p2, int p3, const size_t* p4)
 }
 
 int
-NCD2_def_var_fill(int ncid, int p2, int p3, const void* p4)
-{
-    NC* drno;
-    int ret;
-    if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret);
-    ret = nc_def_var_fill(getnc3id(drno), p2, p3, p4);
-    return THROW(ret);
-}
-
-int
 NCD2_def_var_endian(int ncid, int p2, int p3)
 {
     NC* drno;
diff --git a/libdap2/ncd2dispatch.h b/libdap2/ncd2dispatch.h
index ab132e3..697c18a 100644
--- a/libdap2/ncd2dispatch.h
+++ b/libdap2/ncd2dispatch.h
@@ -158,6 +158,9 @@ NCD2_rename_var(int ncid, int varid, const char *name);
 extern int
 NCD2_var_par_access(int, int, int);
 
+extern int
+NCD2_def_var_fill(int, int, int, const void *);
+
   /* netCDF4 API only */
 #ifdef USE_NETCDF4
   extern int
@@ -242,9 +245,6 @@ NCD2_var_par_access(int, int, int);
   NCD2_def_var_chunking(int, int, int, const size_t *);
 
   extern int
-  NCD2_def_var_fill(int, int, int, const void *);
-
-  extern int
   NCD2_def_var_endian(int, int, int);
 
   extern int
diff --git a/libdap4/Makefile.in b/libdap4/Makefile.in
index 8b71e20..bc2491c 100644
--- a/libdap4/Makefile.in
+++ b/libdap4/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -159,7 +159,29 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/libdap4_la-d4chunk.Plo \
+	./$(DEPDIR)/libdap4_la-d4crc32.Plo \
+	./$(DEPDIR)/libdap4_la-d4curlflags.Plo \
+	./$(DEPDIR)/libdap4_la-d4curlfunctions.Plo \
+	./$(DEPDIR)/libdap4_la-d4cvt.Plo \
+	./$(DEPDIR)/libdap4_la-d4data.Plo \
+	./$(DEPDIR)/libdap4_la-d4debug.Plo \
+	./$(DEPDIR)/libdap4_la-d4dump.Plo \
+	./$(DEPDIR)/libdap4_la-d4file.Plo \
+	./$(DEPDIR)/libdap4_la-d4fix.Plo \
+	./$(DEPDIR)/libdap4_la-d4http.Plo \
+	./$(DEPDIR)/libdap4_la-d4meta.Plo \
+	./$(DEPDIR)/libdap4_la-d4odom.Plo \
+	./$(DEPDIR)/libdap4_la-d4parser.Plo \
+	./$(DEPDIR)/libdap4_la-d4printer.Plo \
+	./$(DEPDIR)/libdap4_la-d4read.Plo \
+	./$(DEPDIR)/libdap4_la-d4swap.Plo \
+	./$(DEPDIR)/libdap4_la-d4util.Plo \
+	./$(DEPDIR)/libdap4_la-d4varx.Plo \
+	./$(DEPDIR)/libdap4_la-ezxml.Plo \
+	./$(DEPDIR)/libdap4_la-ezxml_extra.Plo \
+	./$(DEPDIR)/libdap4_la-ncd4dispatch.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -245,7 +267,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -254,6 +275,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -292,6 +314,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -471,8 +494,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -505,28 +528,34 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4chunk.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4crc32.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4curlflags.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4curlfunctions.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4cvt.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4data.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4debug.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4dump.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4file.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4fix.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4http.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4meta.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4odom.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4parser.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4printer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4read.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4swap.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4util.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4varx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-ezxml.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-ezxml_extra.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-ncd4dispatch.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4chunk.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4crc32.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4curlflags.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4curlfunctions.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4cvt.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4data.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4debug.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4dump.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4file.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4fix.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4http.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4meta.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4odom.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4parser.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4printer.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4read.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4swap.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4util.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-d4varx.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-ezxml.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-ezxml_extra.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdap4_la-ncd4dispatch.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -764,7 +793,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -837,7 +869,28 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libdap4_la-d4chunk.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4crc32.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4curlflags.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4curlfunctions.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4cvt.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4data.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4debug.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4dump.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4file.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4fix.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4http.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4meta.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4odom.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4parser.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4printer.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4read.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4swap.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4util.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4varx.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-ezxml.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-ezxml_extra.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-ncd4dispatch.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -883,7 +936,28 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libdap4_la-d4chunk.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4crc32.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4curlflags.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4curlfunctions.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4cvt.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4data.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4debug.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4dump.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4file.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4fix.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4http.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4meta.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4odom.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4parser.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4printer.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4read.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4swap.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4util.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-d4varx.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-ezxml.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-ezxml_extra.Plo
+	-rm -f ./$(DEPDIR)/libdap4_la-ncd4dispatch.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -904,16 +978,16 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
diff --git a/libdap4/d4chunk.c b/libdap4/d4chunk.c
index 8e159b7..c85b48b 100644
--- a/libdap4/d4chunk.c
+++ b/libdap4/d4chunk.c
@@ -91,7 +91,7 @@ NCD4_dechunk(NCD4meta* metadata)
     metadata->localchecksumming = metadata->serial.remotechecksumming;
 
     metadata->serial.remotelittleendian = ((hdr.flags & LITTLE_ENDIAN_CHUNK) ? 1 : 0);
-    metadata->serial.dmr = p;
+    metadata->serial.dmr = (char*)p;
     metadata->serial.dmr[hdr.count-1] = '\0';
     metadata->serial.dmr = strdup(metadata->serial.dmr);
     if(metadata->serial.dmr == NULL)
diff --git a/libdap4/d4curlfunctions.c b/libdap4/d4curlfunctions.c
index 0c4f0bc..f4eafba 100644
--- a/libdap4/d4curlfunctions.c
+++ b/libdap4/d4curlfunctions.c
@@ -200,12 +200,14 @@ set_curl_options(NCD4INFO* state)
     for(i=0;i<nclistlength(store);i++) {
         struct CURLFLAG* flag;
 	NCTriple* triple = (NCTriple*)nclistget(store,i);
-        size_t hostlen = strlen(triple->host);
+        size_t hostlen = (triple->host ? strlen(triple->host) : 0);
         const char* flagname;
         if(strncmp("CURL.",triple->key,5) != 0) continue; /* not a curl flag */
         /* do hostport prefix comparison */
         if(hostport != NULL) {
-          int t = strncmp(hostport,triple->host,hostlen);
+	  int t = 0;
+	  if(triple->host != NULL)
+              t = strncmp(hostport,triple->host,hostlen);
           if(t !=  0) continue;
         }
         flagname = triple->key+5; /* 5 == strlen("CURL."); */
diff --git a/libdap4/d4varx.c b/libdap4/d4varx.c
index 2bbd28b..09d71fc 100644
--- a/libdap4/d4varx.c
+++ b/libdap4/d4varx.c
@@ -21,7 +21,7 @@ NCD4_get_vara(int ncid, int varid,
 {
     int ret;
     /* TODO: optimize since we know stride is 1 */
-    ret = NCD4_get_vars(ncid,varid,start,edges,(ptrdiff_t *)nc_sizevector1,value,memtype);
+    ret = NCD4_get_vars(ncid,varid,start,edges,nc_ptrdiffvector1,value,memtype);
     return ret;
 }
 
diff --git a/libdap4/ncd4dispatch.c b/libdap4/ncd4dispatch.c
index b374af2..1a33794 100644
--- a/libdap4/ncd4dispatch.c
+++ b/libdap4/ncd4dispatch.c
@@ -853,6 +853,7 @@ NCDEFAULT_put_varm,
 NCD4_inq_var_all,
 
 NCD4_var_par_access,
+NCD4_def_var_fill,
 
 #ifdef USE_NETCDF4
 NCD4_show_metadata,
@@ -888,7 +889,6 @@ NCD4_def_opaque,
 NCD4_def_var_deflate,
 NCD4_def_var_fletcher32,
 NCD4_def_var_chunking,
-NCD4_def_var_fill,
 NCD4_def_var_endian,
 NCD4_def_var_filter,
 NCD4_set_var_chunk_cache,
diff --git a/libdispatch/Makefile.in b/libdispatch/Makefile.in
index f0441bf..1bfd62d 100644
--- a/libdispatch/Makefile.in
+++ b/libdispatch/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -194,7 +194,50 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/dwinpath.Po \
+	./$(DEPDIR)/libdispatch_la-datt.Plo \
+	./$(DEPDIR)/libdispatch_la-dattget.Plo \
+	./$(DEPDIR)/libdispatch_la-dattinq.Plo \
+	./$(DEPDIR)/libdispatch_la-dattput.Plo \
+	./$(DEPDIR)/libdispatch_la-dauth.Plo \
+	./$(DEPDIR)/libdispatch_la-dcompound.Plo \
+	./$(DEPDIR)/libdispatch_la-dcopy.Plo \
+	./$(DEPDIR)/libdispatch_la-ddim.Plo \
+	./$(DEPDIR)/libdispatch_la-ddispatch.Plo \
+	./$(DEPDIR)/libdispatch_la-denum.Plo \
+	./$(DEPDIR)/libdispatch_la-derror.Plo \
+	./$(DEPDIR)/libdispatch_la-dfile.Plo \
+	./$(DEPDIR)/libdispatch_la-dfilter.Plo \
+	./$(DEPDIR)/libdispatch_la-dgroup.Plo \
+	./$(DEPDIR)/libdispatch_la-dinternal.Plo \
+	./$(DEPDIR)/libdispatch_la-doffsets.Plo \
+	./$(DEPDIR)/libdispatch_la-dopaque.Plo \
+	./$(DEPDIR)/libdispatch_la-dparallel.Plo \
+	./$(DEPDIR)/libdispatch_la-drc.Plo \
+	./$(DEPDIR)/libdispatch_la-dstring.Plo \
+	./$(DEPDIR)/libdispatch_la-dtype.Plo \
+	./$(DEPDIR)/libdispatch_la-dutf8.Plo \
+	./$(DEPDIR)/libdispatch_la-dutil.Plo \
+	./$(DEPDIR)/libdispatch_la-dvar.Plo \
+	./$(DEPDIR)/libdispatch_la-dvarget.Plo \
+	./$(DEPDIR)/libdispatch_la-dvarinq.Plo \
+	./$(DEPDIR)/libdispatch_la-dvarput.Plo \
+	./$(DEPDIR)/libdispatch_la-dvlen.Plo \
+	./$(DEPDIR)/libdispatch_la-dwinpath.Plo \
+	./$(DEPDIR)/libdispatch_la-nc.Plo \
+	./$(DEPDIR)/libdispatch_la-ncaux.Plo \
+	./$(DEPDIR)/libdispatch_la-ncbytes.Plo \
+	./$(DEPDIR)/libdispatch_la-nchashmap.Plo \
+	./$(DEPDIR)/libdispatch_la-nclist.Plo \
+	./$(DEPDIR)/libdispatch_la-nclistmgr.Plo \
+	./$(DEPDIR)/libdispatch_la-nclog.Plo \
+	./$(DEPDIR)/libdispatch_la-nctime.Plo \
+	./$(DEPDIR)/libdispatch_la-ncuri.Plo \
+	./$(DEPDIR)/libdispatch_la-utf8proc.Plo \
+	./$(DEPDIR)/libnetcdf2_la-dv2i.Plo ./$(DEPDIR)/ncbytes.Po \
+	./$(DEPDIR)/nclist.Po ./$(DEPDIR)/ncuri.Po \
+	./$(DEPDIR)/test_ncuri.Po ./$(DEPDIR)/test_pathcvt.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -487,7 +530,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -496,6 +538,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -534,6 +577,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -677,8 +721,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -691,6 +735,15 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
 	@list='$(noinst_LTLIBRARIES)'; \
@@ -708,15 +761,6 @@ libdispatch.la: $(libdispatch_la_OBJECTS) $(libdispatch_la_DEPENDENCIES) $(EXTRA
 libnetcdf2.la: $(libnetcdf2_la_OBJECTS) $(libnetcdf2_la_DEPENDENCIES) $(EXTRA_libnetcdf2_la_DEPENDENCIES) 
 	$(AM_V_CCLD)$(LINK) $(am_libnetcdf2_la_rpath) $(libnetcdf2_la_OBJECTS) $(libnetcdf2_la_LIBADD) $(LIBS)
 
-clean-checkPROGRAMS:
-	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
-	echo " rm -f" $$list; \
-	rm -f $$list || exit $$?; \
-	test -n "$(EXEEXT)" || exit 0; \
-	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
-	echo " rm -f" $$list; \
-	rm -f $$list
-
 test_ncuri$(EXEEXT): $(test_ncuri_OBJECTS) $(test_ncuri_DEPENDENCIES) $(EXTRA_test_ncuri_DEPENDENCIES) 
 	@rm -f test_ncuri$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(test_ncuri_OBJECTS) $(test_ncuri_LDADD) $(LIBS)
@@ -731,52 +775,58 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dwinpath.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-datt.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dattget.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dattinq.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dattput.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dauth.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dcompound.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dcopy.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ddim.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ddispatch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-denum.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-derror.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dfile.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dfilter.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dgroup.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dinternal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-doffsets.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dopaque.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dparallel.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-drc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dstring.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dtype.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dutf8.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dutil.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvar.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvarget.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvarinq.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvarput.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvlen.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dwinpath.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ncaux.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ncbytes.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nchashmap.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nclist.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nclistmgr.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nclog.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nctime.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ncuri.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-utf8proc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf2_la-dv2i.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncbytes.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nclist.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncuri.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_ncuri.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_pathcvt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dwinpath.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-datt.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dattget.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dattinq.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dattput.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dauth.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dcompound.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dcopy.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ddim.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ddispatch.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-denum.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-derror.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dfile.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dfilter.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dgroup.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dinternal.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-doffsets.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dopaque.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dparallel.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-drc.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dstring.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dtype.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dutf8.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dutil.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvar.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvarget.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvarinq.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvarput.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dvlen.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-dwinpath.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nc.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ncaux.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ncbytes.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nchashmap.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nclist.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nclistmgr.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nclog.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-nctime.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-ncuri.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdispatch_la-utf8proc.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf2_la-dv2i.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncbytes.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nclist.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncuri.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_ncuri.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_pathcvt.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1260,7 +1310,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1310,7 +1360,10 @@ test_pathcvt.log: test_pathcvt$(EXEEXT)
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1385,7 +1438,52 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
 	clean-noinstLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/dwinpath.Po
+	-rm -f ./$(DEPDIR)/libdispatch_la-datt.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dattget.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dattinq.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dattput.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dauth.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dcompound.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dcopy.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ddim.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ddispatch.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-denum.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-derror.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dfile.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dfilter.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dgroup.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dinternal.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-doffsets.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dopaque.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dparallel.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-drc.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dstring.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dtype.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dutf8.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dutil.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvar.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvarget.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvarinq.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvarput.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvlen.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dwinpath.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nc.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ncaux.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ncbytes.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nchashmap.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nclist.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nclistmgr.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nclog.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nctime.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ncuri.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-utf8proc.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf2_la-dv2i.Plo
+	-rm -f ./$(DEPDIR)/ncbytes.Po
+	-rm -f ./$(DEPDIR)/nclist.Po
+	-rm -f ./$(DEPDIR)/ncuri.Po
+	-rm -f ./$(DEPDIR)/test_ncuri.Po
+	-rm -f ./$(DEPDIR)/test_pathcvt.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1431,7 +1529,52 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/dwinpath.Po
+	-rm -f ./$(DEPDIR)/libdispatch_la-datt.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dattget.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dattinq.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dattput.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dauth.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dcompound.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dcopy.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ddim.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ddispatch.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-denum.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-derror.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dfile.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dfilter.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dgroup.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dinternal.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-doffsets.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dopaque.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dparallel.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-drc.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dstring.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dtype.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dutf8.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dutil.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvar.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvarget.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvarinq.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvarput.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dvlen.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-dwinpath.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nc.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ncaux.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ncbytes.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nchashmap.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nclist.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nclistmgr.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nclog.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-nctime.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-ncuri.Plo
+	-rm -f ./$(DEPDIR)/libdispatch_la-utf8proc.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf2_la-dv2i.Plo
+	-rm -f ./$(DEPDIR)/ncbytes.Po
+	-rm -f ./$(DEPDIR)/nclist.Po
+	-rm -f ./$(DEPDIR)/ncuri.Po
+	-rm -f ./$(DEPDIR)/test_ncuri.Po
+	-rm -f ./$(DEPDIR)/test_pathcvt.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1452,8 +1595,8 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libtool \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
 	clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
diff --git a/libdispatch/ddim.c b/libdispatch/ddim.c
index 1ead3ef..93e7364 100644
--- a/libdispatch/ddim.c
+++ b/libdispatch/ddim.c
@@ -234,7 +234,7 @@ another dimension.
 For netCDF classic and 64-bit offset files, if the new name is longer
 than the old name, the netCDF dataset must be in define mode.
 
-For netCDF-4 files the dataset is switched to define more for the
+For netCDF-4 files the dataset is switched to define mode for the
 rename, regardless of the name length.
 
 \param ncid NetCDF or group ID, from a previous call to nc_open(),
@@ -253,6 +253,7 @@ with length less than NC_MAX_NAME.
 \returns ::NC_ENAMEINUSE String match to name in use
 \returns ::NC_ENOMEM     Memory allocation (malloc) failure
 \returns ::NC_EPERM      Write to read only
+\returns ::NC_ENOTINDEFINE Not in define mode and new name is longer than old.
 \section nc_rename_dim_example Example
 
 Here is an example using nc_rename_dim to rename the dimension lat to
diff --git a/libdispatch/derror.c b/libdispatch/derror.c
index 68cede3..c3c1bfa 100644
--- a/libdispatch/derror.c
+++ b/libdispatch/derror.c
@@ -194,6 +194,8 @@ const char *nc_strerror(int ncerr1)
 	 return "NetCDF: file not found";
       case NC_ECANTREMOVE:
 	 return "NetCDF: cannot delete file";
+      case NC_EINTERNAL:
+	 return "NetCDF: internal library error; Please contact Unidata support";
       case NC_EHDFERR:
 	 return "NetCDF: HDF error";
       case NC_ECANTREAD:
diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c
index 416bc8e..ad83466 100644
--- a/libdispatch/dfile.c
+++ b/libdispatch/dfile.c
@@ -21,6 +21,11 @@
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> /* lseek() */
+#endif
+
 #include "ncdispatch.h"
 #include "netcdf_mem.h"
 #include "ncwinpath.h"
@@ -116,40 +121,34 @@ NC_interpret_magic_number(char* magic, int* model, int* version)
     /* Look at the magic number */
     *model = 0;
     *version = 0;
-#ifdef USE_NETCDF4
     /* Use the complete magic number string for HDF5 */
     if(memcmp(magic,HDF5_SIGNATURE,sizeof(HDF5_SIGNATURE))==0) {
 	*model = NC_FORMATX_NC4;
 	*version = 5; /* redundant */
 	goto done;
     }
-#endif
-#if defined(USE_NETCDF4) && defined(USE_HDF4)
     if(magic[0] == '\016' && magic[1] == '\003'
               && magic[2] == '\023' && magic[3] == '\001') {
 	*model = NC_FORMATX_NC_HDF4;
 	*version = 4; /* redundant */
 	goto done;
     }
-#endif
     if(magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F') {
         if(magic[3] == '\001') {
             *version = 1; /* netcdf classic version 1 */
 	    *model = NC_FORMATX_NC3;
-	    goto done;	    
+	    goto done;
 	}
         if(magic[3] == '\002') {
             *version = 2; /* netcdf classic version 2 */
 	    *model = NC_FORMATX_NC3;
 	    goto done;
         }
-#ifdef USE_CDF5
         if(magic[3] == '\005') {
           *version = 5; /* cdf5 (including pnetcdf) file */
 	  *model = NC_FORMATX_NC3;
 	  goto done;
 	}
-#endif
      }
      /* No match  */
      status = NC_ENOTNC;
@@ -191,7 +190,7 @@ NC_check_file_type(const char *path, int flags, void *parameters,
    *model = 0;
    *version = 0;
 
-    memset((void*)&file,0,sizeof(file));   
+    memset((void*)&file,0,sizeof(file));
     file.path = path; /* do not free */
     file.parameters = parameters;
     if(inmemory && parameters == NULL)
@@ -240,7 +239,7 @@ next:
 	    /* double and try again */
 	    pos = 2*pos;
         }
-    }    
+    }
 done:
     closemagic(&file);
     return status;
@@ -531,7 +530,7 @@ nc__create(const char *path, int cmode, size_t initialsz,
 }
 /**
  * @internal Create a file with special (deprecated) Cray settings.
- * 
+ *
  * @deprecated This function was used in the old days with the Cray at
  * NCAR. The Cray is long gone, and this call is supported only for
  * backward compatibility. Use nc_create() instead.
@@ -583,7 +582,7 @@ nc__create_mp(const char *path, int cmode, size_t initialsz,
  * to the dataset, including appending or changing data, adding or
  * renaming dimensions, variables, and attributes, or deleting
  * attributes.)
- * 
+ *
  * The NC_SHARE flag is only used for netCDF classic and 64-bit offset
  * files. It is appropriate when one process may be writing the
  * dataset and one or more other processes reading the dataset
@@ -622,14 +621,14 @@ nc__create_mp(const char *path, int cmode, size_t initialsz,
  * accessed data to be retrieved from disk. Without MMAP, NC_DISKLESS
  * will read the whole file into memory on nc_open. Thus, MMAP will
  * provide some performance improvement in this case.
- * 
+ *
  * It is not necessary to pass any information about the format of the
  * file being opened. The file type will be detected automatically by
  * the netCDF library.
  *
  * If a the path is a DAP URL, then the open mode is read-only.
  * Setting NC_WRITE will be ignored.
- * 
+ *
  * As of version 4.3.1.2, multiple calls to nc_open with the same
  * path will return the same ncid value.
  *
@@ -651,10 +650,10 @@ nc__create_mp(const char *path, int cmode, size_t initialsz,
  * @returns ::NC_EDIMMETA Error in netCDF-4 dimension metadata. (NetCDF-4 files only.)
  *
  * <h1>Examples</h1>
- * 
+ *
  * Here is an example using nc_open()to open an existing netCDF dataset
  * named foo.nc for read-only, non-shared access:
- * 
+ *
  * @code
  * #include <netcdf.h>
  *   ...
@@ -1679,12 +1678,12 @@ check_create_mode(int mode)
        (mode & NC_CDF5);
     if (mode_format && (mode_format & (mode_format - 1)))
        return NC_EINVAL;
-    
+
     /* Can't use both NC_MPIIO and NC_MPIPOSIX. Make up your damn
      * mind! */
     if (mode & NC_MPIIO && mode & NC_MPIPOSIX)
        return NC_EINVAL;
-    
+
     /* Can't use both parallel and diskless. */
     if ((mode & NC_MPIIO && mode & NC_DISKLESS) ||
 	(mode & NC_MPIPOSIX && mode & NC_DISKLESS))
@@ -1693,11 +1692,11 @@ check_create_mode(int mode)
 #ifndef USE_DISKLESS
    /* If diskless is requested, but not built, return error. */
    if (mode & NC_DISKLESS)
-       return NC_ENOTBUILT;       
+       return NC_ENOTBUILT;
    if (mode & NC_INMEMORY)
-       return NC_ENOTBUILT;       
+       return NC_ENOTBUILT;
 #endif
-   
+
 #ifndef USE_NETCDF4
    /* If the user asks for a netCDF-4 file, and the library was built
     * without netCDF-4, then return an error.*/
@@ -1764,7 +1763,7 @@ NC_create(const char *path0, int cmode, size_t initialsz,
    /* Check mode flag for sanity. */
    if ((stat = check_create_mode(cmode)))
       return stat;
-   
+
    /* Initialize the dispatch table. The function pointers in the
     * dispatch table will depend on how netCDF was built
     * (with/without netCDF-4, DAP, CDMREMOTE). */
@@ -1861,7 +1860,7 @@ NC_create(const char *path0, int cmode, size_t initialsz,
 
    if((cmode & NC_MPIIO) && (cmode & NC_MPIPOSIX))
    {
-       nullfree(path);       
+       nullfree(path);
        return  NC_EINVAL;
    }
 
@@ -2008,12 +2007,12 @@ NC_open(const char *path0, int cmode, int basepe, size_t *chunksizehintp,
 	stat = NC_check_file_type(path,flags,parameters,&model,&version);
         if(stat == NC_NOERR) {
 	    if(model == 0) {
-		nullfree(path);       		
+		nullfree(path);
 		return NC_ENOTNC;
 	    }
 	} else {
 	    /* presumably not a netcdf file */
-	    nullfree(path);       			    
+	    nullfree(path);
 	    return stat;
 	}
     }
@@ -2023,6 +2022,28 @@ NC_open(const char *path0, int cmode, int basepe, size_t *chunksizehintp,
 	return NC_ENOTNC;
    }
 
+   /* Suppress unsupported formats */
+   {
+	int hdf5built = 0;
+	int hdf4built = 0;
+	int cdf5built = 0;
+#ifdef USE_NETCDF4
+	hdf5built = 1;
+  #ifdef USEHDF4
+        hdf4built = 1;
+  #endif
+#endif
+#ifdef USE_CDF5
+       cdf5built = 1;
+#endif
+	if(!hdf5built && model == NC_FORMATX_NC4)
+	    return NC_ENOTBUILT;
+	if(!hdf4built && model == NC_FORMATX_NC4 && version == 4)
+	    return NC_ENOTBUILT;
+	if(!cdf5built && model == NC_FORMATX_NC3 && version == 5)
+	    return NC_ENOTBUILT;
+    }
+
    /* Force flag consistentcy */
    if(model == NC_FORMATX_NC4 || model == NC_FORMATX_NC_HDF4 || model == NC_FORMATX_DAP4)
       cmode |= NC_NETCDF4;
@@ -2058,45 +2079,50 @@ NC_open(const char *path0, int cmode, int basepe, size_t *chunksizehintp,
    /* Invalid to use both NC_MPIIO and NC_MPIPOSIX. Make up your damn
     * mind! */
    if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX)) {
-       nullfree(path);       
+       nullfree(path);
        return NC_EINVAL;
    }
 
-   /* override any other table choice */
-   if(dispatcher != NULL) goto havetable;
-
    /* Figure out what dispatcher to use */
+   if (!dispatcher) {
+      switch (model) {
 #if defined(ENABLE_DAP)
-   if(model == (NC_FORMATX_DAP2))
-	dispatcher = NCD2_dispatch_table;
-   else
+      case NC_FORMATX_DAP2:
+         dispatcher = NCD2_dispatch_table;
+         break;
 #endif
 #if defined(ENABLE_DAP4)
-   if(model == (NC_FORMATX_DAP4))
-	dispatcher = NCD4_dispatch_table;
-   else
+      case NC_FORMATX_DAP4:
+         dispatcher = NCD4_dispatch_table;
+         break;
 #endif
 #if  defined(USE_PNETCDF)
-   if(model == (NC_FORMATX_PNETCDF))
-	dispatcher = NCP_dispatch_table;
-   else
+      case NC_FORMATX_PNETCDF:
+         dispatcher = NCP_dispatch_table;
+         break;
 #endif
 #if defined(USE_NETCDF4)
-   if(model == (NC_FORMATX_NC4) || model == (NC_FORMATX_NC_HDF4))
-	dispatcher = NC4_dispatch_table;
-   else
+      case NC_FORMATX_NC4:
+         dispatcher = NC4_dispatch_table;
+         break;
+#endif
+#if defined(USE_HDF4)
+      case NC_FORMATX_NC_HDF4:
+         dispatcher = HDF4_dispatch_table;
+         break;
 #endif
-   if(model == (NC_FORMATX_NC3))
-	dispatcher = NC3_dispatch_table;
-   else {
-       nullfree(path);              
-       return  NC_ENOTNC;
+      case NC_FORMATX_NC3:
+         dispatcher = NC3_dispatch_table;
+         break;
+      default:
+         nullfree(path);
+         return NC_ENOTNC;
+      }
    }
 
-havetable:
-
-   if(dispatcher == NULL) {
-       nullfree(path);              
+   /* If we can't figure out what dispatch table to use, give up. */
+   if (!dispatcher) {
+       nullfree(path);
        return NC_ENOTNC;
    }
 
@@ -2175,7 +2201,6 @@ openmagic(struct MagicFile* file)
     }
 #ifdef USE_PARALLEL
     if (file->use_parallel) {
-	MPI_Status mstatus;
 	int retval;
 	MPI_Offset size;
 	MPI_Comm comm = MPI_COMM_WORLD;
@@ -2206,17 +2231,17 @@ openmagic(struct MagicFile* file)
 	    {status = errno; goto done;}
 	/* Get its length */
 	{
-#ifdef _MSC_VER
 	int fd = fileno(file->fp);
+#ifdef _MSC_VER
 	__int64 len64 = _filelengthi64(fd);
 	if(len64 < 0)
             {status = errno; goto done;}
 	file->filelen = (long long)len64;
 #else
-	long size;
-	if((status = fseek(file->fp, 0L, SEEK_END)) < 0)
+	off_t size;
+	size = lseek(fd, 0, SEEK_END);
+	if(size == -1)
 	    {status = errno; goto done;}
-	size = ftell(file->fp);
 	file->filelen = (long long)size;
 #endif
 	rewind(file->fp);
@@ -2249,12 +2274,8 @@ readmagic(struct MagicFile* file, long pos, char* magic)
     if (file->use_parallel) {
 	MPI_Status mstatus;
 	int retval;
-	MPI_Offset offset;
-	offset = pos;
-	if((retval = MPI_File_seek(file->fh, offset, MPI_SEEK_SET)) != MPI_SUCCESS)
-	    {status = NC_EPARINIT; goto done;}	
-	if((retval = MPI_File_read(file->fh, magic, MAGIC_NUMBER_LEN, MPI_CHAR,
-				 &mstatus)) != MPI_SUCCESS)
+	if((retval = MPI_File_read_at_all(file->fh, pos, magic,
+                     MAGIC_NUMBER_LEN, MPI_CHAR, &mstatus)) != MPI_SUCCESS)
 	    {status = NC_EPARINIT; goto done;}
 	goto done;
     }
@@ -2277,9 +2298,9 @@ done:
     return status;
 }
 
-/** 
- * Close the file opened to check for magic number. 
- * 
+/**
+ * Close the file opened to check for magic number.
+ *
  * @param file pointer to the MagicFile struct for this open file.
  * @returns NC_NOERR for success
  * @returns NC_EPARINIT if there was a problem closing file with MPI
@@ -2293,7 +2314,6 @@ closemagic(struct MagicFile* file)
     if(file->inmemory) goto done; /* noop*/
 #ifdef USE_PARALLEL
     if (file->use_parallel) {
-	MPI_Status mstatus;
 	int retval;
 	if((retval = MPI_File_close(&file->fh)) != MPI_SUCCESS)
 		{status = NC_EPARINIT; goto done;}
diff --git a/libdispatch/dfilter.c b/libdispatch/dfilter.c
index e4f9aea..8c43607 100644
--- a/libdispatch/dfilter.c
+++ b/libdispatch/dfilter.c
@@ -156,7 +156,7 @@ NC_parsefilterspec(const char* spec, unsigned int* idp, size_t* nparamsp, unsign
 	    /* convert to network byte order */
 	    memcpy(mem,&val64u,sizeof(mem));
 #ifdef WORDS_BIGENDIAN	    
-	    byteswap8(mem);  /* convert big endian to little endian */
+	    NC_byteswap8(mem);  /* convert big endian to little endian */
 #endif
 	    vector = (unsigned int*)mem;
 	    ulist[nparams++] = vector[0];
diff --git a/libdispatch/drc.c b/libdispatch/drc.c
index 374ffcd..e2de99d 100644
--- a/libdispatch/drc.c
+++ b/libdispatch/drc.c
@@ -33,7 +33,7 @@ See LICENSE.txt for license information.
 /* Forward */
 static char* rcreadline(char** nextlinep);
 static void rctrim(char* text);
-static NClist* rcorder(NClist* rc);
+static void rcorder(NClist* rc);
 static int rccompile(const char* path);
 static struct NCTriple* rclocate(const char* key, const char* hostport);
 static int rcsearch(const char* prefix, const char* rcname, char** pathp);
@@ -220,29 +220,36 @@ rctrim(char* text)
 /* Order the triples: those with urls must be first,
    but otherwise relative order does not matter.
 */
-static NClist*
+static void
 rcorder(NClist* rc)
 {
     int i;
     int len = nclistlength(rc);
-    NClist* newrc = nclistnew();
-    if(rc == NULL || len == 0) return newrc;
-    /* Two passes: 1) pull triples with host */
+    NClist* tmprc = nclistnew();
+    if(rc == NULL || len == 0) return;
+    /* Copy rc into tmprc and clear rc */
     for(i=0;i<len;i++) {
         NCTriple* ti = nclistget(rc,i);
+        nclistpush(tmprc,ti);
+    }
+    nclistclear(rc);
+    /* Two passes: 1) pull triples with host */
+    for(i=0;i<len;i++) {
+        NCTriple* ti = nclistget(tmprc,i);
 	if(ti->host == NULL) continue;
-	nclistpush(newrc,ti);
+	nclistpush(rc,ti);
     }
     /* pass 2 pull triples without host*/
     for(i=0;i<len;i++) {
-        NCTriple* ti = nclistget(rc,i);
+        NCTriple* ti = nclistget(tmprc,i);
 	if(ti->host != NULL) continue;
-	nclistpush(newrc,ti);
+	nclistpush(rc,ti);
     }
 #ifdef D4DEBUG
-    storedump("reorder:",newrc);
+    storedump("reorder:",rc);
 #endif
-    return newrc;
+    nclistfree(tmprc);
+
 }
 
 /* Create a triple store from a file */
@@ -250,7 +257,7 @@ static int
 rccompile(const char* path)
 {
     int ret = NC_NOERR;
-    NClist* rc = ncrc_globalstate.rcinfo.triples;
+    NClist* rc = NULL;
     char* contents = NULL;
     NCbytes* tmp = ncbytesnew();
     NCURI* uri = NULL;
@@ -262,8 +269,14 @@ rccompile(const char* path)
     }
     contents = ncbytesextract(tmp);
     if(contents == NULL) contents = strdup("");
-    rcfreetriples(rc); /* clear out any old data */
-    rc = nclistnew();
+    /* Either reuse or create new  */
+    rc = ncrc_globalstate.rcinfo.triples;
+    if(rc != NULL)
+        rcfreetriples(rc); /* clear out any old data */
+    else {
+        rc = nclistnew();
+        ncrc_globalstate.rcinfo.triples = rc;
+    }
     nextline = contents;
     for(;;) {
 	char* line;
@@ -302,6 +315,8 @@ rccompile(const char* path)
 	    }
 	    ncbytesnull(tmp);
 	    triple->host = ncbytesextract(tmp);
+	    if(strlen(triple->host)==0)
+		{free(triple->host); triple->host = NULL;}
         }
         /* split off key and value */
         key=line;
@@ -318,7 +333,8 @@ rccompile(const char* path)
         rctrim(triple->value);
 #ifdef D4DEBUG
 	fprintf(stderr,"rc: host=%s key=%s value=%s\n",
-		triple->host,triple->key,triple->valu);
+		(triple->host != NULL ? triple->host : "<null>"),
+		triple->key,triple->valu);
 #endif
 	nclistpush(rc,triple);
 	triple = NULL;
@@ -326,6 +342,7 @@ rccompile(const char* path)
     rcorder(rc);
 
 done:
+    if(contents) free(contents);
     ncurifree(uri);
     ncbytesfree(tmp);
     return (ret);
@@ -338,8 +355,7 @@ done:
 static struct NCTriple*
 rclocate(const char* key, const char* hostport)
 {
-    int i, found, t;
-    size_t hplen;
+    int i,found;
     NClist* rc = ncrc_globalstate.rcinfo.triples;
     NCTriple* triple = NULL;
 
@@ -351,13 +367,16 @@ rclocate(const char* key, const char* hostport)
 
     for(found=0,i=0;i<nclistlength(rc);i++) {
 	triple = (NCTriple*)nclistget(rc,i);
-        hplen = strlen(triple->host);
+        size_t hplen = (triple->host == NULL ? 0 : strlen(triple->host));
+        int t;
         if(strcmp(key,triple->key) != 0) continue; /* keys do not match */
         /* If the triple entry has no url, then use it
            (because we have checked all other cases)*/
         if(hplen == 0) {found=1;break;}
         /* do hostport match */
-        t = strcmp(hostport,triple->host);
+	t = 0;
+	if(triple->host != NULL)
+            t = strcmp(hostport,triple->host);
         if(t ==  0) {found=1; break;}
     }
     return (found?triple:NULL);
diff --git a/libdispatch/dvar.c b/libdispatch/dvar.c
index 11bc559..d76f2e5 100644
--- a/libdispatch/dvar.c
+++ b/libdispatch/dvar.c
@@ -1,8 +1,8 @@
-/*! \file
-Functions for defining and inquiring about variables.
-
-Copyright 2010 University Corporation for Atmospheric
-Research/Unidata. See COPYRIGHT file for more info.
+/* Copyright 2010-2018 University Corporation for Atmospheric
+   Research/Unidata. See COPYRIGHT file for more info. */
+/**
+ * @file
+ * Functions for defining and inquiring about variables.
 */
 
 #include "ncdispatch.h"
@@ -239,6 +239,10 @@ For classic format, 64-bit offset format, and netCDF-4/HDF5 with
 classic mode, if the new name is longer than the old name, the netCDF
 dataset must be in define mode.
 
+For netCDF-4/HDF5 files, renaming the variable changes the order of
+the variables in the file. The renamed variable becomes the last
+variable in the file.
+
 @param ncid NetCDF or group ID, from a previous call to nc_open(),
 nc_create(), nc_def_grp(), or associated inquiry functions such as
 nc_inq_ncid().
@@ -279,7 +283,7 @@ rel_hum in an existing netCDF dataset named foo.nc:
      status = nc_enddef(ncid);
      if (status != NC_NOERR) handle_error(status);
 @endcode
-
+ at author Glenn Davis, Ed Hartnett, Dennis Heimbigner
 */
 int
 nc_rename_var(int ncid, int varid, const char *name)
@@ -416,13 +420,16 @@ NC_inq_recvar(int ncid, int varid, int* nrecdimsp, int *is_recdim)
    entirely.
 */
 
-/** \internal
-\ingroup variables
-Find the length of a type. This is how much space is required by the user, as in
-\code
-vals = malloc(nel * nctypelen(var.type));
-ncvarget(cdfid, varid, cor, edg, vals);
-\endcode
+/**
+ * @internal
+ * @ingroup variables
+ * Find the length of a type. This is how much space is required by
+ * the in memory to hold one element of this type.
+ *
+ * @parm type A netCDF atomic type.
+ *
+ * @return Length of the type in bytes, or -1 if type not found.
+ * @author Ed Hartnett
  */
 int
 nctypelen(nc_type type)
@@ -538,6 +545,87 @@ NC_getshape(int ncid, int varid, int ndims, size_t* shape)
    return status;
 }
 
+/*! Set the fill value for a variable.
+
+\ingroup variables
+
+\param ncid NetCDF ID, from a previous call to nc_open or
+nc_create.
+
+\param varid Variable ID.
+
+\param no_fill Set to NC_NOFILL to turn off fill mode for this
+variable. Set to NC_FILL (the default) to turn on fill mode for the
+variable.
+
+\param fill_value the fill value to be used for this variable. Must be
+the same type as the variable. This must point to enough free memory
+to hold one element of the data type of the variable. (For example, an
+NC_INT will require 4 bytes for it's fill value, which is also an
+NC_INT.)
+
+ * @returns ::NC_NOERR No error.
+ * @returns ::NC_EBADID Bad ID.
+ * @returns ::NC_ENOTINDEFINE Not in define mode.  This is returned for
+netCDF classic, 64-bit offset, or 64-bit data files, or for netCDF-4 files,
+when they were created with NC_STRICT_NC3 flag. See \ref nc_create.
+ * @returns ::NC_EPERM Attempt to create object in read-only file.
+
+\section nc_def_var_fill_example Example
+
+In this example from libsrc4/tst_vars.c, a variable is defined, and
+the fill mode turned off. Then nc_inq_fill() is used to check that the
+setting is correct. Then some data are written to the variable. Since
+the data that are written do not cover the full extent of the
+variable, the missing values will just be random. If fill value mode
+was turned on, the missing values would get the fill value.
+
+\code
+#define DIM7_LEN 2
+#define DIM7_NAME "dim_7_from_Indiana"
+#define VAR7_NAME "var_7_from_Idaho"
+#define NDIMS 1
+      int dimids[NDIMS];
+      size_t index[NDIMS];
+      int varid;
+      int no_fill;
+      unsigned short ushort_data = 42, ushort_data_in, fill_value_in;
+
+      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+      if (nc_def_dim(ncid, DIM7_NAME, DIM7_LEN, &dimids[0])) ERR;
+      if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids,
+		     &varid)) ERR;
+      if (nc_def_var_fill(ncid, varid, 1, NULL)) ERR;
+
+      if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
+      if (!no_fill) ERR;
+
+      index[0] = 1;
+      if (nc_put_var1_ushort(ncid, varid, index, &ushort_data)) ERR;
+
+      index[0] = 0;
+      if (nc_get_var1_ushort(ncid, varid, index, &ushort_data_in)) ERR;
+
+      if (nc_close(ncid)) ERR;
+\endcode
+*/
+int
+nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
+{
+    NC* ncp;
+    int stat = NC_check_id(ncid,&ncp);
+    if(stat != NC_NOERR) return stat;
+
+    /* Dennis Heimbigner: (Using NC_GLOBAL is ilegal, as this API) has no
+     * provision for specifying the type of the fillvalue, it must of necessity
+     * be using the type of the variable to interpret the bytes of the
+     * fill_value argument.
+     */
+    if (varid == NC_GLOBAL) return NC_EGLOBAL;
+
+    return ncp->dispatch->def_var_fill(ncid,varid,no_fill,fill_value);
+}
+
 #ifdef USE_NETCDF4
 /** \ingroup variables
 
@@ -680,11 +768,22 @@ nc_free_string(size_t len, char **data)
  * This function must be called after nc_def_var and before nc_enddef
  * or any functions which writes data to the file.
  *
+ * Deflation and shuffline require chunked data. If this function is
+ * called on a variable with contigious data, then the data is changed
+ * to chunked data, with default chunksizes. Use nc_def_var_chunking()
+ * to tune performance with user-defined chunksizes.
+ *
+ * If this function is called on a scalar variable, it is ignored.
+ *
  * @param ncid NetCDF or group ID, from a previous call to nc_open(),
  * nc_create(), nc_def_grp(), or associated inquiry functions such as
  * nc_inq_ncid().
  * @param varid Variable ID
- * @param shuffle True to turn on the shuffle filter.
+ * @param shuffle True to turn on the shuffle filter. The shuffle
+ * filter can assist with the compression of integer data by changing
+ * the byte order in the data stream. It makes no sense to use the
+ * shuffle filter without setting a deflate level, or to use shuffle
+ * on non-integer data.
  * @param deflate True to turn on deflation for this variable.
  * @param deflate_level A number between 0 (no compression) and 9
  * (maximum compression).
@@ -752,6 +851,7 @@ filter and compression.
       ERR(retval);
         ...
 @endcode
+* @author Ed Hartnett, Dennis Heimbigner
 */
 int
 nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_level)
@@ -770,6 +870,11 @@ nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_le
  * This function must be called after nc_def_var and before nc_enddef
  * or any functions which writes data to the file.
  *
+ * Checksums require chunked data. If this function is called on a
+ * variable with contigious data, then the data is changed to chunked
+ * data, with default chunksizes. Use nc_def_var_chunking() to tune
+ * performance with user-defined chunksizes.
+ *
  * @param ncid NetCDF or group ID, from a previous call to nc_open(),
  * nc_create(), nc_def_grp(), or associated inquiry functions such as
  * nc_inq_ncid().
@@ -786,6 +891,7 @@ not netCDF-4/HDF5.
 netcdf-4 file.
  * @returns ::NC_ELATEDEF Too late to change settings for this variable.
  * @returns ::NC_EINVAL Invalid input
+ * @author Ed Hartnett, Dennis Heimbigner
 */
 int
 nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
@@ -899,80 +1005,6 @@ nc_def_var_chunking(int ncid, int varid, int storage,
 					   chunksizesp);
 }
 
-/*! Set the fill value for a netCDF4/HDF5 variable.
-
-\ingroup variables
-
-\param ncid NetCDF ID, from a previous call to nc_open or
-nc_create.
-
-\param varid Variable ID.
-
-\param no_fill Set to NC_NOFILL to turn off fill mode for this
-variable. Set to NC_FILL (the default) to turn on fill mode for the
-variable.
-
-\param fill_value the fill value to be used for this variable. Must be
-the same type as the variable. This must point to enough free memory
-to hold one element of the data type of the variable. (For example, an
-NC_INT will require 4 bytes for it's fill value, which is also an
-NC_INT.)
-
- * @returns ::NC_NOERR No error.
- * @returns ::NC_EBADID Bad ID.
- * @returns ::NC_ENOTNC4 Not a netCDF-4 file.
- * @returns ::NC_ENOTINDEFINE Not in define mode.  This is returned for
-netCDF classic or 64-bit offset files, or for netCDF-4 files, when
-they wwere created with NC_STRICT_NC3 flag. See \ref nc_create.
- * @returns ::NC_EPERM Attempt to create object in read-only file.
-
-\section nc_def_var_fill_example Example
-
-In this example from libsrc4/tst_vars.c, a variable is defined, and
-the fill mode turned off. Then nc_inq_fill() is used to check that the
-setting is correct. Then some data are written to the variable. Since
-the data that are written do not cover the full extent of the
-variable, the missing values will just be random. If fill value mode
-was turned on, the missing values would get the fill value.
-
-\code
-#define DIM7_LEN 2
-#define DIM7_NAME "dim_7_from_Indiana"
-#define VAR7_NAME "var_7_from_Idaho"
-#define NDIMS 1
-      int dimids[NDIMS];
-      size_t index[NDIMS];
-      int varid;
-      int no_fill;
-      unsigned short ushort_data = 42, ushort_data_in, fill_value_in;
-
-      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
-      if (nc_def_dim(ncid, DIM7_NAME, DIM7_LEN, &dimids[0])) ERR;
-      if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids,
-		     &varid)) ERR;
-      if (nc_def_var_fill(ncid, varid, 1, NULL)) ERR;
-
-      if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
-      if (!no_fill) ERR;
-
-      index[0] = 1;
-      if (nc_put_var1_ushort(ncid, varid, index, &ushort_data)) ERR;
-
-      index[0] = 0;
-      if (nc_get_var1_ushort(ncid, varid, index, &ushort_data_in)) ERR;
-
-      if (nc_close(ncid)) ERR;
-\endcode
-*/
-int
-nc_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
-{
-    NC* ncp;
-    int stat = NC_check_id(ncid,&ncp);
-    if(stat != NC_NOERR) return stat;
-    return ncp->dispatch->def_var_fill(ncid,varid,no_fill,fill_value);
-}
-
 /**
 @ingroup variables
 
@@ -1059,6 +1091,7 @@ nc_def_var_endian(int ncid, int varid, int endian)
  * @param parms Filter parameters.
  *
  * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ID.
  * @author Dennis Heimbigner
  */
 int
diff --git a/libdispatch/ncbytes.c b/libdispatch/ncbytes.c
index 6618986..7d0aa90 100644
--- a/libdispatch/ncbytes.c
+++ b/libdispatch/ncbytes.c
@@ -46,7 +46,7 @@ ncbytessetalloc(NCbytes* bb, unsigned long sz)
 {
   char* newcontent;
   if(bb == NULL) return ncbytesfail();
-  if(sz <= 0) {sz = (bb->alloc?2*bb->alloc:DEFAULTALLOC);}
+  if(sz == 0) {sz = (bb->alloc?2*bb->alloc:DEFAULTALLOC);}
   if(bb->alloc >= sz) return TRUE;
   if(bb->nonextendible) return ncbytesfail();
   newcontent=(char*)calloc(sz,sizeof(char));
@@ -110,9 +110,7 @@ ncbytesappend(NCbytes* bb, char elem)
 {
   if(bb == NULL) return ncbytesfail();
   /* We need space for the char + null */
-  while(bb->length+1 >= bb->alloc) {
-	if(!ncbytessetalloc(bb,0)) return ncbytesfail();
-  }
+  ncbytessetalloc(bb,bb->length+2);
   bb->content[bb->length] = (char)(elem & 0xFF);
   bb->length++;
   bb->content[bb->length] = '\0';
diff --git a/libdispatch/nchashmap.c b/libdispatch/nchashmap.c
index cd8b71c..584c0b1 100644
--- a/libdispatch/nchashmap.c
+++ b/libdispatch/nchashmap.c
@@ -1,206 +1,1982 @@
-/*********************************************************************
- *   Copyright 2010, UCAR/Unidata
- *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
- *   $Header$
- *********************************************************************/
+/*
+Copyright (c) 1998-2017 University Corporation for Atmospheric Research/Unidata
+See LICENSE.txt for license information.
+*/
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#define NEWHASHMAP
 
-#include <stdlib.h>
+#include "config.h"
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <assert.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include "nc.h"
 
 #include "nchashmap.h"
+#include "nc3internal.h"
+
+#define VERIFY 
 
-#ifndef TRUE
-#define TRUE 1
+#ifdef VERIFY
+#define ASSERT(x) assert(x)
+#else
+#define ASSERT(x)
 #endif
-#ifndef FALSE
-#define FALSE 0
+
+/* See lookup3.c */
+extern unsigned int hash_fast(const void* key, size_t length);
+
+/* this should be prime */
+#define TABLE_STARTSIZE 1021
+
+/* Flags must be powers of 2 */
+/* Slot has data */
+#define ACTIVE 1
+/* Slot had its value deleted */
+#define DELETED 2
+/* Slot is unused */
+#define EMPTY 0
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+/* Forward */
+static unsigned int NC_nprimes;
+static unsigned int NC_primes[16386];
+static unsigned int findPrimeGreaterThan(size_t val);
+
+static void
+rehash(NC_hashmap* hm)
+{
+    size_t size = hm->size;
+    size_t count = hm->count;
+    NC_hentry* oldtable = hm->table;
+
+    hm->size = findPrimeGreaterThan(size<<1);
+    hm->table = (NC_hentry*)calloc(sizeof(NC_hentry), hm->size);
+    hm->count = 0;
+
+    while(size > 0) {
+	--size;
+        if(oldtable[size].flags == ACTIVE) {
+            void* data = oldtable[size].data;
+	    char* key = oldtable[size].key;
+            NC_hashmapadd(hm, data, key);
+#ifdef VERIFY
+	    { void* data2;
+            ASSERT(NC_hashmapget(hm, key, &data2) == 1);
+	    ASSERT(data == data2);
+	    }
 #endif
+        }
+    }
+    free(oldtable);
+    ASSERT(count == hm->count);
+}
 
-#define DEFAULTALLOC 31
+/* Locate where given object is or should be placed in indexp.
+   if fail to find spot return 0 else 1.
+   If deletok then a deleted slot is ok to return;
+   If hashkeyp is non-null, then return hashkey
+   return invariant: return == 0 || *indexp is defined 
+ */
+static int
+locate(NC_hashmap* hash, const char* key, size_t* indexp, size_t* hashkeyp, int deletedok)
+{
+    size_t i;
+    size_t keylen = strlen(key);
+    size_t hashkey = hash_fast(key, keylen);
+    size_t index = hashkey % hash->size;
+    size_t step = 1; /* simple linear probe */
+    int deletefound = 0;
+    size_t deletedindex = 0; /* first deleted entry encountered */
 
-NChashmap* nchashnew(void) {return nchashnew0(DEFAULTALLOC);}
+    if(hashkeyp) *hashkeyp = hashkey;
+    /* Search table using linear probing */
+    for (i = 0; i < hash->size; i++) {
+        NC_hentry entry = hash->table[index];
+        if(entry.flags & ACTIVE) {
+            if(entry.hashkey == hashkey
+               && strncmp(key,entry.key,keylen)==0) {
+		if(indexp) *indexp = index;
+		return 1;
+            }
+	    /* Keep looking */
+	} else if(entry.flags & DELETED) {
+	    if(!deletefound) {/* save this position */
+	        deletefound = 1;
+		deletedindex = index;
+	    }
+	    /* Keep looking */
+ 	} else { /* Empty slot */
+	    if(indexp) *indexp = index;
+	    return 1;
+	}
+        /* linear probe */
+	index = (index + step) % hash->size;
+    }
+    if(deletedok && deletefound) {
+	if(indexp) *indexp = deletedindex;	
+	return 1;
+    }
+    return 0;
+}
 
-NChashmap* nchashnew0(size_t alloc)
+NC_hashmap*
+NC_hashmapnew(size_t startsize)
 {
-  NChashmap* hm;
-  if(sizeof(nchashid) != sizeof(void*)){
-	fprintf(stderr,"nchashmap: sizeof(nchashid) != sizeof(void*)");
-	abort();
-  }
-  hm = (NChashmap*)malloc(sizeof(NChashmap));
-  if(!hm) return NULL;
-  hm->alloc = alloc;
-  hm->table = (NClist**)malloc(hm->alloc*sizeof(NClist*));
-  if(!hm->table) {free(hm); return NULL;}
-  memset((void*)hm->table,0,hm->alloc*sizeof(NClist*));
-  return hm;
+    NC_hashmap* hm = (NC_hashmap*)malloc(sizeof(NC_hashmap));
+
+    if(startsize == 0)
+	startsize = TABLE_STARTSIZE;
+    else {
+	startsize *= 4;
+	startsize /= 3;
+	startsize = findPrimeGreaterThan(startsize);
+    }
+    hm->table = (NC_hentry*)calloc(sizeof(NC_hentry), (size_t)startsize);
+    hm->size = startsize;
+    hm->count = 0;
+    return hm;
 }
 
 int
-nchashfree(NChashmap* hm)
+NC_hashmapadd(NC_hashmap* hash, void* data, const char* key)
 {
-  if(hm) {
-    int i;
-    for(i=0;i<hm->alloc;i++) {
-	if(hm->table[i] != NULL) nclistfree(hm->table[i]);
-    }
-    free(hm->table);
-    free(hm);
-  }
-  return TRUE;
+    if(hash->size*3/4 <= hash->count)
+	rehash(hash);
+
+    for(;;) {
+	size_t index, hashkey;
+	if(!locate(hash,key,&index,&hashkey,1)) {
+	    rehash(hash);
+	    continue; /* try on larger table */
+	}
+        NC_hentry* entry = &hash->table[index];
+	if(entry->flags & ACTIVE) {
+	    /* key already exists in table => overwrite */
+	    entry->data = data;
+	    return 1;
+        } else { /* !ACTIVE || DELETED */
+	    entry->flags = ACTIVE;
+	    entry->data = data;
+	    entry->hashkey = hashkey;
+	    entry->key = (char*)key;
+	    ++hash->count;
+	    return 1;
+	}
+     }
+     return 0;
 }
 
-/* Insert a <nchashid,void*> pair into the table*/
-/* Fail if already there*/
 int
-nchashinsert(NChashmap* hm, nchashid hash, void* value)
+NC_hashmapremove(NC_hashmap* hash, const char* key, void** datap)
 {
-    int i;
-    size_t offset,len;
-    NClist* seq;
-    void** list;
-
-    offset = (hash % hm->alloc);
-    seq = hm->table[offset];
-    if(seq == NULL) {seq = nclistnew(); hm->table[offset] = seq;}
-    len = nclistlength(seq);
-    list = nclistcontents(seq);
-    for(i=0;i<len;i+=2,list+=2) {
-	if(hash==(nchashid)(*list)) return FALSE;
-    }
-    nclistpush(seq,(void*)hash);
-    nclistpush(seq,value);
-    hm->size++;
-    return TRUE;
+    size_t index;
+    NC_hentry entry;
+    if(!locate(hash,key,&index,NULL,0))
+	return 0; /* not present */
+    entry = hash->table[index];
+
+    if(entry.flags & ACTIVE) { /* matching entry found */
+	hash->table[index].flags = DELETED; /* also turn off ACTIVE */
+	hash->table[index].key = NULL;
+	--hash->count;
+	if(datap) *datap = hash->table[index].data;
+	return 1;
+    } else /* !ACTIVE && !DELETED => not in table*/
+	return 0;
 }
 
-/* Insert a <nchashid,void*> pair into the table*/
-/* Overwrite if already there*/
 int
-nchashreplace(NChashmap* hm, nchashid hash, void* value)
+NC_hashmapget(NC_hashmap* hash, const char* key, void** datap)
 {
-    int i;
-    size_t offset,len;
-    NClist* seq;
-    void** list;
-
-    offset = (hash % hm->alloc);
-    seq = hm->table[offset];
-    if(seq == NULL) {seq = nclistnew(); hm->table[offset] = seq;}
-    len = nclistlength(seq);
-    list = nclistcontents(seq);
-    for(i=0;i<len;i+=2,list+=2) {
-	if(hash==(nchashid)(*list)) {list[1] = value; return TRUE;}
+    if(hash->count) {
+        size_t index;
+        NC_hentry entry;
+        if(!locate(hash,key,&index,NULL,0))
+	    return 0; /* not present */
+	entry = hash->table[index];
+	if(entry.flags & ACTIVE) {
+	    if(datap) *datap = entry.data;
+	    return 1;
+        } else /* Not found */
+	    return 0;
     }
-    nclistpush(seq,(void*)hash);
-    nclistpush(seq,value);
-    hm->size++;
-    return TRUE;
+    return 0;
 }
 
-/* remove a nchashid*/
-/* return TRUE if found, false otherwise*/
+/** Change the data for the specified key
+    Return 1 if found, 0 otherwise
+*/
 int
-nchashremove(NChashmap* hm, nchashid hash)
+NC_hashmapsetdata(NC_hashmap* hash, const char* key, void* newdata)
 {
-    size_t i;
-    size_t offset,len;
-    NClist* seq;
-    void** list;
-
-    offset = (hash % hm->alloc);
-    seq = hm->table[offset];
-    if(seq == NULL) return TRUE;
-    len = nclistlength(seq);
-    list = nclistcontents(seq);
-    for(i=0;i<len;i+=2,list+=2) {
-	if(hash==(nchashid)(*list)) {
-	    nclistremove(seq,(i+1));
-	    nclistremove(seq,i);
-	    hm->size--;
-	    if(nclistlength(seq) == 0) {nclistfree(seq); hm->table[offset] = NULL;}
-	    return TRUE;
-	}
-    }
-    return FALSE;
+    size_t index;
+    NC_hentry* entry;
+    if(hash == NULL || hash->count == 0 || key == NULL)
+	return 0; /* no such entry */
+    if(!locate(hash,key,&index,NULL,0))
+        return 0; /* not present */
+    entry = &hash->table[index];
+    assert((entry->flags & ACTIVE) == ACTIVE);
+    entry->data = newdata;
+    return 1;    
 }
 
-/* lookup a nchashid; return DATANULL if not found*/
-/* (use hashlookup if the possible values include 0)*/
-void*
-nchashget(NChashmap* hm, nchashid hash)
+size_t
+NC_hashmapcount(NC_hashmap* hash)
 {
-    void* value = NULL;
-    if(!nchashlookup(hm,hash,&value)) return NULL;
-    return value;
+    return hash->count;
 }
 
 int
-nchashlookup(NChashmap* hm, nchashid hash, void** valuep)
+NC_hashmapfree(NC_hashmap* hash)
 {
-    int i;
-    size_t offset,len;
-    NClist* seq;
-    void** list;
-
-    offset = (hash % hm->alloc);
-    seq = hm->table[offset];
-    if(seq == NULL) return TRUE;
-    len = nclistlength(seq);
-    list = nclistcontents(seq);
-    for(i=0;i<len;i+=2,list+=2) {
-	if(hash==(nchashid)(*list)) {if(valuep) {*valuep = list[1]; return TRUE;}}
+    if(hash) {
+      free(hash->table);
+      free(hash);
     }
-    return FALSE;
+    return 1;
 }
 
-/* Return the ith pair; order is completely arbitrary*/
-/* Can be expensive*/
-int
-nchashith(NChashmap* hm, int index, nchashid* hashp, void** elemp)
+/**************************************************/
+/* Prime table */
+
+/*
+Binary search prime table for first prime just greater than or
+equal to val
+*/
+
+static unsigned int
+findPrimeGreaterThan(size_t val)
 {
-    int i;
-    if(hm == NULL) return FALSE;
-    for(i=0;i<hm->alloc;i++) {
-	NClist* seq = hm->table[i];
-	int len = nclistlength(seq) / 2;
-	if(len == 0) continue;
-	if((index - len) < 0) {
-	    if(hashp) *hashp = (nchashid)nclistget(seq,index*2);
-	    if(elemp) *elemp = nclistget(seq,(index*2)+1);
-	    return TRUE;
-	}
-	index -= len;
-    }
-    return FALSE;
+      int n = NC_nprimes;
+      int L = 1; /* skip leading flag number */
+      int R = (n - 2); /* skip trailing flag */
+      unsigned int v = 0;
+
+      if(val >= 0xFFFFFFFF)
+	return 0; /* Too big */
+      v = (unsigned int)val;
+
+      for(;;) {
+	if(L >= R) break;
+            int m = (L + R) / 2;
+	/* is this an acceptable prime? */
+            if(NC_primes[m-1] < v && NC_primes[m] >= v)
+	    return NC_primes[m]; /* acceptable*/
+            else if(NC_primes[m-1] >= v)
+	        R = m;
+            else if(NC_primes[m] < v)
+	        L = m;
+      }
+      return 0;
 }
 
-/* Return all the keys; order is completely arbitrary*/
-/* Can be expensive*/
-int
-nchashkeys(NChashmap* hm, nchashid** keylist)
+/*
+Table of the the first 2^14 primes.
+Add leading and trailing values to simplify
+search binary algorithm.
+*/
+static unsigned int NC_primes[16386] = {
+0U,
+2U, 3U, 5U, 7U, 11U, 13U, 17U, 19U, 23U, 29U,
+31U, 37U, 41U, 43U, 47U, 53U, 59U, 61U, 67U, 71U,
+73U, 79U, 83U, 89U, 97U, 101U, 103U, 107U, 109U, 113U,
+127U, 131U, 137U, 139U, 149U, 151U, 157U, 163U, 167U, 173U,
+179U, 181U, 191U, 193U, 197U, 199U, 211U, 223U, 227U, 229U,
+233U, 239U, 241U, 251U, 257U, 263U, 269U, 271U, 277U, 281U,
+283U, 293U, 307U, 311U, 313U, 317U, 331U, 337U, 347U, 349U,
+353U, 359U, 367U, 373U, 379U, 383U, 389U, 397U, 401U, 409U,
+419U, 421U, 431U, 433U, 439U, 443U, 449U, 457U, 461U, 463U,
+467U, 479U, 487U, 491U, 499U, 503U, 509U, 521U, 523U, 541U,
+547U, 557U, 563U, 569U, 571U, 577U, 587U, 593U, 599U, 601U,
+607U, 613U, 617U, 619U, 631U, 641U, 643U, 647U, 653U, 659U,
+661U, 673U, 677U, 683U, 691U, 701U, 709U, 719U, 727U, 733U,
+739U, 743U, 751U, 757U, 761U, 769U, 773U, 787U, 797U, 809U,
+811U, 821U, 823U, 827U, 829U, 839U, 853U, 857U, 859U, 863U,
+877U, 881U, 883U, 887U, 907U, 911U, 919U, 929U, 937U, 941U,
+947U, 953U, 967U, 971U, 977U, 983U, 991U, 997U, 1009U, 1013U,
+1019U, 1021U, 1031U, 1033U, 1039U, 1049U, 1051U, 1061U, 1063U, 1069U,
+1087U, 1091U, 1093U, 1097U, 1103U, 1109U, 1117U, 1123U, 1129U, 1151U,
+1153U, 1163U, 1171U, 1181U, 1187U, 1193U, 1201U, 1213U, 1217U, 1223U,
+1229U, 1231U, 1237U, 1249U, 1259U, 1277U, 1279U, 1283U, 1289U, 1291U,
+1297U, 1301U, 1303U, 1307U, 1319U, 1321U, 1327U, 1361U, 1367U, 1373U,
+1381U, 1399U, 1409U, 1423U, 1427U, 1429U, 1433U, 1439U, 1447U, 1451U,
+1453U, 1459U, 1471U, 1481U, 1483U, 1487U, 1489U, 1493U, 1499U, 1511U,
+1523U, 1531U, 1543U, 1549U, 1553U, 1559U, 1567U, 1571U, 1579U, 1583U,
+1597U, 1601U, 1607U, 1609U, 1613U, 1619U, 1621U, 1627U, 1637U, 1657U,
+1663U, 1667U, 1669U, 1693U, 1697U, 1699U, 1709U, 1721U, 1723U, 1733U,
+1741U, 1747U, 1753U, 1759U, 1777U, 1783U, 1787U, 1789U, 1801U, 1811U,
+1823U, 1831U, 1847U, 1861U, 1867U, 1871U, 1873U, 1877U, 1879U, 1889U,
+1901U, 1907U, 1913U, 1931U, 1933U, 1949U, 1951U, 1973U, 1979U, 1987U,
+1993U, 1997U, 1999U, 2003U, 2011U, 2017U, 2027U, 2029U, 2039U, 2053U,
+2063U, 2069U, 2081U, 2083U, 2087U, 2089U, 2099U, 2111U, 2113U, 2129U,
+2131U, 2137U, 2141U, 2143U, 2153U, 2161U, 2179U, 2203U, 2207U, 2213U,
+2221U, 2237U, 2239U, 2243U, 2251U, 2267U, 2269U, 2273U, 2281U, 2287U,
+2293U, 2297U, 2309U, 2311U, 2333U, 2339U, 2341U, 2347U, 2351U, 2357U,
+2371U, 2377U, 2381U, 2383U, 2389U, 2393U, 2399U, 2411U, 2417U, 2423U,
+2437U, 2441U, 2447U, 2459U, 2467U, 2473U, 2477U, 2503U, 2521U, 2531U,
+2539U, 2543U, 2549U, 2551U, 2557U, 2579U, 2591U, 2593U, 2609U, 2617U,
+2621U, 2633U, 2647U, 2657U, 2659U, 2663U, 2671U, 2677U, 2683U, 2687U,
+2689U, 2693U, 2699U, 2707U, 2711U, 2713U, 2719U, 2729U, 2731U, 2741U,
+2749U, 2753U, 2767U, 2777U, 2789U, 2791U, 2797U, 2801U, 2803U, 2819U,
+2833U, 2837U, 2843U, 2851U, 2857U, 2861U, 2879U, 2887U, 2897U, 2903U,
+2909U, 2917U, 2927U, 2939U, 2953U, 2957U, 2963U, 2969U, 2971U, 2999U,
+3001U, 3011U, 3019U, 3023U, 3037U, 3041U, 3049U, 3061U, 3067U, 3079U,
+3083U, 3089U, 3109U, 3119U, 3121U, 3137U, 3163U, 3167U, 3169U, 3181U,
+3187U, 3191U, 3203U, 3209U, 3217U, 3221U, 3229U, 3251U, 3253U, 3257U,
+3259U, 3271U, 3299U, 3301U, 3307U, 3313U, 3319U, 3323U, 3329U, 3331U,
+3343U, 3347U, 3359U, 3361U, 3371U, 3373U, 3389U, 3391U, 3407U, 3413U,
+3433U, 3449U, 3457U, 3461U, 3463U, 3467U, 3469U, 3491U, 3499U, 3511U,
+3517U, 3527U, 3529U, 3533U, 3539U, 3541U, 3547U, 3557U, 3559U, 3571U,
+3581U, 3583U, 3593U, 3607U, 3613U, 3617U, 3623U, 3631U, 3637U, 3643U,
+3659U, 3671U, 3673U, 3677U, 3691U, 3697U, 3701U, 3709U, 3719U, 3727U,
+3733U, 3739U, 3761U, 3767U, 3769U, 3779U, 3793U, 3797U, 3803U, 3821U,
+3823U, 3833U, 3847U, 3851U, 3853U, 3863U, 3877U, 3881U, 3889U, 3907U,
+3911U, 3917U, 3919U, 3923U, 3929U, 3931U, 3943U, 3947U, 3967U, 3989U,
+4001U, 4003U, 4007U, 4013U, 4019U, 4021U, 4027U, 4049U, 4051U, 4057U,
+4073U, 4079U, 4091U, 4093U, 4099U, 4111U, 4127U, 4129U, 4133U, 4139U,
+4153U, 4157U, 4159U, 4177U, 4201U, 4211U, 4217U, 4219U, 4229U, 4231U,
+4241U, 4243U, 4253U, 4259U, 4261U, 4271U, 4273U, 4283U, 4289U, 4297U,
+4327U, 4337U, 4339U, 4349U, 4357U, 4363U, 4373U, 4391U, 4397U, 4409U,
+4421U, 4423U, 4441U, 4447U, 4451U, 4457U, 4463U, 4481U, 4483U, 4493U,
+4507U, 4513U, 4517U, 4519U, 4523U, 4547U, 4549U, 4561U, 4567U, 4583U,
+4591U, 4597U, 4603U, 4621U, 4637U, 4639U, 4643U, 4649U, 4651U, 4657U,
+4663U, 4673U, 4679U, 4691U, 4703U, 4721U, 4723U, 4729U, 4733U, 4751U,
+4759U, 4783U, 4787U, 4789U, 4793U, 4799U, 4801U, 4813U, 4817U, 4831U,
+4861U, 4871U, 4877U, 4889U, 4903U, 4909U, 4919U, 4931U, 4933U, 4937U,
+4943U, 4951U, 4957U, 4967U, 4969U, 4973U, 4987U, 4993U, 4999U, 5003U,
+5009U, 5011U, 5021U, 5023U, 5039U, 5051U, 5059U, 5077U, 5081U, 5087U,
+5099U, 5101U, 5107U, 5113U, 5119U, 5147U, 5153U, 5167U, 5171U, 5179U,
+5189U, 5197U, 5209U, 5227U, 5231U, 5233U, 5237U, 5261U, 5273U, 5279U,
+5281U, 5297U, 5303U, 5309U, 5323U, 5333U, 5347U, 5351U, 5381U, 5387U,
+5393U, 5399U, 5407U, 5413U, 5417U, 5419U, 5431U, 5437U, 5441U, 5443U,
+5449U, 5471U, 5477U, 5479U, 5483U, 5501U, 5503U, 5507U, 5519U, 5521U,
+5527U, 5531U, 5557U, 5563U, 5569U, 5573U, 5581U, 5591U, 5623U, 5639U,
+5641U, 5647U, 5651U, 5653U, 5657U, 5659U, 5669U, 5683U, 5689U, 5693U,
+5701U, 5711U, 5717U, 5737U, 5741U, 5743U, 5749U, 5779U, 5783U, 5791U,
+5801U, 5807U, 5813U, 5821U, 5827U, 5839U, 5843U, 5849U, 5851U, 5857U,
+5861U, 5867U, 5869U, 5879U, 5881U, 5897U, 5903U, 5923U, 5927U, 5939U,
+5953U, 5981U, 5987U, 6007U, 6011U, 6029U, 6037U, 6043U, 6047U, 6053U,
+6067U, 6073U, 6079U, 6089U, 6091U, 6101U, 6113U, 6121U, 6131U, 6133U,
+6143U, 6151U, 6163U, 6173U, 6197U, 6199U, 6203U, 6211U, 6217U, 6221U,
+6229U, 6247U, 6257U, 6263U, 6269U, 6271U, 6277U, 6287U, 6299U, 6301U,
+6311U, 6317U, 6323U, 6329U, 6337U, 6343U, 6353U, 6359U, 6361U, 6367U,
+6373U, 6379U, 6389U, 6397U, 6421U, 6427U, 6449U, 6451U, 6469U, 6473U,
+6481U, 6491U, 6521U, 6529U, 6547U, 6551U, 6553U, 6563U, 6569U, 6571U,
+6577U, 6581U, 6599U, 6607U, 6619U, 6637U, 6653U, 6659U, 6661U, 6673U,
+6679U, 6689U, 6691U, 6701U, 6703U, 6709U, 6719U, 6733U, 6737U, 6761U,
+6763U, 6779U, 6781U, 6791U, 6793U, 6803U, 6823U, 6827U, 6829U, 6833U,
+6841U, 6857U, 6863U, 6869U, 6871U, 6883U, 6899U, 6907U, 6911U, 6917U,
+6947U, 6949U, 6959U, 6961U, 6967U, 6971U, 6977U, 6983U, 6991U, 6997U,
+7001U, 7013U, 7019U, 7027U, 7039U, 7043U, 7057U, 7069U, 7079U, 7103U,
+7109U, 7121U, 7127U, 7129U, 7151U, 7159U, 7177U, 7187U, 7193U, 7207U,
+7211U, 7213U, 7219U, 7229U, 7237U, 7243U, 7247U, 7253U, 7283U, 7297U,
+7307U, 7309U, 7321U, 7331U, 7333U, 7349U, 7351U, 7369U, 7393U, 7411U,
+7417U, 7433U, 7451U, 7457U, 7459U, 7477U, 7481U, 7487U, 7489U, 7499U,
+7507U, 7517U, 7523U, 7529U, 7537U, 7541U, 7547U, 7549U, 7559U, 7561U,
+7573U, 7577U, 7583U, 7589U, 7591U, 7603U, 7607U, 7621U, 7639U, 7643U,
+7649U, 7669U, 7673U, 7681U, 7687U, 7691U, 7699U, 7703U, 7717U, 7723U,
+7727U, 7741U, 7753U, 7757U, 7759U, 7789U, 7793U, 7817U, 7823U, 7829U,
+7841U, 7853U, 7867U, 7873U, 7877U, 7879U, 7883U, 7901U, 7907U, 7919U,
+7927U, 7933U, 7937U, 7949U, 7951U, 7963U, 7993U, 8009U, 8011U, 8017U,
+8039U, 8053U, 8059U, 8069U, 8081U, 8087U, 8089U, 8093U, 8101U, 8111U,
+8117U, 8123U, 8147U, 8161U, 8167U, 8171U, 8179U, 8191U, 8209U, 8219U,
+8221U, 8231U, 8233U, 8237U, 8243U, 8263U, 8269U, 8273U, 8287U, 8291U,
+8293U, 8297U, 8311U, 8317U, 8329U, 8353U, 8363U, 8369U, 8377U, 8387U,
+8389U, 8419U, 8423U, 8429U, 8431U, 8443U, 8447U, 8461U, 8467U, 8501U,
+8513U, 8521U, 8527U, 8537U, 8539U, 8543U, 8563U, 8573U, 8581U, 8597U,
+8599U, 8609U, 8623U, 8627U, 8629U, 8641U, 8647U, 8663U, 8669U, 8677U,
+8681U, 8689U, 8693U, 8699U, 8707U, 8713U, 8719U, 8731U, 8737U, 8741U,
+8747U, 8753U, 8761U, 8779U, 8783U, 8803U, 8807U, 8819U, 8821U, 8831U,
+8837U, 8839U, 8849U, 8861U, 8863U, 8867U, 8887U, 8893U, 8923U, 8929U,
+8933U, 8941U, 8951U, 8963U, 8969U, 8971U, 8999U, 9001U, 9007U, 9011U,
+9013U, 9029U, 9041U, 9043U, 9049U, 9059U, 9067U, 9091U, 9103U, 9109U,
+9127U, 9133U, 9137U, 9151U, 9157U, 9161U, 9173U, 9181U, 9187U, 9199U,
+9203U, 9209U, 9221U, 9227U, 9239U, 9241U, 9257U, 9277U, 9281U, 9283U,
+9293U, 9311U, 9319U, 9323U, 9337U, 9341U, 9343U, 9349U, 9371U, 9377U,
+9391U, 9397U, 9403U, 9413U, 9419U, 9421U, 9431U, 9433U, 9437U, 9439U,
+9461U, 9463U, 9467U, 9473U, 9479U, 9491U, 9497U, 9511U, 9521U, 9533U,
+9539U, 9547U, 9551U, 9587U, 9601U, 9613U, 9619U, 9623U, 9629U, 9631U,
+9643U, 9649U, 9661U, 9677U, 9679U, 9689U, 9697U, 9719U, 9721U, 9733U,
+9739U, 9743U, 9749U, 9767U, 9769U, 9781U, 9787U, 9791U, 9803U, 9811U,
+9817U, 9829U, 9833U, 9839U, 9851U, 9857U, 9859U, 9871U, 9883U, 9887U,
+9901U, 9907U, 9923U, 9929U, 9931U, 9941U, 9949U, 9967U, 9973U, 10007U,
+10009U, 10037U, 10039U, 10061U, 10067U, 10069U, 10079U, 10091U, 10093U, 10099U,
+10103U, 10111U, 10133U, 10139U, 10141U, 10151U, 10159U, 10163U, 10169U, 10177U,
+10181U, 10193U, 10211U, 10223U, 10243U, 10247U, 10253U, 10259U, 10267U, 10271U,
+10273U, 10289U, 10301U, 10303U, 10313U, 10321U, 10331U, 10333U, 10337U, 10343U,
+10357U, 10369U, 10391U, 10399U, 10427U, 10429U, 10433U, 10453U, 10457U, 10459U,
+10463U, 10477U, 10487U, 10499U, 10501U, 10513U, 10529U, 10531U, 10559U, 10567U,
+10589U, 10597U, 10601U, 10607U, 10613U, 10627U, 10631U, 10639U, 10651U, 10657U,
+10663U, 10667U, 10687U, 10691U, 10709U, 10711U, 10723U, 10729U, 10733U, 10739U,
+10753U, 10771U, 10781U, 10789U, 10799U, 10831U, 10837U, 10847U, 10853U, 10859U,
+10861U, 10867U, 10883U, 10889U, 10891U, 10903U, 10909U, 10937U, 10939U, 10949U,
+10957U, 10973U, 10979U, 10987U, 10993U, 11003U, 11027U, 11047U, 11057U, 11059U,
+11069U, 11071U, 11083U, 11087U, 11093U, 11113U, 11117U, 11119U, 11131U, 11149U,
+11159U, 11161U, 11171U, 11173U, 11177U, 11197U, 11213U, 11239U, 11243U, 11251U,
+11257U, 11261U, 11273U, 11279U, 11287U, 11299U, 11311U, 11317U, 11321U, 11329U,
+11351U, 11353U, 11369U, 11383U, 11393U, 11399U, 11411U, 11423U, 11437U, 11443U,
+11447U, 11467U, 11471U, 11483U, 11489U, 11491U, 11497U, 11503U, 11519U, 11527U,
+11549U, 11551U, 11579U, 11587U, 11593U, 11597U, 11617U, 11621U, 11633U, 11657U,
+11677U, 11681U, 11689U, 11699U, 11701U, 11717U, 11719U, 11731U, 11743U, 11777U,
+11779U, 11783U, 11789U, 11801U, 11807U, 11813U, 11821U, 11827U, 11831U, 11833U,
+11839U, 11863U, 11867U, 11887U, 11897U, 11903U, 11909U, 11923U, 11927U, 11933U,
+11939U, 11941U, 11953U, 11959U, 11969U, 11971U, 11981U, 11987U, 12007U, 12011U,
+12037U, 12041U, 12043U, 12049U, 12071U, 12073U, 12097U, 12101U, 12107U, 12109U,
+12113U, 12119U, 12143U, 12149U, 12157U, 12161U, 12163U, 12197U, 12203U, 12211U,
+12227U, 12239U, 12241U, 12251U, 12253U, 12263U, 12269U, 12277U, 12281U, 12289U,
+12301U, 12323U, 12329U, 12343U, 12347U, 12373U, 12377U, 12379U, 12391U, 12401U,
+12409U, 12413U, 12421U, 12433U, 12437U, 12451U, 12457U, 12473U, 12479U, 12487U,
+12491U, 12497U, 12503U, 12511U, 12517U, 12527U, 12539U, 12541U, 12547U, 12553U,
+12569U, 12577U, 12583U, 12589U, 12601U, 12611U, 12613U, 12619U, 12637U, 12641U,
+12647U, 12653U, 12659U, 12671U, 12689U, 12697U, 12703U, 12713U, 12721U, 12739U,
+12743U, 12757U, 12763U, 12781U, 12791U, 12799U, 12809U, 12821U, 12823U, 12829U,
+12841U, 12853U, 12889U, 12893U, 12899U, 12907U, 12911U, 12917U, 12919U, 12923U,
+12941U, 12953U, 12959U, 12967U, 12973U, 12979U, 12983U, 13001U, 13003U, 13007U,
+13009U, 13033U, 13037U, 13043U, 13049U, 13063U, 13093U, 13099U, 13103U, 13109U,
+13121U, 13127U, 13147U, 13151U, 13159U, 13163U, 13171U, 13177U, 13183U, 13187U,
+13217U, 13219U, 13229U, 13241U, 13249U, 13259U, 13267U, 13291U, 13297U, 13309U,
+13313U, 13327U, 13331U, 13337U, 13339U, 13367U, 13381U, 13397U, 13399U, 13411U,
+13417U, 13421U, 13441U, 13451U, 13457U, 13463U, 13469U, 13477U, 13487U, 13499U,
+13513U, 13523U, 13537U, 13553U, 13567U, 13577U, 13591U, 13597U, 13613U, 13619U,
+13627U, 13633U, 13649U, 13669U, 13679U, 13681U, 13687U, 13691U, 13693U, 13697U,
+13709U, 13711U, 13721U, 13723U, 13729U, 13751U, 13757U, 13759U, 13763U, 13781U,
+13789U, 13799U, 13807U, 13829U, 13831U, 13841U, 13859U, 13873U, 13877U, 13879U,
+13883U, 13901U, 13903U, 13907U, 13913U, 13921U, 13931U, 13933U, 13963U, 13967U,
+13997U, 13999U, 14009U, 14011U, 14029U, 14033U, 14051U, 14057U, 14071U, 14081U,
+14083U, 14087U, 14107U, 14143U, 14149U, 14153U, 14159U, 14173U, 14177U, 14197U,
+14207U, 14221U, 14243U, 14249U, 14251U, 14281U, 14293U, 14303U, 14321U, 14323U,
+14327U, 14341U, 14347U, 14369U, 14387U, 14389U, 14401U, 14407U, 14411U, 14419U,
+14423U, 14431U, 14437U, 14447U, 14449U, 14461U, 14479U, 14489U, 14503U, 14519U,
+14533U, 14537U, 14543U, 14549U, 14551U, 14557U, 14561U, 14563U, 14591U, 14593U,
+14621U, 14627U, 14629U, 14633U, 14639U, 14653U, 14657U, 14669U, 14683U, 14699U,
+14713U, 14717U, 14723U, 14731U, 14737U, 14741U, 14747U, 14753U, 14759U, 14767U,
+14771U, 14779U, 14783U, 14797U, 14813U, 14821U, 14827U, 14831U, 14843U, 14851U,
+14867U, 14869U, 14879U, 14887U, 14891U, 14897U, 14923U, 14929U, 14939U, 14947U,
+14951U, 14957U, 14969U, 14983U, 15013U, 15017U, 15031U, 15053U, 15061U, 15073U,
+15077U, 15083U, 15091U, 15101U, 15107U, 15121U, 15131U, 15137U, 15139U, 15149U,
+15161U, 15173U, 15187U, 15193U, 15199U, 15217U, 15227U, 15233U, 15241U, 15259U,
+15263U, 15269U, 15271U, 15277U, 15287U, 15289U, 15299U, 15307U, 15313U, 15319U,
+15329U, 15331U, 15349U, 15359U, 15361U, 15373U, 15377U, 15383U, 15391U, 15401U,
+15413U, 15427U, 15439U, 15443U, 15451U, 15461U, 15467U, 15473U, 15493U, 15497U,
+15511U, 15527U, 15541U, 15551U, 15559U, 15569U, 15581U, 15583U, 15601U, 15607U,
+15619U, 15629U, 15641U, 15643U, 15647U, 15649U, 15661U, 15667U, 15671U, 15679U,
+15683U, 15727U, 15731U, 15733U, 15737U, 15739U, 15749U, 15761U, 15767U, 15773U,
+15787U, 15791U, 15797U, 15803U, 15809U, 15817U, 15823U, 15859U, 15877U, 15881U,
+15887U, 15889U, 15901U, 15907U, 15913U, 15919U, 15923U, 15937U, 15959U, 15971U,
+15973U, 15991U, 16001U, 16007U, 16033U, 16057U, 16061U, 16063U, 16067U, 16069U,
+16073U, 16087U, 16091U, 16097U, 16103U, 16111U, 16127U, 16139U, 16141U, 16183U,
+16187U, 16189U, 16193U, 16217U, 16223U, 16229U, 16231U, 16249U, 16253U, 16267U,
+16273U, 16301U, 16319U, 16333U, 16339U, 16349U, 16361U, 16363U, 16369U, 16381U,
+16411U, 16417U, 16421U, 16427U, 16433U, 16447U, 16451U, 16453U, 16477U, 16481U,
+16487U, 16493U, 16519U, 16529U, 16547U, 16553U, 16561U, 16567U, 16573U, 16603U,
+16607U, 16619U, 16631U, 16633U, 16649U, 16651U, 16657U, 16661U, 16673U, 16691U,
+16693U, 16699U, 16703U, 16729U, 16741U, 16747U, 16759U, 16763U, 16787U, 16811U,
+16823U, 16829U, 16831U, 16843U, 16871U, 16879U, 16883U, 16889U, 16901U, 16903U,
+16921U, 16927U, 16931U, 16937U, 16943U, 16963U, 16979U, 16981U, 16987U, 16993U,
+17011U, 17021U, 17027U, 17029U, 17033U, 17041U, 17047U, 17053U, 17077U, 17093U,
+17099U, 17107U, 17117U, 17123U, 17137U, 17159U, 17167U, 17183U, 17189U, 17191U,
+17203U, 17207U, 17209U, 17231U, 17239U, 17257U, 17291U, 17293U, 17299U, 17317U,
+17321U, 17327U, 17333U, 17341U, 17351U, 17359U, 17377U, 17383U, 17387U, 17389U,
+17393U, 17401U, 17417U, 17419U, 17431U, 17443U, 17449U, 17467U, 17471U, 17477U,
+17483U, 17489U, 17491U, 17497U, 17509U, 17519U, 17539U, 17551U, 17569U, 17573U,
+17579U, 17581U, 17597U, 17599U, 17609U, 17623U, 17627U, 17657U, 17659U, 17669U,
+17681U, 17683U, 17707U, 17713U, 17729U, 17737U, 17747U, 17749U, 17761U, 17783U,
+17789U, 17791U, 17807U, 17827U, 17837U, 17839U, 17851U, 17863U, 17881U, 17891U,
+17903U, 17909U, 17911U, 17921U, 17923U, 17929U, 17939U, 17957U, 17959U, 17971U,
+17977U, 17981U, 17987U, 17989U, 18013U, 18041U, 18043U, 18047U, 18049U, 18059U,
+18061U, 18077U, 18089U, 18097U, 18119U, 18121U, 18127U, 18131U, 18133U, 18143U,
+18149U, 18169U, 18181U, 18191U, 18199U, 18211U, 18217U, 18223U, 18229U, 18233U,
+18251U, 18253U, 18257U, 18269U, 18287U, 18289U, 18301U, 18307U, 18311U, 18313U,
+18329U, 18341U, 18353U, 18367U, 18371U, 18379U, 18397U, 18401U, 18413U, 18427U,
+18433U, 18439U, 18443U, 18451U, 18457U, 18461U, 18481U, 18493U, 18503U, 18517U,
+18521U, 18523U, 18539U, 18541U, 18553U, 18583U, 18587U, 18593U, 18617U, 18637U,
+18661U, 18671U, 18679U, 18691U, 18701U, 18713U, 18719U, 18731U, 18743U, 18749U,
+18757U, 18773U, 18787U, 18793U, 18797U, 18803U, 18839U, 18859U, 18869U, 18899U,
+18911U, 18913U, 18917U, 18919U, 18947U, 18959U, 18973U, 18979U, 19001U, 19009U,
+19013U, 19031U, 19037U, 19051U, 19069U, 19073U, 19079U, 19081U, 19087U, 19121U,
+19139U, 19141U, 19157U, 19163U, 19181U, 19183U, 19207U, 19211U, 19213U, 19219U,
+19231U, 19237U, 19249U, 19259U, 19267U, 19273U, 19289U, 19301U, 19309U, 19319U,
+19333U, 19373U, 19379U, 19381U, 19387U, 19391U, 19403U, 19417U, 19421U, 19423U,
+19427U, 19429U, 19433U, 19441U, 19447U, 19457U, 19463U, 19469U, 19471U, 19477U,
+19483U, 19489U, 19501U, 19507U, 19531U, 19541U, 19543U, 19553U, 19559U, 19571U,
+19577U, 19583U, 19597U, 19603U, 19609U, 19661U, 19681U, 19687U, 19697U, 19699U,
+19709U, 19717U, 19727U, 19739U, 19751U, 19753U, 19759U, 19763U, 19777U, 19793U,
+19801U, 19813U, 19819U, 19841U, 19843U, 19853U, 19861U, 19867U, 19889U, 19891U,
+19913U, 19919U, 19927U, 19937U, 19949U, 19961U, 19963U, 19973U, 19979U, 19991U,
+19993U, 19997U, 20011U, 20021U, 20023U, 20029U, 20047U, 20051U, 20063U, 20071U,
+20089U, 20101U, 20107U, 20113U, 20117U, 20123U, 20129U, 20143U, 20147U, 20149U,
+20161U, 20173U, 20177U, 20183U, 20201U, 20219U, 20231U, 20233U, 20249U, 20261U,
+20269U, 20287U, 20297U, 20323U, 20327U, 20333U, 20341U, 20347U, 20353U, 20357U,
+20359U, 20369U, 20389U, 20393U, 20399U, 20407U, 20411U, 20431U, 20441U, 20443U,
+20477U, 20479U, 20483U, 20507U, 20509U, 20521U, 20533U, 20543U, 20549U, 20551U,
+20563U, 20593U, 20599U, 20611U, 20627U, 20639U, 20641U, 20663U, 20681U, 20693U,
+20707U, 20717U, 20719U, 20731U, 20743U, 20747U, 20749U, 20753U, 20759U, 20771U,
+20773U, 20789U, 20807U, 20809U, 20849U, 20857U, 20873U, 20879U, 20887U, 20897U,
+20899U, 20903U, 20921U, 20929U, 20939U, 20947U, 20959U, 20963U, 20981U, 20983U,
+21001U, 21011U, 21013U, 21017U, 21019U, 21023U, 21031U, 21059U, 21061U, 21067U,
+21089U, 21101U, 21107U, 21121U, 21139U, 21143U, 21149U, 21157U, 21163U, 21169U,
+21179U, 21187U, 21191U, 21193U, 21211U, 21221U, 21227U, 21247U, 21269U, 21277U,
+21283U, 21313U, 21317U, 21319U, 21323U, 21341U, 21347U, 21377U, 21379U, 21383U,
+21391U, 21397U, 21401U, 21407U, 21419U, 21433U, 21467U, 21481U, 21487U, 21491U,
+21493U, 21499U, 21503U, 21517U, 21521U, 21523U, 21529U, 21557U, 21559U, 21563U,
+21569U, 21577U, 21587U, 21589U, 21599U, 21601U, 21611U, 21613U, 21617U, 21647U,
+21649U, 21661U, 21673U, 21683U, 21701U, 21713U, 21727U, 21737U, 21739U, 21751U,
+21757U, 21767U, 21773U, 21787U, 21799U, 21803U, 21817U, 21821U, 21839U, 21841U,
+21851U, 21859U, 21863U, 21871U, 21881U, 21893U, 21911U, 21929U, 21937U, 21943U,
+21961U, 21977U, 21991U, 21997U, 22003U, 22013U, 22027U, 22031U, 22037U, 22039U,
+22051U, 22063U, 22067U, 22073U, 22079U, 22091U, 22093U, 22109U, 22111U, 22123U,
+22129U, 22133U, 22147U, 22153U, 22157U, 22159U, 22171U, 22189U, 22193U, 22229U,
+22247U, 22259U, 22271U, 22273U, 22277U, 22279U, 22283U, 22291U, 22303U, 22307U,
+22343U, 22349U, 22367U, 22369U, 22381U, 22391U, 22397U, 22409U, 22433U, 22441U,
+22447U, 22453U, 22469U, 22481U, 22483U, 22501U, 22511U, 22531U, 22541U, 22543U,
+22549U, 22567U, 22571U, 22573U, 22613U, 22619U, 22621U, 22637U, 22639U, 22643U,
+22651U, 22669U, 22679U, 22691U, 22697U, 22699U, 22709U, 22717U, 22721U, 22727U,
+22739U, 22741U, 22751U, 22769U, 22777U, 22783U, 22787U, 22807U, 22811U, 22817U,
+22853U, 22859U, 22861U, 22871U, 22877U, 22901U, 22907U, 22921U, 22937U, 22943U,
+22961U, 22963U, 22973U, 22993U, 23003U, 23011U, 23017U, 23021U, 23027U, 23029U,
+23039U, 23041U, 23053U, 23057U, 23059U, 23063U, 23071U, 23081U, 23087U, 23099U,
+23117U, 23131U, 23143U, 23159U, 23167U, 23173U, 23189U, 23197U, 23201U, 23203U,
+23209U, 23227U, 23251U, 23269U, 23279U, 23291U, 23293U, 23297U, 23311U, 23321U,
+23327U, 23333U, 23339U, 23357U, 23369U, 23371U, 23399U, 23417U, 23431U, 23447U,
+23459U, 23473U, 23497U, 23509U, 23531U, 23537U, 23539U, 23549U, 23557U, 23561U,
+23563U, 23567U, 23581U, 23593U, 23599U, 23603U, 23609U, 23623U, 23627U, 23629U,
+23633U, 23663U, 23669U, 23671U, 23677U, 23687U, 23689U, 23719U, 23741U, 23743U,
+23747U, 23753U, 23761U, 23767U, 23773U, 23789U, 23801U, 23813U, 23819U, 23827U,
+23831U, 23833U, 23857U, 23869U, 23873U, 23879U, 23887U, 23893U, 23899U, 23909U,
+23911U, 23917U, 23929U, 23957U, 23971U, 23977U, 23981U, 23993U, 24001U, 24007U,
+24019U, 24023U, 24029U, 24043U, 24049U, 24061U, 24071U, 24077U, 24083U, 24091U,
+24097U, 24103U, 24107U, 24109U, 24113U, 24121U, 24133U, 24137U, 24151U, 24169U,
+24179U, 24181U, 24197U, 24203U, 24223U, 24229U, 24239U, 24247U, 24251U, 24281U,
+24317U, 24329U, 24337U, 24359U, 24371U, 24373U, 24379U, 24391U, 24407U, 24413U,
+24419U, 24421U, 24439U, 24443U, 24469U, 24473U, 24481U, 24499U, 24509U, 24517U,
+24527U, 24533U, 24547U, 24551U, 24571U, 24593U, 24611U, 24623U, 24631U, 24659U,
+24671U, 24677U, 24683U, 24691U, 24697U, 24709U, 24733U, 24749U, 24763U, 24767U,
+24781U, 24793U, 24799U, 24809U, 24821U, 24841U, 24847U, 24851U, 24859U, 24877U,
+24889U, 24907U, 24917U, 24919U, 24923U, 24943U, 24953U, 24967U, 24971U, 24977U,
+24979U, 24989U, 25013U, 25031U, 25033U, 25037U, 25057U, 25073U, 25087U, 25097U,
+25111U, 25117U, 25121U, 25127U, 25147U, 25153U, 25163U, 25169U, 25171U, 25183U,
+25189U, 25219U, 25229U, 25237U, 25243U, 25247U, 25253U, 25261U, 25301U, 25303U,
+25307U, 25309U, 25321U, 25339U, 25343U, 25349U, 25357U, 25367U, 25373U, 25391U,
+25409U, 25411U, 25423U, 25439U, 25447U, 25453U, 25457U, 25463U, 25469U, 25471U,
+25523U, 25537U, 25541U, 25561U, 25577U, 25579U, 25583U, 25589U, 25601U, 25603U,
+25609U, 25621U, 25633U, 25639U, 25643U, 25657U, 25667U, 25673U, 25679U, 25693U,
+25703U, 25717U, 25733U, 25741U, 25747U, 25759U, 25763U, 25771U, 25793U, 25799U,
+25801U, 25819U, 25841U, 25847U, 25849U, 25867U, 25873U, 25889U, 25903U, 25913U,
+25919U, 25931U, 25933U, 25939U, 25943U, 25951U, 25969U, 25981U, 25997U, 25999U,
+26003U, 26017U, 26021U, 26029U, 26041U, 26053U, 26083U, 26099U, 26107U, 26111U,
+26113U, 26119U, 26141U, 26153U, 26161U, 26171U, 26177U, 26183U, 26189U, 26203U,
+26209U, 26227U, 26237U, 26249U, 26251U, 26261U, 26263U, 26267U, 26293U, 26297U,
+26309U, 26317U, 26321U, 26339U, 26347U, 26357U, 26371U, 26387U, 26393U, 26399U,
+26407U, 26417U, 26423U, 26431U, 26437U, 26449U, 26459U, 26479U, 26489U, 26497U,
+26501U, 26513U, 26539U, 26557U, 26561U, 26573U, 26591U, 26597U, 26627U, 26633U,
+26641U, 26647U, 26669U, 26681U, 26683U, 26687U, 26693U, 26699U, 26701U, 26711U,
+26713U, 26717U, 26723U, 26729U, 26731U, 26737U, 26759U, 26777U, 26783U, 26801U,
+26813U, 26821U, 26833U, 26839U, 26849U, 26861U, 26863U, 26879U, 26881U, 26891U,
+26893U, 26903U, 26921U, 26927U, 26947U, 26951U, 26953U, 26959U, 26981U, 26987U,
+26993U, 27011U, 27017U, 27031U, 27043U, 27059U, 27061U, 27067U, 27073U, 27077U,
+27091U, 27103U, 27107U, 27109U, 27127U, 27143U, 27179U, 27191U, 27197U, 27211U,
+27239U, 27241U, 27253U, 27259U, 27271U, 27277U, 27281U, 27283U, 27299U, 27329U,
+27337U, 27361U, 27367U, 27397U, 27407U, 27409U, 27427U, 27431U, 27437U, 27449U,
+27457U, 27479U, 27481U, 27487U, 27509U, 27527U, 27529U, 27539U, 27541U, 27551U,
+27581U, 27583U, 27611U, 27617U, 27631U, 27647U, 27653U, 27673U, 27689U, 27691U,
+27697U, 27701U, 27733U, 27737U, 27739U, 27743U, 27749U, 27751U, 27763U, 27767U,
+27773U, 27779U, 27791U, 27793U, 27799U, 27803U, 27809U, 27817U, 27823U, 27827U,
+27847U, 27851U, 27883U, 27893U, 27901U, 27917U, 27919U, 27941U, 27943U, 27947U,
+27953U, 27961U, 27967U, 27983U, 27997U, 28001U, 28019U, 28027U, 28031U, 28051U,
+28057U, 28069U, 28081U, 28087U, 28097U, 28099U, 28109U, 28111U, 28123U, 28151U,
+28163U, 28181U, 28183U, 28201U, 28211U, 28219U, 28229U, 28277U, 28279U, 28283U,
+28289U, 28297U, 28307U, 28309U, 28319U, 28349U, 28351U, 28387U, 28393U, 28403U,
+28409U, 28411U, 28429U, 28433U, 28439U, 28447U, 28463U, 28477U, 28493U, 28499U,
+28513U, 28517U, 28537U, 28541U, 28547U, 28549U, 28559U, 28571U, 28573U, 28579U,
+28591U, 28597U, 28603U, 28607U, 28619U, 28621U, 28627U, 28631U, 28643U, 28649U,
+28657U, 28661U, 28663U, 28669U, 28687U, 28697U, 28703U, 28711U, 28723U, 28729U,
+28751U, 28753U, 28759U, 28771U, 28789U, 28793U, 28807U, 28813U, 28817U, 28837U,
+28843U, 28859U, 28867U, 28871U, 28879U, 28901U, 28909U, 28921U, 28927U, 28933U,
+28949U, 28961U, 28979U, 29009U, 29017U, 29021U, 29023U, 29027U, 29033U, 29059U,
+29063U, 29077U, 29101U, 29123U, 29129U, 29131U, 29137U, 29147U, 29153U, 29167U,
+29173U, 29179U, 29191U, 29201U, 29207U, 29209U, 29221U, 29231U, 29243U, 29251U,
+29269U, 29287U, 29297U, 29303U, 29311U, 29327U, 29333U, 29339U, 29347U, 29363U,
+29383U, 29387U, 29389U, 29399U, 29401U, 29411U, 29423U, 29429U, 29437U, 29443U,
+29453U, 29473U, 29483U, 29501U, 29527U, 29531U, 29537U, 29567U, 29569U, 29573U,
+29581U, 29587U, 29599U, 29611U, 29629U, 29633U, 29641U, 29663U, 29669U, 29671U,
+29683U, 29717U, 29723U, 29741U, 29753U, 29759U, 29761U, 29789U, 29803U, 29819U,
+29833U, 29837U, 29851U, 29863U, 29867U, 29873U, 29879U, 29881U, 29917U, 29921U,
+29927U, 29947U, 29959U, 29983U, 29989U, 30011U, 30013U, 30029U, 30047U, 30059U,
+30071U, 30089U, 30091U, 30097U, 30103U, 30109U, 30113U, 30119U, 30133U, 30137U,
+30139U, 30161U, 30169U, 30181U, 30187U, 30197U, 30203U, 30211U, 30223U, 30241U,
+30253U, 30259U, 30269U, 30271U, 30293U, 30307U, 30313U, 30319U, 30323U, 30341U,
+30347U, 30367U, 30389U, 30391U, 30403U, 30427U, 30431U, 30449U, 30467U, 30469U,
+30491U, 30493U, 30497U, 30509U, 30517U, 30529U, 30539U, 30553U, 30557U, 30559U,
+30577U, 30593U, 30631U, 30637U, 30643U, 30649U, 30661U, 30671U, 30677U, 30689U,
+30697U, 30703U, 30707U, 30713U, 30727U, 30757U, 30763U, 30773U, 30781U, 30803U,
+30809U, 30817U, 30829U, 30839U, 30841U, 30851U, 30853U, 30859U, 30869U, 30871U,
+30881U, 30893U, 30911U, 30931U, 30937U, 30941U, 30949U, 30971U, 30977U, 30983U,
+31013U, 31019U, 31033U, 31039U, 31051U, 31063U, 31069U, 31079U, 31081U, 31091U,
+31121U, 31123U, 31139U, 31147U, 31151U, 31153U, 31159U, 31177U, 31181U, 31183U,
+31189U, 31193U, 31219U, 31223U, 31231U, 31237U, 31247U, 31249U, 31253U, 31259U,
+31267U, 31271U, 31277U, 31307U, 31319U, 31321U, 31327U, 31333U, 31337U, 31357U,
+31379U, 31387U, 31391U, 31393U, 31397U, 31469U, 31477U, 31481U, 31489U, 31511U,
+31513U, 31517U, 31531U, 31541U, 31543U, 31547U, 31567U, 31573U, 31583U, 31601U,
+31607U, 31627U, 31643U, 31649U, 31657U, 31663U, 31667U, 31687U, 31699U, 31721U,
+31723U, 31727U, 31729U, 31741U, 31751U, 31769U, 31771U, 31793U, 31799U, 31817U,
+31847U, 31849U, 31859U, 31873U, 31883U, 31891U, 31907U, 31957U, 31963U, 31973U,
+31981U, 31991U, 32003U, 32009U, 32027U, 32029U, 32051U, 32057U, 32059U, 32063U,
+32069U, 32077U, 32083U, 32089U, 32099U, 32117U, 32119U, 32141U, 32143U, 32159U,
+32173U, 32183U, 32189U, 32191U, 32203U, 32213U, 32233U, 32237U, 32251U, 32257U,
+32261U, 32297U, 32299U, 32303U, 32309U, 32321U, 32323U, 32327U, 32341U, 32353U,
+32359U, 32363U, 32369U, 32371U, 32377U, 32381U, 32401U, 32411U, 32413U, 32423U,
+32429U, 32441U, 32443U, 32467U, 32479U, 32491U, 32497U, 32503U, 32507U, 32531U,
+32533U, 32537U, 32561U, 32563U, 32569U, 32573U, 32579U, 32587U, 32603U, 32609U,
+32611U, 32621U, 32633U, 32647U, 32653U, 32687U, 32693U, 32707U, 32713U, 32717U,
+32719U, 32749U, 32771U, 32779U, 32783U, 32789U, 32797U, 32801U, 32803U, 32831U,
+32833U, 32839U, 32843U, 32869U, 32887U, 32909U, 32911U, 32917U, 32933U, 32939U,
+32941U, 32957U, 32969U, 32971U, 32983U, 32987U, 32993U, 32999U, 33013U, 33023U,
+33029U, 33037U, 33049U, 33053U, 33071U, 33073U, 33083U, 33091U, 33107U, 33113U,
+33119U, 33149U, 33151U, 33161U, 33179U, 33181U, 33191U, 33199U, 33203U, 33211U,
+33223U, 33247U, 33287U, 33289U, 33301U, 33311U, 33317U, 33329U, 33331U, 33343U,
+33347U, 33349U, 33353U, 33359U, 33377U, 33391U, 33403U, 33409U, 33413U, 33427U,
+33457U, 33461U, 33469U, 33479U, 33487U, 33493U, 33503U, 33521U, 33529U, 33533U,
+33547U, 33563U, 33569U, 33577U, 33581U, 33587U, 33589U, 33599U, 33601U, 33613U,
+33617U, 33619U, 33623U, 33629U, 33637U, 33641U, 33647U, 33679U, 33703U, 33713U,
+33721U, 33739U, 33749U, 33751U, 33757U, 33767U, 33769U, 33773U, 33791U, 33797U,
+33809U, 33811U, 33827U, 33829U, 33851U, 33857U, 33863U, 33871U, 33889U, 33893U,
+33911U, 33923U, 33931U, 33937U, 33941U, 33961U, 33967U, 33997U, 34019U, 34031U,
+34033U, 34039U, 34057U, 34061U, 34123U, 34127U, 34129U, 34141U, 34147U, 34157U,
+34159U, 34171U, 34183U, 34211U, 34213U, 34217U, 34231U, 34253U, 34259U, 34261U,
+34267U, 34273U, 34283U, 34297U, 34301U, 34303U, 34313U, 34319U, 34327U, 34337U,
+34351U, 34361U, 34367U, 34369U, 34381U, 34403U, 34421U, 34429U, 34439U, 34457U,
+34469U, 34471U, 34483U, 34487U, 34499U, 34501U, 34511U, 34513U, 34519U, 34537U,
+34543U, 34549U, 34583U, 34589U, 34591U, 34603U, 34607U, 34613U, 34631U, 34649U,
+34651U, 34667U, 34673U, 34679U, 34687U, 34693U, 34703U, 34721U, 34729U, 34739U,
+34747U, 34757U, 34759U, 34763U, 34781U, 34807U, 34819U, 34841U, 34843U, 34847U,
+34849U, 34871U, 34877U, 34883U, 34897U, 34913U, 34919U, 34939U, 34949U, 34961U,
+34963U, 34981U, 35023U, 35027U, 35051U, 35053U, 35059U, 35069U, 35081U, 35083U,
+35089U, 35099U, 35107U, 35111U, 35117U, 35129U, 35141U, 35149U, 35153U, 35159U,
+35171U, 35201U, 35221U, 35227U, 35251U, 35257U, 35267U, 35279U, 35281U, 35291U,
+35311U, 35317U, 35323U, 35327U, 35339U, 35353U, 35363U, 35381U, 35393U, 35401U,
+35407U, 35419U, 35423U, 35437U, 35447U, 35449U, 35461U, 35491U, 35507U, 35509U,
+35521U, 35527U, 35531U, 35533U, 35537U, 35543U, 35569U, 35573U, 35591U, 35593U,
+35597U, 35603U, 35617U, 35671U, 35677U, 35729U, 35731U, 35747U, 35753U, 35759U,
+35771U, 35797U, 35801U, 35803U, 35809U, 35831U, 35837U, 35839U, 35851U, 35863U,
+35869U, 35879U, 35897U, 35899U, 35911U, 35923U, 35933U, 35951U, 35963U, 35969U,
+35977U, 35983U, 35993U, 35999U, 36007U, 36011U, 36013U, 36017U, 36037U, 36061U,
+36067U, 36073U, 36083U, 36097U, 36107U, 36109U, 36131U, 36137U, 36151U, 36161U,
+36187U, 36191U, 36209U, 36217U, 36229U, 36241U, 36251U, 36263U, 36269U, 36277U,
+36293U, 36299U, 36307U, 36313U, 36319U, 36341U, 36343U, 36353U, 36373U, 36383U,
+36389U, 36433U, 36451U, 36457U, 36467U, 36469U, 36473U, 36479U, 36493U, 36497U,
+36523U, 36527U, 36529U, 36541U, 36551U, 36559U, 36563U, 36571U, 36583U, 36587U,
+36599U, 36607U, 36629U, 36637U, 36643U, 36653U, 36671U, 36677U, 36683U, 36691U,
+36697U, 36709U, 36713U, 36721U, 36739U, 36749U, 36761U, 36767U, 36779U, 36781U,
+36787U, 36791U, 36793U, 36809U, 36821U, 36833U, 36847U, 36857U, 36871U, 36877U,
+36887U, 36899U, 36901U, 36913U, 36919U, 36923U, 36929U, 36931U, 36943U, 36947U,
+36973U, 36979U, 36997U, 37003U, 37013U, 37019U, 37021U, 37039U, 37049U, 37057U,
+37061U, 37087U, 37097U, 37117U, 37123U, 37139U, 37159U, 37171U, 37181U, 37189U,
+37199U, 37201U, 37217U, 37223U, 37243U, 37253U, 37273U, 37277U, 37307U, 37309U,
+37313U, 37321U, 37337U, 37339U, 37357U, 37361U, 37363U, 37369U, 37379U, 37397U,
+37409U, 37423U, 37441U, 37447U, 37463U, 37483U, 37489U, 37493U, 37501U, 37507U,
+37511U, 37517U, 37529U, 37537U, 37547U, 37549U, 37561U, 37567U, 37571U, 37573U,
+37579U, 37589U, 37591U, 37607U, 37619U, 37633U, 37643U, 37649U, 37657U, 37663U,
+37691U, 37693U, 37699U, 37717U, 37747U, 37781U, 37783U, 37799U, 37811U, 37813U,
+37831U, 37847U, 37853U, 37861U, 37871U, 37879U, 37889U, 37897U, 37907U, 37951U,
+37957U, 37963U, 37967U, 37987U, 37991U, 37993U, 37997U, 38011U, 38039U, 38047U,
+38053U, 38069U, 38083U, 38113U, 38119U, 38149U, 38153U, 38167U, 38177U, 38183U,
+38189U, 38197U, 38201U, 38219U, 38231U, 38237U, 38239U, 38261U, 38273U, 38281U,
+38287U, 38299U, 38303U, 38317U, 38321U, 38327U, 38329U, 38333U, 38351U, 38371U,
+38377U, 38393U, 38431U, 38447U, 38449U, 38453U, 38459U, 38461U, 38501U, 38543U,
+38557U, 38561U, 38567U, 38569U, 38593U, 38603U, 38609U, 38611U, 38629U, 38639U,
+38651U, 38653U, 38669U, 38671U, 38677U, 38693U, 38699U, 38707U, 38711U, 38713U,
+38723U, 38729U, 38737U, 38747U, 38749U, 38767U, 38783U, 38791U, 38803U, 38821U,
+38833U, 38839U, 38851U, 38861U, 38867U, 38873U, 38891U, 38903U, 38917U, 38921U,
+38923U, 38933U, 38953U, 38959U, 38971U, 38977U, 38993U, 39019U, 39023U, 39041U,
+39043U, 39047U, 39079U, 39089U, 39097U, 39103U, 39107U, 39113U, 39119U, 39133U,
+39139U, 39157U, 39161U, 39163U, 39181U, 39191U, 39199U, 39209U, 39217U, 39227U,
+39229U, 39233U, 39239U, 39241U, 39251U, 39293U, 39301U, 39313U, 39317U, 39323U,
+39341U, 39343U, 39359U, 39367U, 39371U, 39373U, 39383U, 39397U, 39409U, 39419U,
+39439U, 39443U, 39451U, 39461U, 39499U, 39503U, 39509U, 39511U, 39521U, 39541U,
+39551U, 39563U, 39569U, 39581U, 39607U, 39619U, 39623U, 39631U, 39659U, 39667U,
+39671U, 39679U, 39703U, 39709U, 39719U, 39727U, 39733U, 39749U, 39761U, 39769U,
+39779U, 39791U, 39799U, 39821U, 39827U, 39829U, 39839U, 39841U, 39847U, 39857U,
+39863U, 39869U, 39877U, 39883U, 39887U, 39901U, 39929U, 39937U, 39953U, 39971U,
+39979U, 39983U, 39989U, 40009U, 40013U, 40031U, 40037U, 40039U, 40063U, 40087U,
+40093U, 40099U, 40111U, 40123U, 40127U, 40129U, 40151U, 40153U, 40163U, 40169U,
+40177U, 40189U, 40193U, 40213U, 40231U, 40237U, 40241U, 40253U, 40277U, 40283U,
+40289U, 40343U, 40351U, 40357U, 40361U, 40387U, 40423U, 40427U, 40429U, 40433U,
+40459U, 40471U, 40483U, 40487U, 40493U, 40499U, 40507U, 40519U, 40529U, 40531U,
+40543U, 40559U, 40577U, 40583U, 40591U, 40597U, 40609U, 40627U, 40637U, 40639U,
+40693U, 40697U, 40699U, 40709U, 40739U, 40751U, 40759U, 40763U, 40771U, 40787U,
+40801U, 40813U, 40819U, 40823U, 40829U, 40841U, 40847U, 40849U, 40853U, 40867U,
+40879U, 40883U, 40897U, 40903U, 40927U, 40933U, 40939U, 40949U, 40961U, 40973U,
+40993U, 41011U, 41017U, 41023U, 41039U, 41047U, 41051U, 41057U, 41077U, 41081U,
+41113U, 41117U, 41131U, 41141U, 41143U, 41149U, 41161U, 41177U, 41179U, 41183U,
+41189U, 41201U, 41203U, 41213U, 41221U, 41227U, 41231U, 41233U, 41243U, 41257U,
+41263U, 41269U, 41281U, 41299U, 41333U, 41341U, 41351U, 41357U, 41381U, 41387U,
+41389U, 41399U, 41411U, 41413U, 41443U, 41453U, 41467U, 41479U, 41491U, 41507U,
+41513U, 41519U, 41521U, 41539U, 41543U, 41549U, 41579U, 41593U, 41597U, 41603U,
+41609U, 41611U, 41617U, 41621U, 41627U, 41641U, 41647U, 41651U, 41659U, 41669U,
+41681U, 41687U, 41719U, 41729U, 41737U, 41759U, 41761U, 41771U, 41777U, 41801U,
+41809U, 41813U, 41843U, 41849U, 41851U, 41863U, 41879U, 41887U, 41893U, 41897U,
+41903U, 41911U, 41927U, 41941U, 41947U, 41953U, 41957U, 41959U, 41969U, 41981U,
+41983U, 41999U, 42013U, 42017U, 42019U, 42023U, 42043U, 42061U, 42071U, 42073U,
+42083U, 42089U, 42101U, 42131U, 42139U, 42157U, 42169U, 42179U, 42181U, 42187U,
+42193U, 42197U, 42209U, 42221U, 42223U, 42227U, 42239U, 42257U, 42281U, 42283U,
+42293U, 42299U, 42307U, 42323U, 42331U, 42337U, 42349U, 42359U, 42373U, 42379U,
+42391U, 42397U, 42403U, 42407U, 42409U, 42433U, 42437U, 42443U, 42451U, 42457U,
+42461U, 42463U, 42467U, 42473U, 42487U, 42491U, 42499U, 42509U, 42533U, 42557U,
+42569U, 42571U, 42577U, 42589U, 42611U, 42641U, 42643U, 42649U, 42667U, 42677U,
+42683U, 42689U, 42697U, 42701U, 42703U, 42709U, 42719U, 42727U, 42737U, 42743U,
+42751U, 42767U, 42773U, 42787U, 42793U, 42797U, 42821U, 42829U, 42839U, 42841U,
+42853U, 42859U, 42863U, 42899U, 42901U, 42923U, 42929U, 42937U, 42943U, 42953U,
+42961U, 42967U, 42979U, 42989U, 43003U, 43013U, 43019U, 43037U, 43049U, 43051U,
+43063U, 43067U, 43093U, 43103U, 43117U, 43133U, 43151U, 43159U, 43177U, 43189U,
+43201U, 43207U, 43223U, 43237U, 43261U, 43271U, 43283U, 43291U, 43313U, 43319U,
+43321U, 43331U, 43391U, 43397U, 43399U, 43403U, 43411U, 43427U, 43441U, 43451U,
+43457U, 43481U, 43487U, 43499U, 43517U, 43541U, 43543U, 43573U, 43577U, 43579U,
+43591U, 43597U, 43607U, 43609U, 43613U, 43627U, 43633U, 43649U, 43651U, 43661U,
+43669U, 43691U, 43711U, 43717U, 43721U, 43753U, 43759U, 43777U, 43781U, 43783U,
+43787U, 43789U, 43793U, 43801U, 43853U, 43867U, 43889U, 43891U, 43913U, 43933U,
+43943U, 43951U, 43961U, 43963U, 43969U, 43973U, 43987U, 43991U, 43997U, 44017U,
+44021U, 44027U, 44029U, 44041U, 44053U, 44059U, 44071U, 44087U, 44089U, 44101U,
+44111U, 44119U, 44123U, 44129U, 44131U, 44159U, 44171U, 44179U, 44189U, 44201U,
+44203U, 44207U, 44221U, 44249U, 44257U, 44263U, 44267U, 44269U, 44273U, 44279U,
+44281U, 44293U, 44351U, 44357U, 44371U, 44381U, 44383U, 44389U, 44417U, 44449U,
+44453U, 44483U, 44491U, 44497U, 44501U, 44507U, 44519U, 44531U, 44533U, 44537U,
+44543U, 44549U, 44563U, 44579U, 44587U, 44617U, 44621U, 44623U, 44633U, 44641U,
+44647U, 44651U, 44657U, 44683U, 44687U, 44699U, 44701U, 44711U, 44729U, 44741U,
+44753U, 44771U, 44773U, 44777U, 44789U, 44797U, 44809U, 44819U, 44839U, 44843U,
+44851U, 44867U, 44879U, 44887U, 44893U, 44909U, 44917U, 44927U, 44939U, 44953U,
+44959U, 44963U, 44971U, 44983U, 44987U, 45007U, 45013U, 45053U, 45061U, 45077U,
+45083U, 45119U, 45121U, 45127U, 45131U, 45137U, 45139U, 45161U, 45179U, 45181U,
+45191U, 45197U, 45233U, 45247U, 45259U, 45263U, 45281U, 45289U, 45293U, 45307U,
+45317U, 45319U, 45329U, 45337U, 45341U, 45343U, 45361U, 45377U, 45389U, 45403U,
+45413U, 45427U, 45433U, 45439U, 45481U, 45491U, 45497U, 45503U, 45523U, 45533U,
+45541U, 45553U, 45557U, 45569U, 45587U, 45589U, 45599U, 45613U, 45631U, 45641U,
+45659U, 45667U, 45673U, 45677U, 45691U, 45697U, 45707U, 45737U, 45751U, 45757U,
+45763U, 45767U, 45779U, 45817U, 45821U, 45823U, 45827U, 45833U, 45841U, 45853U,
+45863U, 45869U, 45887U, 45893U, 45943U, 45949U, 45953U, 45959U, 45971U, 45979U,
+45989U, 46021U, 46027U, 46049U, 46051U, 46061U, 46073U, 46091U, 46093U, 46099U,
+46103U, 46133U, 46141U, 46147U, 46153U, 46171U, 46181U, 46183U, 46187U, 46199U,
+46219U, 46229U, 46237U, 46261U, 46271U, 46273U, 46279U, 46301U, 46307U, 46309U,
+46327U, 46337U, 46349U, 46351U, 46381U, 46399U, 46411U, 46439U, 46441U, 46447U,
+46451U, 46457U, 46471U, 46477U, 46489U, 46499U, 46507U, 46511U, 46523U, 46549U,
+46559U, 46567U, 46573U, 46589U, 46591U, 46601U, 46619U, 46633U, 46639U, 46643U,
+46649U, 46663U, 46679U, 46681U, 46687U, 46691U, 46703U, 46723U, 46727U, 46747U,
+46751U, 46757U, 46769U, 46771U, 46807U, 46811U, 46817U, 46819U, 46829U, 46831U,
+46853U, 46861U, 46867U, 46877U, 46889U, 46901U, 46919U, 46933U, 46957U, 46993U,
+46997U, 47017U, 47041U, 47051U, 47057U, 47059U, 47087U, 47093U, 47111U, 47119U,
+47123U, 47129U, 47137U, 47143U, 47147U, 47149U, 47161U, 47189U, 47207U, 47221U,
+47237U, 47251U, 47269U, 47279U, 47287U, 47293U, 47297U, 47303U, 47309U, 47317U,
+47339U, 47351U, 47353U, 47363U, 47381U, 47387U, 47389U, 47407U, 47417U, 47419U,
+47431U, 47441U, 47459U, 47491U, 47497U, 47501U, 47507U, 47513U, 47521U, 47527U,
+47533U, 47543U, 47563U, 47569U, 47581U, 47591U, 47599U, 47609U, 47623U, 47629U,
+47639U, 47653U, 47657U, 47659U, 47681U, 47699U, 47701U, 47711U, 47713U, 47717U,
+47737U, 47741U, 47743U, 47777U, 47779U, 47791U, 47797U, 47807U, 47809U, 47819U,
+47837U, 47843U, 47857U, 47869U, 47881U, 47903U, 47911U, 47917U, 47933U, 47939U,
+47947U, 47951U, 47963U, 47969U, 47977U, 47981U, 48017U, 48023U, 48029U, 48049U,
+48073U, 48079U, 48091U, 48109U, 48119U, 48121U, 48131U, 48157U, 48163U, 48179U,
+48187U, 48193U, 48197U, 48221U, 48239U, 48247U, 48259U, 48271U, 48281U, 48299U,
+48311U, 48313U, 48337U, 48341U, 48353U, 48371U, 48383U, 48397U, 48407U, 48409U,
+48413U, 48437U, 48449U, 48463U, 48473U, 48479U, 48481U, 48487U, 48491U, 48497U,
+48523U, 48527U, 48533U, 48539U, 48541U, 48563U, 48571U, 48589U, 48593U, 48611U,
+48619U, 48623U, 48647U, 48649U, 48661U, 48673U, 48677U, 48679U, 48731U, 48733U,
+48751U, 48757U, 48761U, 48767U, 48779U, 48781U, 48787U, 48799U, 48809U, 48817U,
+48821U, 48823U, 48847U, 48857U, 48859U, 48869U, 48871U, 48883U, 48889U, 48907U,
+48947U, 48953U, 48973U, 48989U, 48991U, 49003U, 49009U, 49019U, 49031U, 49033U,
+49037U, 49043U, 49057U, 49069U, 49081U, 49103U, 49109U, 49117U, 49121U, 49123U,
+49139U, 49157U, 49169U, 49171U, 49177U, 49193U, 49199U, 49201U, 49207U, 49211U,
+49223U, 49253U, 49261U, 49277U, 49279U, 49297U, 49307U, 49331U, 49333U, 49339U,
+49363U, 49367U, 49369U, 49391U, 49393U, 49409U, 49411U, 49417U, 49429U, 49433U,
+49451U, 49459U, 49463U, 49477U, 49481U, 49499U, 49523U, 49529U, 49531U, 49537U,
+49547U, 49549U, 49559U, 49597U, 49603U, 49613U, 49627U, 49633U, 49639U, 49663U,
+49667U, 49669U, 49681U, 49697U, 49711U, 49727U, 49739U, 49741U, 49747U, 49757U,
+49783U, 49787U, 49789U, 49801U, 49807U, 49811U, 49823U, 49831U, 49843U, 49853U,
+49871U, 49877U, 49891U, 49919U, 49921U, 49927U, 49937U, 49939U, 49943U, 49957U,
+49991U, 49993U, 49999U, 50021U, 50023U, 50033U, 50047U, 50051U, 50053U, 50069U,
+50077U, 50087U, 50093U, 50101U, 50111U, 50119U, 50123U, 50129U, 50131U, 50147U,
+50153U, 50159U, 50177U, 50207U, 50221U, 50227U, 50231U, 50261U, 50263U, 50273U,
+50287U, 50291U, 50311U, 50321U, 50329U, 50333U, 50341U, 50359U, 50363U, 50377U,
+50383U, 50387U, 50411U, 50417U, 50423U, 50441U, 50459U, 50461U, 50497U, 50503U,
+50513U, 50527U, 50539U, 50543U, 50549U, 50551U, 50581U, 50587U, 50591U, 50593U,
+50599U, 50627U, 50647U, 50651U, 50671U, 50683U, 50707U, 50723U, 50741U, 50753U,
+50767U, 50773U, 50777U, 50789U, 50821U, 50833U, 50839U, 50849U, 50857U, 50867U,
+50873U, 50891U, 50893U, 50909U, 50923U, 50929U, 50951U, 50957U, 50969U, 50971U,
+50989U, 50993U, 51001U, 51031U, 51043U, 51047U, 51059U, 51061U, 51071U, 51109U,
+51131U, 51133U, 51137U, 51151U, 51157U, 51169U, 51193U, 51197U, 51199U, 51203U,
+51217U, 51229U, 51239U, 51241U, 51257U, 51263U, 51283U, 51287U, 51307U, 51329U,
+51341U, 51343U, 51347U, 51349U, 51361U, 51383U, 51407U, 51413U, 51419U, 51421U,
+51427U, 51431U, 51437U, 51439U, 51449U, 51461U, 51473U, 51479U, 51481U, 51487U,
+51503U, 51511U, 51517U, 51521U, 51539U, 51551U, 51563U, 51577U, 51581U, 51593U,
+51599U, 51607U, 51613U, 51631U, 51637U, 51647U, 51659U, 51673U, 51679U, 51683U,
+51691U, 51713U, 51719U, 51721U, 51749U, 51767U, 51769U, 51787U, 51797U, 51803U,
+51817U, 51827U, 51829U, 51839U, 51853U, 51859U, 51869U, 51871U, 51893U, 51899U,
+51907U, 51913U, 51929U, 51941U, 51949U, 51971U, 51973U, 51977U, 51991U, 52009U,
+52021U, 52027U, 52051U, 52057U, 52067U, 52069U, 52081U, 52103U, 52121U, 52127U,
+52147U, 52153U, 52163U, 52177U, 52181U, 52183U, 52189U, 52201U, 52223U, 52237U,
+52249U, 52253U, 52259U, 52267U, 52289U, 52291U, 52301U, 52313U, 52321U, 52361U,
+52363U, 52369U, 52379U, 52387U, 52391U, 52433U, 52453U, 52457U, 52489U, 52501U,
+52511U, 52517U, 52529U, 52541U, 52543U, 52553U, 52561U, 52567U, 52571U, 52579U,
+52583U, 52609U, 52627U, 52631U, 52639U, 52667U, 52673U, 52691U, 52697U, 52709U,
+52711U, 52721U, 52727U, 52733U, 52747U, 52757U, 52769U, 52783U, 52807U, 52813U,
+52817U, 52837U, 52859U, 52861U, 52879U, 52883U, 52889U, 52901U, 52903U, 52919U,
+52937U, 52951U, 52957U, 52963U, 52967U, 52973U, 52981U, 52999U, 53003U, 53017U,
+53047U, 53051U, 53069U, 53077U, 53087U, 53089U, 53093U, 53101U, 53113U, 53117U,
+53129U, 53147U, 53149U, 53161U, 53171U, 53173U, 53189U, 53197U, 53201U, 53231U,
+53233U, 53239U, 53267U, 53269U, 53279U, 53281U, 53299U, 53309U, 53323U, 53327U,
+53353U, 53359U, 53377U, 53381U, 53401U, 53407U, 53411U, 53419U, 53437U, 53441U,
+53453U, 53479U, 53503U, 53507U, 53527U, 53549U, 53551U, 53569U, 53591U, 53593U,
+53597U, 53609U, 53611U, 53617U, 53623U, 53629U, 53633U, 53639U, 53653U, 53657U,
+53681U, 53693U, 53699U, 53717U, 53719U, 53731U, 53759U, 53773U, 53777U, 53783U,
+53791U, 53813U, 53819U, 53831U, 53849U, 53857U, 53861U, 53881U, 53887U, 53891U,
+53897U, 53899U, 53917U, 53923U, 53927U, 53939U, 53951U, 53959U, 53987U, 53993U,
+54001U, 54011U, 54013U, 54037U, 54049U, 54059U, 54083U, 54091U, 54101U, 54121U,
+54133U, 54139U, 54151U, 54163U, 54167U, 54181U, 54193U, 54217U, 54251U, 54269U,
+54277U, 54287U, 54293U, 54311U, 54319U, 54323U, 54331U, 54347U, 54361U, 54367U,
+54371U, 54377U, 54401U, 54403U, 54409U, 54413U, 54419U, 54421U, 54437U, 54443U,
+54449U, 54469U, 54493U, 54497U, 54499U, 54503U, 54517U, 54521U, 54539U, 54541U,
+54547U, 54559U, 54563U, 54577U, 54581U, 54583U, 54601U, 54617U, 54623U, 54629U,
+54631U, 54647U, 54667U, 54673U, 54679U, 54709U, 54713U, 54721U, 54727U, 54751U,
+54767U, 54773U, 54779U, 54787U, 54799U, 54829U, 54833U, 54851U, 54869U, 54877U,
+54881U, 54907U, 54917U, 54919U, 54941U, 54949U, 54959U, 54973U, 54979U, 54983U,
+55001U, 55009U, 55021U, 55049U, 55051U, 55057U, 55061U, 55073U, 55079U, 55103U,
+55109U, 55117U, 55127U, 55147U, 55163U, 55171U, 55201U, 55207U, 55213U, 55217U,
+55219U, 55229U, 55243U, 55249U, 55259U, 55291U, 55313U, 55331U, 55333U, 55337U,
+55339U, 55343U, 55351U, 55373U, 55381U, 55399U, 55411U, 55439U, 55441U, 55457U,
+55469U, 55487U, 55501U, 55511U, 55529U, 55541U, 55547U, 55579U, 55589U, 55603U,
+55609U, 55619U, 55621U, 55631U, 55633U, 55639U, 55661U, 55663U, 55667U, 55673U,
+55681U, 55691U, 55697U, 55711U, 55717U, 55721U, 55733U, 55763U, 55787U, 55793U,
+55799U, 55807U, 55813U, 55817U, 55819U, 55823U, 55829U, 55837U, 55843U, 55849U,
+55871U, 55889U, 55897U, 55901U, 55903U, 55921U, 55927U, 55931U, 55933U, 55949U,
+55967U, 55987U, 55997U, 56003U, 56009U, 56039U, 56041U, 56053U, 56081U, 56087U,
+56093U, 56099U, 56101U, 56113U, 56123U, 56131U, 56149U, 56167U, 56171U, 56179U,
+56197U, 56207U, 56209U, 56237U, 56239U, 56249U, 56263U, 56267U, 56269U, 56299U,
+56311U, 56333U, 56359U, 56369U, 56377U, 56383U, 56393U, 56401U, 56417U, 56431U,
+56437U, 56443U, 56453U, 56467U, 56473U, 56477U, 56479U, 56489U, 56501U, 56503U,
+56509U, 56519U, 56527U, 56531U, 56533U, 56543U, 56569U, 56591U, 56597U, 56599U,
+56611U, 56629U, 56633U, 56659U, 56663U, 56671U, 56681U, 56687U, 56701U, 56711U,
+56713U, 56731U, 56737U, 56747U, 56767U, 56773U, 56779U, 56783U, 56807U, 56809U,
+56813U, 56821U, 56827U, 56843U, 56857U, 56873U, 56891U, 56893U, 56897U, 56909U,
+56911U, 56921U, 56923U, 56929U, 56941U, 56951U, 56957U, 56963U, 56983U, 56989U,
+56993U, 56999U, 57037U, 57041U, 57047U, 57059U, 57073U, 57077U, 57089U, 57097U,
+57107U, 57119U, 57131U, 57139U, 57143U, 57149U, 57163U, 57173U, 57179U, 57191U,
+57193U, 57203U, 57221U, 57223U, 57241U, 57251U, 57259U, 57269U, 57271U, 57283U,
+57287U, 57301U, 57329U, 57331U, 57347U, 57349U, 57367U, 57373U, 57383U, 57389U,
+57397U, 57413U, 57427U, 57457U, 57467U, 57487U, 57493U, 57503U, 57527U, 57529U,
+57557U, 57559U, 57571U, 57587U, 57593U, 57601U, 57637U, 57641U, 57649U, 57653U,
+57667U, 57679U, 57689U, 57697U, 57709U, 57713U, 57719U, 57727U, 57731U, 57737U,
+57751U, 57773U, 57781U, 57787U, 57791U, 57793U, 57803U, 57809U, 57829U, 57839U,
+57847U, 57853U, 57859U, 57881U, 57899U, 57901U, 57917U, 57923U, 57943U, 57947U,
+57973U, 57977U, 57991U, 58013U, 58027U, 58031U, 58043U, 58049U, 58057U, 58061U,
+58067U, 58073U, 58099U, 58109U, 58111U, 58129U, 58147U, 58151U, 58153U, 58169U,
+58171U, 58189U, 58193U, 58199U, 58207U, 58211U, 58217U, 58229U, 58231U, 58237U,
+58243U, 58271U, 58309U, 58313U, 58321U, 58337U, 58363U, 58367U, 58369U, 58379U,
+58391U, 58393U, 58403U, 58411U, 58417U, 58427U, 58439U, 58441U, 58451U, 58453U,
+58477U, 58481U, 58511U, 58537U, 58543U, 58549U, 58567U, 58573U, 58579U, 58601U,
+58603U, 58613U, 58631U, 58657U, 58661U, 58679U, 58687U, 58693U, 58699U, 58711U,
+58727U, 58733U, 58741U, 58757U, 58763U, 58771U, 58787U, 58789U, 58831U, 58889U,
+58897U, 58901U, 58907U, 58909U, 58913U, 58921U, 58937U, 58943U, 58963U, 58967U,
+58979U, 58991U, 58997U, 59009U, 59011U, 59021U, 59023U, 59029U, 59051U, 59053U,
+59063U, 59069U, 59077U, 59083U, 59093U, 59107U, 59113U, 59119U, 59123U, 59141U,
+59149U, 59159U, 59167U, 59183U, 59197U, 59207U, 59209U, 59219U, 59221U, 59233U,
+59239U, 59243U, 59263U, 59273U, 59281U, 59333U, 59341U, 59351U, 59357U, 59359U,
+59369U, 59377U, 59387U, 59393U, 59399U, 59407U, 59417U, 59419U, 59441U, 59443U,
+59447U, 59453U, 59467U, 59471U, 59473U, 59497U, 59509U, 59513U, 59539U, 59557U,
+59561U, 59567U, 59581U, 59611U, 59617U, 59621U, 59627U, 59629U, 59651U, 59659U,
+59663U, 59669U, 59671U, 59693U, 59699U, 59707U, 59723U, 59729U, 59743U, 59747U,
+59753U, 59771U, 59779U, 59791U, 59797U, 59809U, 59833U, 59863U, 59879U, 59887U,
+59921U, 59929U, 59951U, 59957U, 59971U, 59981U, 59999U, 60013U, 60017U, 60029U,
+60037U, 60041U, 60077U, 60083U, 60089U, 60091U, 60101U, 60103U, 60107U, 60127U,
+60133U, 60139U, 60149U, 60161U, 60167U, 60169U, 60209U, 60217U, 60223U, 60251U,
+60257U, 60259U, 60271U, 60289U, 60293U, 60317U, 60331U, 60337U, 60343U, 60353U,
+60373U, 60383U, 60397U, 60413U, 60427U, 60443U, 60449U, 60457U, 60493U, 60497U,
+60509U, 60521U, 60527U, 60539U, 60589U, 60601U, 60607U, 60611U, 60617U, 60623U,
+60631U, 60637U, 60647U, 60649U, 60659U, 60661U, 60679U, 60689U, 60703U, 60719U,
+60727U, 60733U, 60737U, 60757U, 60761U, 60763U, 60773U, 60779U, 60793U, 60811U,
+60821U, 60859U, 60869U, 60887U, 60889U, 60899U, 60901U, 60913U, 60917U, 60919U,
+60923U, 60937U, 60943U, 60953U, 60961U, 61001U, 61007U, 61027U, 61031U, 61043U,
+61051U, 61057U, 61091U, 61099U, 61121U, 61129U, 61141U, 61151U, 61153U, 61169U,
+61211U, 61223U, 61231U, 61253U, 61261U, 61283U, 61291U, 61297U, 61331U, 61333U,
+61339U, 61343U, 61357U, 61363U, 61379U, 61381U, 61403U, 61409U, 61417U, 61441U,
+61463U, 61469U, 61471U, 61483U, 61487U, 61493U, 61507U, 61511U, 61519U, 61543U,
+61547U, 61553U, 61559U, 61561U, 61583U, 61603U, 61609U, 61613U, 61627U, 61631U,
+61637U, 61643U, 61651U, 61657U, 61667U, 61673U, 61681U, 61687U, 61703U, 61717U,
+61723U, 61729U, 61751U, 61757U, 61781U, 61813U, 61819U, 61837U, 61843U, 61861U,
+61871U, 61879U, 61909U, 61927U, 61933U, 61949U, 61961U, 61967U, 61979U, 61981U,
+61987U, 61991U, 62003U, 62011U, 62017U, 62039U, 62047U, 62053U, 62057U, 62071U,
+62081U, 62099U, 62119U, 62129U, 62131U, 62137U, 62141U, 62143U, 62171U, 62189U,
+62191U, 62201U, 62207U, 62213U, 62219U, 62233U, 62273U, 62297U, 62299U, 62303U,
+62311U, 62323U, 62327U, 62347U, 62351U, 62383U, 62401U, 62417U, 62423U, 62459U,
+62467U, 62473U, 62477U, 62483U, 62497U, 62501U, 62507U, 62533U, 62539U, 62549U,
+62563U, 62581U, 62591U, 62597U, 62603U, 62617U, 62627U, 62633U, 62639U, 62653U,
+62659U, 62683U, 62687U, 62701U, 62723U, 62731U, 62743U, 62753U, 62761U, 62773U,
+62791U, 62801U, 62819U, 62827U, 62851U, 62861U, 62869U, 62873U, 62897U, 62903U,
+62921U, 62927U, 62929U, 62939U, 62969U, 62971U, 62981U, 62983U, 62987U, 62989U,
+63029U, 63031U, 63059U, 63067U, 63073U, 63079U, 63097U, 63103U, 63113U, 63127U,
+63131U, 63149U, 63179U, 63197U, 63199U, 63211U, 63241U, 63247U, 63277U, 63281U,
+63299U, 63311U, 63313U, 63317U, 63331U, 63337U, 63347U, 63353U, 63361U, 63367U,
+63377U, 63389U, 63391U, 63397U, 63409U, 63419U, 63421U, 63439U, 63443U, 63463U,
+63467U, 63473U, 63487U, 63493U, 63499U, 63521U, 63527U, 63533U, 63541U, 63559U,
+63577U, 63587U, 63589U, 63599U, 63601U, 63607U, 63611U, 63617U, 63629U, 63647U,
+63649U, 63659U, 63667U, 63671U, 63689U, 63691U, 63697U, 63703U, 63709U, 63719U,
+63727U, 63737U, 63743U, 63761U, 63773U, 63781U, 63793U, 63799U, 63803U, 63809U,
+63823U, 63839U, 63841U, 63853U, 63857U, 63863U, 63901U, 63907U, 63913U, 63929U,
+63949U, 63977U, 63997U, 64007U, 64013U, 64019U, 64033U, 64037U, 64063U, 64067U,
+64081U, 64091U, 64109U, 64123U, 64151U, 64153U, 64157U, 64171U, 64187U, 64189U,
+64217U, 64223U, 64231U, 64237U, 64271U, 64279U, 64283U, 64301U, 64303U, 64319U,
+64327U, 64333U, 64373U, 64381U, 64399U, 64403U, 64433U, 64439U, 64451U, 64453U,
+64483U, 64489U, 64499U, 64513U, 64553U, 64567U, 64577U, 64579U, 64591U, 64601U,
+64609U, 64613U, 64621U, 64627U, 64633U, 64661U, 64663U, 64667U, 64679U, 64693U,
+64709U, 64717U, 64747U, 64763U, 64781U, 64783U, 64793U, 64811U, 64817U, 64849U,
+64853U, 64871U, 64877U, 64879U, 64891U, 64901U, 64919U, 64921U, 64927U, 64937U,
+64951U, 64969U, 64997U, 65003U, 65011U, 65027U, 65029U, 65033U, 65053U, 65063U,
+65071U, 65089U, 65099U, 65101U, 65111U, 65119U, 65123U, 65129U, 65141U, 65147U,
+65167U, 65171U, 65173U, 65179U, 65183U, 65203U, 65213U, 65239U, 65257U, 65267U,
+65269U, 65287U, 65293U, 65309U, 65323U, 65327U, 65353U, 65357U, 65371U, 65381U,
+65393U, 65407U, 65413U, 65419U, 65423U, 65437U, 65447U, 65449U, 65479U, 65497U,
+65519U, 65521U, 65537U, 65539U, 65543U, 65551U, 65557U, 65563U, 65579U, 65581U,
+65587U, 65599U, 65609U, 65617U, 65629U, 65633U, 65647U, 65651U, 65657U, 65677U,
+65687U, 65699U, 65701U, 65707U, 65713U, 65717U, 65719U, 65729U, 65731U, 65761U,
+65777U, 65789U, 65809U, 65827U, 65831U, 65837U, 65839U, 65843U, 65851U, 65867U,
+65881U, 65899U, 65921U, 65927U, 65929U, 65951U, 65957U, 65963U, 65981U, 65983U,
+65993U, 66029U, 66037U, 66041U, 66047U, 66067U, 66071U, 66083U, 66089U, 66103U,
+66107U, 66109U, 66137U, 66161U, 66169U, 66173U, 66179U, 66191U, 66221U, 66239U,
+66271U, 66293U, 66301U, 66337U, 66343U, 66347U, 66359U, 66361U, 66373U, 66377U,
+66383U, 66403U, 66413U, 66431U, 66449U, 66457U, 66463U, 66467U, 66491U, 66499U,
+66509U, 66523U, 66529U, 66533U, 66541U, 66553U, 66569U, 66571U, 66587U, 66593U,
+66601U, 66617U, 66629U, 66643U, 66653U, 66683U, 66697U, 66701U, 66713U, 66721U,
+66733U, 66739U, 66749U, 66751U, 66763U, 66791U, 66797U, 66809U, 66821U, 66841U,
+66851U, 66853U, 66863U, 66877U, 66883U, 66889U, 66919U, 66923U, 66931U, 66943U,
+66947U, 66949U, 66959U, 66973U, 66977U, 67003U, 67021U, 67033U, 67043U, 67049U,
+67057U, 67061U, 67073U, 67079U, 67103U, 67121U, 67129U, 67139U, 67141U, 67153U,
+67157U, 67169U, 67181U, 67187U, 67189U, 67211U, 67213U, 67217U, 67219U, 67231U,
+67247U, 67261U, 67271U, 67273U, 67289U, 67307U, 67339U, 67343U, 67349U, 67369U,
+67391U, 67399U, 67409U, 67411U, 67421U, 67427U, 67429U, 67433U, 67447U, 67453U,
+67477U, 67481U, 67489U, 67493U, 67499U, 67511U, 67523U, 67531U, 67537U, 67547U,
+67559U, 67567U, 67577U, 67579U, 67589U, 67601U, 67607U, 67619U, 67631U, 67651U,
+67679U, 67699U, 67709U, 67723U, 67733U, 67741U, 67751U, 67757U, 67759U, 67763U,
+67777U, 67783U, 67789U, 67801U, 67807U, 67819U, 67829U, 67843U, 67853U, 67867U,
+67883U, 67891U, 67901U, 67927U, 67931U, 67933U, 67939U, 67943U, 67957U, 67961U,
+67967U, 67979U, 67987U, 67993U, 68023U, 68041U, 68053U, 68059U, 68071U, 68087U,
+68099U, 68111U, 68113U, 68141U, 68147U, 68161U, 68171U, 68207U, 68209U, 68213U,
+68219U, 68227U, 68239U, 68261U, 68279U, 68281U, 68311U, 68329U, 68351U, 68371U,
+68389U, 68399U, 68437U, 68443U, 68447U, 68449U, 68473U, 68477U, 68483U, 68489U,
+68491U, 68501U, 68507U, 68521U, 68531U, 68539U, 68543U, 68567U, 68581U, 68597U,
+68611U, 68633U, 68639U, 68659U, 68669U, 68683U, 68687U, 68699U, 68711U, 68713U,
+68729U, 68737U, 68743U, 68749U, 68767U, 68771U, 68777U, 68791U, 68813U, 68819U,
+68821U, 68863U, 68879U, 68881U, 68891U, 68897U, 68899U, 68903U, 68909U, 68917U,
+68927U, 68947U, 68963U, 68993U, 69001U, 69011U, 69019U, 69029U, 69031U, 69061U,
+69067U, 69073U, 69109U, 69119U, 69127U, 69143U, 69149U, 69151U, 69163U, 69191U,
+69193U, 69197U, 69203U, 69221U, 69233U, 69239U, 69247U, 69257U, 69259U, 69263U,
+69313U, 69317U, 69337U, 69341U, 69371U, 69379U, 69383U, 69389U, 69401U, 69403U,
+69427U, 69431U, 69439U, 69457U, 69463U, 69467U, 69473U, 69481U, 69491U, 69493U,
+69497U, 69499U, 69539U, 69557U, 69593U, 69623U, 69653U, 69661U, 69677U, 69691U,
+69697U, 69709U, 69737U, 69739U, 69761U, 69763U, 69767U, 69779U, 69809U, 69821U,
+69827U, 69829U, 69833U, 69847U, 69857U, 69859U, 69877U, 69899U, 69911U, 69929U,
+69931U, 69941U, 69959U, 69991U, 69997U, 70001U, 70003U, 70009U, 70019U, 70039U,
+70051U, 70061U, 70067U, 70079U, 70099U, 70111U, 70117U, 70121U, 70123U, 70139U,
+70141U, 70157U, 70163U, 70177U, 70181U, 70183U, 70199U, 70201U, 70207U, 70223U,
+70229U, 70237U, 70241U, 70249U, 70271U, 70289U, 70297U, 70309U, 70313U, 70321U,
+70327U, 70351U, 70373U, 70379U, 70381U, 70393U, 70423U, 70429U, 70439U, 70451U,
+70457U, 70459U, 70481U, 70487U, 70489U, 70501U, 70507U, 70529U, 70537U, 70549U,
+70571U, 70573U, 70583U, 70589U, 70607U, 70619U, 70621U, 70627U, 70639U, 70657U,
+70663U, 70667U, 70687U, 70709U, 70717U, 70729U, 70753U, 70769U, 70783U, 70793U,
+70823U, 70841U, 70843U, 70849U, 70853U, 70867U, 70877U, 70879U, 70891U, 70901U,
+70913U, 70919U, 70921U, 70937U, 70949U, 70951U, 70957U, 70969U, 70979U, 70981U,
+70991U, 70997U, 70999U, 71011U, 71023U, 71039U, 71059U, 71069U, 71081U, 71089U,
+71119U, 71129U, 71143U, 71147U, 71153U, 71161U, 71167U, 71171U, 71191U, 71209U,
+71233U, 71237U, 71249U, 71257U, 71261U, 71263U, 71287U, 71293U, 71317U, 71327U,
+71329U, 71333U, 71339U, 71341U, 71347U, 71353U, 71359U, 71363U, 71387U, 71389U,
+71399U, 71411U, 71413U, 71419U, 71429U, 71437U, 71443U, 71453U, 71471U, 71473U,
+71479U, 71483U, 71503U, 71527U, 71537U, 71549U, 71551U, 71563U, 71569U, 71593U,
+71597U, 71633U, 71647U, 71663U, 71671U, 71693U, 71699U, 71707U, 71711U, 71713U,
+71719U, 71741U, 71761U, 71777U, 71789U, 71807U, 71809U, 71821U, 71837U, 71843U,
+71849U, 71861U, 71867U, 71879U, 71881U, 71887U, 71899U, 71909U, 71917U, 71933U,
+71941U, 71947U, 71963U, 71971U, 71983U, 71987U, 71993U, 71999U, 72019U, 72031U,
+72043U, 72047U, 72053U, 72073U, 72077U, 72089U, 72091U, 72101U, 72103U, 72109U,
+72139U, 72161U, 72167U, 72169U, 72173U, 72211U, 72221U, 72223U, 72227U, 72229U,
+72251U, 72253U, 72269U, 72271U, 72277U, 72287U, 72307U, 72313U, 72337U, 72341U,
+72353U, 72367U, 72379U, 72383U, 72421U, 72431U, 72461U, 72467U, 72469U, 72481U,
+72493U, 72497U, 72503U, 72533U, 72547U, 72551U, 72559U, 72577U, 72613U, 72617U,
+72623U, 72643U, 72647U, 72649U, 72661U, 72671U, 72673U, 72679U, 72689U, 72701U,
+72707U, 72719U, 72727U, 72733U, 72739U, 72763U, 72767U, 72797U, 72817U, 72823U,
+72859U, 72869U, 72871U, 72883U, 72889U, 72893U, 72901U, 72907U, 72911U, 72923U,
+72931U, 72937U, 72949U, 72953U, 72959U, 72973U, 72977U, 72997U, 73009U, 73013U,
+73019U, 73037U, 73039U, 73043U, 73061U, 73063U, 73079U, 73091U, 73121U, 73127U,
+73133U, 73141U, 73181U, 73189U, 73237U, 73243U, 73259U, 73277U, 73291U, 73303U,
+73309U, 73327U, 73331U, 73351U, 73361U, 73363U, 73369U, 73379U, 73387U, 73417U,
+73421U, 73433U, 73453U, 73459U, 73471U, 73477U, 73483U, 73517U, 73523U, 73529U,
+73547U, 73553U, 73561U, 73571U, 73583U, 73589U, 73597U, 73607U, 73609U, 73613U,
+73637U, 73643U, 73651U, 73673U, 73679U, 73681U, 73693U, 73699U, 73709U, 73721U,
+73727U, 73751U, 73757U, 73771U, 73783U, 73819U, 73823U, 73847U, 73849U, 73859U,
+73867U, 73877U, 73883U, 73897U, 73907U, 73939U, 73943U, 73951U, 73961U, 73973U,
+73999U, 74017U, 74021U, 74027U, 74047U, 74051U, 74071U, 74077U, 74093U, 74099U,
+74101U, 74131U, 74143U, 74149U, 74159U, 74161U, 74167U, 74177U, 74189U, 74197U,
+74201U, 74203U, 74209U, 74219U, 74231U, 74257U, 74279U, 74287U, 74293U, 74297U,
+74311U, 74317U, 74323U, 74353U, 74357U, 74363U, 74377U, 74381U, 74383U, 74411U,
+74413U, 74419U, 74441U, 74449U, 74453U, 74471U, 74489U, 74507U, 74509U, 74521U,
+74527U, 74531U, 74551U, 74561U, 74567U, 74573U, 74587U, 74597U, 74609U, 74611U,
+74623U, 74653U, 74687U, 74699U, 74707U, 74713U, 74717U, 74719U, 74729U, 74731U,
+74747U, 74759U, 74761U, 74771U, 74779U, 74797U, 74821U, 74827U, 74831U, 74843U,
+74857U, 74861U, 74869U, 74873U, 74887U, 74891U, 74897U, 74903U, 74923U, 74929U,
+74933U, 74941U, 74959U, 75011U, 75013U, 75017U, 75029U, 75037U, 75041U, 75079U,
+75083U, 75109U, 75133U, 75149U, 75161U, 75167U, 75169U, 75181U, 75193U, 75209U,
+75211U, 75217U, 75223U, 75227U, 75239U, 75253U, 75269U, 75277U, 75289U, 75307U,
+75323U, 75329U, 75337U, 75347U, 75353U, 75367U, 75377U, 75389U, 75391U, 75401U,
+75403U, 75407U, 75431U, 75437U, 75479U, 75503U, 75511U, 75521U, 75527U, 75533U,
+75539U, 75541U, 75553U, 75557U, 75571U, 75577U, 75583U, 75611U, 75617U, 75619U,
+75629U, 75641U, 75653U, 75659U, 75679U, 75683U, 75689U, 75703U, 75707U, 75709U,
+75721U, 75731U, 75743U, 75767U, 75773U, 75781U, 75787U, 75793U, 75797U, 75821U,
+75833U, 75853U, 75869U, 75883U, 75913U, 75931U, 75937U, 75941U, 75967U, 75979U,
+75983U, 75989U, 75991U, 75997U, 76001U, 76003U, 76031U, 76039U, 76079U, 76081U,
+76091U, 76099U, 76103U, 76123U, 76129U, 76147U, 76157U, 76159U, 76163U, 76207U,
+76213U, 76231U, 76243U, 76249U, 76253U, 76259U, 76261U, 76283U, 76289U, 76303U,
+76333U, 76343U, 76367U, 76369U, 76379U, 76387U, 76403U, 76421U, 76423U, 76441U,
+76463U, 76471U, 76481U, 76487U, 76493U, 76507U, 76511U, 76519U, 76537U, 76541U,
+76543U, 76561U, 76579U, 76597U, 76603U, 76607U, 76631U, 76649U, 76651U, 76667U,
+76673U, 76679U, 76697U, 76717U, 76733U, 76753U, 76757U, 76771U, 76777U, 76781U,
+76801U, 76819U, 76829U, 76831U, 76837U, 76847U, 76871U, 76873U, 76883U, 76907U,
+76913U, 76919U, 76943U, 76949U, 76961U, 76963U, 76991U, 77003U, 77017U, 77023U,
+77029U, 77041U, 77047U, 77069U, 77081U, 77093U, 77101U, 77137U, 77141U, 77153U,
+77167U, 77171U, 77191U, 77201U, 77213U, 77237U, 77239U, 77243U, 77249U, 77261U,
+77263U, 77267U, 77269U, 77279U, 77291U, 77317U, 77323U, 77339U, 77347U, 77351U,
+77359U, 77369U, 77377U, 77383U, 77417U, 77419U, 77431U, 77447U, 77471U, 77477U,
+77479U, 77489U, 77491U, 77509U, 77513U, 77521U, 77527U, 77543U, 77549U, 77551U,
+77557U, 77563U, 77569U, 77573U, 77587U, 77591U, 77611U, 77617U, 77621U, 77641U,
+77647U, 77659U, 77681U, 77687U, 77689U, 77699U, 77711U, 77713U, 77719U, 77723U,
+77731U, 77743U, 77747U, 77761U, 77773U, 77783U, 77797U, 77801U, 77813U, 77839U,
+77849U, 77863U, 77867U, 77893U, 77899U, 77929U, 77933U, 77951U, 77969U, 77977U,
+77983U, 77999U, 78007U, 78017U, 78031U, 78041U, 78049U, 78059U, 78079U, 78101U,
+78121U, 78137U, 78139U, 78157U, 78163U, 78167U, 78173U, 78179U, 78191U, 78193U,
+78203U, 78229U, 78233U, 78241U, 78259U, 78277U, 78283U, 78301U, 78307U, 78311U,
+78317U, 78341U, 78347U, 78367U, 78401U, 78427U, 78437U, 78439U, 78467U, 78479U,
+78487U, 78497U, 78509U, 78511U, 78517U, 78539U, 78541U, 78553U, 78569U, 78571U,
+78577U, 78583U, 78593U, 78607U, 78623U, 78643U, 78649U, 78653U, 78691U, 78697U,
+78707U, 78713U, 78721U, 78737U, 78779U, 78781U, 78787U, 78791U, 78797U, 78803U,
+78809U, 78823U, 78839U, 78853U, 78857U, 78877U, 78887U, 78889U, 78893U, 78901U,
+78919U, 78929U, 78941U, 78977U, 78979U, 78989U, 79031U, 79039U, 79043U, 79063U,
+79087U, 79103U, 79111U, 79133U, 79139U, 79147U, 79151U, 79153U, 79159U, 79181U,
+79187U, 79193U, 79201U, 79229U, 79231U, 79241U, 79259U, 79273U, 79279U, 79283U,
+79301U, 79309U, 79319U, 79333U, 79337U, 79349U, 79357U, 79367U, 79379U, 79393U,
+79397U, 79399U, 79411U, 79423U, 79427U, 79433U, 79451U, 79481U, 79493U, 79531U,
+79537U, 79549U, 79559U, 79561U, 79579U, 79589U, 79601U, 79609U, 79613U, 79621U,
+79627U, 79631U, 79633U, 79657U, 79669U, 79687U, 79691U, 79693U, 79697U, 79699U,
+79757U, 79769U, 79777U, 79801U, 79811U, 79813U, 79817U, 79823U, 79829U, 79841U,
+79843U, 79847U, 79861U, 79867U, 79873U, 79889U, 79901U, 79903U, 79907U, 79939U,
+79943U, 79967U, 79973U, 79979U, 79987U, 79997U, 79999U, 80021U, 80039U, 80051U,
+80071U, 80077U, 80107U, 80111U, 80141U, 80147U, 80149U, 80153U, 80167U, 80173U,
+80177U, 80191U, 80207U, 80209U, 80221U, 80231U, 80233U, 80239U, 80251U, 80263U,
+80273U, 80279U, 80287U, 80309U, 80317U, 80329U, 80341U, 80347U, 80363U, 80369U,
+80387U, 80407U, 80429U, 80447U, 80449U, 80471U, 80473U, 80489U, 80491U, 80513U,
+80527U, 80537U, 80557U, 80567U, 80599U, 80603U, 80611U, 80621U, 80627U, 80629U,
+80651U, 80657U, 80669U, 80671U, 80677U, 80681U, 80683U, 80687U, 80701U, 80713U,
+80737U, 80747U, 80749U, 80761U, 80777U, 80779U, 80783U, 80789U, 80803U, 80809U,
+80819U, 80831U, 80833U, 80849U, 80863U, 80897U, 80909U, 80911U, 80917U, 80923U,
+80929U, 80933U, 80953U, 80963U, 80989U, 81001U, 81013U, 81017U, 81019U, 81023U,
+81031U, 81041U, 81043U, 81047U, 81049U, 81071U, 81077U, 81083U, 81097U, 81101U,
+81119U, 81131U, 81157U, 81163U, 81173U, 81181U, 81197U, 81199U, 81203U, 81223U,
+81233U, 81239U, 81281U, 81283U, 81293U, 81299U, 81307U, 81331U, 81343U, 81349U,
+81353U, 81359U, 81371U, 81373U, 81401U, 81409U, 81421U, 81439U, 81457U, 81463U,
+81509U, 81517U, 81527U, 81533U, 81547U, 81551U, 81553U, 81559U, 81563U, 81569U,
+81611U, 81619U, 81629U, 81637U, 81647U, 81649U, 81667U, 81671U, 81677U, 81689U,
+81701U, 81703U, 81707U, 81727U, 81737U, 81749U, 81761U, 81769U, 81773U, 81799U,
+81817U, 81839U, 81847U, 81853U, 81869U, 81883U, 81899U, 81901U, 81919U, 81929U,
+81931U, 81937U, 81943U, 81953U, 81967U, 81971U, 81973U, 82003U, 82007U, 82009U,
+82013U, 82021U, 82031U, 82037U, 82039U, 82051U, 82067U, 82073U, 82129U, 82139U,
+82141U, 82153U, 82163U, 82171U, 82183U, 82189U, 82193U, 82207U, 82217U, 82219U,
+82223U, 82231U, 82237U, 82241U, 82261U, 82267U, 82279U, 82301U, 82307U, 82339U,
+82349U, 82351U, 82361U, 82373U, 82387U, 82393U, 82421U, 82457U, 82463U, 82469U,
+82471U, 82483U, 82487U, 82493U, 82499U, 82507U, 82529U, 82531U, 82549U, 82559U,
+82561U, 82567U, 82571U, 82591U, 82601U, 82609U, 82613U, 82619U, 82633U, 82651U,
+82657U, 82699U, 82721U, 82723U, 82727U, 82729U, 82757U, 82759U, 82763U, 82781U,
+82787U, 82793U, 82799U, 82811U, 82813U, 82837U, 82847U, 82883U, 82889U, 82891U,
+82903U, 82913U, 82939U, 82963U, 82981U, 82997U, 83003U, 83009U, 83023U, 83047U,
+83059U, 83063U, 83071U, 83077U, 83089U, 83093U, 83101U, 83117U, 83137U, 83177U,
+83203U, 83207U, 83219U, 83221U, 83227U, 83231U, 83233U, 83243U, 83257U, 83267U,
+83269U, 83273U, 83299U, 83311U, 83339U, 83341U, 83357U, 83383U, 83389U, 83399U,
+83401U, 83407U, 83417U, 83423U, 83431U, 83437U, 83443U, 83449U, 83459U, 83471U,
+83477U, 83497U, 83537U, 83557U, 83561U, 83563U, 83579U, 83591U, 83597U, 83609U,
+83617U, 83621U, 83639U, 83641U, 83653U, 83663U, 83689U, 83701U, 83717U, 83719U,
+83737U, 83761U, 83773U, 83777U, 83791U, 83813U, 83833U, 83843U, 83857U, 83869U,
+83873U, 83891U, 83903U, 83911U, 83921U, 83933U, 83939U, 83969U, 83983U, 83987U,
+84011U, 84017U, 84047U, 84053U, 84059U, 84061U, 84067U, 84089U, 84121U, 84127U,
+84131U, 84137U, 84143U, 84163U, 84179U, 84181U, 84191U, 84199U, 84211U, 84221U,
+84223U, 84229U, 84239U, 84247U, 84263U, 84299U, 84307U, 84313U, 84317U, 84319U,
+84347U, 84349U, 84377U, 84389U, 84391U, 84401U, 84407U, 84421U, 84431U, 84437U,
+84443U, 84449U, 84457U, 84463U, 84467U, 84481U, 84499U, 84503U, 84509U, 84521U,
+84523U, 84533U, 84551U, 84559U, 84589U, 84629U, 84631U, 84649U, 84653U, 84659U,
+84673U, 84691U, 84697U, 84701U, 84713U, 84719U, 84731U, 84737U, 84751U, 84761U,
+84787U, 84793U, 84809U, 84811U, 84827U, 84857U, 84859U, 84869U, 84871U, 84913U,
+84919U, 84947U, 84961U, 84967U, 84977U, 84979U, 84991U, 85009U, 85021U, 85027U,
+85037U, 85049U, 85061U, 85081U, 85087U, 85091U, 85093U, 85103U, 85109U, 85121U,
+85133U, 85147U, 85159U, 85193U, 85199U, 85201U, 85213U, 85223U, 85229U, 85237U,
+85243U, 85247U, 85259U, 85297U, 85303U, 85313U, 85331U, 85333U, 85361U, 85363U,
+85369U, 85381U, 85411U, 85427U, 85429U, 85439U, 85447U, 85451U, 85453U, 85469U,
+85487U, 85513U, 85517U, 85523U, 85531U, 85549U, 85571U, 85577U, 85597U, 85601U,
+85607U, 85619U, 85621U, 85627U, 85639U, 85643U, 85661U, 85667U, 85669U, 85691U,
+85703U, 85711U, 85717U, 85733U, 85751U, 85781U, 85793U, 85817U, 85819U, 85829U,
+85831U, 85837U, 85843U, 85847U, 85853U, 85889U, 85903U, 85909U, 85931U, 85933U,
+85991U, 85999U, 86011U, 86017U, 86027U, 86029U, 86069U, 86077U, 86083U, 86111U,
+86113U, 86117U, 86131U, 86137U, 86143U, 86161U, 86171U, 86179U, 86183U, 86197U,
+86201U, 86209U, 86239U, 86243U, 86249U, 86257U, 86263U, 86269U, 86287U, 86291U,
+86293U, 86297U, 86311U, 86323U, 86341U, 86351U, 86353U, 86357U, 86369U, 86371U,
+86381U, 86389U, 86399U, 86413U, 86423U, 86441U, 86453U, 86461U, 86467U, 86477U,
+86491U, 86501U, 86509U, 86531U, 86533U, 86539U, 86561U, 86573U, 86579U, 86587U,
+86599U, 86627U, 86629U, 86677U, 86689U, 86693U, 86711U, 86719U, 86729U, 86743U,
+86753U, 86767U, 86771U, 86783U, 86813U, 86837U, 86843U, 86851U, 86857U, 86861U,
+86869U, 86923U, 86927U, 86929U, 86939U, 86951U, 86959U, 86969U, 86981U, 86993U,
+87011U, 87013U, 87037U, 87041U, 87049U, 87071U, 87083U, 87103U, 87107U, 87119U,
+87121U, 87133U, 87149U, 87151U, 87179U, 87181U, 87187U, 87211U, 87221U, 87223U,
+87251U, 87253U, 87257U, 87277U, 87281U, 87293U, 87299U, 87313U, 87317U, 87323U,
+87337U, 87359U, 87383U, 87403U, 87407U, 87421U, 87427U, 87433U, 87443U, 87473U,
+87481U, 87491U, 87509U, 87511U, 87517U, 87523U, 87539U, 87541U, 87547U, 87553U,
+87557U, 87559U, 87583U, 87587U, 87589U, 87613U, 87623U, 87629U, 87631U, 87641U,
+87643U, 87649U, 87671U, 87679U, 87683U, 87691U, 87697U, 87701U, 87719U, 87721U,
+87739U, 87743U, 87751U, 87767U, 87793U, 87797U, 87803U, 87811U, 87833U, 87853U,
+87869U, 87877U, 87881U, 87887U, 87911U, 87917U, 87931U, 87943U, 87959U, 87961U,
+87973U, 87977U, 87991U, 88001U, 88003U, 88007U, 88019U, 88037U, 88069U, 88079U,
+88093U, 88117U, 88129U, 88169U, 88177U, 88211U, 88223U, 88237U, 88241U, 88259U,
+88261U, 88289U, 88301U, 88321U, 88327U, 88337U, 88339U, 88379U, 88397U, 88411U,
+88423U, 88427U, 88463U, 88469U, 88471U, 88493U, 88499U, 88513U, 88523U, 88547U,
+88589U, 88591U, 88607U, 88609U, 88643U, 88651U, 88657U, 88661U, 88663U, 88667U,
+88681U, 88721U, 88729U, 88741U, 88747U, 88771U, 88789U, 88793U, 88799U, 88801U,
+88807U, 88811U, 88813U, 88817U, 88819U, 88843U, 88853U, 88861U, 88867U, 88873U,
+88883U, 88897U, 88903U, 88919U, 88937U, 88951U, 88969U, 88993U, 88997U, 89003U,
+89009U, 89017U, 89021U, 89041U, 89051U, 89057U, 89069U, 89071U, 89083U, 89087U,
+89101U, 89107U, 89113U, 89119U, 89123U, 89137U, 89153U, 89189U, 89203U, 89209U,
+89213U, 89227U, 89231U, 89237U, 89261U, 89269U, 89273U, 89293U, 89303U, 89317U,
+89329U, 89363U, 89371U, 89381U, 89387U, 89393U, 89399U, 89413U, 89417U, 89431U,
+89443U, 89449U, 89459U, 89477U, 89491U, 89501U, 89513U, 89519U, 89521U, 89527U,
+89533U, 89561U, 89563U, 89567U, 89591U, 89597U, 89599U, 89603U, 89611U, 89627U,
+89633U, 89653U, 89657U, 89659U, 89669U, 89671U, 89681U, 89689U, 89753U, 89759U,
+89767U, 89779U, 89783U, 89797U, 89809U, 89819U, 89821U, 89833U, 89839U, 89849U,
+89867U, 89891U, 89897U, 89899U, 89909U, 89917U, 89923U, 89939U, 89959U, 89963U,
+89977U, 89983U, 89989U, 90001U, 90007U, 90011U, 90017U, 90019U, 90023U, 90031U,
+90053U, 90059U, 90067U, 90071U, 90073U, 90089U, 90107U, 90121U, 90127U, 90149U,
+90163U, 90173U, 90187U, 90191U, 90197U, 90199U, 90203U, 90217U, 90227U, 90239U,
+90247U, 90263U, 90271U, 90281U, 90289U, 90313U, 90353U, 90359U, 90371U, 90373U,
+90379U, 90397U, 90401U, 90403U, 90407U, 90437U, 90439U, 90469U, 90473U, 90481U,
+90499U, 90511U, 90523U, 90527U, 90529U, 90533U, 90547U, 90583U, 90599U, 90617U,
+90619U, 90631U, 90641U, 90647U, 90659U, 90677U, 90679U, 90697U, 90703U, 90709U,
+90731U, 90749U, 90787U, 90793U, 90803U, 90821U, 90823U, 90833U, 90841U, 90847U,
+90863U, 90887U, 90901U, 90907U, 90911U, 90917U, 90931U, 90947U, 90971U, 90977U,
+90989U, 90997U, 91009U, 91019U, 91033U, 91079U, 91081U, 91097U, 91099U, 91121U,
+91127U, 91129U, 91139U, 91141U, 91151U, 91153U, 91159U, 91163U, 91183U, 91193U,
+91199U, 91229U, 91237U, 91243U, 91249U, 91253U, 91283U, 91291U, 91297U, 91303U,
+91309U, 91331U, 91367U, 91369U, 91373U, 91381U, 91387U, 91393U, 91397U, 91411U,
+91423U, 91433U, 91453U, 91457U, 91459U, 91463U, 91493U, 91499U, 91513U, 91529U,
+91541U, 91571U, 91573U, 91577U, 91583U, 91591U, 91621U, 91631U, 91639U, 91673U,
+91691U, 91703U, 91711U, 91733U, 91753U, 91757U, 91771U, 91781U, 91801U, 91807U,
+91811U, 91813U, 91823U, 91837U, 91841U, 91867U, 91873U, 91909U, 91921U, 91939U,
+91943U, 91951U, 91957U, 91961U, 91967U, 91969U, 91997U, 92003U, 92009U, 92033U,
+92041U, 92051U, 92077U, 92083U, 92107U, 92111U, 92119U, 92143U, 92153U, 92173U,
+92177U, 92179U, 92189U, 92203U, 92219U, 92221U, 92227U, 92233U, 92237U, 92243U,
+92251U, 92269U, 92297U, 92311U, 92317U, 92333U, 92347U, 92353U, 92357U, 92363U,
+92369U, 92377U, 92381U, 92383U, 92387U, 92399U, 92401U, 92413U, 92419U, 92431U,
+92459U, 92461U, 92467U, 92479U, 92489U, 92503U, 92507U, 92551U, 92557U, 92567U,
+92569U, 92581U, 92593U, 92623U, 92627U, 92639U, 92641U, 92647U, 92657U, 92669U,
+92671U, 92681U, 92683U, 92693U, 92699U, 92707U, 92717U, 92723U, 92737U, 92753U,
+92761U, 92767U, 92779U, 92789U, 92791U, 92801U, 92809U, 92821U, 92831U, 92849U,
+92857U, 92861U, 92863U, 92867U, 92893U, 92899U, 92921U, 92927U, 92941U, 92951U,
+92957U, 92959U, 92987U, 92993U, 93001U, 93047U, 93053U, 93059U, 93077U, 93083U,
+93089U, 93097U, 93103U, 93113U, 93131U, 93133U, 93139U, 93151U, 93169U, 93179U,
+93187U, 93199U, 93229U, 93239U, 93241U, 93251U, 93253U, 93257U, 93263U, 93281U,
+93283U, 93287U, 93307U, 93319U, 93323U, 93329U, 93337U, 93371U, 93377U, 93383U,
+93407U, 93419U, 93427U, 93463U, 93479U, 93481U, 93487U, 93491U, 93493U, 93497U,
+93503U, 93523U, 93529U, 93553U, 93557U, 93559U, 93563U, 93581U, 93601U, 93607U,
+93629U, 93637U, 93683U, 93701U, 93703U, 93719U, 93739U, 93761U, 93763U, 93787U,
+93809U, 93811U, 93827U, 93851U, 93871U, 93887U, 93889U, 93893U, 93901U, 93911U,
+93913U, 93923U, 93937U, 93941U, 93949U, 93967U, 93971U, 93979U, 93983U, 93997U,
+94007U, 94009U, 94033U, 94049U, 94057U, 94063U, 94079U, 94099U, 94109U, 94111U,
+94117U, 94121U, 94151U, 94153U, 94169U, 94201U, 94207U, 94219U, 94229U, 94253U,
+94261U, 94273U, 94291U, 94307U, 94309U, 94321U, 94327U, 94331U, 94343U, 94349U,
+94351U, 94379U, 94397U, 94399U, 94421U, 94427U, 94433U, 94439U, 94441U, 94447U,
+94463U, 94477U, 94483U, 94513U, 94529U, 94531U, 94541U, 94543U, 94547U, 94559U,
+94561U, 94573U, 94583U, 94597U, 94603U, 94613U, 94621U, 94649U, 94651U, 94687U,
+94693U, 94709U, 94723U, 94727U, 94747U, 94771U, 94777U, 94781U, 94789U, 94793U,
+94811U, 94819U, 94823U, 94837U, 94841U, 94847U, 94849U, 94873U, 94889U, 94903U,
+94907U, 94933U, 94949U, 94951U, 94961U, 94993U, 94999U, 95003U, 95009U, 95021U,
+95027U, 95063U, 95071U, 95083U, 95087U, 95089U, 95093U, 95101U, 95107U, 95111U,
+95131U, 95143U, 95153U, 95177U, 95189U, 95191U, 95203U, 95213U, 95219U, 95231U,
+95233U, 95239U, 95257U, 95261U, 95267U, 95273U, 95279U, 95287U, 95311U, 95317U,
+95327U, 95339U, 95369U, 95383U, 95393U, 95401U, 95413U, 95419U, 95429U, 95441U,
+95443U, 95461U, 95467U, 95471U, 95479U, 95483U, 95507U, 95527U, 95531U, 95539U,
+95549U, 95561U, 95569U, 95581U, 95597U, 95603U, 95617U, 95621U, 95629U, 95633U,
+95651U, 95701U, 95707U, 95713U, 95717U, 95723U, 95731U, 95737U, 95747U, 95773U,
+95783U, 95789U, 95791U, 95801U, 95803U, 95813U, 95819U, 95857U, 95869U, 95873U,
+95881U, 95891U, 95911U, 95917U, 95923U, 95929U, 95947U, 95957U, 95959U, 95971U,
+95987U, 95989U, 96001U, 96013U, 96017U, 96043U, 96053U, 96059U, 96079U, 96097U,
+96137U, 96149U, 96157U, 96167U, 96179U, 96181U, 96199U, 96211U, 96221U, 96223U,
+96233U, 96259U, 96263U, 96269U, 96281U, 96289U, 96293U, 96323U, 96329U, 96331U,
+96337U, 96353U, 96377U, 96401U, 96419U, 96431U, 96443U, 96451U, 96457U, 96461U,
+96469U, 96479U, 96487U, 96493U, 96497U, 96517U, 96527U, 96553U, 96557U, 96581U,
+96587U, 96589U, 96601U, 96643U, 96661U, 96667U, 96671U, 96697U, 96703U, 96731U,
+96737U, 96739U, 96749U, 96757U, 96763U, 96769U, 96779U, 96787U, 96797U, 96799U,
+96821U, 96823U, 96827U, 96847U, 96851U, 96857U, 96893U, 96907U, 96911U, 96931U,
+96953U, 96959U, 96973U, 96979U, 96989U, 96997U, 97001U, 97003U, 97007U, 97021U,
+97039U, 97073U, 97081U, 97103U, 97117U, 97127U, 97151U, 97157U, 97159U, 97169U,
+97171U, 97177U, 97187U, 97213U, 97231U, 97241U, 97259U, 97283U, 97301U, 97303U,
+97327U, 97367U, 97369U, 97373U, 97379U, 97381U, 97387U, 97397U, 97423U, 97429U,
+97441U, 97453U, 97459U, 97463U, 97499U, 97501U, 97511U, 97523U, 97547U, 97549U,
+97553U, 97561U, 97571U, 97577U, 97579U, 97583U, 97607U, 97609U, 97613U, 97649U,
+97651U, 97673U, 97687U, 97711U, 97729U, 97771U, 97777U, 97787U, 97789U, 97813U,
+97829U, 97841U, 97843U, 97847U, 97849U, 97859U, 97861U, 97871U, 97879U, 97883U,
+97919U, 97927U, 97931U, 97943U, 97961U, 97967U, 97973U, 97987U, 98009U, 98011U,
+98017U, 98041U, 98047U, 98057U, 98081U, 98101U, 98123U, 98129U, 98143U, 98179U,
+98207U, 98213U, 98221U, 98227U, 98251U, 98257U, 98269U, 98297U, 98299U, 98317U,
+98321U, 98323U, 98327U, 98347U, 98369U, 98377U, 98387U, 98389U, 98407U, 98411U,
+98419U, 98429U, 98443U, 98453U, 98459U, 98467U, 98473U, 98479U, 98491U, 98507U,
+98519U, 98533U, 98543U, 98561U, 98563U, 98573U, 98597U, 98621U, 98627U, 98639U,
+98641U, 98663U, 98669U, 98689U, 98711U, 98713U, 98717U, 98729U, 98731U, 98737U,
+98773U, 98779U, 98801U, 98807U, 98809U, 98837U, 98849U, 98867U, 98869U, 98873U,
+98887U, 98893U, 98897U, 98899U, 98909U, 98911U, 98927U, 98929U, 98939U, 98947U,
+98953U, 98963U, 98981U, 98993U, 98999U, 99013U, 99017U, 99023U, 99041U, 99053U,
+99079U, 99083U, 99089U, 99103U, 99109U, 99119U, 99131U, 99133U, 99137U, 99139U,
+99149U, 99173U, 99181U, 99191U, 99223U, 99233U, 99241U, 99251U, 99257U, 99259U,
+99277U, 99289U, 99317U, 99347U, 99349U, 99367U, 99371U, 99377U, 99391U, 99397U,
+99401U, 99409U, 99431U, 99439U, 99469U, 99487U, 99497U, 99523U, 99527U, 99529U,
+99551U, 99559U, 99563U, 99571U, 99577U, 99581U, 99607U, 99611U, 99623U, 99643U,
+99661U, 99667U, 99679U, 99689U, 99707U, 99709U, 99713U, 99719U, 99721U, 99733U,
+99761U, 99767U, 99787U, 99793U, 99809U, 99817U, 99823U, 99829U, 99833U, 99839U,
+99859U, 99871U, 99877U, 99881U, 99901U, 99907U, 99923U, 99929U, 99961U, 99971U,
+99989U, 99991U, 100003U, 100019U, 100043U, 100049U, 100057U, 100069U, 100103U, 100109U,
+100129U, 100151U, 100153U, 100169U, 100183U, 100189U, 100193U, 100207U, 100213U, 100237U,
+100267U, 100271U, 100279U, 100291U, 100297U, 100313U, 100333U, 100343U, 100357U, 100361U,
+100363U, 100379U, 100391U, 100393U, 100403U, 100411U, 100417U, 100447U, 100459U, 100469U,
+100483U, 100493U, 100501U, 100511U, 100517U, 100519U, 100523U, 100537U, 100547U, 100549U,
+100559U, 100591U, 100609U, 100613U, 100621U, 100649U, 100669U, 100673U, 100693U, 100699U,
+100703U, 100733U, 100741U, 100747U, 100769U, 100787U, 100799U, 100801U, 100811U, 100823U,
+100829U, 100847U, 100853U, 100907U, 100913U, 100927U, 100931U, 100937U, 100943U, 100957U,
+100981U, 100987U, 100999U, 101009U, 101021U, 101027U, 101051U, 101063U, 101081U, 101089U,
+101107U, 101111U, 101113U, 101117U, 101119U, 101141U, 101149U, 101159U, 101161U, 101173U,
+101183U, 101197U, 101203U, 101207U, 101209U, 101221U, 101267U, 101273U, 101279U, 101281U,
+101287U, 101293U, 101323U, 101333U, 101341U, 101347U, 101359U, 101363U, 101377U, 101383U,
+101399U, 101411U, 101419U, 101429U, 101449U, 101467U, 101477U, 101483U, 101489U, 101501U,
+101503U, 101513U, 101527U, 101531U, 101533U, 101537U, 101561U, 101573U, 101581U, 101599U,
+101603U, 101611U, 101627U, 101641U, 101653U, 101663U, 101681U, 101693U, 101701U, 101719U,
+101723U, 101737U, 101741U, 101747U, 101749U, 101771U, 101789U, 101797U, 101807U, 101833U,
+101837U, 101839U, 101863U, 101869U, 101873U, 101879U, 101891U, 101917U, 101921U, 101929U,
+101939U, 101957U, 101963U, 101977U, 101987U, 101999U, 102001U, 102013U, 102019U, 102023U,
+102031U, 102043U, 102059U, 102061U, 102071U, 102077U, 102079U, 102101U, 102103U, 102107U,
+102121U, 102139U, 102149U, 102161U, 102181U, 102191U, 102197U, 102199U, 102203U, 102217U,
+102229U, 102233U, 102241U, 102251U, 102253U, 102259U, 102293U, 102299U, 102301U, 102317U,
+102329U, 102337U, 102359U, 102367U, 102397U, 102407U, 102409U, 102433U, 102437U, 102451U,
+102461U, 102481U, 102497U, 102499U, 102503U, 102523U, 102533U, 102539U, 102547U, 102551U,
+102559U, 102563U, 102587U, 102593U, 102607U, 102611U, 102643U, 102647U, 102653U, 102667U,
+102673U, 102677U, 102679U, 102701U, 102761U, 102763U, 102769U, 102793U, 102797U, 102811U,
+102829U, 102841U, 102859U, 102871U, 102877U, 102881U, 102911U, 102913U, 102929U, 102931U,
+102953U, 102967U, 102983U, 103001U, 103007U, 103043U, 103049U, 103067U, 103069U, 103079U,
+103087U, 103091U, 103093U, 103099U, 103123U, 103141U, 103171U, 103177U, 103183U, 103217U,
+103231U, 103237U, 103289U, 103291U, 103307U, 103319U, 103333U, 103349U, 103357U, 103387U,
+103391U, 103393U, 103399U, 103409U, 103421U, 103423U, 103451U, 103457U, 103471U, 103483U,
+103511U, 103529U, 103549U, 103553U, 103561U, 103567U, 103573U, 103577U, 103583U, 103591U,
+103613U, 103619U, 103643U, 103651U, 103657U, 103669U, 103681U, 103687U, 103699U, 103703U,
+103723U, 103769U, 103787U, 103801U, 103811U, 103813U, 103837U, 103841U, 103843U, 103867U,
+103889U, 103903U, 103913U, 103919U, 103951U, 103963U, 103967U, 103969U, 103979U, 103981U,
+103991U, 103993U, 103997U, 104003U, 104009U, 104021U, 104033U, 104047U, 104053U, 104059U,
+104087U, 104089U, 104107U, 104113U, 104119U, 104123U, 104147U, 104149U, 104161U, 104173U,
+104179U, 104183U, 104207U, 104231U, 104233U, 104239U, 104243U, 104281U, 104287U, 104297U,
+104309U, 104311U, 104323U, 104327U, 104347U, 104369U, 104381U, 104383U, 104393U, 104399U,
+104417U, 104459U, 104471U, 104473U, 104479U, 104491U, 104513U, 104527U, 104537U, 104543U,
+104549U, 104551U, 104561U, 104579U, 104593U, 104597U, 104623U, 104639U, 104651U, 104659U,
+104677U, 104681U, 104683U, 104693U, 104701U, 104707U, 104711U, 104717U, 104723U, 104729U,
+104743U, 104759U, 104761U, 104773U, 104779U, 104789U, 104801U, 104803U, 104827U, 104831U,
+104849U, 104851U, 104869U, 104879U, 104891U, 104911U, 104917U, 104933U, 104947U, 104953U,
+104959U, 104971U, 104987U, 104999U, 105019U, 105023U, 105031U, 105037U, 105071U, 105097U,
+105107U, 105137U, 105143U, 105167U, 105173U, 105199U, 105211U, 105227U, 105229U, 105239U,
+105251U, 105253U, 105263U, 105269U, 105277U, 105319U, 105323U, 105331U, 105337U, 105341U,
+105359U, 105361U, 105367U, 105373U, 105379U, 105389U, 105397U, 105401U, 105407U, 105437U,
+105449U, 105467U, 105491U, 105499U, 105503U, 105509U, 105517U, 105527U, 105529U, 105533U,
+105541U, 105557U, 105563U, 105601U, 105607U, 105613U, 105619U, 105649U, 105653U, 105667U,
+105673U, 105683U, 105691U, 105701U, 105727U, 105733U, 105751U, 105761U, 105767U, 105769U,
+105817U, 105829U, 105863U, 105871U, 105883U, 105899U, 105907U, 105913U, 105929U, 105943U,
+105953U, 105967U, 105971U, 105977U, 105983U, 105997U, 106013U, 106019U, 106031U, 106033U,
+106087U, 106103U, 106109U, 106121U, 106123U, 106129U, 106163U, 106181U, 106187U, 106189U,
+106207U, 106213U, 106217U, 106219U, 106243U, 106261U, 106273U, 106277U, 106279U, 106291U,
+106297U, 106303U, 106307U, 106319U, 106321U, 106331U, 106349U, 106357U, 106363U, 106367U,
+106373U, 106391U, 106397U, 106411U, 106417U, 106427U, 106433U, 106441U, 106451U, 106453U,
+106487U, 106501U, 106531U, 106537U, 106541U, 106543U, 106591U, 106619U, 106621U, 106627U,
+106637U, 106649U, 106657U, 106661U, 106663U, 106669U, 106681U, 106693U, 106699U, 106703U,
+106721U, 106727U, 106739U, 106747U, 106751U, 106753U, 106759U, 106781U, 106783U, 106787U,
+106801U, 106823U, 106853U, 106859U, 106861U, 106867U, 106871U, 106877U, 106903U, 106907U,
+106921U, 106937U, 106949U, 106957U, 106961U, 106963U, 106979U, 106993U, 107021U, 107033U,
+107053U, 107057U, 107069U, 107071U, 107077U, 107089U, 107099U, 107101U, 107119U, 107123U,
+107137U, 107171U, 107183U, 107197U, 107201U, 107209U, 107227U, 107243U, 107251U, 107269U,
+107273U, 107279U, 107309U, 107323U, 107339U, 107347U, 107351U, 107357U, 107377U, 107441U,
+107449U, 107453U, 107467U, 107473U, 107507U, 107509U, 107563U, 107581U, 107599U, 107603U,
+107609U, 107621U, 107641U, 107647U, 107671U, 107687U, 107693U, 107699U, 107713U, 107717U,
+107719U, 107741U, 107747U, 107761U, 107773U, 107777U, 107791U, 107827U, 107837U, 107839U,
+107843U, 107857U, 107867U, 107873U, 107881U, 107897U, 107903U, 107923U, 107927U, 107941U,
+107951U, 107971U, 107981U, 107999U, 108007U, 108011U, 108013U, 108023U, 108037U, 108041U,
+108061U, 108079U, 108089U, 108107U, 108109U, 108127U, 108131U, 108139U, 108161U, 108179U,
+108187U, 108191U, 108193U, 108203U, 108211U, 108217U, 108223U, 108233U, 108247U, 108263U,
+108271U, 108287U, 108289U, 108293U, 108301U, 108343U, 108347U, 108359U, 108377U, 108379U,
+108401U, 108413U, 108421U, 108439U, 108457U, 108461U, 108463U, 108497U, 108499U, 108503U,
+108517U, 108529U, 108533U, 108541U, 108553U, 108557U, 108571U, 108587U, 108631U, 108637U,
+108643U, 108649U, 108677U, 108707U, 108709U, 108727U, 108739U, 108751U, 108761U, 108769U,
+108791U, 108793U, 108799U, 108803U, 108821U, 108827U, 108863U, 108869U, 108877U, 108881U,
+108883U, 108887U, 108893U, 108907U, 108917U, 108923U, 108929U, 108943U, 108947U, 108949U,
+108959U, 108961U, 108967U, 108971U, 108991U, 109001U, 109013U, 109037U, 109049U, 109063U,
+109073U, 109097U, 109103U, 109111U, 109121U, 109133U, 109139U, 109141U, 109147U, 109159U,
+109169U, 109171U, 109199U, 109201U, 109211U, 109229U, 109253U, 109267U, 109279U, 109297U,
+109303U, 109313U, 109321U, 109331U, 109357U, 109363U, 109367U, 109379U, 109387U, 109391U,
+109397U, 109423U, 109433U, 109441U, 109451U, 109453U, 109469U, 109471U, 109481U, 109507U,
+109517U, 109519U, 109537U, 109541U, 109547U, 109567U, 109579U, 109583U, 109589U, 109597U,
+109609U, 109619U, 109621U, 109639U, 109661U, 109663U, 109673U, 109717U, 109721U, 109741U,
+109751U, 109789U, 109793U, 109807U, 109819U, 109829U, 109831U, 109841U, 109843U, 109847U,
+109849U, 109859U, 109873U, 109883U, 109891U, 109897U, 109903U, 109913U, 109919U, 109937U,
+109943U, 109961U, 109987U, 110017U, 110023U, 110039U, 110051U, 110059U, 110063U, 110069U,
+110083U, 110119U, 110129U, 110161U, 110183U, 110221U, 110233U, 110237U, 110251U, 110261U,
+110269U, 110273U, 110281U, 110291U, 110311U, 110321U, 110323U, 110339U, 110359U, 110419U,
+110431U, 110437U, 110441U, 110459U, 110477U, 110479U, 110491U, 110501U, 110503U, 110527U,
+110533U, 110543U, 110557U, 110563U, 110567U, 110569U, 110573U, 110581U, 110587U, 110597U,
+110603U, 110609U, 110623U, 110629U, 110641U, 110647U, 110651U, 110681U, 110711U, 110729U,
+110731U, 110749U, 110753U, 110771U, 110777U, 110807U, 110813U, 110819U, 110821U, 110849U,
+110863U, 110879U, 110881U, 110899U, 110909U, 110917U, 110921U, 110923U, 110927U, 110933U,
+110939U, 110947U, 110951U, 110969U, 110977U, 110989U, 111029U, 111031U, 111043U, 111049U,
+111053U, 111091U, 111103U, 111109U, 111119U, 111121U, 111127U, 111143U, 111149U, 111187U,
+111191U, 111211U, 111217U, 111227U, 111229U, 111253U, 111263U, 111269U, 111271U, 111301U,
+111317U, 111323U, 111337U, 111341U, 111347U, 111373U, 111409U, 111427U, 111431U, 111439U,
+111443U, 111467U, 111487U, 111491U, 111493U, 111497U, 111509U, 111521U, 111533U, 111539U,
+111577U, 111581U, 111593U, 111599U, 111611U, 111623U, 111637U, 111641U, 111653U, 111659U,
+111667U, 111697U, 111721U, 111731U, 111733U, 111751U, 111767U, 111773U, 111779U, 111781U,
+111791U, 111799U, 111821U, 111827U, 111829U, 111833U, 111847U, 111857U, 111863U, 111869U,
+111871U, 111893U, 111913U, 111919U, 111949U, 111953U, 111959U, 111973U, 111977U, 111997U,
+112019U, 112031U, 112061U, 112067U, 112069U, 112087U, 112097U, 112103U, 112111U, 112121U,
+112129U, 112139U, 112153U, 112163U, 112181U, 112199U, 112207U, 112213U, 112223U, 112237U,
+112241U, 112247U, 112249U, 112253U, 112261U, 112279U, 112289U, 112291U, 112297U, 112303U,
+112327U, 112331U, 112337U, 112339U, 112349U, 112361U, 112363U, 112397U, 112403U, 112429U,
+112459U, 112481U, 112501U, 112507U, 112543U, 112559U, 112571U, 112573U, 112577U, 112583U,
+112589U, 112601U, 112603U, 112621U, 112643U, 112657U, 112663U, 112687U, 112691U, 112741U,
+112757U, 112759U, 112771U, 112787U, 112799U, 112807U, 112831U, 112843U, 112859U, 112877U,
+112901U, 112909U, 112913U, 112919U, 112921U, 112927U, 112939U, 112951U, 112967U, 112979U,
+112997U, 113011U, 113017U, 113021U, 113023U, 113027U, 113039U, 113041U, 113051U, 113063U,
+113081U, 113083U, 113089U, 113093U, 113111U, 113117U, 113123U, 113131U, 113143U, 113147U,
+113149U, 113153U, 113159U, 113161U, 113167U, 113171U, 113173U, 113177U, 113189U, 113209U,
+113213U, 113227U, 113233U, 113279U, 113287U, 113327U, 113329U, 113341U, 113357U, 113359U,
+113363U, 113371U, 113381U, 113383U, 113417U, 113437U, 113453U, 113467U, 113489U, 113497U,
+113501U, 113513U, 113537U, 113539U, 113557U, 113567U, 113591U, 113621U, 113623U, 113647U,
+113657U, 113683U, 113717U, 113719U, 113723U, 113731U, 113749U, 113759U, 113761U, 113777U,
+113779U, 113783U, 113797U, 113809U, 113819U, 113837U, 113843U, 113891U, 113899U, 113903U,
+113909U, 113921U, 113933U, 113947U, 113957U, 113963U, 113969U, 113983U, 113989U, 114001U,
+114013U, 114031U, 114041U, 114043U, 114067U, 114073U, 114077U, 114083U, 114089U, 114113U,
+114143U, 114157U, 114161U, 114167U, 114193U, 114197U, 114199U, 114203U, 114217U, 114221U,
+114229U, 114259U, 114269U, 114277U, 114281U, 114299U, 114311U, 114319U, 114329U, 114343U,
+114371U, 114377U, 114407U, 114419U, 114451U, 114467U, 114473U, 114479U, 114487U, 114493U,
+114547U, 114553U, 114571U, 114577U, 114593U, 114599U, 114601U, 114613U, 114617U, 114641U,
+114643U, 114649U, 114659U, 114661U, 114671U, 114679U, 114689U, 114691U, 114713U, 114743U,
+114749U, 114757U, 114761U, 114769U, 114773U, 114781U, 114797U, 114799U, 114809U, 114827U,
+114833U, 114847U, 114859U, 114883U, 114889U, 114901U, 114913U, 114941U, 114967U, 114973U,
+114997U, 115001U, 115013U, 115019U, 115021U, 115057U, 115061U, 115067U, 115079U, 115099U,
+115117U, 115123U, 115127U, 115133U, 115151U, 115153U, 115163U, 115183U, 115201U, 115211U,
+115223U, 115237U, 115249U, 115259U, 115279U, 115301U, 115303U, 115309U, 115319U, 115321U,
+115327U, 115331U, 115337U, 115343U, 115361U, 115363U, 115399U, 115421U, 115429U, 115459U,
+115469U, 115471U, 115499U, 115513U, 115523U, 115547U, 115553U, 115561U, 115571U, 115589U,
+115597U, 115601U, 115603U, 115613U, 115631U, 115637U, 115657U, 115663U, 115679U, 115693U,
+115727U, 115733U, 115741U, 115751U, 115757U, 115763U, 115769U, 115771U, 115777U, 115781U,
+115783U, 115793U, 115807U, 115811U, 115823U, 115831U, 115837U, 115849U, 115853U, 115859U,
+115861U, 115873U, 115877U, 115879U, 115883U, 115891U, 115901U, 115903U, 115931U, 115933U,
+115963U, 115979U, 115981U, 115987U, 116009U, 116027U, 116041U, 116047U, 116089U, 116099U,
+116101U, 116107U, 116113U, 116131U, 116141U, 116159U, 116167U, 116177U, 116189U, 116191U,
+116201U, 116239U, 116243U, 116257U, 116269U, 116273U, 116279U, 116293U, 116329U, 116341U,
+116351U, 116359U, 116371U, 116381U, 116387U, 116411U, 116423U, 116437U, 116443U, 116447U,
+116461U, 116471U, 116483U, 116491U, 116507U, 116531U, 116533U, 116537U, 116539U, 116549U,
+116579U, 116593U, 116639U, 116657U, 116663U, 116681U, 116687U, 116689U, 116707U, 116719U,
+116731U, 116741U, 116747U, 116789U, 116791U, 116797U, 116803U, 116819U, 116827U, 116833U,
+116849U, 116867U, 116881U, 116903U, 116911U, 116923U, 116927U, 116929U, 116933U, 116953U,
+116959U, 116969U, 116981U, 116989U, 116993U, 117017U, 117023U, 117037U, 117041U, 117043U,
+117053U, 117071U, 117101U, 117109U, 117119U, 117127U, 117133U, 117163U, 117167U, 117191U,
+117193U, 117203U, 117209U, 117223U, 117239U, 117241U, 117251U, 117259U, 117269U, 117281U,
+117307U, 117319U, 117329U, 117331U, 117353U, 117361U, 117371U, 117373U, 117389U, 117413U,
+117427U, 117431U, 117437U, 117443U, 117497U, 117499U, 117503U, 117511U, 117517U, 117529U,
+117539U, 117541U, 117563U, 117571U, 117577U, 117617U, 117619U, 117643U, 117659U, 117671U,
+117673U, 117679U, 117701U, 117703U, 117709U, 117721U, 117727U, 117731U, 117751U, 117757U,
+117763U, 117773U, 117779U, 117787U, 117797U, 117809U, 117811U, 117833U, 117839U, 117841U,
+117851U, 117877U, 117881U, 117883U, 117889U, 117899U, 117911U, 117917U, 117937U, 117959U,
+117973U, 117977U, 117979U, 117989U, 117991U, 118033U, 118037U, 118043U, 118051U, 118057U,
+118061U, 118081U, 118093U, 118127U, 118147U, 118163U, 118169U, 118171U, 118189U, 118211U,
+118213U, 118219U, 118247U, 118249U, 118253U, 118259U, 118273U, 118277U, 118297U, 118343U,
+118361U, 118369U, 118373U, 118387U, 118399U, 118409U, 118411U, 118423U, 118429U, 118453U,
+118457U, 118463U, 118471U, 118493U, 118529U, 118543U, 118549U, 118571U, 118583U, 118589U,
+118603U, 118619U, 118621U, 118633U, 118661U, 118669U, 118673U, 118681U, 118687U, 118691U,
+118709U, 118717U, 118739U, 118747U, 118751U, 118757U, 118787U, 118799U, 118801U, 118819U,
+118831U, 118843U, 118861U, 118873U, 118891U, 118897U, 118901U, 118903U, 118907U, 118913U,
+118927U, 118931U, 118967U, 118973U, 119027U, 119033U, 119039U, 119047U, 119057U, 119069U,
+119083U, 119087U, 119089U, 119099U, 119101U, 119107U, 119129U, 119131U, 119159U, 119173U,
+119179U, 119183U, 119191U, 119227U, 119233U, 119237U, 119243U, 119267U, 119291U, 119293U,
+119297U, 119299U, 119311U, 119321U, 119359U, 119363U, 119389U, 119417U, 119419U, 119429U,
+119447U, 119489U, 119503U, 119513U, 119533U, 119549U, 119551U, 119557U, 119563U, 119569U,
+119591U, 119611U, 119617U, 119627U, 119633U, 119653U, 119657U, 119659U, 119671U, 119677U,
+119687U, 119689U, 119699U, 119701U, 119723U, 119737U, 119747U, 119759U, 119771U, 119773U,
+119783U, 119797U, 119809U, 119813U, 119827U, 119831U, 119839U, 119849U, 119851U, 119869U,
+119881U, 119891U, 119921U, 119923U, 119929U, 119953U, 119963U, 119971U, 119981U, 119983U,
+119993U, 120011U, 120017U, 120041U, 120047U, 120049U, 120067U, 120077U, 120079U, 120091U,
+120097U, 120103U, 120121U, 120157U, 120163U, 120167U, 120181U, 120193U, 120199U, 120209U,
+120223U, 120233U, 120247U, 120277U, 120283U, 120293U, 120299U, 120319U, 120331U, 120349U,
+120371U, 120383U, 120391U, 120397U, 120401U, 120413U, 120427U, 120431U, 120473U, 120503U,
+120511U, 120539U, 120551U, 120557U, 120563U, 120569U, 120577U, 120587U, 120607U, 120619U,
+120623U, 120641U, 120647U, 120661U, 120671U, 120677U, 120689U, 120691U, 120709U, 120713U,
+120721U, 120737U, 120739U, 120749U, 120763U, 120767U, 120779U, 120811U, 120817U, 120823U,
+120829U, 120833U, 120847U, 120851U, 120863U, 120871U, 120877U, 120889U, 120899U, 120907U,
+120917U, 120919U, 120929U, 120937U, 120941U, 120943U, 120947U, 120977U, 120997U, 121001U,
+121007U, 121013U, 121019U, 121021U, 121039U, 121061U, 121063U, 121067U, 121081U, 121123U,
+121139U, 121151U, 121157U, 121169U, 121171U, 121181U, 121189U, 121229U, 121259U, 121267U,
+121271U, 121283U, 121291U, 121309U, 121313U, 121321U, 121327U, 121333U, 121343U, 121349U,
+121351U, 121357U, 121367U, 121369U, 121379U, 121403U, 121421U, 121439U, 121441U, 121447U,
+121453U, 121469U, 121487U, 121493U, 121501U, 121507U, 121523U, 121531U, 121547U, 121553U,
+121559U, 121571U, 121577U, 121579U, 121591U, 121607U, 121609U, 121621U, 121631U, 121633U,
+121637U, 121661U, 121687U, 121697U, 121711U, 121721U, 121727U, 121763U, 121787U, 121789U,
+121843U, 121853U, 121867U, 121883U, 121889U, 121909U, 121921U, 121931U, 121937U, 121949U,
+121951U, 121963U, 121967U, 121993U, 121997U, 122011U, 122021U, 122027U, 122029U, 122033U,
+122039U, 122041U, 122051U, 122053U, 122069U, 122081U, 122099U, 122117U, 122131U, 122147U,
+122149U, 122167U, 122173U, 122201U, 122203U, 122207U, 122209U, 122219U, 122231U, 122251U,
+122263U, 122267U, 122273U, 122279U, 122299U, 122321U, 122323U, 122327U, 122347U, 122363U,
+122387U, 122389U, 122393U, 122399U, 122401U, 122443U, 122449U, 122453U, 122471U, 122477U,
+122489U, 122497U, 122501U, 122503U, 122509U, 122527U, 122533U, 122557U, 122561U, 122579U,
+122597U, 122599U, 122609U, 122611U, 122651U, 122653U, 122663U, 122693U, 122701U, 122719U,
+122741U, 122743U, 122753U, 122761U, 122777U, 122789U, 122819U, 122827U, 122833U, 122839U,
+122849U, 122861U, 122867U, 122869U, 122887U, 122891U, 122921U, 122929U, 122939U, 122953U,
+122957U, 122963U, 122971U, 123001U, 123007U, 123017U, 123031U, 123049U, 123059U, 123077U,
+123083U, 123091U, 123113U, 123121U, 123127U, 123143U, 123169U, 123191U, 123203U, 123209U,
+123217U, 123229U, 123239U, 123259U, 123269U, 123289U, 123307U, 123311U, 123323U, 123341U,
+123373U, 123377U, 123379U, 123397U, 123401U, 123407U, 123419U, 123427U, 123433U, 123439U,
+123449U, 123457U, 123479U, 123491U, 123493U, 123499U, 123503U, 123517U, 123527U, 123547U,
+123551U, 123553U, 123581U, 123583U, 123593U, 123601U, 123619U, 123631U, 123637U, 123653U,
+123661U, 123667U, 123677U, 123701U, 123707U, 123719U, 123727U, 123731U, 123733U, 123737U,
+123757U, 123787U, 123791U, 123803U, 123817U, 123821U, 123829U, 123833U, 123853U, 123863U,
+123887U, 123911U, 123923U, 123931U, 123941U, 123953U, 123973U, 123979U, 123983U, 123989U,
+123997U, 124001U, 124021U, 124067U, 124087U, 124097U, 124121U, 124123U, 124133U, 124139U,
+124147U, 124153U, 124171U, 124181U, 124183U, 124193U, 124199U, 124213U, 124231U, 124247U,
+124249U, 124277U, 124291U, 124297U, 124301U, 124303U, 124309U, 124337U, 124339U, 124343U,
+124349U, 124351U, 124363U, 124367U, 124427U, 124429U, 124433U, 124447U, 124459U, 124471U,
+124477U, 124489U, 124493U, 124513U, 124529U, 124541U, 124543U, 124561U, 124567U, 124577U,
+124601U, 124633U, 124643U, 124669U, 124673U, 124679U, 124693U, 124699U, 124703U, 124717U,
+124721U, 124739U, 124753U, 124759U, 124769U, 124771U, 124777U, 124781U, 124783U, 124793U,
+124799U, 124819U, 124823U, 124847U, 124853U, 124897U, 124907U, 124909U, 124919U, 124951U,
+124979U, 124981U, 124987U, 124991U, 125003U, 125017U, 125029U, 125053U, 125063U, 125093U,
+125101U, 125107U, 125113U, 125117U, 125119U, 125131U, 125141U, 125149U, 125183U, 125197U,
+125201U, 125207U, 125219U, 125221U, 125231U, 125243U, 125261U, 125269U, 125287U, 125299U,
+125303U, 125311U, 125329U, 125339U, 125353U, 125371U, 125383U, 125387U, 125399U, 125407U,
+125423U, 125429U, 125441U, 125453U, 125471U, 125497U, 125507U, 125509U, 125527U, 125539U,
+125551U, 125591U, 125597U, 125617U, 125621U, 125627U, 125639U, 125641U, 125651U, 125659U,
+125669U, 125683U, 125687U, 125693U, 125707U, 125711U, 125717U, 125731U, 125737U, 125743U,
+125753U, 125777U, 125789U, 125791U, 125803U, 125813U, 125821U, 125863U, 125887U, 125897U,
+125899U, 125921U, 125927U, 125929U, 125933U, 125941U, 125959U, 125963U, 126001U, 126011U,
+126013U, 126019U, 126023U, 126031U, 126037U, 126041U, 126047U, 126067U, 126079U, 126097U,
+126107U, 126127U, 126131U, 126143U, 126151U, 126173U, 126199U, 126211U, 126223U, 126227U,
+126229U, 126233U, 126241U, 126257U, 126271U, 126307U, 126311U, 126317U, 126323U, 126337U,
+126341U, 126349U, 126359U, 126397U, 126421U, 126433U, 126443U, 126457U, 126461U, 126473U,
+126481U, 126487U, 126491U, 126493U, 126499U, 126517U, 126541U, 126547U, 126551U, 126583U,
+126601U, 126611U, 126613U, 126631U, 126641U, 126653U, 126683U, 126691U, 126703U, 126713U,
+126719U, 126733U, 126739U, 126743U, 126751U, 126757U, 126761U, 126781U, 126823U, 126827U,
+126839U, 126851U, 126857U, 126859U, 126913U, 126923U, 126943U, 126949U, 126961U, 126967U,
+126989U, 127031U, 127033U, 127037U, 127051U, 127079U, 127081U, 127103U, 127123U, 127133U,
+127139U, 127157U, 127163U, 127189U, 127207U, 127217U, 127219U, 127241U, 127247U, 127249U,
+127261U, 127271U, 127277U, 127289U, 127291U, 127297U, 127301U, 127321U, 127331U, 127343U,
+127363U, 127373U, 127399U, 127403U, 127423U, 127447U, 127453U, 127481U, 127487U, 127493U,
+127507U, 127529U, 127541U, 127549U, 127579U, 127583U, 127591U, 127597U, 127601U, 127607U,
+127609U, 127637U, 127643U, 127649U, 127657U, 127663U, 127669U, 127679U, 127681U, 127691U,
+127703U, 127709U, 127711U, 127717U, 127727U, 127733U, 127739U, 127747U, 127763U, 127781U,
+127807U, 127817U, 127819U, 127837U, 127843U, 127849U, 127859U, 127867U, 127873U, 127877U,
+127913U, 127921U, 127931U, 127951U, 127973U, 127979U, 127997U, 128021U, 128033U, 128047U,
+128053U, 128099U, 128111U, 128113U, 128119U, 128147U, 128153U, 128159U, 128173U, 128189U,
+128201U, 128203U, 128213U, 128221U, 128237U, 128239U, 128257U, 128273U, 128287U, 128291U,
+128311U, 128321U, 128327U, 128339U, 128341U, 128347U, 128351U, 128377U, 128389U, 128393U,
+128399U, 128411U, 128413U, 128431U, 128437U, 128449U, 128461U, 128467U, 128473U, 128477U,
+128483U, 128489U, 128509U, 128519U, 128521U, 128549U, 128551U, 128563U, 128591U, 128599U,
+128603U, 128621U, 128629U, 128657U, 128659U, 128663U, 128669U, 128677U, 128683U, 128693U,
+128717U, 128747U, 128749U, 128761U, 128767U, 128813U, 128819U, 128831U, 128833U, 128837U,
+128857U, 128861U, 128873U, 128879U, 128903U, 128923U, 128939U, 128941U, 128951U, 128959U,
+128969U, 128971U, 128981U, 128983U, 128987U, 128993U, 129001U, 129011U, 129023U, 129037U,
+129049U, 129061U, 129083U, 129089U, 129097U, 129113U, 129119U, 129121U, 129127U, 129169U,
+129187U, 129193U, 129197U, 129209U, 129221U, 129223U, 129229U, 129263U, 129277U, 129281U,
+129287U, 129289U, 129293U, 129313U, 129341U, 129347U, 129361U, 129379U, 129401U, 129403U,
+129419U, 129439U, 129443U, 129449U, 129457U, 129461U, 129469U, 129491U, 129497U, 129499U,
+129509U, 129517U, 129527U, 129529U, 129533U, 129539U, 129553U, 129581U, 129587U, 129589U,
+129593U, 129607U, 129629U, 129631U, 129641U, 129643U, 129671U, 129707U, 129719U, 129733U,
+129737U, 129749U, 129757U, 129763U, 129769U, 129793U, 129803U, 129841U, 129853U, 129887U,
+129893U, 129901U, 129917U, 129919U, 129937U, 129953U, 129959U, 129967U, 129971U, 130003U,
+130021U, 130027U, 130043U, 130051U, 130057U, 130069U, 130073U, 130079U, 130087U, 130099U,
+130121U, 130127U, 130147U, 130171U, 130183U, 130199U, 130201U, 130211U, 130223U, 130241U,
+130253U, 130259U, 130261U, 130267U, 130279U, 130303U, 130307U, 130337U, 130343U, 130349U,
+130363U, 130367U, 130369U, 130379U, 130399U, 130409U, 130411U, 130423U, 130439U, 130447U,
+130457U, 130469U, 130477U, 130483U, 130489U, 130513U, 130517U, 130523U, 130531U, 130547U,
+130553U, 130579U, 130589U, 130619U, 130621U, 130631U, 130633U, 130639U, 130643U, 130649U,
+130651U, 130657U, 130681U, 130687U, 130693U, 130699U, 130729U, 130769U, 130783U, 130787U,
+130807U, 130811U, 130817U, 130829U, 130841U, 130843U, 130859U, 130873U, 130927U, 130957U,
+130969U, 130973U, 130981U, 130987U, 131009U, 131011U, 131023U, 131041U, 131059U, 131063U,
+131071U, 131101U, 131111U, 131113U, 131129U, 131143U, 131149U, 131171U, 131203U, 131213U,
+131221U, 131231U, 131249U, 131251U, 131267U, 131293U, 131297U, 131303U, 131311U, 131317U,
+131321U, 131357U, 131363U, 131371U, 131381U, 131413U, 131431U, 131437U, 131441U, 131447U,
+131449U, 131477U, 131479U, 131489U, 131497U, 131501U, 131507U, 131519U, 131543U, 131561U,
+131581U, 131591U, 131611U, 131617U, 131627U, 131639U, 131641U, 131671U, 131687U, 131701U,
+131707U, 131711U, 131713U, 131731U, 131743U, 131749U, 131759U, 131771U, 131777U, 131779U,
+131783U, 131797U, 131837U, 131839U, 131849U, 131861U, 131891U, 131893U, 131899U, 131909U,
+131927U, 131933U, 131939U, 131941U, 131947U, 131959U, 131969U, 132001U, 132019U, 132047U,
+132049U, 132059U, 132071U, 132103U, 132109U, 132113U, 132137U, 132151U, 132157U, 132169U,
+132173U, 132199U, 132229U, 132233U, 132241U, 132247U, 132257U, 132263U, 132283U, 132287U,
+132299U, 132313U, 132329U, 132331U, 132347U, 132361U, 132367U, 132371U, 132383U, 132403U,
+132409U, 132421U, 132437U, 132439U, 132469U, 132491U, 132499U, 132511U, 132523U, 132527U,
+132529U, 132533U, 132541U, 132547U, 132589U, 132607U, 132611U, 132619U, 132623U, 132631U,
+132637U, 132647U, 132661U, 132667U, 132679U, 132689U, 132697U, 132701U, 132707U, 132709U,
+132721U, 132739U, 132749U, 132751U, 132757U, 132761U, 132763U, 132817U, 132833U, 132851U,
+132857U, 132859U, 132863U, 132887U, 132893U, 132911U, 132929U, 132947U, 132949U, 132953U,
+132961U, 132967U, 132971U, 132989U, 133013U, 133033U, 133039U, 133051U, 133069U, 133073U,
+133087U, 133097U, 133103U, 133109U, 133117U, 133121U, 133153U, 133157U, 133169U, 133183U,
+133187U, 133201U, 133213U, 133241U, 133253U, 133261U, 133271U, 133277U, 133279U, 133283U,
+133303U, 133319U, 133321U, 133327U, 133337U, 133349U, 133351U, 133379U, 133387U, 133391U,
+133403U, 133417U, 133439U, 133447U, 133451U, 133481U, 133493U, 133499U, 133519U, 133541U,
+133543U, 133559U, 133571U, 133583U, 133597U, 133631U, 133633U, 133649U, 133657U, 133669U,
+133673U, 133691U, 133697U, 133709U, 133711U, 133717U, 133723U, 133733U, 133769U, 133781U,
+133801U, 133811U, 133813U, 133831U, 133843U, 133853U, 133873U, 133877U, 133919U, 133949U,
+133963U, 133967U, 133979U, 133981U, 133993U, 133999U, 134033U, 134039U, 134047U, 134053U,
+134059U, 134077U, 134081U, 134087U, 134089U, 134093U, 134129U, 134153U, 134161U, 134171U,
+134177U, 134191U, 134207U, 134213U, 134219U, 134227U, 134243U, 134257U, 134263U, 134269U,
+134287U, 134291U, 134293U, 134327U, 134333U, 134339U, 134341U, 134353U, 134359U, 134363U,
+134369U, 134371U, 134399U, 134401U, 134417U, 134437U, 134443U, 134471U, 134489U, 134503U,
+134507U, 134513U, 134581U, 134587U, 134591U, 134593U, 134597U, 134609U, 134639U, 134669U,
+134677U, 134681U, 134683U, 134699U, 134707U, 134731U, 134741U, 134753U, 134777U, 134789U,
+134807U, 134837U, 134839U, 134851U, 134857U, 134867U, 134873U, 134887U, 134909U, 134917U,
+134921U, 134923U, 134947U, 134951U, 134989U, 134999U, 135007U, 135017U, 135019U, 135029U,
+135043U, 135049U, 135059U, 135077U, 135089U, 135101U, 135119U, 135131U, 135151U, 135173U,
+135181U, 135193U, 135197U, 135209U, 135211U, 135221U, 135241U, 135257U, 135271U, 135277U,
+135281U, 135283U, 135301U, 135319U, 135329U, 135347U, 135349U, 135353U, 135367U, 135389U,
+135391U, 135403U, 135409U, 135427U, 135431U, 135433U, 135449U, 135461U, 135463U, 135467U,
+135469U, 135479U, 135497U, 135511U, 135533U, 135559U, 135571U, 135581U, 135589U, 135593U,
+135599U, 135601U, 135607U, 135613U, 135617U, 135623U, 135637U, 135647U, 135649U, 135661U,
+135671U, 135697U, 135701U, 135719U, 135721U, 135727U, 135731U, 135743U, 135757U, 135781U,
+135787U, 135799U, 135829U, 135841U, 135851U, 135859U, 135887U, 135893U, 135899U, 135911U,
+135913U, 135929U, 135937U, 135977U, 135979U, 136013U, 136027U, 136033U, 136043U, 136057U,
+136067U, 136069U, 136093U, 136099U, 136111U, 136133U, 136139U, 136163U, 136177U, 136189U,
+136193U, 136207U, 136217U, 136223U, 136237U, 136247U, 136261U, 136273U, 136277U, 136303U,
+136309U, 136319U, 136327U, 136333U, 136337U, 136343U, 136351U, 136361U, 136373U, 136379U,
+136393U, 136397U, 136399U, 136403U, 136417U, 136421U, 136429U, 136447U, 136453U, 136463U,
+136471U, 136481U, 136483U, 136501U, 136511U, 136519U, 136523U, 136531U, 136537U, 136541U,
+136547U, 136559U, 136573U, 136601U, 136603U, 136607U, 136621U, 136649U, 136651U, 136657U,
+136691U, 136693U, 136709U, 136711U, 136727U, 136733U, 136739U, 136751U, 136753U, 136769U,
+136777U, 136811U, 136813U, 136841U, 136849U, 136859U, 136861U, 136879U, 136883U, 136889U,
+136897U, 136943U, 136949U, 136951U, 136963U, 136973U, 136979U, 136987U, 136991U, 136993U,
+136999U, 137029U, 137077U, 137087U, 137089U, 137117U, 137119U, 137131U, 137143U, 137147U,
+137153U, 137177U, 137183U, 137191U, 137197U, 137201U, 137209U, 137219U, 137239U, 137251U,
+137273U, 137279U, 137303U, 137321U, 137339U, 137341U, 137353U, 137359U, 137363U, 137369U,
+137383U, 137387U, 137393U, 137399U, 137413U, 137437U, 137443U, 137447U, 137453U, 137477U,
+137483U, 137491U, 137507U, 137519U, 137537U, 137567U, 137573U, 137587U, 137593U, 137597U,
+137623U, 137633U, 137639U, 137653U, 137659U, 137699U, 137707U, 137713U, 137723U, 137737U,
+137743U, 137771U, 137777U, 137791U, 137803U, 137827U, 137831U, 137849U, 137867U, 137869U,
+137873U, 137909U, 137911U, 137927U, 137933U, 137941U, 137947U, 137957U, 137983U, 137993U,
+137999U, 138007U, 138041U, 138053U, 138059U, 138071U, 138077U, 138079U, 138101U, 138107U,
+138113U, 138139U, 138143U, 138157U, 138163U, 138179U, 138181U, 138191U, 138197U, 138209U,
+138239U, 138241U, 138247U, 138251U, 138283U, 138289U, 138311U, 138319U, 138323U, 138337U,
+138349U, 138371U, 138373U, 138389U, 138401U, 138403U, 138407U, 138427U, 138433U, 138449U,
+138451U, 138461U, 138469U, 138493U, 138497U, 138511U, 138517U, 138547U, 138559U, 138563U,
+138569U, 138571U, 138577U, 138581U, 138587U, 138599U, 138617U, 138629U, 138637U, 138641U,
+138647U, 138661U, 138679U, 138683U, 138727U, 138731U, 138739U, 138763U, 138793U, 138797U,
+138799U, 138821U, 138829U, 138841U, 138863U, 138869U, 138883U, 138889U, 138893U, 138899U,
+138917U, 138923U, 138937U, 138959U, 138967U, 138977U, 139021U, 139033U, 139067U, 139079U,
+139091U, 139109U, 139121U, 139123U, 139133U, 139169U, 139177U, 139187U, 139199U, 139201U,
+139241U, 139267U, 139273U, 139291U, 139297U, 139301U, 139303U, 139309U, 139313U, 139333U,
+139339U, 139343U, 139361U, 139367U, 139369U, 139387U, 139393U, 139397U, 139409U, 139423U,
+139429U, 139439U, 139457U, 139459U, 139483U, 139487U, 139493U, 139501U, 139511U, 139537U,
+139547U, 139571U, 139589U, 139591U, 139597U, 139609U, 139619U, 139627U, 139661U, 139663U,
+139681U, 139697U, 139703U, 139709U, 139721U, 139729U, 139739U, 139747U, 139753U, 139759U,
+139787U, 139801U, 139813U, 139831U, 139837U, 139861U, 139871U, 139883U, 139891U, 139901U,
+139907U, 139921U, 139939U, 139943U, 139967U, 139969U, 139981U, 139987U, 139991U, 139999U,
+140009U, 140053U, 140057U, 140069U, 140071U, 140111U, 140123U, 140143U, 140159U, 140167U,
+140171U, 140177U, 140191U, 140197U, 140207U, 140221U, 140227U, 140237U, 140249U, 140263U,
+140269U, 140281U, 140297U, 140317U, 140321U, 140333U, 140339U, 140351U, 140363U, 140381U,
+140401U, 140407U, 140411U, 140417U, 140419U, 140423U, 140443U, 140449U, 140453U, 140473U,
+140477U, 140521U, 140527U, 140533U, 140549U, 140551U, 140557U, 140587U, 140593U, 140603U,
+140611U, 140617U, 140627U, 140629U, 140639U, 140659U, 140663U, 140677U, 140681U, 140683U,
+140689U, 140717U, 140729U, 140731U, 140741U, 140759U, 140761U, 140773U, 140779U, 140797U,
+140813U, 140827U, 140831U, 140837U, 140839U, 140863U, 140867U, 140869U, 140891U, 140893U,
+140897U, 140909U, 140929U, 140939U, 140977U, 140983U, 140989U, 141023U, 141041U, 141061U,
+141067U, 141073U, 141079U, 141101U, 141107U, 141121U, 141131U, 141157U, 141161U, 141179U,
+141181U, 141199U, 141209U, 141221U, 141223U, 141233U, 141241U, 141257U, 141263U, 141269U,
+141277U, 141283U, 141301U, 141307U, 141311U, 141319U, 141353U, 141359U, 141371U, 141397U,
+141403U, 141413U, 141439U, 141443U, 141461U, 141481U, 141497U, 141499U, 141509U, 141511U,
+141529U, 141539U, 141551U, 141587U, 141601U, 141613U, 141619U, 141623U, 141629U, 141637U,
+141649U, 141653U, 141667U, 141671U, 141677U, 141679U, 141689U, 141697U, 141707U, 141709U,
+141719U, 141731U, 141761U, 141767U, 141769U, 141773U, 141793U, 141803U, 141811U, 141829U,
+141833U, 141851U, 141853U, 141863U, 141871U, 141907U, 141917U, 141931U, 141937U, 141941U,
+141959U, 141961U, 141971U, 141991U, 142007U, 142019U, 142031U, 142039U, 142049U, 142057U,
+142061U, 142067U, 142097U, 142099U, 142111U, 142123U, 142151U, 142157U, 142159U, 142169U,
+142183U, 142189U, 142193U, 142211U, 142217U, 142223U, 142231U, 142237U, 142271U, 142297U,
+142319U, 142327U, 142357U, 142369U, 142381U, 142391U, 142403U, 142421U, 142427U, 142433U,
+142453U, 142469U, 142501U, 142529U, 142537U, 142543U, 142547U, 142553U, 142559U, 142567U,
+142573U, 142589U, 142591U, 142601U, 142607U, 142609U, 142619U, 142657U, 142673U, 142697U,
+142699U, 142711U, 142733U, 142757U, 142759U, 142771U, 142787U, 142789U, 142799U, 142811U,
+142837U, 142841U, 142867U, 142871U, 142873U, 142897U, 142903U, 142907U, 142939U, 142949U,
+142963U, 142969U, 142973U, 142979U, 142981U, 142993U, 143053U, 143063U, 143093U, 143107U,
+143111U, 143113U, 143137U, 143141U, 143159U, 143177U, 143197U, 143239U, 143243U, 143249U,
+143257U, 143261U, 143263U, 143281U, 143287U, 143291U, 143329U, 143333U, 143357U, 143387U,
+143401U, 143413U, 143419U, 143443U, 143461U, 143467U, 143477U, 143483U, 143489U, 143501U,
+143503U, 143509U, 143513U, 143519U, 143527U, 143537U, 143551U, 143567U, 143569U, 143573U,
+143593U, 143609U, 143617U, 143629U, 143651U, 143653U, 143669U, 143677U, 143687U, 143699U,
+143711U, 143719U, 143729U, 143743U, 143779U, 143791U, 143797U, 143807U, 143813U, 143821U,
+143827U, 143831U, 143833U, 143873U, 143879U, 143881U, 143909U, 143947U, 143953U, 143971U,
+143977U, 143981U, 143999U, 144013U, 144031U, 144037U, 144061U, 144071U, 144073U, 144103U,
+144139U, 144161U, 144163U, 144167U, 144169U, 144173U, 144203U, 144223U, 144241U, 144247U,
+144253U, 144259U, 144271U, 144289U, 144299U, 144307U, 144311U, 144323U, 144341U, 144349U,
+144379U, 144383U, 144407U, 144409U, 144413U, 144427U, 144439U, 144451U, 144461U, 144479U,
+144481U, 144497U, 144511U, 144539U, 144541U, 144563U, 144569U, 144577U, 144583U, 144589U,
+144593U, 144611U, 144629U, 144659U, 144667U, 144671U, 144701U, 144709U, 144719U, 144731U,
+144737U, 144751U, 144757U, 144763U, 144773U, 144779U, 144791U, 144817U, 144829U, 144839U,
+144847U, 144883U, 144887U, 144889U, 144899U, 144917U, 144931U, 144941U, 144961U, 144967U,
+144973U, 144983U, 145007U, 145009U, 145021U, 145031U, 145037U, 145043U, 145063U, 145069U,
+145091U, 145109U, 145121U, 145133U, 145139U, 145177U, 145193U, 145207U, 145213U, 145219U,
+145253U, 145259U, 145267U, 145283U, 145289U, 145303U, 145307U, 145349U, 145361U, 145381U,
+145391U, 145399U, 145417U, 145423U, 145433U, 145441U, 145451U, 145459U, 145463U, 145471U,
+145477U, 145487U, 145501U, 145511U, 145513U, 145517U, 145531U, 145543U, 145547U, 145549U,
+145577U, 145589U, 145601U, 145603U, 145633U, 145637U, 145643U, 145661U, 145679U, 145681U,
+145687U, 145703U, 145709U, 145721U, 145723U, 145753U, 145757U, 145759U, 145771U, 145777U,
+145799U, 145807U, 145819U, 145823U, 145829U, 145861U, 145879U, 145897U, 145903U, 145931U,
+145933U, 145949U, 145963U, 145967U, 145969U, 145987U, 145991U, 146009U, 146011U, 146021U,
+146023U, 146033U, 146051U, 146057U, 146059U, 146063U, 146077U, 146093U, 146099U, 146117U,
+146141U, 146161U, 146173U, 146191U, 146197U, 146203U, 146213U, 146221U, 146239U, 146249U,
+146273U, 146291U, 146297U, 146299U, 146309U, 146317U, 146323U, 146347U, 146359U, 146369U,
+146381U, 146383U, 146389U, 146407U, 146417U, 146423U, 146437U, 146449U, 146477U, 146513U,
+146519U, 146521U, 146527U, 146539U, 146543U, 146563U, 146581U, 146603U, 146609U, 146617U,
+146639U, 146647U, 146669U, 146677U, 146681U, 146683U, 146701U, 146719U, 146743U, 146749U,
+146767U, 146777U, 146801U, 146807U, 146819U, 146833U, 146837U, 146843U, 146849U, 146857U,
+146891U, 146893U, 146917U, 146921U, 146933U, 146941U, 146953U, 146977U, 146983U, 146987U,
+146989U, 147011U, 147029U, 147031U, 147047U, 147073U, 147083U, 147089U, 147097U, 147107U,
+147137U, 147139U, 147151U, 147163U, 147179U, 147197U, 147209U, 147211U, 147221U, 147227U,
+147229U, 147253U, 147263U, 147283U, 147289U, 147293U, 147299U, 147311U, 147319U, 147331U,
+147341U, 147347U, 147353U, 147377U, 147391U, 147397U, 147401U, 147409U, 147419U, 147449U,
+147451U, 147457U, 147481U, 147487U, 147503U, 147517U, 147541U, 147547U, 147551U, 147557U,
+147571U, 147583U, 147607U, 147613U, 147617U, 147629U, 147647U, 147661U, 147671U, 147673U,
+147689U, 147703U, 147709U, 147727U, 147739U, 147743U, 147761U, 147769U, 147773U, 147779U,
+147787U, 147793U, 147799U, 147811U, 147827U, 147853U, 147859U, 147863U, 147881U, 147919U,
+147937U, 147949U, 147977U, 147997U, 148013U, 148021U, 148061U, 148063U, 148073U, 148079U,
+148091U, 148123U, 148139U, 148147U, 148151U, 148153U, 148157U, 148171U, 148193U, 148199U,
+148201U, 148207U, 148229U, 148243U, 148249U, 148279U, 148301U, 148303U, 148331U, 148339U,
+148361U, 148367U, 148381U, 148387U, 148399U, 148403U, 148411U, 148429U, 148439U, 148457U,
+148469U, 148471U, 148483U, 148501U, 148513U, 148517U, 148531U, 148537U, 148549U, 148573U,
+148579U, 148609U, 148627U, 148633U, 148639U, 148663U, 148667U, 148669U, 148691U, 148693U,
+148711U, 148721U, 148723U, 148727U, 148747U, 148763U, 148781U, 148783U, 148793U, 148817U,
+148829U, 148853U, 148859U, 148861U, 148867U, 148873U, 148891U, 148913U, 148921U, 148927U,
+148931U, 148933U, 148949U, 148957U, 148961U, 148991U, 148997U, 149011U, 149021U, 149027U,
+149033U, 149053U, 149057U, 149059U, 149069U, 149077U, 149087U, 149099U, 149101U, 149111U,
+149113U, 149119U, 149143U, 149153U, 149159U, 149161U, 149173U, 149183U, 149197U, 149213U,
+149239U, 149249U, 149251U, 149257U, 149269U, 149287U, 149297U, 149309U, 149323U, 149333U,
+149341U, 149351U, 149371U, 149377U, 149381U, 149393U, 149399U, 149411U, 149417U, 149419U,
+149423U, 149441U, 149459U, 149489U, 149491U, 149497U, 149503U, 149519U, 149521U, 149531U,
+149533U, 149543U, 149551U, 149561U, 149563U, 149579U, 149603U, 149623U, 149627U, 149629U,
+149689U, 149711U, 149713U, 149717U, 149729U, 149731U, 149749U, 149759U, 149767U, 149771U,
+149791U, 149803U, 149827U, 149837U, 149839U, 149861U, 149867U, 149873U, 149893U, 149899U,
+149909U, 149911U, 149921U, 149939U, 149953U, 149969U, 149971U, 149993U, 150001U, 150011U,
+150041U, 150053U, 150061U, 150067U, 150077U, 150083U, 150089U, 150091U, 150097U, 150107U,
+150131U, 150151U, 150169U, 150193U, 150197U, 150203U, 150209U, 150211U, 150217U, 150221U,
+150223U, 150239U, 150247U, 150287U, 150299U, 150301U, 150323U, 150329U, 150343U, 150373U,
+150377U, 150379U, 150383U, 150401U, 150407U, 150413U, 150427U, 150431U, 150439U, 150473U,
+150497U, 150503U, 150517U, 150523U, 150533U, 150551U, 150559U, 150571U, 150583U, 150587U,
+150589U, 150607U, 150611U, 150617U, 150649U, 150659U, 150697U, 150707U, 150721U, 150743U,
+150767U, 150769U, 150779U, 150791U, 150797U, 150827U, 150833U, 150847U, 150869U, 150881U,
+150883U, 150889U, 150893U, 150901U, 150907U, 150919U, 150929U, 150959U, 150961U, 150967U,
+150979U, 150989U, 150991U, 151007U, 151009U, 151013U, 151027U, 151049U, 151051U, 151057U,
+151091U, 151121U, 151141U, 151153U, 151157U, 151163U, 151169U, 151171U, 151189U, 151201U,
+151213U, 151237U, 151241U, 151243U, 151247U, 151253U, 151273U, 151279U, 151289U, 151303U,
+151337U, 151339U, 151343U, 151357U, 151379U, 151381U, 151391U, 151397U, 151423U, 151429U,
+151433U, 151451U, 151471U, 151477U, 151483U, 151499U, 151507U, 151517U, 151523U, 151531U,
+151537U, 151549U, 151553U, 151561U, 151573U, 151579U, 151597U, 151603U, 151607U, 151609U,
+151631U, 151637U, 151643U, 151651U, 151667U, 151673U, 151681U, 151687U, 151693U, 151703U,
+151717U, 151729U, 151733U, 151769U, 151771U, 151783U, 151787U, 151799U, 151813U, 151817U,
+151841U, 151847U, 151849U, 151871U, 151883U, 151897U, 151901U, 151903U, 151909U, 151937U,
+151939U, 151967U, 151969U, 152003U, 152017U, 152027U, 152029U, 152039U, 152041U, 152063U,
+152077U, 152081U, 152083U, 152093U, 152111U, 152123U, 152147U, 152183U, 152189U, 152197U,
+152203U, 152213U, 152219U, 152231U, 152239U, 152249U, 152267U, 152287U, 152293U, 152297U,
+152311U, 152363U, 152377U, 152381U, 152389U, 152393U, 152407U, 152417U, 152419U, 152423U,
+152429U, 152441U, 152443U, 152459U, 152461U, 152501U, 152519U, 152531U, 152533U, 152539U,
+152563U, 152567U, 152597U, 152599U, 152617U, 152623U, 152629U, 152639U, 152641U, 152657U,
+152671U, 152681U, 152717U, 152723U, 152729U, 152753U, 152767U, 152777U, 152783U, 152791U,
+152809U, 152819U, 152821U, 152833U, 152837U, 152839U, 152843U, 152851U, 152857U, 152879U,
+152897U, 152899U, 152909U, 152939U, 152941U, 152947U, 152953U, 152959U, 152981U, 152989U,
+152993U, 153001U, 153059U, 153067U, 153071U, 153073U, 153077U, 153089U, 153107U, 153113U,
+153133U, 153137U, 153151U, 153191U, 153247U, 153259U, 153269U, 153271U, 153277U, 153281U,
+153287U, 153313U, 153319U, 153337U, 153343U, 153353U, 153359U, 153371U, 153379U, 153407U,
+153409U, 153421U, 153427U, 153437U, 153443U, 153449U, 153457U, 153469U, 153487U, 153499U,
+153509U, 153511U, 153521U, 153523U, 153529U, 153533U, 153557U, 153563U, 153589U, 153607U,
+153611U, 153623U, 153641U, 153649U, 153689U, 153701U, 153719U, 153733U, 153739U, 153743U,
+153749U, 153757U, 153763U, 153817U, 153841U, 153871U, 153877U, 153887U, 153889U, 153911U,
+153913U, 153929U, 153941U, 153947U, 153949U, 153953U, 153991U, 153997U, 154001U, 154027U,
+154043U, 154057U, 154061U, 154067U, 154073U, 154079U, 154081U, 154087U, 154097U, 154111U,
+154127U, 154153U, 154157U, 154159U, 154181U, 154183U, 154211U, 154213U, 154229U, 154243U,
+154247U, 154267U, 154277U, 154279U, 154291U, 154303U, 154313U, 154321U, 154333U, 154339U,
+154351U, 154369U, 154373U, 154387U, 154409U, 154417U, 154423U, 154439U, 154459U, 154487U,
+154493U, 154501U, 154523U, 154543U, 154571U, 154573U, 154579U, 154589U, 154591U, 154613U,
+154619U, 154621U, 154643U, 154667U, 154669U, 154681U, 154691U, 154699U, 154723U, 154727U,
+154733U, 154747U, 154753U, 154769U, 154787U, 154789U, 154799U, 154807U, 154823U, 154841U,
+154849U, 154871U, 154873U, 154877U, 154883U, 154897U, 154927U, 154933U, 154937U, 154943U,
+154981U, 154991U, 155003U, 155009U, 155017U, 155027U, 155047U, 155069U, 155081U, 155083U,
+155087U, 155119U, 155137U, 155153U, 155161U, 155167U, 155171U, 155191U, 155201U, 155203U,
+155209U, 155219U, 155231U, 155251U, 155269U, 155291U, 155299U, 155303U, 155317U, 155327U,
+155333U, 155371U, 155377U, 155381U, 155383U, 155387U, 155399U, 155413U, 155423U, 155443U,
+155453U, 155461U, 155473U, 155501U, 155509U, 155521U, 155537U, 155539U, 155557U, 155569U,
+155579U, 155581U, 155593U, 155599U, 155609U, 155621U, 155627U, 155653U, 155657U, 155663U,
+155671U, 155689U, 155693U, 155699U, 155707U, 155717U, 155719U, 155723U, 155731U, 155741U,
+155747U, 155773U, 155777U, 155783U, 155797U, 155801U, 155809U, 155821U, 155833U, 155849U,
+155851U, 155861U, 155863U, 155887U, 155891U, 155893U, 155921U, 156007U, 156011U, 156019U,
+156041U, 156059U, 156061U, 156071U, 156089U, 156109U, 156119U, 156127U, 156131U, 156139U,
+156151U, 156157U, 156217U, 156227U, 156229U, 156241U, 156253U, 156257U, 156259U, 156269U,
+156307U, 156319U, 156329U, 156347U, 156353U, 156361U, 156371U, 156419U, 156421U, 156437U,
+156467U, 156487U, 156491U, 156493U, 156511U, 156521U, 156539U, 156577U, 156589U, 156593U,
+156601U, 156619U, 156623U, 156631U, 156641U, 156659U, 156671U, 156677U, 156679U, 156683U,
+156691U, 156703U, 156707U, 156719U, 156727U, 156733U, 156749U, 156781U, 156797U, 156799U,
+156817U, 156823U, 156833U, 156841U, 156887U, 156899U, 156901U, 156913U, 156941U, 156943U,
+156967U, 156971U, 156979U, 157007U, 157013U, 157019U, 157037U, 157049U, 157051U, 157057U,
+157061U, 157081U, 157103U, 157109U, 157127U, 157133U, 157141U, 157163U, 157177U, 157181U,
+157189U, 157207U, 157211U, 157217U, 157219U, 157229U, 157231U, 157243U, 157247U, 157253U,
+157259U, 157271U, 157273U, 157277U, 157279U, 157291U, 157303U, 157307U, 157321U, 157327U,
+157349U, 157351U, 157363U, 157393U, 157411U, 157427U, 157429U, 157433U, 157457U, 157477U,
+157483U, 157489U, 157513U, 157519U, 157523U, 157543U, 157559U, 157561U, 157571U, 157579U,
+157627U, 157637U, 157639U, 157649U, 157667U, 157669U, 157679U, 157721U, 157733U, 157739U,
+157747U, 157769U, 157771U, 157793U, 157799U, 157813U, 157823U, 157831U, 157837U, 157841U,
+157867U, 157877U, 157889U, 157897U, 157901U, 157907U, 157931U, 157933U, 157951U, 157991U,
+157999U, 158003U, 158009U, 158017U, 158029U, 158047U, 158071U, 158077U, 158113U, 158129U,
+158141U, 158143U, 158161U, 158189U, 158201U, 158209U, 158227U, 158231U, 158233U, 158243U,
+158261U, 158269U, 158293U, 158303U, 158329U, 158341U, 158351U, 158357U, 158359U, 158363U,
+158371U, 158393U, 158407U, 158419U, 158429U, 158443U, 158449U, 158489U, 158507U, 158519U,
+158527U, 158537U, 158551U, 158563U, 158567U, 158573U, 158581U, 158591U, 158597U, 158611U,
+158617U, 158621U, 158633U, 158647U, 158657U, 158663U, 158699U, 158731U, 158747U, 158749U,
+158759U, 158761U, 158771U, 158777U, 158791U, 158803U, 158843U, 158849U, 158863U, 158867U,
+158881U, 158909U, 158923U, 158927U, 158941U, 158959U, 158981U, 158993U, 159013U, 159017U,
+159023U, 159059U, 159073U, 159079U, 159097U, 159113U, 159119U, 159157U, 159161U, 159167U,
+159169U, 159179U, 159191U, 159193U, 159199U, 159209U, 159223U, 159227U, 159233U, 159287U,
+159293U, 159311U, 159319U, 159337U, 159347U, 159349U, 159361U, 159389U, 159403U, 159407U,
+159421U, 159431U, 159437U, 159457U, 159463U, 159469U, 159473U, 159491U, 159499U, 159503U,
+159521U, 159539U, 159541U, 159553U, 159563U, 159569U, 159571U, 159589U, 159617U, 159623U,
+159629U, 159631U, 159667U, 159671U, 159673U, 159683U, 159697U, 159701U, 159707U, 159721U,
+159737U, 159739U, 159763U, 159769U, 159773U, 159779U, 159787U, 159791U, 159793U, 159799U,
+159811U, 159833U, 159839U, 159853U, 159857U, 159869U, 159871U, 159899U, 159911U, 159931U,
+159937U, 159977U, 159979U, 160001U, 160009U, 160019U, 160031U, 160033U, 160049U, 160073U,
+160079U, 160081U, 160087U, 160091U, 160093U, 160117U, 160141U, 160159U, 160163U, 160169U,
+160183U, 160201U, 160207U, 160217U, 160231U, 160243U, 160253U, 160309U, 160313U, 160319U,
+160343U, 160357U, 160367U, 160373U, 160387U, 160397U, 160403U, 160409U, 160423U, 160441U,
+160453U, 160481U, 160483U, 160499U, 160507U, 160541U, 160553U, 160579U, 160583U, 160591U,
+160603U, 160619U, 160621U, 160627U, 160637U, 160639U, 160649U, 160651U, 160663U, 160669U,
+160681U, 160687U, 160697U, 160709U, 160711U, 160723U, 160739U, 160751U, 160753U, 160757U,
+160781U, 160789U, 160807U, 160813U, 160817U, 160829U, 160841U, 160861U, 160877U, 160879U,
+160883U, 160903U, 160907U, 160933U, 160967U, 160969U, 160981U, 160997U, 161009U, 161017U,
+161033U, 161039U, 161047U, 161053U, 161059U, 161071U, 161087U, 161093U, 161123U, 161137U,
+161141U, 161149U, 161159U, 161167U, 161201U, 161221U, 161233U, 161237U, 161263U, 161267U,
+161281U, 161303U, 161309U, 161323U, 161333U, 161339U, 161341U, 161363U, 161377U, 161387U,
+161407U, 161411U, 161453U, 161459U, 161461U, 161471U, 161503U, 161507U, 161521U, 161527U,
+161531U, 161543U, 161561U, 161563U, 161569U, 161573U, 161591U, 161599U, 161611U, 161627U,
+161639U, 161641U, 161659U, 161683U, 161717U, 161729U, 161731U, 161741U, 161743U, 161753U,
+161761U, 161771U, 161773U, 161779U, 161783U, 161807U, 161831U, 161839U, 161869U, 161873U,
+161879U, 161881U, 161911U, 161921U, 161923U, 161947U, 161957U, 161969U, 161971U, 161977U,
+161983U, 161999U, 162007U, 162011U, 162017U, 162053U, 162059U, 162079U, 162091U, 162109U,
+162119U, 162143U, 162209U, 162221U, 162229U, 162251U, 162257U, 162263U, 162269U, 162277U,
+162287U, 162289U, 162293U, 162343U, 162359U, 162389U, 162391U, 162413U, 162419U, 162439U,
+162451U, 162457U, 162473U, 162493U, 162499U, 162517U, 162523U, 162527U, 162529U, 162553U,
+162557U, 162563U, 162577U, 162593U, 162601U, 162611U, 162623U, 162629U, 162641U, 162649U,
+162671U, 162677U, 162683U, 162691U, 162703U, 162709U, 162713U, 162727U, 162731U, 162739U,
+162749U, 162751U, 162779U, 162787U, 162791U, 162821U, 162823U, 162829U, 162839U, 162847U,
+162853U, 162859U, 162881U, 162889U, 162901U, 162907U, 162917U, 162937U, 162947U, 162971U,
+162973U, 162989U, 162997U, 163003U, 163019U, 163021U, 163027U, 163061U, 163063U, 163109U,
+163117U, 163127U, 163129U, 163147U, 163151U, 163169U, 163171U, 163181U, 163193U, 163199U,
+163211U, 163223U, 163243U, 163249U, 163259U, 163307U, 163309U, 163321U, 163327U, 163337U,
+163351U, 163363U, 163367U, 163393U, 163403U, 163409U, 163411U, 163417U, 163433U, 163469U,
+163477U, 163481U, 163483U, 163487U, 163517U, 163543U, 163561U, 163567U, 163573U, 163601U,
+163613U, 163621U, 163627U, 163633U, 163637U, 163643U, 163661U, 163673U, 163679U, 163697U,
+163729U, 163733U, 163741U, 163753U, 163771U, 163781U, 163789U, 163811U, 163819U, 163841U,
+163847U, 163853U, 163859U, 163861U, 163871U, 163883U, 163901U, 163909U, 163927U, 163973U,
+163979U, 163981U, 163987U, 163991U, 163993U, 163997U, 164011U, 164023U, 164039U, 164051U,
+164057U, 164071U, 164089U, 164093U, 164113U, 164117U, 164147U, 164149U, 164173U, 164183U,
+164191U, 164201U, 164209U, 164231U, 164233U, 164239U, 164249U, 164251U, 164267U, 164279U,
+164291U, 164299U, 164309U, 164321U, 164341U, 164357U, 164363U, 164371U, 164377U, 164387U,
+164413U, 164419U, 164429U, 164431U, 164443U, 164447U, 164449U, 164471U, 164477U, 164503U,
+164513U, 164531U, 164569U, 164581U, 164587U, 164599U, 164617U, 164621U, 164623U, 164627U,
+164653U, 164663U, 164677U, 164683U, 164701U, 164707U, 164729U, 164743U, 164767U, 164771U,
+164789U, 164809U, 164821U, 164831U, 164837U, 164839U, 164881U, 164893U, 164911U, 164953U,
+164963U, 164987U, 164999U, 165001U, 165037U, 165041U, 165047U, 165049U, 165059U, 165079U,
+165083U, 165089U, 165103U, 165133U, 165161U, 165173U, 165181U, 165203U, 165211U, 165229U,
+165233U, 165247U, 165287U, 165293U, 165311U, 165313U, 165317U, 165331U, 165343U, 165349U,
+165367U, 165379U, 165383U, 165391U, 165397U, 165437U, 165443U, 165449U, 165457U, 165463U,
+165469U, 165479U, 165511U, 165523U, 165527U, 165533U, 165541U, 165551U, 165553U, 165559U,
+165569U, 165587U, 165589U, 165601U, 165611U, 165617U, 165653U, 165667U, 165673U, 165701U,
+165703U, 165707U, 165709U, 165713U, 165719U, 165721U, 165749U, 165779U, 165799U, 165811U,
+165817U, 165829U, 165833U, 165857U, 165877U, 165883U, 165887U, 165901U, 165931U, 165941U,
+165947U, 165961U, 165983U, 166013U, 166021U, 166027U, 166031U, 166043U, 166063U, 166081U,
+166099U, 166147U, 166151U, 166157U, 166169U, 166183U, 166189U, 166207U, 166219U, 166237U,
+166247U, 166259U, 166273U, 166289U, 166297U, 166301U, 166303U, 166319U, 166349U, 166351U,
+166357U, 166363U, 166393U, 166399U, 166403U, 166409U, 166417U, 166429U, 166457U, 166471U,
+166487U, 166541U, 166561U, 166567U, 166571U, 166597U, 166601U, 166603U, 166609U, 166613U,
+166619U, 166627U, 166631U, 166643U, 166657U, 166667U, 166669U, 166679U, 166693U, 166703U,
+166723U, 166739U, 166741U, 166781U, 166783U, 166799U, 166807U, 166823U, 166841U, 166843U,
+166847U, 166849U, 166853U, 166861U, 166867U, 166871U, 166909U, 166919U, 166931U, 166949U,
+166967U, 166973U, 166979U, 166987U, 167009U, 167017U, 167021U, 167023U, 167033U, 167039U,
+167047U, 167051U, 167071U, 167077U, 167081U, 167087U, 167099U, 167107U, 167113U, 167117U,
+167119U, 167149U, 167159U, 167173U, 167177U, 167191U, 167197U, 167213U, 167221U, 167249U,
+167261U, 167267U, 167269U, 167309U, 167311U, 167317U, 167329U, 167339U, 167341U, 167381U,
+167393U, 167407U, 167413U, 167423U, 167429U, 167437U, 167441U, 167443U, 167449U, 167471U,
+167483U, 167491U, 167521U, 167537U, 167543U, 167593U, 167597U, 167611U, 167621U, 167623U,
+167627U, 167633U, 167641U, 167663U, 167677U, 167683U, 167711U, 167729U, 167747U, 167759U,
+167771U, 167777U, 167779U, 167801U, 167809U, 167861U, 167863U, 167873U, 167879U, 167887U,
+167891U, 167899U, 167911U, 167917U, 167953U, 167971U, 167987U, 168013U, 168023U, 168029U,
+168037U, 168043U, 168067U, 168071U, 168083U, 168089U, 168109U, 168127U, 168143U, 168151U,
+168193U, 168197U, 168211U, 168227U, 168247U, 168253U, 168263U, 168269U, 168277U, 168281U,
+168293U, 168323U, 168331U, 168347U, 168353U, 168391U, 168409U, 168433U, 168449U, 168451U,
+168457U, 168463U, 168481U, 168491U, 168499U, 168523U, 168527U, 168533U, 168541U, 168559U,
+168599U, 168601U, 168617U, 168629U, 168631U, 168643U, 168673U, 168677U, 168697U, 168713U,
+168719U, 168731U, 168737U, 168743U, 168761U, 168769U, 168781U, 168803U, 168851U, 168863U,
+168869U, 168887U, 168893U, 168899U, 168901U, 168913U, 168937U, 168943U, 168977U, 168991U,
+169003U, 169007U, 169009U, 169019U, 169049U, 169063U, 169067U, 169069U, 169079U, 169093U,
+169097U, 169111U, 169129U, 169151U, 169159U, 169177U, 169181U, 169199U, 169217U, 169219U,
+169241U, 169243U, 169249U, 169259U, 169283U, 169307U, 169313U, 169319U, 169321U, 169327U,
+169339U, 169343U, 169361U, 169369U, 169373U, 169399U, 169409U, 169427U, 169457U, 169471U,
+169483U, 169489U, 169493U, 169501U, 169523U, 169531U, 169553U, 169567U, 169583U, 169591U,
+169607U, 169627U, 169633U, 169639U, 169649U, 169657U, 169661U, 169667U, 169681U, 169691U,
+169693U, 169709U, 169733U, 169751U, 169753U, 169769U, 169777U, 169783U, 169789U, 169817U,
+169823U, 169831U, 169837U, 169843U, 169859U, 169889U, 169891U, 169909U, 169913U, 169919U,
+169933U, 169937U, 169943U, 169951U, 169957U, 169987U, 169991U, 170003U, 170021U, 170029U,
+170047U, 170057U, 170063U, 170081U, 170099U, 170101U, 170111U, 170123U, 170141U, 170167U,
+170179U, 170189U, 170197U, 170207U, 170213U, 170227U, 170231U, 170239U, 170243U, 170249U,
+170263U, 170267U, 170279U, 170293U, 170299U, 170327U, 170341U, 170347U, 170351U, 170353U,
+170363U, 170369U, 170371U, 170383U, 170389U, 170393U, 170413U, 170441U, 170447U, 170473U,
+170483U, 170497U, 170503U, 170509U, 170537U, 170539U, 170551U, 170557U, 170579U, 170603U,
+170609U, 170627U, 170633U, 170641U, 170647U, 170669U, 170689U, 170701U, 170707U, 170711U,
+170741U, 170749U, 170759U, 170761U, 170767U, 170773U, 170777U, 170801U, 170809U, 170813U,
+170827U, 170837U, 170843U, 170851U, 170857U, 170873U, 170881U, 170887U, 170899U, 170921U,
+170927U, 170953U, 170957U, 170971U, 171007U, 171023U, 171029U, 171043U, 171047U, 171049U,
+171053U, 171077U, 171079U, 171091U, 171103U, 171131U, 171161U, 171163U, 171167U, 171169U,
+171179U, 171203U, 171233U, 171251U, 171253U, 171263U, 171271U, 171293U, 171299U, 171317U,
+171329U, 171341U, 171383U, 171401U, 171403U, 171427U, 171439U, 171449U, 171467U, 171469U,
+171473U, 171481U, 171491U, 171517U, 171529U, 171539U, 171541U, 171553U, 171559U, 171571U,
+171583U, 171617U, 171629U, 171637U, 171641U, 171653U, 171659U, 171671U, 171673U, 171679U,
+171697U, 171707U, 171713U, 171719U, 171733U, 171757U, 171761U, 171763U, 171793U, 171799U,
+171803U, 171811U, 171823U, 171827U, 171851U, 171863U, 171869U, 171877U, 171881U, 171889U,
+171917U, 171923U, 171929U, 171937U, 171947U, 172001U, 172009U, 172021U, 172027U, 172031U,
+172049U, 172069U, 172079U, 172093U, 172097U, 172127U, 172147U, 172153U, 172157U, 172169U,
+172171U, 172181U, 172199U, 172213U, 172217U, 172219U, 172223U, 172243U, 172259U, 172279U,
+172283U, 172297U, 172307U, 172313U, 172321U, 172331U, 172343U, 172351U, 172357U, 172373U,
+172399U, 172411U, 172421U, 172423U, 172427U, 172433U, 172439U, 172441U, 172489U, 172507U,
+172517U, 172519U, 172541U, 172553U, 172561U, 172573U, 172583U, 172589U, 172597U, 172603U,
+172607U, 172619U, 172633U, 172643U, 172649U, 172657U, 172663U, 172673U, 172681U, 172687U,
+172709U, 172717U, 172721U, 172741U, 172751U, 172759U, 172787U, 172801U, 172807U, 172829U,
+172849U, 172853U, 172859U, 172867U, 172871U, 172877U, 172883U, 172933U, 172969U, 172973U,
+172981U, 172987U, 172993U, 172999U, 173021U, 173023U, 173039U, 173053U, 173059U, 173081U,
+173087U, 173099U, 173137U, 173141U, 173149U, 173177U, 173183U, 173189U, 173191U, 173207U,
+173209U, 173219U, 173249U, 173263U, 173267U, 173273U, 173291U, 173293U, 173297U, 173309U,
+173347U, 173357U, 173359U, 173429U, 173431U, 173473U, 173483U, 173491U, 173497U, 173501U,
+173531U, 173539U, 173543U, 173549U, 173561U, 173573U, 173599U, 173617U, 173629U, 173647U,
+173651U, 173659U, 173669U, 173671U, 173683U, 173687U, 173699U, 173707U, 173713U, 173729U,
+173741U, 173743U, 173773U, 173777U, 173779U, 173783U, 173807U, 173819U, 173827U, 173839U,
+173851U, 173861U, 173867U, 173891U, 173897U, 173909U, 173917U, 173923U, 173933U, 173969U,
+173977U, 173981U, 173993U, 174007U, 174017U, 174019U, 174047U, 174049U, 174061U, 174067U,
+174071U, 174077U, 174079U, 174091U, 174101U, 174121U, 174137U, 174143U, 174149U, 174157U,
+174169U, 174197U, 174221U, 174241U, 174257U, 174259U, 174263U, 174281U, 174289U, 174299U,
+174311U, 174329U, 174331U, 174337U, 174347U, 174367U, 174389U, 174407U, 174413U, 174431U,
+174443U, 174457U, 174467U, 174469U, 174481U, 174487U, 174491U, 174527U, 174533U, 174569U,
+174571U, 174583U, 174599U, 174613U, 174617U, 174631U, 174637U, 174649U, 174653U, 174659U,
+174673U, 174679U, 174703U, 174721U, 174737U, 174749U, 174761U, 174763U, 174767U, 174773U,
+174799U, 174821U, 174829U, 174851U, 174859U, 174877U, 174893U, 174901U, 174907U, 174917U,
+174929U, 174931U, 174943U, 174959U, 174989U, 174991U, 175003U, 175013U, 175039U, 175061U,
+175067U, 175069U, 175079U, 175081U, 175103U, 175129U, 175141U, 175211U, 175229U, 175261U,
+175267U, 175277U, 175291U, 175303U, 175309U, 175327U, 175333U, 175349U, 175361U, 175391U,
+175393U, 175403U, 175411U, 175433U, 175447U, 175453U, 175463U, 175481U, 175493U, 175499U,
+175519U, 175523U, 175543U, 175573U, 175601U, 175621U, 175631U, 175633U, 175649U, 175663U,
+175673U, 175687U, 175691U, 175699U, 175709U, 175723U, 175727U, 175753U, 175757U, 175759U,
+175781U, 175783U, 175811U, 175829U, 175837U, 175843U, 175853U, 175859U, 175873U, 175891U,
+175897U, 175909U, 175919U, 175937U, 175939U, 175949U, 175961U, 175963U, 175979U, 175991U,
+175993U, 176017U, 176021U, 176023U, 176041U, 176047U, 176051U, 176053U, 176063U, 176081U,
+176087U, 176089U, 176123U, 176129U, 176153U, 176159U, 176161U, 176179U, 176191U, 176201U,
+176207U, 176213U, 176221U, 176227U, 176237U, 176243U, 176261U, 176299U, 176303U, 176317U,
+176321U, 176327U, 176329U, 176333U, 176347U, 176353U, 176357U, 176369U, 176383U, 176389U,
+176401U, 176413U, 176417U, 176419U, 176431U, 176459U, 176461U, 176467U, 176489U, 176497U,
+176503U, 176507U, 176509U, 176521U, 176531U, 176537U, 176549U, 176551U, 176557U, 176573U,
+176591U, 176597U, 176599U, 176609U, 176611U, 176629U, 176641U, 176651U, 176677U, 176699U,
+176711U, 176713U, 176741U, 176747U, 176753U, 176777U, 176779U, 176789U, 176791U, 176797U,
+176807U, 176809U, 176819U, 176849U, 176857U, 176887U, 176899U, 176903U, 176921U, 176923U,
+176927U, 176933U, 176951U, 176977U, 176983U, 176989U, 177007U, 177011U, 177013U, 177019U,
+177043U, 177091U, 177101U, 177109U, 177113U, 177127U, 177131U, 177167U, 177173U, 177209U,
+177211U, 177217U, 177223U, 177239U, 177257U, 177269U, 177283U, 177301U, 177319U, 177323U,
+177337U, 177347U, 177379U, 177383U, 177409U, 177421U, 177427U, 177431U, 177433U, 177467U,
+177473U, 177481U, 177487U, 177493U, 177511U, 177533U, 177539U, 177553U, 177589U, 177601U,
+177623U, 177647U, 177677U, 177679U, 177691U, 177739U, 177743U, 177761U, 177763U, 177787U,
+177791U, 177797U, 177811U, 177823U, 177839U, 177841U, 177883U, 177887U, 177889U, 177893U,
+177907U, 177913U, 177917U, 177929U, 177943U, 177949U, 177953U, 177967U, 177979U, 178001U,
+178021U, 178037U, 178039U, 178067U, 178069U, 178091U, 178093U, 178103U, 178117U, 178127U,
+178141U, 178151U, 178169U, 178183U, 178187U, 178207U, 178223U, 178231U, 178247U, 178249U,
+178259U, 178261U, 178289U, 178301U, 178307U, 178327U, 178333U, 178349U, 178351U, 178361U,
+178393U, 178397U, 178403U, 178417U, 178439U, 178441U, 178447U, 178469U, 178481U, 178487U,
+178489U, 178501U, 178513U, 178531U, 178537U, 178559U, 178561U, 178567U, 178571U, 178597U,
+178601U, 178603U, 178609U, 178613U, 178621U, 178627U, 178639U, 178643U, 178681U, 178691U,
+178693U, 178697U, 178753U, 178757U, 178781U, 178793U, 178799U, 178807U, 178813U, 178817U,
+178819U, 178831U, 178853U, 178859U, 178873U, 178877U, 178889U, 178897U, 178903U, 178907U,
+178909U, 178921U, 178931U, 178933U, 178939U, 178951U, 178973U, 178987U, 179021U, 179029U,
+179033U, 179041U, 179051U, 179057U, 179083U, 179089U, 179099U, 179107U, 179111U, 179119U,
+179143U, 179161U, 179167U, 179173U, 179203U, 179209U, 179213U, 179233U, 179243U, 179261U,
+179269U, 179281U, 179287U, 179317U, 179321U, 179327U, 179351U, 179357U, 179369U, 179381U,
+179383U, 179393U, 179407U, 179411U, 179429U, 179437U, 179441U, 179453U, 179461U, 179471U,
+179479U, 179483U, 179497U, 179519U, 179527U, 179533U, 179549U, 179563U, 179573U, 179579U,
+179581U, 179591U, 179593U, 179603U, 179623U, 179633U, 179651U, 179657U, 179659U, 179671U,
+179687U, 179689U, 179693U, 179717U, 179719U, 179737U, 179743U, 179749U, 179779U, 179801U,
+179807U, 179813U, 179819U, 179821U, 179827U, 179833U, 179849U, 179897U, 179899U, 179903U,
+179909U, 179917U, 179923U, 179939U, 179947U, 179951U, 179953U, 179957U, 179969U, 179981U,
+179989U, 179999U, 180001U, 180007U, 180023U, 180043U, 180053U, 180071U, 180073U, 180077U,
+180097U, 180137U, 180161U, 180179U, 180181U, 180211U, 180221U, 180233U, 180239U, 180241U,
+180247U, 180259U, 180263U, 180281U, 180287U, 180289U, 180307U, 180311U, 180317U, 180331U,
+180337U, 180347U, 180361U, 180371U, 180379U, 180391U, 180413U, 180419U, 180437U, 180463U,
+180473U, 180491U, 180497U, 180503U,
+0xFFFFFFFF
+};
+
+static unsigned int NC_nprimes = (sizeof(NC_primes) / sizeof(unsigned int));
+
+/**************************************************/
+/* Debug support */
+void
+printhstring(NC_string* s)
 {
-    int i,j,index;
-    nchashid* keys;
-    if(hm == NULL) return FALSE;
-    if(hm->size == 0) {
-	keys = NULL;
-    } else {
-        keys = (nchashid*)malloc(sizeof(nchashid)*hm->size);
-        for(index=0,i=0;i<hm->alloc;i++) {
- 	    NClist* seq = hm->table[i];
-	    for(j=0;j<nclistlength(seq);j+=2) {
-	        keys[index++] = (nchashid)nclistget(seq,j);
-	    }
+    size_t n;
+    char ss[256];
+
+    n = (s == NULL?0:s->nchars);
+    strcpy(ss,"NULL");
+    if(s != NULL)
+	strncpy(ss,s->cp,sizeof(ss)-1);
+    ss[255] = '\0';
+    if(n == 0 || n > 256)
+	strcpy(ss,"<undefined>");
+    fprintf(stderr,"%lx %ld |%s|\n",(unsigned  long)s,(unsigned long)n,ss);
+    fflush(stderr);
+}
+
+void
+printhashmap(NC_hashmap* hm)
+{
+    size_t i;
+    if(hm == NULL) {fprintf(stderr,"NULL"); fflush(stderr); return;}
+    fprintf(stderr,"{size=%lu count=%lu table=0x%lx}\n",
+	(unsigned long)hm->size,(unsigned long)hm->count,(unsigned long)((uintptr_t)hm->table));
+    if(hm->size > 4000) {
+	fprintf(stderr,"MALFORMED\n");
+	return;
+    }
+    for(i=0;i<hm->size;i++) {
+	NC_hentry e = hm->table[i];
+	if(e.flags == ACTIVE && e.key == NULL) {
+	    fprintf(stderr,"[%ld] flags=ACTIVE hashkey=%lu data=%p key=NULL\n",
+		(unsigned long)i,(unsigned long)e.hashkey,e.data);
+	} else if(e.flags == ACTIVE && e.key != NULL) {
+	    char nm[64];
+	    int elided = 0;
+	    size_t len = strlen(e.key);
+	    if(len > 63) {elided = 1; len = 63;}
+	    memcpy(nm,e.key,len);
+	    nm[63] = '\0';
+	    fprintf(stderr,"[%ld] flags=ACTIVE hashkey=%lu data=%p key=0x%lx |%s|%s\n",
+			(unsigned long)i, (unsigned long)e.hashkey, e.data,(unsigned long)((uintptr_t)nm),e.key,(elided?"...":""));
+	} else if(e.flags == DELETED) {
+	    fprintf(stderr,"[%ld] flags=DELETED hashkey=%lu\n",
+		(unsigned long)i,(unsigned long)e.hashkey);
+	} else {/*empty*/
+	    fprintf(stderr,"[%ld] flags=EMPTY\n",(unsigned long)i);
 	}
     }
-    if(keylist) {*keylist = keys;}
-    else {free(keys);}
-
-    return TRUE;
+    fflush(stderr);
 }
diff --git a/libdispatch/nclist.c b/libdispatch/nclist.c
index 15142c4..4890119 100644
--- a/libdispatch/nclist.c
+++ b/libdispatch/nclist.c
@@ -53,7 +53,7 @@ Free a list and its contents
 int
 nclistfreeall(NClist* l)
 {
-  unsigned long i;
+  size_t i;
   if(l == NULL) return TRUE;
   for(i=0;i<l->length;i++) {
       void* value = l->content[i];
@@ -63,7 +63,7 @@ nclistfreeall(NClist* l)
 }
 
 int
-nclistsetalloc(NClist* l, unsigned long sz)
+nclistsetalloc(NClist* l, size_t sz)
 {
   void** newcontent = NULL;
   if(l == NULL) return FALSE;
@@ -80,35 +80,44 @@ nclistsetalloc(NClist* l, unsigned long sz)
 }
 
 int
-nclistsetlength(NClist* l, unsigned long sz)
+nclistsetlength(NClist* l, size_t newlen)
 {
   if(l == NULL) return FALSE;
-  if(sz > l->alloc && !nclistsetalloc(l,sz)) return FALSE;
-  l->length = sz;
+  if(newlen > l->alloc && !nclistsetalloc(l,newlen)) return FALSE;
+  if(newlen > l->length) {
+      /* clear any extension */
+      memset(&l->content[l->length],0,(newlen - l->length)*sizeof(void*));
+  }
+  l->length = newlen;
   return TRUE;
 }
 
 void*
-nclistget(NClist* l, unsigned long index)
+nclistget(NClist* l, size_t index)
 {
   if(l == NULL || l->length == 0) return NULL;
   if(index >= l->length) return NULL;
   return l->content[index];
 }
 
-/* Insert at position i of l; will overwrite previous value */
+/* Insert at position i of l; will overwrite previous value;
+   guarantees alloc and length
+*/
 int
-nclistset(NClist* l, unsigned long index, void* elem)
+nclistset(NClist* l, size_t index, void* elem)
 {
   if(l == NULL) return FALSE;
-  if(index >= l->length) return FALSE;
+  if(!nclistsetalloc(l,index+1)) return FALSE;
+  if(index >= l->length) {
+      if(!nclistsetlength(l,index+1)) return FALSE;	
+  }
   l->content[index] = elem;
   return TRUE;
 }
 
 /* Insert at position i of l; will push up elements i..|seq|. */
 int
-nclistinsert(NClist* l, unsigned long index, void* elem)
+nclistinsert(NClist* l, size_t index, void* elem)
 {
   long i; /* do not make unsigned */
   if(l == NULL) return FALSE;
@@ -146,9 +155,9 @@ nclisttop(NClist* l)
 }
 
 void*
-nclistremove(NClist* l, unsigned long i)
+nclistremove(NClist* l, size_t i)
 {
-  unsigned long len;
+  size_t len;
   void* elem;
   if(l == NULL || (len=l->length) == 0) return NULL;
   if(i >= len) return NULL;
@@ -171,7 +180,7 @@ nclistdup(NClist* l)
 int
 nclistcontains(NClist* l, void* elem)
 {
-    unsigned long i;
+    size_t i;
     for(i=0;i<nclistlength(l);i++) {
 	if(elem == nclistget(l,i)) return 1;
     }
@@ -182,8 +191,8 @@ nclistcontains(NClist* l, void* elem)
 int
 nclistelemremove(NClist* l, void* elem)
 {
-  unsigned long len;
-  unsigned long i;
+  size_t len;
+  size_t i;
   int found = 0;
   if(l == NULL || (len=l->length) == 0) return 0;
   for(i=0;i<nclistlength(l);i++) {
@@ -207,7 +216,7 @@ nclistelemremove(NClist* l, void* elem)
 int
 nclistunique(NClist* l)
 {
-    unsigned long i,j,k,len;
+    size_t i,j,k,len;
     void** content;
     if(l == NULL || l->length == 0) return 1;
     len = l->length;
diff --git a/libdispatch/nclistmgr.c b/libdispatch/nclistmgr.c
index 13679f0..5bb4fe7 100644
--- a/libdispatch/nclistmgr.c
+++ b/libdispatch/nclistmgr.c
@@ -88,6 +88,11 @@ find_in_NCList(int ext_ncid)
    unsigned int ncid = ((unsigned int)ext_ncid) >> ID_SHIFT;
    if(numfiles > 0 && nc_filelist != NULL && ncid < NCFILELISTLENGTH)
 	f = nc_filelist[ncid];
+
+   /* for classic files, ext_ncid must be a multiple of (1<<ID_SHIFT) */
+   if (f != NULL && f->model == NC_FORMATX_NC3 && (ext_ncid % (1<<ID_SHIFT)))
+       return NULL;
+
    return f;
 }
 
diff --git a/libhdf4/CMakeLists.txt b/libhdf4/CMakeLists.txt
new file mode 100644
index 0000000..38fed11
--- /dev/null
+++ b/libhdf4/CMakeLists.txt
@@ -0,0 +1,17 @@
+## This is a CMake file, part of Unidata's netCDF package.
+# Copyright 2018, see the COPYRIGHT file for more information.
+#
+# This builds the HDF4 dispatch layer.
+#
+# Ed Hartnett
+
+# The source files for the HDF4 dispatch layer.
+SET(libhdf4_SOURCES hdf4attr.c hdf4dim.c hdf4dispatch.c hdf4file.c hdf4func.c
+  hdf4grp.c hdf4type.c hdf4var.c)
+
+# Build the HDF4 dispatch layer as a library that will be included in
+# the netCDF library.
+add_library(netcdfhdf4 OBJECT ${libhdf4_SOURCES})
+
+# Remember to package this file for CMake builds.
+ADD_EXTRA_DIST(${libhdf4_SOURCES} CMakeLists.txt)
diff --git a/libhdf4/Makefile.am b/libhdf4/Makefile.am
new file mode 100644
index 0000000..8cd6b6f
--- /dev/null
+++ b/libhdf4/Makefile.am
@@ -0,0 +1,25 @@
+# This is part of Unidata's netCDF package. Copyright 2018, see the
+# COPYRIGHT file for more information.
+
+# Build the HDF4 dispatch layer.
+
+# Ed Hartnett
+
+# Get AM_CPPFLAGS.
+include $(top_srcdir)/lib_flags.am
+libnetcdf4_la_CPPFLAGS = ${AM_CPPFLAGS}
+
+# This is our output. The HDF4 convenience library.
+noinst_LTLIBRARIES = libnchdf4.la
+
+# The source files.
+libnchdf4_la_SOURCES = hdf4dispatch.c hdf4attr.c hdf4dim.c hdf4file.c	\
+hdf4grp.c hdf4type.c hdf4var.c hdf4func.c
+
+# Package this for cmake build.
+EXTRA_DIST = CMakeLists.txt
+
+
+
+
+
diff --git a/libsrcp/Makefile.in b/libhdf4/Makefile.in
similarity index 83%
copy from libsrcp/Makefile.in
copy to libhdf4/Makefile.in
index 38f979a..90ed4a1 100644
--- a/libsrcp/Makefile.in
+++ b/libhdf4/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,10 +14,12 @@
 
 @SET_MAKE@
 
-# Copyright 2005, see the COPYRIGHT file for more information.
+# This is part of Unidata's netCDF package. Copyright 2018, see the
+# COPYRIGHT file for more information.
 
-# This automake file is in charge of building the libsrc directory,
-# which contains the classic library code.
+# Build the HDF4 dispatch layer.
+
+# Ed Hartnett
 
 # This is part of the netCDF package.
 # Copyright 2005 University Corporation for Atmospheric Research/Unidata
@@ -103,7 +105,7 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 @USE_DAP_TRUE at am__append_1 = -I${top_srcdir}/oc2
-subdir = libsrcp
+subdir = libhdf4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -117,9 +119,10 @@ CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
-libnetcdfp_la_LIBADD =
-am_libnetcdfp_la_OBJECTS = libnetcdfp_la-ncpdispatch.lo
-libnetcdfp_la_OBJECTS = $(am_libnetcdfp_la_OBJECTS)
+libnchdf4_la_LIBADD =
+am_libnchdf4_la_OBJECTS = hdf4dispatch.lo hdf4attr.lo hdf4dim.lo \
+	hdf4file.lo hdf4grp.lo hdf4type.lo hdf4var.lo hdf4func.lo
+libnchdf4_la_OBJECTS = $(am_libnchdf4_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -138,7 +141,11 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/hdf4attr.Plo ./$(DEPDIR)/hdf4dim.Plo \
+	./$(DEPDIR)/hdf4dispatch.Plo ./$(DEPDIR)/hdf4file.Plo \
+	./$(DEPDIR)/hdf4func.Plo ./$(DEPDIR)/hdf4grp.Plo \
+	./$(DEPDIR)/hdf4type.Plo ./$(DEPDIR)/hdf4var.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -158,8 +165,8 @@ AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libnetcdfp_la_SOURCES)
-DIST_SOURCES = $(libnetcdfp_la_SOURCES)
+SOURCES = $(libnchdf4_la_SOURCES)
+DIST_SOURCES = $(libnchdf4_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -224,7 +231,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -233,6 +239,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -271,6 +278,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -370,15 +378,20 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_TESTS_ENVIRONMENT = export TOPSRCDIR=${abs_top_srcdir}; export TOPBUILDDIR=${abs_top_builddir}; 
-libnetcdfp_la_CPPFLAGS = ${AM_CPPFLAGS}
 
-# This is the code for a dispatch table for pnetcdf
-# (which has CDF5 as its magic number)
+# Get AM_CPPFLAGS.
+libnetcdf4_la_CPPFLAGS = ${AM_CPPFLAGS}
+
+# This is our output. The HDF4 convenience library.
+noinst_LTLIBRARIES = libnchdf4.la
+
+# The source files.
+libnchdf4_la_SOURCES = hdf4dispatch.c hdf4attr.c hdf4dim.c hdf4file.c	\
+hdf4grp.c hdf4type.c hdf4var.c hdf4func.c
 
-# These files comprise the pnetcdf dispatch library code.
-libnetcdfp_la_SOURCES = ncpdispatch.c
-noinst_LTLIBRARIES = libnetcdfp.la
-EXTRA_DIST = CMakeLists.txt 
+
+# Package this for cmake build.
+EXTRA_DIST = CMakeLists.txt
 all: all-am
 
 .SUFFIXES:
@@ -392,16 +405,16 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libsrcp/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libhdf4/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign libsrcp/Makefile
+	  $(AUTOMAKE) --foreign libhdf4/Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -425,8 +438,8 @@ clean-noinstLTLIBRARIES:
 	  rm -f $${locs}; \
 	}
 
-libnetcdfp.la: $(libnetcdfp_la_OBJECTS) $(libnetcdfp_la_DEPENDENCIES) $(EXTRA_libnetcdfp_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(LINK)  $(libnetcdfp_la_OBJECTS) $(libnetcdfp_la_LIBADD) $(LIBS)
+libnchdf4.la: $(libnchdf4_la_OBJECTS) $(libnchdf4_la_DEPENDENCIES) $(EXTRA_libnchdf4_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(LINK)  $(libnchdf4_la_OBJECTS) $(libnchdf4_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -434,7 +447,20 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4attr.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4dim.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4dispatch.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4file.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4func.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4grp.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4type.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf4var.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -460,13 +486,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-libnetcdfp_la-ncpdispatch.lo: ncpdispatch.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdfp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnetcdfp_la-ncpdispatch.lo -MD -MP -MF $(DEPDIR)/libnetcdfp_la-ncpdispatch.Tpo -c -o libnetcdfp_la-ncpdispatch.lo `test -f 'ncpdispatch.c' || echo '$(srcdir)/'`ncpdispatch.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libnetcdfp_la-ncpdispatch.Tpo $(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='ncpdispatch.c' object='libnetcdfp_la-ncpdispatch.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnetcdfp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnetcdfp_la-ncpdispatch.lo `test -f 'ncpdispatch.c' || echo '$(srcdir)/'`ncpdispatch.c
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -525,7 +544,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -595,7 +617,14 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/hdf4attr.Plo
+	-rm -f ./$(DEPDIR)/hdf4dim.Plo
+	-rm -f ./$(DEPDIR)/hdf4dispatch.Plo
+	-rm -f ./$(DEPDIR)/hdf4file.Plo
+	-rm -f ./$(DEPDIR)/hdf4func.Plo
+	-rm -f ./$(DEPDIR)/hdf4grp.Plo
+	-rm -f ./$(DEPDIR)/hdf4type.Plo
+	-rm -f ./$(DEPDIR)/hdf4var.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -641,7 +670,14 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/hdf4attr.Plo
+	-rm -f ./$(DEPDIR)/hdf4dim.Plo
+	-rm -f ./$(DEPDIR)/hdf4dispatch.Plo
+	-rm -f ./$(DEPDIR)/hdf4file.Plo
+	-rm -f ./$(DEPDIR)/hdf4func.Plo
+	-rm -f ./$(DEPDIR)/hdf4grp.Plo
+	-rm -f ./$(DEPDIR)/hdf4type.Plo
+	-rm -f ./$(DEPDIR)/hdf4var.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -662,16 +698,16 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
diff --git a/libhdf4/hdf4attr.c b/libhdf4/hdf4attr.c
new file mode 100644
index 0000000..4d59fd8
--- /dev/null
+++ b/libhdf4/hdf4attr.c
@@ -0,0 +1,69 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
+/**
+ * @file
+ * @internal This file handles the HDF4 attribute functions.
+ *
+ * @author Ed Hartnett
+ */
+
+#include "nc4internal.h"
+#include "nc.h"
+#include "hdf4dispatch.h"
+#include "ncdispatch.h"
+
+int nc4typelen(nc_type type);
+
+/**
+ * @internal Not allowed for HDF4.
+ *
+ * @param ncid Ignored.
+ * @param varid Ignored.
+ * @param name Ignored.
+ * @param newname Ignored.
+ *
+ * @return ::NC_EPERM Not allowed for HDF4.
+ * @author Ed Hartnett
+ */
+int
+HDF4_rename_att(int ncid, int varid, const char *name, const char *newname)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal Not allowed for HDF4.
+ *
+ * @param ncid Ignored.
+ * @param varid Ignored.
+ * @param name Ignored.
+ *
+ * @return ::NC_EPERM Not allowed with HDF4.
+ * @author Ed Hartnett
+ */
+int
+HDF4_del_att(int ncid, int varid, const char *name)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal Not allowed for HDF4.
+ *
+ * @param ncid Ignored.
+ * @param varid Ignored.
+ * @param name Ignored.
+ * @param file_type Ignored.
+ * @param len Ignored.
+ * @param data Ignored.
+ * @param memtype Ignored.
+ *
+ * @return ::NC_EPERM Not allowed with HDF4.
+ * @author Ed Hartnett
+ */
+int
+HDF4_put_att(int ncid, int varid, const char *name, nc_type file_type,
+             size_t len, const void *data, nc_type mem_type)
+{
+   return NC_EPERM;
+}
diff --git a/libhdf4/hdf4dim.c b/libhdf4/hdf4dim.c
new file mode 100644
index 0000000..93c33dd
--- /dev/null
+++ b/libhdf4/hdf4dim.c
@@ -0,0 +1,44 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
+/**
+ * @file
+ * @internal This file handles the HDF4 dimension functions.
+ *
+ * @author Ed Hartnett
+ */
+
+#include "nc4internal.h"
+#include "nc4dispatch.h"
+
+/**
+ * @internal Dims cannot be defined for HDF4 files.
+ *
+ * @param ncid Ignored.
+ * @param name Ignored.
+ * @param len Ignored.
+ * @param idp Ignored.
+ *
+ * @return ::NC_EPERM Can't define dims.
+ * @author Ed Hartnett
+ */
+int
+HDF4_def_dim(int ncid, const char *name, size_t len, int *idp)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal Not allowed for HDF4.
+ *
+ * @param ncid Ignored.
+ * @param dimid Ignored.
+ * @param name Ignored.
+ *
+ * @return ::NC_NEPERM Can't write to HDF4 file.
+ * @author Ed Hartnett
+ */
+int
+HDF4_rename_dim(int ncid, int dimid, const char *name)
+{
+   return NC_EPERM;
+}
diff --git a/libhdf4/hdf4dispatch.c b/libhdf4/hdf4dispatch.c
new file mode 100644
index 0000000..5579a41
--- /dev/null
+++ b/libhdf4/hdf4dispatch.c
@@ -0,0 +1,134 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
+/**
+ * @file
+ * @internal Dispatch code for HDF4. HDF4 access is read-only.
+ *
+ * @author Ed Hartnett
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include "hdf4dispatch.h"
+#include "nc4dispatch.h"
+#include "nc.h"
+
+/* This is the dispatch object that holds pointers to all the
+ * functions that make up the HDF4 dispatch interface. */
+static NC_Dispatch HDF4_dispatcher = {
+
+NC_FORMATX_NC_HDF4,
+
+HDF4_create,
+HDF4_open,
+
+HDF4_redef,
+HDF4__enddef,
+HDF4_sync,
+HDF4_abort,
+HDF4_close,
+HDF4_set_fill,
+HDF4_inq_base_pe,
+HDF4_set_base_pe,
+HDF4_inq_format,
+HDF4_inq_format_extended,
+
+NC4_inq,
+NC4_inq_type,
+
+HDF4_def_dim,
+NC4_inq_dimid,
+NC4_inq_dim,
+NC4_inq_unlimdim,
+HDF4_rename_dim,
+
+NC4_inq_att,
+NC4_inq_attid,
+NC4_inq_attname,
+HDF4_rename_att,
+HDF4_del_att,
+NC4_get_att,
+HDF4_put_att,
+
+HDF4_def_var,
+NC4_inq_varid,
+HDF4_rename_var,
+HDF4_get_vara,
+HDF4_put_vara,
+NCDEFAULT_get_vars,
+NCDEFAULT_put_vars,
+NCDEFAULT_get_varm,
+NCDEFAULT_put_varm,
+
+NC4_inq_var_all,
+
+HDF4_var_par_access,
+HDF4_def_var_fill,
+
+NC4_show_metadata,
+NC4_inq_unlimdims,
+
+NC4_inq_ncid,
+NC4_inq_grps,
+NC4_inq_grpname,
+NC4_inq_grpname_full,
+NC4_inq_grp_parent,
+NC4_inq_grp_full_ncid,
+NC4_inq_varids,
+NC4_inq_dimids,
+NC4_inq_typeids,
+NC4_inq_type_equal,
+HDF4_def_grp,
+HDF4_rename_grp,
+NC4_inq_user_type,
+NC4_inq_typeid,
+
+HDF4_def_compound,
+HDF4_insert_compound,
+HDF4_insert_array_compound,
+HDF4_inq_compound_field,
+HDF4_inq_compound_fieldindex,
+HDF4_def_vlen,
+HDF4_put_vlen_element,
+HDF4_get_vlen_element,
+HDF4_def_enum,
+HDF4_insert_enum,
+HDF4_inq_enum_member,
+HDF4_inq_enum_ident,
+HDF4_def_opaque,
+HDF4_def_var_deflate,
+HDF4_def_var_fletcher32,
+HDF4_def_var_chunking,
+HDF4_def_var_endian,
+HDF4_def_var_filter,
+HDF4_set_var_chunk_cache,
+HDF4_get_var_chunk_cache,
+
+};
+
+NC_Dispatch* HDF4_dispatch_table = NULL;
+
+/**
+ * @internal Initialize HDF4 dispatch layer.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+ */
+int
+HDF4_initialize(void)
+{
+    HDF4_dispatch_table = &HDF4_dispatcher;
+    return NC_NOERR;
+}
+
+/**
+ * @internal Finalize HDF4 dispatch layer.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+ */
+int
+HDF4_finalize(void)
+{
+    return NC_NOERR;
+}
diff --git a/libhdf4/hdf4file.c b/libhdf4/hdf4file.c
new file mode 100644
index 0000000..7759338
--- /dev/null
+++ b/libhdf4/hdf4file.c
@@ -0,0 +1,713 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
+/**
+ * @file @internal The HDF4 file functions.
+ *
+ * @author Ed Hartnett
+ */
+
+#include "config.h"
+#include <errno.h>  /* netcdf functions sometimes return system errors */
+#include "nc.h"
+#include "nc4internal.h"
+#include "hdf4dispatch.h"
+#include <mfhdf.h>
+
+extern int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var);
+
+/** @internal These flags may not be set for open mode. */
+static const int ILLEGAL_OPEN_FLAGS = (NC_MMAP|NC_64BIT_OFFSET|NC_MPIIO|NC_MPIPOSIX|NC_DISKLESS);
+
+/**
+ * @internal This function will free all allocated metadata memory,
+ * and close the HDF4 file.
+ *
+ * @param h5 Pointer to HDF5 file info struct.
+ * @param abort True if this is an abort.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+*/
+static int
+close_hdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort)
+{
+   int retval;
+
+   assert(h5 && h5->controller->path && h5->root_grp && h5->no_write);
+   LOG((3, "%s: h5->controller->path %s abort %d", __func__,
+        h5->controller->path, abort));
+
+   /* According to the docs, always end define mode on close. */
+   if (h5->flags & NC_INDEF)
+      h5->flags ^= NC_INDEF;
+
+   /* Delete all the list contents for vars, dims, and atts, in each
+    * group. */
+   if ((retval = nc4_rec_grp_del(&h5->root_grp, h5->root_grp)))
+      return retval;
+
+   /* Close hdf file. */
+   if (SDend(h5->sdid))
+      return NC_EHDFERR;
+
+   /* Free the nc4_info struct; above code should have reclaimed
+      everything else */
+   free(h5);
+   
+   return NC_NOERR;
+}
+
+#define NUM_TYPES 12 /**< Number of netCDF atomic types. */
+
+/** @internal NetCDF atomic type names. */
+static const char nc_type_name_g[NUM_TYPES][NC_MAX_NAME + 1] = {"char", "byte", "short",
+                                                                "int", "float", "double", "ubyte",
+                                                                "ushort", "uint", "int64",
+                                                                "uint64", "string"};
+
+/** @internal NetCDF atomic type sizes. */
+static const int nc_type_size_g[NUM_TYPES] = {sizeof(char), sizeof(char), sizeof(short),
+                                              sizeof(int), sizeof(float), sizeof(double), sizeof(unsigned char),
+                                              sizeof(unsigned short), sizeof(unsigned int), sizeof(long long),
+                                              sizeof(unsigned long long), sizeof(char *)};
+
+/**
+ * @internal Create a HDF4 file. Since the HDF4 integration provides
+ * read-only access to HDF4 files, this returns error NC_ENOTNC4.
+ *
+ * @param path Ignored.
+ * @param cmode Ignored.
+ * @param initialsz Ignored.
+ * @param basepe Ignored.
+ * @param chunksizehintp Ignored.
+ * @param use_parallel Ignored.
+ * @param parameters Ignored.
+ * @param dispatch Ignored.
+ * @param nc_file Ignored.
+ *
+ * @return ::NC_ENOTNC4 Cannot create HDF4 files.
+ * @author Ed Hartnett
+ */
+int
+HDF4_create(const char* path, int cmode, size_t initialsz, int basepe,
+           size_t *chunksizehintp, int use_parallel, void *parameters,
+           NC_Dispatch *dispatch, NC* nc_file)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Given an HDF4 type, set a pointer to netcdf type.
+ *
+ * See http://www.hdfgroup.org/training/HDFtraining/UsersGuide/Fundmtls.fm3.html
+ * for more information re: HDF4 types.
+ *
+ * @param h5 Pointer to HDF5 file info struct.
+ * @param hdf4_typeid Type ID for hdf4 datatype.
+ * @param xtype Pointer to netcdf type, where result will be stored.
+ * @param type_info Pointer to type info for the variable.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+ */
+static int
+get_netcdf_type_from_hdf4(NC_HDF5_FILE_INFO_T *h5, int32 hdf4_typeid,
+                          nc_type *xtype, NC_TYPE_INFO_T *type_info)
+{
+   int t = 0;
+
+   /* Added this variable in the course of fixing NCF-332.
+    * Prior to the fix, all data types were assigned
+    * NC_ENDIAN_BIG, so I am preserving that here for now.
+    * Not sure why it wouldn't be NC_ENDIAN_NATIVE, although
+    * I can hazard a guess or two.
+    */
+   int endianness = NC_ENDIAN_BIG;
+   assert(h5 && xtype);
+
+   switch(hdf4_typeid)
+   {
+   case DFNT_CHAR:
+      *xtype = NC_CHAR;
+      t = 0;
+      break;
+   case DFNT_UCHAR:
+   case DFNT_UINT8:
+      *xtype = NC_UBYTE;
+      t = 6;
+      break;
+   case DFNT_LUINT8:
+      *xtype = NC_UBYTE;
+      t = 6;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   case DFNT_INT8:
+      *xtype = NC_BYTE;
+      t = 1;
+      break;
+   case DFNT_LINT8:
+      *xtype = NC_BYTE;
+      t = 1;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   case DFNT_INT16:
+      *xtype = NC_SHORT;
+      t = 2;
+      break;
+   case DFNT_LINT16:
+      *xtype = NC_SHORT;
+      t = 2;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   case DFNT_UINT16:
+      *xtype = NC_USHORT;
+      t = 7;
+      break;
+   case DFNT_LUINT16:
+      *xtype = NC_USHORT;
+      t = 7;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   case DFNT_INT32:
+      *xtype = NC_INT;
+      t = 3;
+      break;
+   case DFNT_LINT32:
+      *xtype = NC_INT;
+      t = 3;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   case DFNT_UINT32:
+      *xtype = NC_UINT;
+      t = 8;
+      break;
+   case DFNT_LUINT32:
+      *xtype = NC_UINT;
+      t = 8;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   case DFNT_FLOAT32:
+      *xtype = NC_FLOAT;
+      t = 4;
+      break;
+   case DFNT_LFLOAT32:
+      *xtype = NC_FLOAT;
+      t = 4;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   case DFNT_FLOAT64:
+      *xtype = NC_DOUBLE;
+      t = 5;
+      break;
+   case DFNT_LFLOAT64:
+      *xtype = NC_DOUBLE;
+      t = 5;
+      endianness = NC_ENDIAN_LITTLE;
+      break;
+   default:
+      *xtype = NC_NAT;
+      return NC_EBADTYPID;
+   }
+
+   if (type_info)
+   {
+      if (hdf4_typeid == DFNT_FLOAT32)
+         type_info->nc_type_class = NC_FLOAT;
+      else if (hdf4_typeid == DFNT_FLOAT64)
+         type_info->nc_type_class = NC_DOUBLE;
+      else if (hdf4_typeid == DFNT_CHAR)
+         type_info->nc_type_class = NC_STRING;
+      else
+         type_info->nc_type_class = NC_INT;
+      type_info->endianness = endianness;
+      type_info->nc_typeid = *xtype;
+      type_info->size = nc_type_size_g[t];
+      if (!(type_info->name = strdup(nc_type_name_g[t])))
+         return NC_ENOMEM;
+   }
+
+   return NC_NOERR;
+}
+
+/**
+ * @internal Open a HDF4 file.
+ *
+ * @param path The file name of the new file.
+ * @param mode The open mode flag.
+ * @param nc Pointer that gets the NC file info struct.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+*/
+static int
+nc4_open_hdf4_file(const char *path, int mode, NC *nc)
+{
+   NC_HDF5_FILE_INFO_T *h5;
+   NC_GRP_INFO_T *grp;
+   NC_ATT_INFO_T *att;
+   int32 num_datasets, num_gatts;
+   int32 rank;
+   int v, d, a;
+   int retval;
+   NC_HDF5_FILE_INFO_T* nc4_info = NULL;
+
+   LOG((3, "%s: path %s mode %d", __func__, path, mode));
+   assert(path && nc);
+
+   /* Must be read-only access to hdf4 files. */
+   if (mode & NC_WRITE)
+      return NC_EINVAL;
+
+   /* Add necessary structs to hold netcdf-4 file data. */
+   if ((retval = nc4_nc4f_list_add(nc, path, mode)))
+      return retval;
+   nc4_info = NC4_DATA(nc);
+   assert(nc4_info && nc4_info->root_grp);
+   h5 = nc4_info;
+   h5->hdf4 = NC_TRUE;
+   grp = h5->root_grp;
+   h5->no_write = NC_TRUE;
+
+   /* Open the file and initialize SD interface. */
+   if ((h5->sdid = SDstart(path, DFACC_READ)) == FAIL)
+      return NC_EHDFERR;
+
+   /* Learn how many datasets and global atts we have. */
+   if (SDfileinfo(h5->sdid, &num_datasets, &num_gatts))
+      return NC_EHDFERR;
+
+   /* Read the atts. */
+   for (a = 0; a < num_gatts; a++)
+   {
+      int32 att_data_type, att_count;
+      size_t att_type_size;
+
+      /* Add to the end of the list of atts for this var. */
+      if ((retval = nc4_att_list_add(&h5->root_grp->att, &att)))
+         return retval;
+      att->attnum = grp->natts++;
+      att->created = NC_TRUE;
+
+      /* Learn about this attribute. */
+      if (!(att->name = malloc(NC_MAX_HDF4_NAME * sizeof(char))))
+         return NC_ENOMEM;
+      if (SDattrinfo(h5->sdid, a, att->name, &att_data_type, &att_count))
+         return NC_EATTMETA;
+      if ((retval = get_netcdf_type_from_hdf4(h5, att_data_type,
+                                              &att->nc_typeid, NULL)))
+         return retval;
+      att->len = att_count;
+
+      /* Allocate memory to hold the data. */
+      if ((retval = nc4_get_typelen_mem(h5, att->nc_typeid, 0, &att_type_size)))
+         return retval;
+      if (!(att->data = malloc(att_type_size * att->len)))
+         return NC_ENOMEM;
+
+      /* Read the data. */
+      if (SDreadattr(h5->sdid, a, att->data))
+         return NC_EHDFERR;
+   }
+
+   /* Read each dataset. */
+   for (v = 0; v < num_datasets; v++)
+   {
+      NC_VAR_INFO_T *var;
+      int32 data_type, num_atts;
+      /* Problem: Number of dims is returned by the call that requires
+         a pre-allocated array, 'dimsize'.
+         From SDS_SD website:
+         http://www.hdfgroup.org/training/HDFtraining/UsersGuide/SDS_SD.fm3.html
+         The maximum rank is 32, or MAX_VAR_DIMS (as defined in netcdf.h).
+
+         int32 dimsize[MAX_VAR_DIMS];
+      */
+      int32 *dimsize = NULL;
+      size_t var_type_size;
+      int a;
+
+      /* Add a variable. */
+      if ((retval = nc4_var_add(&var)))
+         return retval;
+
+      var->varid = grp->nvars++;
+      var->created = NC_TRUE;
+      var->written_to = NC_TRUE;
+
+      /* Add a var to the variable array, growing it as needed. */
+      if ((retval = nc4_vararray_add(grp, var)))
+         return retval;
+
+      /* Open this dataset in HDF4 file. */
+      if ((var->sdsid = SDselect(h5->sdid, v)) == FAIL)
+         return NC_EVARMETA;
+
+      /* Get shape, name, type, and attribute info about this dataset. */
+      if (!(var->name = malloc(NC_MAX_HDF4_NAME + 1)))
+         return NC_ENOMEM;
+
+      /* Invoke SDgetInfo with null dimsize to get rank. */
+      if (SDgetinfo(var->sdsid, var->name, &rank, NULL, &data_type, &num_atts))
+         return NC_EVARMETA;
+
+      var->hash = hash_fast(var->name, strlen(var->name));
+
+      if(!(dimsize = (int32*)malloc(sizeof(int32)*rank)))
+         return NC_ENOMEM;
+
+      if (SDgetinfo(var->sdsid, var->name, &rank, dimsize, &data_type, &num_atts)) {
+         if(dimsize) free(dimsize);
+         return NC_EVARMETA;
+      }
+
+      var->ndims = rank;
+      var->hdf4_data_type = data_type;
+
+      /* Fill special type_info struct for variable type information. */
+      if (!(var->type_info = calloc(1, sizeof(NC_TYPE_INFO_T)))) {
+         if(dimsize) free(dimsize);
+         return NC_ENOMEM;
+      }
+
+      if ((retval = get_netcdf_type_from_hdf4(h5, data_type, &var->type_info->nc_typeid, var->type_info))) {
+         if(dimsize) free(dimsize);
+         return retval;
+      }
+
+      /* Indicate that the variable has a pointer to the type */
+      var->type_info->rc++;
+
+      if ((retval = nc4_get_typelen_mem(h5, var->type_info->nc_typeid, 0, &var_type_size))) {
+         if(dimsize) free(dimsize);
+         return retval;
+      }
+
+      var->type_info->size = var_type_size;
+      LOG((3, "reading HDF4 dataset %s, rank %d netCDF type %d", var->name,
+           rank, var->type_info->nc_typeid));
+
+      /* Get the fill value. */
+      if (!(var->fill_value = malloc(var_type_size))) {
+         if(dimsize) free(dimsize);
+         return NC_ENOMEM;
+      }
+
+      if (SDgetfillvalue(var->sdsid, var->fill_value))
+      {
+         /* Whoops! No fill value! */
+         free(var->fill_value);
+         var->fill_value = NULL;
+      }
+
+      /* Allocate storage for dimension info in this variable. */
+      if (var->ndims)
+      {
+         if (!(var->dim = malloc(sizeof(NC_DIM_INFO_T *) * var->ndims))) {
+            if(dimsize) free(dimsize);
+            return NC_ENOMEM;
+         }
+
+         if (!(var->dimids = malloc(sizeof(int) * var->ndims))) {
+            if(dimsize) free(dimsize);
+            return NC_ENOMEM;
+         }
+      }
+
+
+      /* Find its dimensions. */
+      for (d = 0; d < var->ndims; d++)
+      {
+         int32 dimid, dim_len, dim_data_type, dim_num_attrs;
+         char dim_name[NC_MAX_NAME + 1];
+         NC_DIM_INFO_T *dim;
+
+         if ((dimid = SDgetdimid(var->sdsid, d)) == FAIL) {
+            if(dimsize) free(dimsize);
+            return NC_EDIMMETA;
+         }
+         if (SDdiminfo(dimid, dim_name, &dim_len, &dim_data_type,
+                       &dim_num_attrs))
+         {
+            if(dimsize) free(dimsize);
+            return NC_EDIMMETA;
+         }
+
+         /* Do we already have this dimension? HDF4 explicitly uses
+          * the name to tell. */
+         for (dim = grp->dim; dim; dim = dim->l.next)
+            if (!strcmp(dim->name, dim_name))
+               break;
+
+         /* If we didn't find this dimension, add one. */
+         if (!dim)
+         {
+            LOG((4, "adding dimension %s for HDF4 dataset %s",
+                 dim_name, var->name));
+            if ((retval = nc4_dim_list_add(&grp->dim, &dim)))
+               return retval;
+            dim->dimid = grp->nc4_info->next_dimid++;
+            if (strlen(dim_name) > NC_MAX_HDF4_NAME)
+               return NC_EMAXNAME;
+            if (!(dim->name = strdup(dim_name)))
+               return NC_ENOMEM;
+            if (dim_len)
+               dim->len = dim_len;
+            else
+               dim->len = *dimsize;
+            dim->hash = hash_fast(dim_name, strlen(dim_name));
+         }
+
+         /* Tell the variable the id of this dimension. */
+         var->dimids[d] = dim->dimid;
+         var->dim[d] = dim;
+      }
+
+      /* Read the atts. */
+      for (a = 0; a < num_atts; a++)
+      {
+         int32 att_data_type, att_count;
+         size_t att_type_size;
+
+         /* Add to the end of the list of atts for this var. */
+         if ((retval = nc4_att_list_add(&var->att, &att))) {
+            if(dimsize) free(dimsize);
+            return retval;
+         }
+         att->attnum = var->natts++;
+         att->created = NC_TRUE;
+
+         /* Learn about this attribute. */
+         if (!(att->name = malloc(NC_MAX_HDF4_NAME * sizeof(char)))) {
+            if(dimsize) free(dimsize);
+            return NC_ENOMEM;
+         }
+         if (SDattrinfo(var->sdsid, a, att->name, &att_data_type, &att_count)) {
+            if(dimsize) free(dimsize);
+            return NC_EATTMETA;
+         }
+         if ((retval = get_netcdf_type_from_hdf4(h5, att_data_type,
+                                                 &att->nc_typeid, NULL))) {
+            if(dimsize) free(dimsize);
+            return retval;
+         }
+
+         att->len = att_count;
+
+         /* Allocate memory to hold the data. */
+         if ((retval = nc4_get_typelen_mem(h5, att->nc_typeid, 0, &att_type_size))) {
+            if(dimsize) free(dimsize);
+            return retval;
+         }
+         if (!(att->data = malloc(att_type_size * att->len))) {
+            if(dimsize) free(dimsize);
+            return NC_ENOMEM;
+         }
+
+         /* Read the data. */
+         if (SDreadattr(var->sdsid, a, att->data)) {
+            if(dimsize) free(dimsize);
+            return NC_EHDFERR;
+         }
+      }
+      if(dimsize) free(dimsize);
+
+      {
+         /* HDF4 files can be chunked */
+         HDF_CHUNK_DEF chunkdefs;
+         int flag;
+         if(!SDgetchunkinfo(var->sdsid, &chunkdefs, &flag)) {
+            if(flag == HDF_NONE)
+               var->contiguous = NC_TRUE;
+            else if((flag & HDF_CHUNK) != 0) {
+               var->contiguous = NC_FALSE;
+               if (!(var->chunksizes = malloc(var->ndims * sizeof(size_t))))
+                  return NC_ENOMEM;
+               for (d = 0; d < var->ndims; d++) {
+                  var->chunksizes[d] = chunkdefs.chunk_lengths[d];
+               }
+            }
+         }
+      }
+
+   } /* next var */
+
+#ifdef LOGGING
+   /* This will print out the names, types, lens, etc of the vars and
+      atts in the file, if the logging level is 2 or greater. */
+   log_metadata_nc(h5->root_grp->nc4_info->controller);
+#endif
+   return NC_NOERR;
+}
+
+/**
+ * @internal Open a HDF4 file.
+ *
+ * @param path The file name of the file.
+ * @param mode The open mode flag.
+ * @param basepe Ignored by this function.
+ * @param chunksizehintp Ignored by this function.
+ * @param use_parallel Must be 0 for sequential, access. Parallel
+ * access not supported for HDF4.
+ * @param parameters pointer to struct holding extra data (e.g. for
+ * parallel I/O) layer. Ignored if NULL.
+ * @param dispatch Pointer to the dispatch table for this file.
+ * @param nc_file Pointer to an instance of NC.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EINVAL Invalid input.
+ * @author Ed Hartnett
+ */
+int
+HDF4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
+          int use_parallel, void *parameters, NC_Dispatch *dispatch,
+          NC *nc_file)
+{
+   assert(nc_file && path);
+
+   LOG((1, "%s: path %s mode %d params %x", __func__, path, mode,
+        parameters));
+
+   /* Check inputs. */
+   assert(path && !use_parallel);
+
+   /* Check the mode for validity */
+   if (mode & ILLEGAL_OPEN_FLAGS)
+      return NC_EINVAL;
+
+   /* Open the file. */
+   nc_file->int_ncid = nc_file->ext_ncid;
+   return nc4_open_hdf4_file(path, mode, nc_file);
+}
+
+/**
+ * @internal Unfortunately HDF only allows specification of fill value
+ * only when a dataset is created. Whereas in netcdf, you first create
+ * the variable and then (optionally) specify the fill value. To
+ * accomplish this in HDF5 I have to delete the dataset, and recreate
+ * it, with the fill value specified. 
+ *
+ * @param ncid File and group ID.
+ * @param fillmode File mode.
+ * @param old_modep Pointer that gets old mode. Ignored if NULL.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+*/
+int
+HDF4_set_fill(int ncid, int fillmode, int *old_modep)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal Not allowed for HDF4 files.
+ *
+ * @param ncid File and group ID.
+ *
+ * @return ::NC_ENOTNC4 No error.
+ * @author Ed Hartnett
+*/
+int
+HDF4_redef(int ncid)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal This does nothing for HDF4 files. Since they are
+ * read-only, then can never be put into define mode.
+ *
+ * @param ncid File and group ID.
+ * @param h_minfree Ignored for netCDF-4 files.
+ * @param v_align Ignored for netCDF-4 files.
+ * @param v_minfree Ignored for netCDF-4 files.
+ * @param r_align Ignored for netCDF-4 files.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+*/
+int
+HDF4__enddef(int ncid, size_t h_minfree, size_t v_align,
+             size_t v_minfree, size_t r_align)
+{
+   return NC_NOERR;   
+}
+
+/**
+ * @internal Does nothing, since HDF4 files are read only. There can
+ * be no changes to sync to disk.
+ *
+ * @param ncid File and group ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+*/
+int
+HDF4_sync(int ncid)
+{
+   return NC_NOERR;
+}
+
+/**
+ * @internal Closes the file. There can be no changes to abort since
+ * HDF4 files are read only.
+ *
+ * @param ncid File and group ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+ */
+int
+HDF4_abort(int ncid)
+{
+   NC *nc;
+   NC_HDF5_FILE_INFO_T* nc4_info;
+   int retval;
+
+   LOG((2, "%s: ncid 0x%x", __func__, ncid));
+
+   /* Find metadata for this file. */
+   if (!(nc = nc4_find_nc_file(ncid, &nc4_info)))
+      return NC_EBADID;
+   assert(nc4_info);
+
+   /* Free any resources the netcdf-4 library has for this file's
+    * metadata. */
+   if ((retval = close_hdf4_file(nc4_info, 1)))
+      return retval;
+
+   return NC_NOERR;
+}
+
+/**
+ * @internal Close the HDF4 file. 
+ *
+ * @param ncid File ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @author Ed Hartnett
+*/
+int
+HDF4_close(int ncid)
+{
+   NC_GRP_INFO_T *grp;
+   NC *nc;
+   NC_HDF5_FILE_INFO_T *h5;
+   int retval;
+
+   LOG((1, "%s: ncid 0x%x", __func__, ncid));
+
+   /* Find our metadata for this file. */
+   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
+      return retval;
+   assert(nc && h5 && grp && !grp->parent);
+
+   /* Call the nc4 close. */
+   if ((retval = close_hdf4_file(grp->nc4_info, 0)))
+      return retval;
+
+   return NC_NOERR;
+}
+
+
diff --git a/libsrc4/ncfunc.c b/libhdf4/hdf4func.c
similarity index 52%
copy from libsrc4/ncfunc.c
copy to libhdf4/hdf4func.c
index 9e3b050..f42e84d 100644
--- a/libsrc4/ncfunc.c
+++ b/libhdf4/hdf4func.c
@@ -1,17 +1,11 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
 /**
- * @internal
+ * @file @internal This file handles the (useless) *_base_pe()
+ * functions, and the inq_format functions for the HDF4 dispatch
+ * layer.
  *
- * Copyright 2003, University Corporation for Atmospheric
- * Research. See netcdf-4/docs/COPYRIGHT file for copying and
- * redistribution conditions.
- *
- * This file is part of netcdf-4, a netCDF-like interface for HDF5, or a
- * HDF5 backend for netCDF, depending on your point of view.
- *
- * This file handles the (useless) *_base_pe() functions, and the
- * inq_format functions.
- *
- * @author Ed Hartnett, Dennis Heimbigner
+ * @author Ed Hartnett
 */
 
 #include "nc4internal.h"
@@ -27,7 +21,7 @@
  * @author Ed Hartnett
  */
 int
-NC4_set_base_pe(int ncid, int pe)
+HDF4_set_base_pe(int ncid, int pe)
 {
    return NC_ENOTNC3;
 }
@@ -43,14 +37,14 @@ NC4_set_base_pe(int ncid, int pe)
  * @author Ed Hartnett
  */
 int
-NC4_inq_base_pe(int ncid, int *pe)
+HDF4_inq_base_pe(int ncid, int *pe)
 {
    return NC_ENOTNC3;
 }
 
 /**
- * @internal Get the format (i.e. NC_FORMAT_NETCDF4 pr
- * NC_FORMAT_NETCDF4_CLASSIC) of an open netCDF-4 file.
+ * @internal Get the format (i.e. NC_FORMAT_NC_HDF4) of an open HDF4
+ * file.
  *
  * @param ncid File ID (ignored).
  * @param formatp Pointer that gets the constant indicating format.
@@ -60,7 +54,7 @@ NC4_inq_base_pe(int ncid, int *pe)
  * @author Ed Hartnett
  */
 int
-NC4_inq_format(int ncid, int *formatp)
+HDF4_inq_format(int ncid, int *formatp)
 {
    NC *nc;
    NC_HDF5_FILE_INFO_T* nc4_info;
@@ -71,15 +65,11 @@ NC4_inq_format(int ncid, int *formatp)
       return NC_NOERR;
 
    /* Find the file metadata. */
-   if (!(nc = nc4_find_nc_file(ncid,&nc4_info)))
+   if (!(nc = nc4_find_nc_file(ncid, &nc4_info)))
       return NC_EBADID;
 
-   /* Otherwise, this is a netcdf-4 file. Check if classic NC3 rules
-    * are in effect for this file. */
-   if (nc4_info->cmode & NC_CLASSIC_MODEL)
-      *formatp = NC_FORMAT_NETCDF4_CLASSIC;
-   else
-      *formatp = NC_FORMAT_NETCDF4;
+   /* HDF4 is the format. */
+   *formatp = NC_FORMATX_NC_HDF4;
 
    return NC_NOERR;
 }
@@ -91,37 +81,32 @@ NC4_inq_format(int ncid, int *formatp)
  * @param ncid File ID (ignored).
  * @param formatp a pointer that gets the extended format. Note that
  * this is not the same as the format provided by nc_inq_format(). The
- * extended foramt indicates the dispatch layer model. NetCDF-4 files
- * will always get NC_FORMATX_NC4 for netCDF files, NC_FORMATX_HDF4
- * for HDF4 files.
+ * extended foramt indicates the dispatch layer model. HDF4 files
+ * will always get NC_FORMATX_NC_HDF4.
  * @param modep a pointer that gets the open/create mode associated with
  * this file. Ignored if NULL.
 
  * @return ::NC_NOERR No error.
  * @return ::NC_EBADID Bad ncid.
- * @author Dennis Heimbigner
+ * @author Ed Hartnett
  */
 int
-NC4_inq_format_extended(int ncid, int *formatp, int *modep)
+HDF4_inq_format_extended(int ncid, int *formatp, int *modep)
 {
    NC *nc;
    NC_HDF5_FILE_INFO_T* h5;
 
-   LOG((2, "nc_inq_format_extended: ncid 0x%x", ncid));
+   LOG((2, "%s: ncid 0x%x", __func__, ncid));
 
    /* Find the file metadata. */
    if (!(nc = nc4_find_nc_file(ncid,&h5)))
       return NC_EBADID;
 
-   if(modep) *modep = (nc->mode|NC_NETCDF4);
+   if (modep)
+      *modep = (nc->mode|NC_NETCDF4);
 
-   if(formatp) {
-#ifdef USE_HDF4
-      /* Distinguish HDF5 from HDF4 */
-      *formatp = (h5->hdf4 ? NC_FORMATX_NC_HDF4 : NC_FORMATX_NC_HDF5);
-#else /* USE_HDF4 */
-      *formatp = NC_FORMATX_NC_HDF5;
-#endif /* USE_HDF4 */
-   }
+   if (formatp) 
+      *formatp = NC_FORMATX_NC_HDF4;
+   
    return NC_NOERR;
 }
diff --git a/libhdf4/hdf4grp.c b/libhdf4/hdf4grp.c
new file mode 100644
index 0000000..48f98ac
--- /dev/null
+++ b/libhdf4/hdf4grp.c
@@ -0,0 +1,53 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
+/**
+ * @file @internal This file handles groups for the HDF4 dispatch
+ * layer. All functions return ::NC_ENOTNC4.
+ * 
+ * @author Ed Hartnett
+*/
+#include "nc4internal.h"
+#include "hdf4dispatch.h"
+
+/**
+ * @internal Create a group. Its ncid is returned in the new_ncid
+ * pointer. 
+ *
+ * @param parent_ncid Parent group.
+ * @param name Name of new group.
+ * @param new_ncid Pointer that gets ncid for new group.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_ESTRICTNC3 Classic model in use for this file.
+ * @return ::NC_ENOTNC4 Not a netCDF-4 file.
+ * @author Ed Hartnett
+*/
+int
+HDF4_def_grp(int parent_ncid, const char *name, int *new_ncid)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal Rename a group. 
+ *
+ * @param grpid Group ID.
+ * @param name New name for group.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_ENOTNC4 Not a netCDF-4 file.
+ * @return ::NC_EPERM File opened read-only.
+ * @return ::NC_EBADGRPID Renaming root forbidden.
+ * @return ::NC_EHDFERR HDF5 function returned error.
+ * @return ::NC_ENOMEM Out of memory.
+ * @author Ed Hartnett
+*/
+int
+HDF4_rename_grp(int grpid, const char *name)
+{
+   return NC_EPERM;   
+}
+
+
diff --git a/libhdf4/hdf4type.c b/libhdf4/hdf4type.c
new file mode 100644
index 0000000..4bb2eac
--- /dev/null
+++ b/libhdf4/hdf4type.c
@@ -0,0 +1,309 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
+/**
+ * @file @internal This file contains the type functions for the HDF4
+ * dispatch layer.
+ *
+ * @author Ed Hartnett
+ */
+#include "nc4internal.h"
+#include "nc4dispatch.h"
+
+#define NUM_ATOMIC_TYPES 13 /**< Number of netCDF atomic types. */
+
+/* The sizes of types may vary from platform to platform, but within
+ * netCDF files, type sizes are fixed. */
+#define NC_CHAR_LEN sizeof(char)      /**< @internal Size of char. */
+#define NC_STRING_LEN sizeof(char *)  /**< @internal Size of char *. */
+#define NC_BYTE_LEN 1     /**< @internal Size of byte. */
+#define NC_SHORT_LEN 2    /**< @internal Size of short. */
+#define NC_INT_LEN 4      /**< @internal Size of int. */
+#define NC_FLOAT_LEN 4    /**< @internal Size of float. */
+#define NC_DOUBLE_LEN 8   /**< @internal Size of double. */
+#define NC_INT64_LEN 8    /**< @internal Size of int64. */
+
+/**
+ * @internal Create a compound type.
+ *
+ * @param ncid File and group ID.
+ * @param size Gets size in bytes of one element of type.
+ * @param name Name of the type.
+ * @param typeidp Gets the type ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EMAXNAME Name is too long.
+ * @return ::NC_EBADNAME Name breaks netCDF name rules.
+ * @author Ed Hartnett
+*/
+int
+HDF4_def_compound(int ncid, size_t size, const char *name, nc_type *typeidp)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Insert a named field into a compound type.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param name Name of the type.
+ * @param offset Offset of field.
+ * @param field_typeid Field type ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EMAXNAME Name is too long.
+ * @return ::NC_EBADNAME Name breaks netCDF name rules.
+ * @author Ed Hartnett
+*/
+int
+HDF4_insert_compound(int ncid, nc_type typeid1, const char *name, size_t offset, 
+		   nc_type field_typeid)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Insert a named array into a compound type.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param name Name of the array field.
+ * @param offset Offset in bytes.
+ * @param field_typeid Type of field.
+ * @param ndims Number of dims for field.
+ * @param dim_sizesp Array of dim sizes.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EMAXNAME Name is too long.
+ * @return ::NC_EBADNAME Name breaks netCDF name rules.
+ * @author Ed Hartnett
+*/
+extern int
+HDF4_insert_array_compound(int ncid, int typeid1, const char *name, 
+			 size_t offset, nc_type field_typeid,
+			 int ndims, const int *dim_sizesp)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Given the ncid, typeid and fieldid, get info about the
+ * field.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param fieldid Field ID.
+ * @param name Gets name of field.
+ * @param offsetp Gets offset of field.
+ * @param field_typeidp Gets field type ID.
+ * @param ndimsp Gets number of dims for this field.
+ * @param dim_sizesp Gets the dim sizes for this field.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @author Ed Hartnett
+*/
+int
+HDF4_inq_compound_field(int ncid, nc_type typeid1, int fieldid, char *name, 
+		      size_t *offsetp, nc_type *field_typeidp, int *ndimsp, 
+		      int *dim_sizesp)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Given the typeid and the name, get the fieldid.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param name Name of field.
+ * @param fieldidp Pointer that gets new field ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EBADTYPE Type not found.
+ * @return ::NC_EBADFIELD Field not found.
+ * @author Ed Hartnett
+*/
+int
+HDF4_inq_compound_fieldindex(int ncid, nc_type typeid1, const char *name, int *fieldidp)
+{
+   return NC_ENOTNC4;
+}
+
+/* Opaque type. */
+
+/**
+ * @internal Create an opaque type. Provide a size and a name.
+ *
+ * @param ncid File and group ID.
+ * @param datum_size Size in bytes of a datum.
+ * @param name Name of new vlen type.
+ * @param typeidp Pointer that gets new type ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EMAXNAME Name is too long.
+ * @return ::NC_EBADNAME Name breaks netCDF name rules.
+ * @author Ed Hartnett
+*/
+int
+HDF4_def_opaque(int ncid, size_t datum_size, const char *name, 
+	      nc_type *typeidp)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Define a variable length type.
+ *
+ * @param ncid File and group ID.
+ * @param name Name of new vlen type.
+ * @param base_typeid Base type of vlen.
+ * @param typeidp Pointer that gets new type ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EMAXNAME Name is too long.
+ * @return ::NC_EBADNAME Name breaks netCDF name rules.
+ * @author Ed Hartnett
+*/
+int
+HDF4_def_vlen(int ncid, const char *name, nc_type base_typeid, 
+	    nc_type *typeidp)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Create an enum type. Provide a base type and a name. At
+ * the moment only ints are accepted as base types.
+ *
+ * @param ncid File and group ID.
+ * @param base_typeid Base type of vlen.
+ * @param name Name of new vlen type.
+ * @param typeidp Pointer that gets new type ID.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EMAXNAME Name is too long.
+ * @return ::NC_EBADNAME Name breaks netCDF name rules.
+ * @author Ed Hartnett
+*/
+int
+HDF4_def_enum(int ncid, nc_type base_typeid, const char *name, 
+	    nc_type *typeidp)
+{
+   return NC_ENOTNC4;
+}
+
+
+/**
+ * @internal Get enum name from enum value. Name size will be <=
+ * NC_MAX_NAME.
+ *
+ * @param ncid File and group ID.
+ * @param xtype Type ID.
+ * @param value Value of enum.
+ * @param identifier Gets the identifier for this enum value.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EBADTYPE Type not found.
+ * @return ::NC_EINVAL Invalid type data.
+ * @author Ed Hartnett
+*/
+int
+HDF4_inq_enum_ident(int ncid, nc_type xtype, long long value, char *identifier)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Get information about an enum member: an identifier and
+ * value. Identifier size will be <= NC_MAX_NAME.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param idx Enum member index.
+ * @param identifier Gets the identifier.
+ * @param value Gets the enum value.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EBADTYPE Type not found.
+ * @return ::NC_EINVAL Bad idx.
+ * @author Ed Hartnett
+*/
+int
+HDF4_inq_enum_member(int ncid, nc_type typeid1, int idx, char *identifier, 
+		   void *value)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Insert a identifier value into an enum type. The value
+ * must fit within the size of the enum type, the identifier size must
+ * be <= NC_MAX_NAME.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param identifier Name of this enum value.
+ * @param value Value of enum.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_EBADTYPE Type not found.
+ * @return ::NC_ETYPDEFINED Type already defined.
+ * @author Ed Hartnett
+*/
+int
+HDF4_insert_enum(int ncid, nc_type typeid1, const char *identifier, 
+	       const void *value)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Insert one element into an already allocated vlen array
+ * element.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param vlen_element The VLEN element to insert.
+ * @param len Length of element in bytes.
+ * @param data Element data.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+*/
+int
+HDF4_put_vlen_element(int ncid, int typeid1, void *vlen_element, 
+		    size_t len, const void *data)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Insert one element into an already allocated vlen array
+ * element.
+ *
+ * @param ncid File and group ID.
+ * @param typeid1 Type ID.
+ * @param vlen_element The VLEN element to insert.
+ * @param len Length of element in bytes.
+ * @param data Element data.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+*/
+int
+HDF4_get_vlen_element(int ncid, int typeid1, const void *vlen_element, 
+		    size_t *len, void *data)
+{
+   return NC_ENOTNC4;
+}
+
diff --git a/libhdf4/hdf4var.c b/libhdf4/hdf4var.c
new file mode 100644
index 0000000..7e70e2f
--- /dev/null
+++ b/libhdf4/hdf4var.c
@@ -0,0 +1,379 @@
+/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
+ * and redistribution conditions.*/
+/**
+ * @file @internal This file handles the variable functions for the
+ * HDF4 dispatch layer.
+ *
+ * @author Ed Hartnett
+ */
+
+#include <nc4internal.h>
+#include "nc4dispatch.h"
+
+/**
+ * @internal Set chunk cache size for a variable. This is the internal
+ * function called by nc_set_var_chunk_cache().
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param size Size in bytes to set cache.
+ * @param nelems Number of elements in cache.
+ * @param preemption Controls cache swapping.
+ *
+ * @returns ::NC_NOERR No error.
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ESTRICTNC3 Attempting netcdf-4 operation on strict nc3 netcdf-4 file.
+ * @returns ::NC_EINVAL Invalid input.
+ * @returns ::NC_EHDFERR HDF5 error.
+ * @author Ed Hartnett
+ */
+int
+HDF4_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
+                         float preemption)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal This is called by nc_get_var_chunk_cache(). Get chunk
+ * cache size for a variable.
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param sizep Gets size in bytes of cache.
+ * @param nelemsp Gets number of element slots in cache.
+ * @param preemptionp Gets cache swapping setting.
+ *
+ * @returns ::NC_NOERR No error.
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ENOTNC4 Not a netCDF-4 file.
+ * @author Ed Hartnett
+ */
+int
+HDF4_get_var_chunk_cache(int ncid, int varid, size_t *sizep,
+                        size_t *nelemsp, float *preemptionp)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Not allowed for HDF4.
+ *
+ * @param ncid File ID.
+ * @param name Name.
+ * @param xtype Type.
+ * @param ndims Number of dims.
+ * @param dimidsp Array of dim IDs.
+ * @param varidp Gets the var ID.
+ *
+ * @returns ::NC_EPERM Not allowed for HDF4.
+ * @author Ed Hartnett
+ */
+int
+HDF4_def_var(int ncid, const char *name, nc_type xtype,
+             int ndims, const int *dimidsp, int *varidp)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal Set compression settings on a variable. This is called by
+ * nc_def_var_deflate().
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param shuffle True to turn on the shuffle filter.
+ * @param deflate True to turn on deflation.
+ * @param deflate_level A number between 0 (no compression) and 9
+ * (maximum compression).
+ *
+ * @returns ::NC_NOERR No error.
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ENOTNC4 Attempting netcdf-4 operation on file that is
+ * not netCDF-4/HDF5.
+ * @returns ::NC_ELATEDEF Too late to change settings for this variable.
+ * @returns ::NC_ENOTINDEFINE Not in define mode.
+ * @returns ::NC_EINVAL Invalid input
+ * @author Ed Hartnett, Dennis Heimbigner
+ */
+int
+HDF4_def_var_deflate(int ncid, int varid, int shuffle, int deflate,
+                     int deflate_level)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal Set checksum on a variable. This is called by
+ * nc_def_var_fletcher32().
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param fletcher32 Pointer to fletcher32 setting.
+ *
+ * @returns ::NC_NOERR No error.
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ENOTNC4 Attempting netcdf-4 operation on file that is
+ * not netCDF-4/HDF5.
+ * @returns ::NC_ELATEDEF Too late to change settings for this variable.
+ * @returns ::NC_ENOTINDEFINE Not in define mode.
+ * @returns ::NC_EINVAL Invalid input
+ * @author Ed Hartnett, Dennis Heimbigner
+ */
+int
+HDF4_def_var_fletcher32(int ncid, int varid, int fletcher32)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Define chunking stuff for a var. This is called by
+ * nc_def_var_chunking(). Chunking is required in any dataset with one
+ * or more unlimited dimensions in HDF5, or any dataset using a
+ * filter.
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param contiguous Pointer to contiguous setting.
+ * @param chunksizesp Array of chunksizes.
+ *
+ * @returns ::NC_NOERR No error.
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ENOTNC4 Attempting netcdf-4 operation on file that is
+ * not netCDF-4/HDF5.
+ * @returns ::NC_ELATEDEF Too late to change settings for this variable.
+ * @returns ::NC_ENOTINDEFINE Not in define mode.
+ * @returns ::NC_EINVAL Invalid input
+ * @returns ::NC_EBADCHUNK Bad chunksize.
+ * @author Ed Hartnett, Dennis Heimbigner
+ */
+int
+HDF4_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksizesp)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal This functions sets fill value and no_fill mode for a
+ * netCDF-4 variable. It is called by nc_def_var_fill().
+ *
+ * @note All pointer parameters may be NULL, in which case they are ignored.
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param no_fill No_fill setting.
+ * @param fill_value Pointer to fill value.
+ *
+ * @returns ::NC_NOERR for success
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ENOTNC4 Attempting netcdf-4 operation on file that is
+ * not netCDF-4/HDF5.
+ * @returns ::NC_ESTRICTNC3 Attempting netcdf-4 operation on strict nc3
+ * netcdf-4 file.
+ * @returns ::NC_ELATEDEF Too late to change settings for this variable.
+ * @returns ::NC_ENOTINDEFINE Not in define mode.
+ * @returns ::NC_EPERM File is read only.
+ * @returns ::NC_EINVAL Invalid input
+ * @author Ed Hartnett
+ */
+int
+HDF4_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal This functions sets endianness for a netCDF-4
+ * variable. Called by nc_def_var_endian().
+ *
+ * @note All pointer parameters may be NULL, in which case they are ignored.
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param endianness Endianness setting.
+ *
+ * @returns ::NC_NOERR for success
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ENOTNC4 Attempting netcdf-4 operation on file that is
+ * not netCDF-4/HDF5.
+ * @returns ::NC_ESTRICTNC3 Attempting netcdf-4 operation on strict nc3
+ * netcdf-4 file.
+ * @returns ::NC_ELATEDEF Too late to change settings for this variable.
+ * @returns ::NC_ENOTINDEFINE Not in define mode.
+ * @returns ::NC_EPERM File is read only.
+ * @returns ::NC_EINVAL Invalid input
+ * @author Ed Hartnett
+ */
+int
+HDF4_def_var_endian(int ncid, int varid, int endianness)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Define filter settings. Called by nc_def_var_filter().
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param id Filter ID
+ * @param nparams Number of parameters for filter.
+ * @param parms Filter parameters.
+ *
+ * @returns ::NC_NOERR for success
+ * @returns ::NC_EBADID Bad ncid.
+ * @returns ::NC_ENOTVAR Invalid variable ID.
+ * @returns ::NC_ENOTNC4 Attempting netcdf-4 operation on file that is
+ * not netCDF-4/HDF5.
+ * @returns ::NC_ELATEDEF Too late to change settings for this variable.
+ * @returns ::NC_EFILTER Filter error.
+ * @returns ::NC_EINVAL Invalid input
+ * @author Dennis Heimbigner
+ */
+int
+HDF4_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams,
+                    const unsigned int* parms)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Not allowed for HDF4.
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID
+ * @param name New name of the variable.
+ *
+ * @returns ::NC_EPERM Not allowed for HDF4.
+ * @author Ed Hartnett
+*/
+int
+HDF4_rename_var(int ncid, int varid, const char *name)
+{
+   return NC_EPERM;
+}
+
+/**
+ * @internal
+ *
+ * This function will change the parallel access of a variable from
+ * independent to collective.
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param par_access NC_COLLECTIVE or NC_INDEPENDENT.
+ *
+ * @returns ::NC_NOERR No error.
+ * @returns ::NC_EBADID Invalid ncid passed.
+ * @returns ::NC_ENOTVAR Invalid varid passed.
+ * @returns ::NC_ENOPAR LFile was not opened with nc_open_par/nc_create_var.
+ * @returns ::NC_EINVAL Invalid par_access specified.
+ * @returns ::NC_NOERR for success
+ * @author Ed Hartnett, Dennis Heimbigner
+ */
+int
+HDF4_var_par_access(int ncid, int varid, int par_access)
+{
+   return NC_ENOTNC4;
+}
+
+/**
+ * @internal Get data from an HDF4 SD dataset.
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param startp Array of start indicies.
+ * @param countp Array of counts.
+ * @param mem_nc_type The type of these data after it is read into memory.
+ * @param is_long Ignored for HDF4.
+ * @param data pointer that gets the data.
+ * @returns ::NC_NOERR for success
+ * @author Ed Hartnett
+ */
+static int
+nc4_get_hdf4_vara(NC *nc, int ncid, int varid, const size_t *startp,
+                  const size_t *countp, nc_type mem_nc_type, int is_long, void *data)
+{
+   NC_GRP_INFO_T *grp;
+   NC_HDF5_FILE_INFO_T *h5;
+   NC_VAR_INFO_T *var;
+   int32 start32[NC_MAX_VAR_DIMS], edge32[NC_MAX_VAR_DIMS];
+   int retval, d;
+
+   /* Find our metadata for this file, group, and var. */
+   assert(nc);
+   if ((retval = nc4_find_g_var_nc(nc, ncid, varid, &grp, &var)))
+      return retval;
+   h5 = NC4_DATA(nc);
+   assert(grp && h5 && var && var->name);
+
+   for (d = 0; d < var->ndims; d++)
+   {
+      start32[d] = startp[d];
+      edge32[d] = countp[d];
+   }
+
+   if (SDreaddata(var->sdsid, start32, NULL, edge32, data))
+      return NC_EHDFERR;
+
+   return NC_NOERR;
+}
+
+/**
+ * @internal Write an array of data to a variable. This is called by
+ * nc_put_vara() and other nc_put_vara_* functions, for netCDF-4
+ * files.
+ * 
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param startp Array of start indicies.
+ * @param countp Array of counts.
+ * @param op pointer that gets the data.
+ * @param memtype The type of these data in memory.
+ *
+ * @returns ::NC_NOERR for success
+ * @author Ed Hartnett, Dennis Heimbigner
+ */
+int
+HDF4_put_vara(int ncid, int varid, const size_t *startp,
+             const size_t *countp, const void *op, int memtype)
+{
+   return NC_EPERM;
+}
+
+/**
+ * Read an array of values. This is called by nc_get_vara() for
+ * netCDF-4 files, as well as all the other nc_get_vara_*
+ * functions. HDF4 files are handled as a special case.
+ *
+ * @param ncid File ID.
+ * @param varid Variable ID.
+ * @param startp Array of start indicies.
+ * @param countp Array of counts.
+ * @param ip pointer that gets the data.
+ * @param memtype The type of these data after it is read into memory.
+
+ * @returns ::NC_NOERR for success
+ * @author Ed Hartnett, Dennis Heimbigner
+ */
+int
+HDF4_get_vara(int ncid, int varid, const size_t *startp,
+              const size_t *countp, void *ip, int memtype)
+{
+   NC *nc;
+   NC_HDF5_FILE_INFO_T* h5;
+
+   LOG((2, "%s: ncid 0x%x varid %d memtype %d", __func__, ncid, varid,
+        memtype));
+
+   if (!(nc = nc4_find_nc_file(ncid, &h5)))
+      return NC_EBADID;
+
+   /* Handle HDF4 cases. */
+   return nc4_get_hdf4_vara(nc, ncid, varid, startp, countp, memtype,
+                            0, (void *)ip);
+}
diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt
index 52c144c..1afc854 100644
--- a/liblib/CMakeLists.txt
+++ b/liblib/CMakeLists.txt
@@ -13,6 +13,10 @@ IF(USE_PNETCDF)
   SET(liblib_LIBS ${liblib_LIBS} netcdfp)
 ENDIF()
 
+IF(USE_HDF4)
+  SET(liblib_LIBS ${liblib_LIBS} netcdfhdf4)
+ENDIF()
+
 IF(ENABLE_DAP2)
   SET(liblib_LIBS ${liblib_LIBS} oc2 dap2)
 ENDIF()
diff --git a/liblib/Makefile.am b/liblib/Makefile.am
index 98d8637..05a4064 100644
--- a/liblib/Makefile.am
+++ b/liblib/Makefile.am
@@ -18,7 +18,7 @@ lib_LTLIBRARIES = libnetcdf.la
 # for information regarding incrementing `-version-info`.
 ##
 
-libnetcdf_la_LDFLAGS = -version-info 14:0:1
+libnetcdf_la_LDFLAGS = -version-info 14:1:1
 
 libnetcdf_la_CPPFLAGS = ${AM_CPPFLAGS}
 libnetcdf_la_LIBADD =
@@ -40,6 +40,12 @@ AM_CPPFLAGS += -I${top_srcdir}/libsrcp
 libnetcdf_la_LIBADD += ${top_builddir}/libsrcp/libnetcdfp.la
 endif # USE_PNETCDF
 
+# + hdf4
+if USE_HDF4
+AM_CPPFLAGS += -I${top_srcdir}/libhdf4
+libnetcdf_la_LIBADD += ${top_builddir}/libhdf4/libnchdf4.la
+endif # USE_PNETCDF
+
 # + dap
 if ENABLE_DAP
 AM_CPPFLAGS += -I${top_srcdir}/libdap2 -I${top_srcdir}/oc
diff --git a/liblib/Makefile.in b/liblib/Makefile.in
index 5a795f0..11644d0 100644
--- a/liblib/Makefile.in
+++ b/liblib/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -113,22 +113,26 @@ target_triplet = @target@
 @USE_PNETCDF_TRUE at am__append_3 = -I${top_srcdir}/libsrcp
 @USE_PNETCDF_TRUE at am__append_4 = ${top_builddir}/libsrcp/libnetcdfp.la
 
+# + hdf4
+ at USE_HDF4_TRUE@am__append_5 = -I${top_srcdir}/libhdf4
+ at USE_HDF4_TRUE@am__append_6 = ${top_builddir}/libhdf4/libnchdf4.la
+
 # + dap
- at ENABLE_DAP_TRUE@am__append_5 = -I${top_srcdir}/libdap2 -I${top_srcdir}/oc
- at ENABLE_DAP_TRUE@am__append_6 = ${top_builddir}/libdap2/libdap2.la \
+ at ENABLE_DAP_TRUE@am__append_7 = -I${top_srcdir}/libdap2 -I${top_srcdir}/oc
+ at ENABLE_DAP_TRUE@am__append_8 = ${top_builddir}/libdap2/libdap2.la \
 @ENABLE_DAP_TRUE@	${top_builddir}/oc2/liboc.la
- at ENABLE_DAP4_TRUE@am__append_7 = -I${top_srcdir}/libdap4
- at ENABLE_DAP4_TRUE@am__append_8 = ${top_builddir}/libdap4/libdap4.la
+ at ENABLE_DAP4_TRUE@am__append_9 = -I${top_srcdir}/libdap4
+ at ENABLE_DAP4_TRUE@am__append_10 = ${top_builddir}/libdap4/libdap4.la
 
 # NetCDF-4 ...
- at USE_NETCDF4_TRUE@am__append_9 = -I${top_srcdir}/libsrc4
- at USE_NETCDF4_TRUE@am__append_10 = ${top_builddir}/libsrc4/libnetcdf4.la
+ at USE_NETCDF4_TRUE@am__append_11 = -I${top_srcdir}/libsrc4
+ at USE_NETCDF4_TRUE@am__append_12 = ${top_builddir}/libsrc4/libnetcdf4.la
 
 # Not ready for prime time yet
 # libnetcdf_la_LIBADD += ${top_builddir}/libdiskless/libdiskless.la
 
 # Force binary mode for file read/write
- at ISCYGWIN_TRUE@am__append_11 = -lbinmode
+ at ISCYGWIN_TRUE@am__append_13 = -lbinmode
 subdir = liblib
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -174,7 +178,8 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
 libnetcdf_la_DEPENDENCIES = $(am__append_2) \
 	${top_builddir}/libdispatch/libdispatch.la \
 	${top_builddir}/libsrc/libnetcdf3.la $(am__append_4) \
-	$(am__append_6) $(am__append_8) $(am__append_10)
+	$(am__append_6) $(am__append_8) $(am__append_10) \
+	$(am__append_12)
 am_libnetcdf_la_OBJECTS = libnetcdf_la-nc_initialize.lo
 libnetcdf_la_OBJECTS = $(am_libnetcdf_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
@@ -198,7 +203,8 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/libnetcdf_la-nc_initialize.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -252,9 +258,10 @@ ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AM_CFLAGS = @AM_CFLAGS@
 AM_CPPFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_3) \
-	$(am__append_5) $(am__append_7) $(am__append_9)
+	$(am__append_5) $(am__append_7) $(am__append_9) \
+	$(am__append_11)
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AM_LDFLAGS = $(am__append_11)
+AM_LDFLAGS = $(am__append_13)
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -285,7 +292,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -294,6 +300,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -332,6 +339,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -440,7 +448,7 @@ lib_LTLIBRARIES = libnetcdf.la
 # These linker flags specify libtool version info.
 # See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
 # for information regarding incrementing `-version-info`.
-libnetcdf_la_LDFLAGS = -version-info 14:0:1
+libnetcdf_la_LDFLAGS = -version-info 14:1:1
 libnetcdf_la_CPPFLAGS = ${AM_CPPFLAGS}
 
 # The output library will always include netcdf3 and dispatch
@@ -448,7 +456,8 @@ libnetcdf_la_CPPFLAGS = ${AM_CPPFLAGS}
 libnetcdf_la_LIBADD = $(am__append_2) \
 	${top_builddir}/libdispatch/libdispatch.la \
 	${top_builddir}/libsrc/libnetcdf3.la $(am__append_4) \
-	$(am__append_6) $(am__append_8) $(am__append_10)
+	$(am__append_6) $(am__append_8) $(am__append_10) \
+	$(am__append_12)
 CLEANFILES = 
 
 # We need at least one source file
@@ -475,8 +484,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -533,7 +542,13 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf_la-nc_initialize.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf_la-nc_initialize.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -624,7 +639,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -698,7 +716,7 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdf_la-nc_initialize.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -744,7 +762,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdf_la-nc_initialize.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -765,9 +783,9 @@ uninstall-am: uninstall-libLTLIBRARIES
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \
+	ctags ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
diff --git a/liblib/nc_initialize.c b/liblib/nc_initialize.c
index 30da3e2..de47c0c 100644
--- a/liblib/nc_initialize.c
+++ b/liblib/nc_initialize.c
@@ -35,6 +35,11 @@ extern int NCP_initialize(void);
 extern int NCP_finalize(void);
 #endif
 
+#ifdef USE_HDF4
+extern int HDF4_initialize(void);
+extern int HDF4_finalize(void);
+#endif
+
 #ifdef _MSC_VER
 #include <io.h>
 #include <fcntl.h>
@@ -83,6 +88,9 @@ nc_initialize()
 #ifdef USE_PNETCDF
     if((stat = NCP_initialize())) goto done;
 #endif
+#ifdef USE_HDF4
+    if((stat = HDF4_initialize())) goto done;
+#endif
 #ifdef USE_NETCDF4
     if((stat = NC4_initialize())) goto done;
     stat = NC4_fileinfo_init();
diff --git a/libnetcdf.settings.in b/libnetcdf.settings.in
index 804edde..0384fac 100644
--- a/libnetcdf.settings.in
+++ b/libnetcdf.settings.in
@@ -35,4 +35,4 @@ Diskless Support:	@HAS_DISKLESS@
 MMap Support:		@HAS_MMAP@
 JNA Support:		@HAS_JNA@
 CDF5 Support:		@HAS_CDF5@
-ERANGE fill Support:	@ENABLE_ERANGE_FILL@
+ERANGE fill Support:	@HAS_ERANGE_FILL@
diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt
index a35af99..b4eddb5 100644
--- a/libsrc/CMakeLists.txt
+++ b/libsrc/CMakeLists.txt
@@ -57,6 +57,7 @@ IF(HAVE_M4)
   FILE(COPY ${libsrc_MANPAGE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
 
   ADD_CUSTOM_TARGET(manpage ALL
+
     COMMAND ${NC_M4} ${ARGS_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/netcdf.m4 > ${CMAKE_CURRENT_BINARY_DIR}/netcdf.3
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     )
diff --git a/libsrc/Makefile.in b/libsrc/Makefile.in
index 6577bc7..2d9fe5f 100644
--- a/libsrc/Makefile.in
+++ b/libsrc/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -167,7 +167,23 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/libnetcdf3_la-attr.Plo \
+	./$(DEPDIR)/libnetcdf3_la-dim.Plo \
+	./$(DEPDIR)/libnetcdf3_la-ffio.Plo \
+	./$(DEPDIR)/libnetcdf3_la-lookup3.Plo \
+	./$(DEPDIR)/libnetcdf3_la-memio.Plo \
+	./$(DEPDIR)/libnetcdf3_la-mmapio.Plo \
+	./$(DEPDIR)/libnetcdf3_la-nc3dispatch.Plo \
+	./$(DEPDIR)/libnetcdf3_la-nc3internal.Plo \
+	./$(DEPDIR)/libnetcdf3_la-nc_hashmap.Plo \
+	./$(DEPDIR)/libnetcdf3_la-ncio.Plo \
+	./$(DEPDIR)/libnetcdf3_la-ncstdio.Plo \
+	./$(DEPDIR)/libnetcdf3_la-ncx.Plo \
+	./$(DEPDIR)/libnetcdf3_la-posixio.Plo \
+	./$(DEPDIR)/libnetcdf3_la-putget.Plo \
+	./$(DEPDIR)/libnetcdf3_la-v1hpg.Plo \
+	./$(DEPDIR)/libnetcdf3_la-var.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -284,7 +300,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -293,6 +308,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -331,6 +347,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -471,8 +488,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -505,22 +522,28 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-attr.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-dim.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ffio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-lookup3.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-memio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-mmapio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc3dispatch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc3internal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc_hashmap.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncstdio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-posixio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-putget.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-v1hpg.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-var.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-attr.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-dim.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ffio.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-lookup3.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-memio.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-mmapio.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc3dispatch.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc3internal.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-nc_hashmap.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncio.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncstdio.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-ncx.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-posixio.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-putget.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-v1hpg.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf3_la-var.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -759,7 +782,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -833,7 +859,22 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdf3_la-attr.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-dim.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ffio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-lookup3.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-memio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-mmapio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-nc3dispatch.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-nc3internal.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-nc_hashmap.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ncio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ncstdio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ncx.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-posixio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-putget.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-v1hpg.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-var.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -879,7 +920,22 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdf3_la-attr.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-dim.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ffio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-lookup3.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-memio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-mmapio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-nc3dispatch.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-nc3internal.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-nc_hashmap.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ncio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ncstdio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-ncx.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-posixio.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-putget.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-v1hpg.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf3_la-var.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -902,20 +958,20 @@ uninstall-man: uninstall-man3
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-man3 install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-am uninstall uninstall-am uninstall-man \
-	uninstall-man3
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-man3 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
+	uninstall-man uninstall-man3
 
 .PRECIOUS: Makefile
 
diff --git a/libsrc/attr.c b/libsrc/attr.c
index 1d5ef3b..353d741 100644
--- a/libsrc/attr.c
+++ b/libsrc/attr.c
@@ -550,7 +550,15 @@ NC3_rename_att( int ncid, int varid, const char *name, const char *unewname)
 		free_NC_string(old);
 		return NC_NOERR;
 	}
-	/* else */
+	/* else not in define mode */
+
+	/* If new name is longer than old, then complain,
+           but otherwise, no change (test is same as set_NC_string)*/
+	if(old->nchars < strlen(newname)) {
+	    free(newname);
+	    return NC_ENOTINDEFINE;
+	}
+
 	status = set_NC_string(old, newname);
 	free(newname);
 	if( status != NC_NOERR)
@@ -632,1405 +640,1405 @@ NC3_del_att(int ncid, int varid, const char *uname)
 	return NC_NOERR;
 }
 
-#line 713
+#line 721
 
 static int
-#line 714
+#line 722
 ncx_pad_putn_Iuchar(void **xpp, size_t nelems, const uchar *tp, nc_type type, void *fillp)
-#line 714
+#line 722
 {
-#line 714
+#line 722
 	switch(type) {
-#line 714
+#line 722
 	case NC_CHAR:
-#line 714
+#line 722
 		return NC_ECHAR;
-#line 714
+#line 722
 	case NC_BYTE:
-#line 714
+#line 722
 		return ncx_pad_putn_schar_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_SHORT:
-#line 714
+#line 722
 		return ncx_pad_putn_short_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_INT:
-#line 714
+#line 722
 		return ncx_putn_int_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_FLOAT:
-#line 714
+#line 722
 		return ncx_putn_float_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_DOUBLE:
-#line 714
+#line 722
 		return ncx_putn_double_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_UBYTE:
-#line 714
+#line 722
 		return ncx_pad_putn_uchar_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_USHORT:
-#line 714
+#line 722
 		return ncx_putn_ushort_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_UINT:
-#line 714
+#line 722
 		return ncx_putn_uint_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_INT64:
-#line 714
+#line 722
 		return ncx_putn_longlong_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	case NC_UINT64:
-#line 714
+#line 722
 		return ncx_putn_ulonglong_uchar(xpp, nelems, tp, fillp);
-#line 714
+#line 722
 	default:
-#line 714
+#line 722
                 assert("ncx_pad_putn_Iuchar invalid type" == 0);
-#line 714
+#line 722
 	}
-#line 714
+#line 722
 	return NC_EBADTYPE;
-#line 714
+#line 722
 }
-#line 714
+#line 722
 
 static int
-#line 715
+#line 723
 ncx_pad_getn_Iuchar(const void **xpp, size_t nelems, uchar *tp, nc_type type)
-#line 715
+#line 723
 {
-#line 715
+#line 723
 	switch(type) {
-#line 715
+#line 723
 	case NC_CHAR:
-#line 715
+#line 723
 		return NC_ECHAR;
-#line 715
+#line 723
 	case NC_BYTE:
-#line 715
+#line 723
 		return ncx_pad_getn_schar_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_SHORT:
-#line 715
+#line 723
 		return ncx_pad_getn_short_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_INT:
-#line 715
+#line 723
 		return ncx_getn_int_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_FLOAT:
-#line 715
+#line 723
 		return ncx_getn_float_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_DOUBLE:
-#line 715
+#line 723
 		return ncx_getn_double_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_UBYTE:
-#line 715
+#line 723
 		return ncx_pad_getn_uchar_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_USHORT:
-#line 715
+#line 723
 		return ncx_getn_ushort_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_UINT:
-#line 715
+#line 723
 		return ncx_getn_uint_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_INT64:
-#line 715
+#line 723
 		return ncx_getn_longlong_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	case NC_UINT64:
-#line 715
+#line 723
 		return ncx_getn_ulonglong_uchar(xpp, nelems, tp);
-#line 715
+#line 723
 	default:
-#line 715
+#line 723
 	        assert("ncx_pad_getn_Iuchar invalid type" == 0);
-#line 715
+#line 723
 	}
-#line 715
+#line 723
 	return NC_EBADTYPE;
-#line 715
+#line 723
 }
-#line 715
+#line 723
 
 
 static int
-#line 717
+#line 725
 ncx_pad_putn_Ischar(void **xpp, size_t nelems, const schar *tp, nc_type type, void *fillp)
-#line 717
+#line 725
 {
-#line 717
+#line 725
 	switch(type) {
-#line 717
+#line 725
 	case NC_CHAR:
-#line 717
+#line 725
 		return NC_ECHAR;
-#line 717
+#line 725
 	case NC_BYTE:
-#line 717
+#line 725
 		return ncx_pad_putn_schar_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_SHORT:
-#line 717
+#line 725
 		return ncx_pad_putn_short_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_INT:
-#line 717
+#line 725
 		return ncx_putn_int_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_FLOAT:
-#line 717
+#line 725
 		return ncx_putn_float_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_DOUBLE:
-#line 717
+#line 725
 		return ncx_putn_double_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_UBYTE:
-#line 717
+#line 725
 		return ncx_pad_putn_uchar_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_USHORT:
-#line 717
+#line 725
 		return ncx_putn_ushort_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_UINT:
-#line 717
+#line 725
 		return ncx_putn_uint_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_INT64:
-#line 717
+#line 725
 		return ncx_putn_longlong_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	case NC_UINT64:
-#line 717
+#line 725
 		return ncx_putn_ulonglong_schar(xpp, nelems, tp, fillp);
-#line 717
+#line 725
 	default:
-#line 717
+#line 725
                 assert("ncx_pad_putn_Ischar invalid type" == 0);
-#line 717
+#line 725
 	}
-#line 717
+#line 725
 	return NC_EBADTYPE;
-#line 717
+#line 725
 }
-#line 717
+#line 725
 
 static int
-#line 718
+#line 726
 ncx_pad_getn_Ischar(const void **xpp, size_t nelems, schar *tp, nc_type type)
-#line 718
+#line 726
 {
-#line 718
+#line 726
 	switch(type) {
-#line 718
+#line 726
 	case NC_CHAR:
-#line 718
+#line 726
 		return NC_ECHAR;
-#line 718
+#line 726
 	case NC_BYTE:
-#line 718
+#line 726
 		return ncx_pad_getn_schar_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_SHORT:
-#line 718
+#line 726
 		return ncx_pad_getn_short_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_INT:
-#line 718
+#line 726
 		return ncx_getn_int_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_FLOAT:
-#line 718
+#line 726
 		return ncx_getn_float_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_DOUBLE:
-#line 718
+#line 726
 		return ncx_getn_double_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_UBYTE:
-#line 718
+#line 726
 		return ncx_pad_getn_uchar_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_USHORT:
-#line 718
+#line 726
 		return ncx_getn_ushort_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_UINT:
-#line 718
+#line 726
 		return ncx_getn_uint_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_INT64:
-#line 718
+#line 726
 		return ncx_getn_longlong_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	case NC_UINT64:
-#line 718
+#line 726
 		return ncx_getn_ulonglong_schar(xpp, nelems, tp);
-#line 718
+#line 726
 	default:
-#line 718
+#line 726
 	        assert("ncx_pad_getn_Ischar invalid type" == 0);
-#line 718
+#line 726
 	}
-#line 718
+#line 726
 	return NC_EBADTYPE;
-#line 718
+#line 726
 }
-#line 718
+#line 726
 
 
 static int
-#line 720
+#line 728
 ncx_pad_putn_Ishort(void **xpp, size_t nelems, const short *tp, nc_type type, void *fillp)
-#line 720
+#line 728
 {
-#line 720
+#line 728
 	switch(type) {
-#line 720
+#line 728
 	case NC_CHAR:
-#line 720
+#line 728
 		return NC_ECHAR;
-#line 720
+#line 728
 	case NC_BYTE:
-#line 720
+#line 728
 		return ncx_pad_putn_schar_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_SHORT:
-#line 720
+#line 728
 		return ncx_pad_putn_short_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_INT:
-#line 720
+#line 728
 		return ncx_putn_int_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_FLOAT:
-#line 720
+#line 728
 		return ncx_putn_float_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_DOUBLE:
-#line 720
+#line 728
 		return ncx_putn_double_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_UBYTE:
-#line 720
+#line 728
 		return ncx_pad_putn_uchar_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_USHORT:
-#line 720
+#line 728
 		return ncx_putn_ushort_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_UINT:
-#line 720
+#line 728
 		return ncx_putn_uint_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_INT64:
-#line 720
+#line 728
 		return ncx_putn_longlong_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	case NC_UINT64:
-#line 720
+#line 728
 		return ncx_putn_ulonglong_short(xpp, nelems, tp, fillp);
-#line 720
+#line 728
 	default:
-#line 720
+#line 728
                 assert("ncx_pad_putn_Ishort invalid type" == 0);
-#line 720
+#line 728
 	}
-#line 720
+#line 728
 	return NC_EBADTYPE;
-#line 720
+#line 728
 }
-#line 720
+#line 728
 
 static int
-#line 721
+#line 729
 ncx_pad_getn_Ishort(const void **xpp, size_t nelems, short *tp, nc_type type)
-#line 721
+#line 729
 {
-#line 721
+#line 729
 	switch(type) {
-#line 721
+#line 729
 	case NC_CHAR:
-#line 721
+#line 729
 		return NC_ECHAR;
-#line 721
+#line 729
 	case NC_BYTE:
-#line 721
+#line 729
 		return ncx_pad_getn_schar_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_SHORT:
-#line 721
+#line 729
 		return ncx_pad_getn_short_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_INT:
-#line 721
+#line 729
 		return ncx_getn_int_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_FLOAT:
-#line 721
+#line 729
 		return ncx_getn_float_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_DOUBLE:
-#line 721
+#line 729
 		return ncx_getn_double_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_UBYTE:
-#line 721
+#line 729
 		return ncx_pad_getn_uchar_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_USHORT:
-#line 721
+#line 729
 		return ncx_getn_ushort_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_UINT:
-#line 721
+#line 729
 		return ncx_getn_uint_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_INT64:
-#line 721
+#line 729
 		return ncx_getn_longlong_short(xpp, nelems, tp);
-#line 721
+#line 729
 	case NC_UINT64:
-#line 721
+#line 729
 		return ncx_getn_ulonglong_short(xpp, nelems, tp);
-#line 721
+#line 729
 	default:
-#line 721
+#line 729
 	        assert("ncx_pad_getn_Ishort invalid type" == 0);
-#line 721
+#line 729
 	}
-#line 721
+#line 729
 	return NC_EBADTYPE;
-#line 721
+#line 729
 }
-#line 721
+#line 729
 
 
 static int
-#line 723
+#line 731
 ncx_pad_putn_Iint(void **xpp, size_t nelems, const int *tp, nc_type type, void *fillp)
-#line 723
+#line 731
 {
-#line 723
+#line 731
 	switch(type) {
-#line 723
+#line 731
 	case NC_CHAR:
-#line 723
+#line 731
 		return NC_ECHAR;
-#line 723
+#line 731
 	case NC_BYTE:
-#line 723
+#line 731
 		return ncx_pad_putn_schar_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_SHORT:
-#line 723
+#line 731
 		return ncx_pad_putn_short_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_INT:
-#line 723
+#line 731
 		return ncx_putn_int_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_FLOAT:
-#line 723
+#line 731
 		return ncx_putn_float_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_DOUBLE:
-#line 723
+#line 731
 		return ncx_putn_double_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_UBYTE:
-#line 723
+#line 731
 		return ncx_pad_putn_uchar_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_USHORT:
-#line 723
+#line 731
 		return ncx_putn_ushort_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_UINT:
-#line 723
+#line 731
 		return ncx_putn_uint_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_INT64:
-#line 723
+#line 731
 		return ncx_putn_longlong_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	case NC_UINT64:
-#line 723
+#line 731
 		return ncx_putn_ulonglong_int(xpp, nelems, tp, fillp);
-#line 723
+#line 731
 	default:
-#line 723
+#line 731
                 assert("ncx_pad_putn_Iint invalid type" == 0);
-#line 723
+#line 731
 	}
-#line 723
+#line 731
 	return NC_EBADTYPE;
-#line 723
+#line 731
 }
-#line 723
+#line 731
 
 static int
-#line 724
+#line 732
 ncx_pad_getn_Iint(const void **xpp, size_t nelems, int *tp, nc_type type)
-#line 724
+#line 732
 {
-#line 724
+#line 732
 	switch(type) {
-#line 724
+#line 732
 	case NC_CHAR:
-#line 724
+#line 732
 		return NC_ECHAR;
-#line 724
+#line 732
 	case NC_BYTE:
-#line 724
+#line 732
 		return ncx_pad_getn_schar_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_SHORT:
-#line 724
+#line 732
 		return ncx_pad_getn_short_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_INT:
-#line 724
+#line 732
 		return ncx_getn_int_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_FLOAT:
-#line 724
+#line 732
 		return ncx_getn_float_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_DOUBLE:
-#line 724
+#line 732
 		return ncx_getn_double_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_UBYTE:
-#line 724
+#line 732
 		return ncx_pad_getn_uchar_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_USHORT:
-#line 724
+#line 732
 		return ncx_getn_ushort_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_UINT:
-#line 724
+#line 732
 		return ncx_getn_uint_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_INT64:
-#line 724
+#line 732
 		return ncx_getn_longlong_int(xpp, nelems, tp);
-#line 724
+#line 732
 	case NC_UINT64:
-#line 724
+#line 732
 		return ncx_getn_ulonglong_int(xpp, nelems, tp);
-#line 724
+#line 732
 	default:
-#line 724
+#line 732
 	        assert("ncx_pad_getn_Iint invalid type" == 0);
-#line 724
+#line 732
 	}
-#line 724
+#line 732
 	return NC_EBADTYPE;
-#line 724
+#line 732
 }
-#line 724
+#line 732
 
 
 static int
-#line 726
+#line 734
 ncx_pad_putn_Ifloat(void **xpp, size_t nelems, const float *tp, nc_type type, void *fillp)
-#line 726
+#line 734
 {
-#line 726
+#line 734
 	switch(type) {
-#line 726
+#line 734
 	case NC_CHAR:
-#line 726
+#line 734
 		return NC_ECHAR;
-#line 726
+#line 734
 	case NC_BYTE:
-#line 726
+#line 734
 		return ncx_pad_putn_schar_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_SHORT:
-#line 726
+#line 734
 		return ncx_pad_putn_short_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_INT:
-#line 726
+#line 734
 		return ncx_putn_int_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_FLOAT:
-#line 726
+#line 734
 		return ncx_putn_float_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_DOUBLE:
-#line 726
+#line 734
 		return ncx_putn_double_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_UBYTE:
-#line 726
+#line 734
 		return ncx_pad_putn_uchar_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_USHORT:
-#line 726
+#line 734
 		return ncx_putn_ushort_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_UINT:
-#line 726
+#line 734
 		return ncx_putn_uint_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_INT64:
-#line 726
+#line 734
 		return ncx_putn_longlong_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	case NC_UINT64:
-#line 726
+#line 734
 		return ncx_putn_ulonglong_float(xpp, nelems, tp, fillp);
-#line 726
+#line 734
 	default:
-#line 726
+#line 734
                 assert("ncx_pad_putn_Ifloat invalid type" == 0);
-#line 726
+#line 734
 	}
-#line 726
+#line 734
 	return NC_EBADTYPE;
-#line 726
+#line 734
 }
-#line 726
+#line 734
 
 static int
-#line 727
+#line 735
 ncx_pad_getn_Ifloat(const void **xpp, size_t nelems, float *tp, nc_type type)
-#line 727
+#line 735
 {
-#line 727
+#line 735
 	switch(type) {
-#line 727
+#line 735
 	case NC_CHAR:
-#line 727
+#line 735
 		return NC_ECHAR;
-#line 727
+#line 735
 	case NC_BYTE:
-#line 727
+#line 735
 		return ncx_pad_getn_schar_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_SHORT:
-#line 727
+#line 735
 		return ncx_pad_getn_short_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_INT:
-#line 727
+#line 735
 		return ncx_getn_int_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_FLOAT:
-#line 727
+#line 735
 		return ncx_getn_float_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_DOUBLE:
-#line 727
+#line 735
 		return ncx_getn_double_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_UBYTE:
-#line 727
+#line 735
 		return ncx_pad_getn_uchar_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_USHORT:
-#line 727
+#line 735
 		return ncx_getn_ushort_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_UINT:
-#line 727
+#line 735
 		return ncx_getn_uint_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_INT64:
-#line 727
+#line 735
 		return ncx_getn_longlong_float(xpp, nelems, tp);
-#line 727
+#line 735
 	case NC_UINT64:
-#line 727
+#line 735
 		return ncx_getn_ulonglong_float(xpp, nelems, tp);
-#line 727
+#line 735
 	default:
-#line 727
+#line 735
 	        assert("ncx_pad_getn_Ifloat invalid type" == 0);
-#line 727
+#line 735
 	}
-#line 727
+#line 735
 	return NC_EBADTYPE;
-#line 727
+#line 735
 }
-#line 727
+#line 735
 
 
 static int
-#line 729
+#line 737
 ncx_pad_putn_Idouble(void **xpp, size_t nelems, const double *tp, nc_type type, void *fillp)
-#line 729
+#line 737
 {
-#line 729
+#line 737
 	switch(type) {
-#line 729
+#line 737
 	case NC_CHAR:
-#line 729
+#line 737
 		return NC_ECHAR;
-#line 729
+#line 737
 	case NC_BYTE:
-#line 729
+#line 737
 		return ncx_pad_putn_schar_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_SHORT:
-#line 729
+#line 737
 		return ncx_pad_putn_short_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_INT:
-#line 729
+#line 737
 		return ncx_putn_int_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_FLOAT:
-#line 729
+#line 737
 		return ncx_putn_float_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_DOUBLE:
-#line 729
+#line 737
 		return ncx_putn_double_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_UBYTE:
-#line 729
+#line 737
 		return ncx_pad_putn_uchar_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_USHORT:
-#line 729
+#line 737
 		return ncx_putn_ushort_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_UINT:
-#line 729
+#line 737
 		return ncx_putn_uint_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_INT64:
-#line 729
+#line 737
 		return ncx_putn_longlong_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	case NC_UINT64:
-#line 729
+#line 737
 		return ncx_putn_ulonglong_double(xpp, nelems, tp, fillp);
-#line 729
+#line 737
 	default:
-#line 729
+#line 737
                 assert("ncx_pad_putn_Idouble invalid type" == 0);
-#line 729
+#line 737
 	}
-#line 729
+#line 737
 	return NC_EBADTYPE;
-#line 729
+#line 737
 }
-#line 729
+#line 737
 
 static int
-#line 730
+#line 738
 ncx_pad_getn_Idouble(const void **xpp, size_t nelems, double *tp, nc_type type)
-#line 730
+#line 738
 {
-#line 730
+#line 738
 	switch(type) {
-#line 730
+#line 738
 	case NC_CHAR:
-#line 730
+#line 738
 		return NC_ECHAR;
-#line 730
+#line 738
 	case NC_BYTE:
-#line 730
+#line 738
 		return ncx_pad_getn_schar_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_SHORT:
-#line 730
+#line 738
 		return ncx_pad_getn_short_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_INT:
-#line 730
+#line 738
 		return ncx_getn_int_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_FLOAT:
-#line 730
+#line 738
 		return ncx_getn_float_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_DOUBLE:
-#line 730
+#line 738
 		return ncx_getn_double_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_UBYTE:
-#line 730
+#line 738
 		return ncx_pad_getn_uchar_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_USHORT:
-#line 730
+#line 738
 		return ncx_getn_ushort_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_UINT:
-#line 730
+#line 738
 		return ncx_getn_uint_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_INT64:
-#line 730
+#line 738
 		return ncx_getn_longlong_double(xpp, nelems, tp);
-#line 730
+#line 738
 	case NC_UINT64:
-#line 730
+#line 738
 		return ncx_getn_ulonglong_double(xpp, nelems, tp);
-#line 730
+#line 738
 	default:
-#line 730
+#line 738
 	        assert("ncx_pad_getn_Idouble invalid type" == 0);
-#line 730
+#line 738
 	}
-#line 730
+#line 738
 	return NC_EBADTYPE;
-#line 730
+#line 738
 }
-#line 730
+#line 738
 
 
 #ifdef IGNORE
 static int
-#line 733
+#line 741
 ncx_pad_putn_Ilong(void **xpp, size_t nelems, const long *tp, nc_type type, void *fillp)
-#line 733
+#line 741
 {
-#line 733
+#line 741
 	switch(type) {
-#line 733
+#line 741
 	case NC_CHAR:
-#line 733
+#line 741
 		return NC_ECHAR;
-#line 733
+#line 741
 	case NC_BYTE:
-#line 733
+#line 741
 		return ncx_pad_putn_schar_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_SHORT:
-#line 733
+#line 741
 		return ncx_pad_putn_short_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_INT:
-#line 733
+#line 741
 		return ncx_putn_int_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_FLOAT:
-#line 733
+#line 741
 		return ncx_putn_float_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_DOUBLE:
-#line 733
+#line 741
 		return ncx_putn_double_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_UBYTE:
-#line 733
+#line 741
 		return ncx_pad_putn_uchar_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_USHORT:
-#line 733
+#line 741
 		return ncx_putn_ushort_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_UINT:
-#line 733
+#line 741
 		return ncx_putn_uint_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_INT64:
-#line 733
+#line 741
 		return ncx_putn_longlong_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	case NC_UINT64:
-#line 733
+#line 741
 		return ncx_putn_ulonglong_long(xpp, nelems, tp, fillp);
-#line 733
+#line 741
 	default:
-#line 733
+#line 741
                 assert("ncx_pad_putn_Ilong invalid type" == 0);
-#line 733
+#line 741
 	}
-#line 733
+#line 741
 	return NC_EBADTYPE;
-#line 733
+#line 741
 }
-#line 733
+#line 741
 
 static int
-#line 734
+#line 742
 ncx_pad_getn_Ilong(const void **xpp, size_t nelems, long *tp, nc_type type)
-#line 734
+#line 742
 {
-#line 734
+#line 742
 	switch(type) {
-#line 734
+#line 742
 	case NC_CHAR:
-#line 734
+#line 742
 		return NC_ECHAR;
-#line 734
+#line 742
 	case NC_BYTE:
-#line 734
+#line 742
 		return ncx_pad_getn_schar_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_SHORT:
-#line 734
+#line 742
 		return ncx_pad_getn_short_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_INT:
-#line 734
+#line 742
 		return ncx_getn_int_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_FLOAT:
-#line 734
+#line 742
 		return ncx_getn_float_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_DOUBLE:
-#line 734
+#line 742
 		return ncx_getn_double_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_UBYTE:
-#line 734
+#line 742
 		return ncx_pad_getn_uchar_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_USHORT:
-#line 734
+#line 742
 		return ncx_getn_ushort_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_UINT:
-#line 734
+#line 742
 		return ncx_getn_uint_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_INT64:
-#line 734
+#line 742
 		return ncx_getn_longlong_long(xpp, nelems, tp);
-#line 734
+#line 742
 	case NC_UINT64:
-#line 734
+#line 742
 		return ncx_getn_ulonglong_long(xpp, nelems, tp);
-#line 734
+#line 742
 	default:
-#line 734
+#line 742
 	        assert("ncx_pad_getn_Ilong invalid type" == 0);
-#line 734
+#line 742
 	}
-#line 734
+#line 742
 	return NC_EBADTYPE;
-#line 734
+#line 742
 }
-#line 734
+#line 742
 
 #endif
 
 static int
-#line 737
+#line 745
 ncx_pad_putn_Ilonglong(void **xpp, size_t nelems, const longlong *tp, nc_type type, void *fillp)
-#line 737
+#line 745
 {
-#line 737
+#line 745
 	switch(type) {
-#line 737
+#line 745
 	case NC_CHAR:
-#line 737
+#line 745
 		return NC_ECHAR;
-#line 737
+#line 745
 	case NC_BYTE:
-#line 737
+#line 745
 		return ncx_pad_putn_schar_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_SHORT:
-#line 737
+#line 745
 		return ncx_pad_putn_short_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_INT:
-#line 737
+#line 745
 		return ncx_putn_int_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_FLOAT:
-#line 737
+#line 745
 		return ncx_putn_float_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_DOUBLE:
-#line 737
+#line 745
 		return ncx_putn_double_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_UBYTE:
-#line 737
+#line 745
 		return ncx_pad_putn_uchar_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_USHORT:
-#line 737
+#line 745
 		return ncx_putn_ushort_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_UINT:
-#line 737
+#line 745
 		return ncx_putn_uint_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_INT64:
-#line 737
+#line 745
 		return ncx_putn_longlong_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	case NC_UINT64:
-#line 737
+#line 745
 		return ncx_putn_ulonglong_longlong(xpp, nelems, tp, fillp);
-#line 737
+#line 745
 	default:
-#line 737
+#line 745
                 assert("ncx_pad_putn_Ilonglong invalid type" == 0);
-#line 737
+#line 745
 	}
-#line 737
+#line 745
 	return NC_EBADTYPE;
-#line 737
+#line 745
 }
-#line 737
+#line 745
 
 static int
-#line 738
+#line 746
 ncx_pad_getn_Ilonglong(const void **xpp, size_t nelems, longlong *tp, nc_type type)
-#line 738
+#line 746
 {
-#line 738
+#line 746
 	switch(type) {
-#line 738
+#line 746
 	case NC_CHAR:
-#line 738
+#line 746
 		return NC_ECHAR;
-#line 738
+#line 746
 	case NC_BYTE:
-#line 738
+#line 746
 		return ncx_pad_getn_schar_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_SHORT:
-#line 738
+#line 746
 		return ncx_pad_getn_short_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_INT:
-#line 738
+#line 746
 		return ncx_getn_int_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_FLOAT:
-#line 738
+#line 746
 		return ncx_getn_float_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_DOUBLE:
-#line 738
+#line 746
 		return ncx_getn_double_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_UBYTE:
-#line 738
+#line 746
 		return ncx_pad_getn_uchar_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_USHORT:
-#line 738
+#line 746
 		return ncx_getn_ushort_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_UINT:
-#line 738
+#line 746
 		return ncx_getn_uint_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_INT64:
-#line 738
+#line 746
 		return ncx_getn_longlong_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	case NC_UINT64:
-#line 738
+#line 746
 		return ncx_getn_ulonglong_longlong(xpp, nelems, tp);
-#line 738
+#line 746
 	default:
-#line 738
+#line 746
 	        assert("ncx_pad_getn_Ilonglong invalid type" == 0);
-#line 738
+#line 746
 	}
-#line 738
+#line 746
 	return NC_EBADTYPE;
-#line 738
+#line 746
 }
-#line 738
+#line 746
 
 
 static int
-#line 740
+#line 748
 ncx_pad_putn_Iushort(void **xpp, size_t nelems, const ushort *tp, nc_type type, void *fillp)
-#line 740
+#line 748
 {
-#line 740
+#line 748
 	switch(type) {
-#line 740
+#line 748
 	case NC_CHAR:
-#line 740
+#line 748
 		return NC_ECHAR;
-#line 740
+#line 748
 	case NC_BYTE:
-#line 740
+#line 748
 		return ncx_pad_putn_schar_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_SHORT:
-#line 740
+#line 748
 		return ncx_pad_putn_short_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_INT:
-#line 740
+#line 748
 		return ncx_putn_int_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_FLOAT:
-#line 740
+#line 748
 		return ncx_putn_float_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_DOUBLE:
-#line 740
+#line 748
 		return ncx_putn_double_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_UBYTE:
-#line 740
+#line 748
 		return ncx_pad_putn_uchar_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_USHORT:
-#line 740
+#line 748
 		return ncx_putn_ushort_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_UINT:
-#line 740
+#line 748
 		return ncx_putn_uint_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_INT64:
-#line 740
+#line 748
 		return ncx_putn_longlong_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	case NC_UINT64:
-#line 740
+#line 748
 		return ncx_putn_ulonglong_ushort(xpp, nelems, tp, fillp);
-#line 740
+#line 748
 	default:
-#line 740
+#line 748
                 assert("ncx_pad_putn_Iushort invalid type" == 0);
-#line 740
+#line 748
 	}
-#line 740
+#line 748
 	return NC_EBADTYPE;
-#line 740
+#line 748
 }
-#line 740
+#line 748
 
 static int
-#line 741
+#line 749
 ncx_pad_getn_Iushort(const void **xpp, size_t nelems, ushort *tp, nc_type type)
-#line 741
+#line 749
 {
-#line 741
+#line 749
 	switch(type) {
-#line 741
+#line 749
 	case NC_CHAR:
-#line 741
+#line 749
 		return NC_ECHAR;
-#line 741
+#line 749
 	case NC_BYTE:
-#line 741
+#line 749
 		return ncx_pad_getn_schar_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_SHORT:
-#line 741
+#line 749
 		return ncx_pad_getn_short_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_INT:
-#line 741
+#line 749
 		return ncx_getn_int_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_FLOAT:
-#line 741
+#line 749
 		return ncx_getn_float_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_DOUBLE:
-#line 741
+#line 749
 		return ncx_getn_double_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_UBYTE:
-#line 741
+#line 749
 		return ncx_pad_getn_uchar_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_USHORT:
-#line 741
+#line 749
 		return ncx_getn_ushort_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_UINT:
-#line 741
+#line 749
 		return ncx_getn_uint_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_INT64:
-#line 741
+#line 749
 		return ncx_getn_longlong_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	case NC_UINT64:
-#line 741
+#line 749
 		return ncx_getn_ulonglong_ushort(xpp, nelems, tp);
-#line 741
+#line 749
 	default:
-#line 741
+#line 749
 	        assert("ncx_pad_getn_Iushort invalid type" == 0);
-#line 741
+#line 749
 	}
-#line 741
+#line 749
 	return NC_EBADTYPE;
-#line 741
+#line 749
 }
-#line 741
+#line 749
 
 
 static int
-#line 743
+#line 751
 ncx_pad_putn_Iuint(void **xpp, size_t nelems, const uint *tp, nc_type type, void *fillp)
-#line 743
+#line 751
 {
-#line 743
+#line 751
 	switch(type) {
-#line 743
+#line 751
 	case NC_CHAR:
-#line 743
+#line 751
 		return NC_ECHAR;
-#line 743
+#line 751
 	case NC_BYTE:
-#line 743
+#line 751
 		return ncx_pad_putn_schar_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_SHORT:
-#line 743
+#line 751
 		return ncx_pad_putn_short_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_INT:
-#line 743
+#line 751
 		return ncx_putn_int_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_FLOAT:
-#line 743
+#line 751
 		return ncx_putn_float_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_DOUBLE:
-#line 743
+#line 751
 		return ncx_putn_double_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_UBYTE:
-#line 743
+#line 751
 		return ncx_pad_putn_uchar_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_USHORT:
-#line 743
+#line 751
 		return ncx_putn_ushort_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_UINT:
-#line 743
+#line 751
 		return ncx_putn_uint_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_INT64:
-#line 743
+#line 751
 		return ncx_putn_longlong_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	case NC_UINT64:
-#line 743
+#line 751
 		return ncx_putn_ulonglong_uint(xpp, nelems, tp, fillp);
-#line 743
+#line 751
 	default:
-#line 743
+#line 751
                 assert("ncx_pad_putn_Iuint invalid type" == 0);
-#line 743
+#line 751
 	}
-#line 743
+#line 751
 	return NC_EBADTYPE;
-#line 743
+#line 751
 }
-#line 743
+#line 751
 
 static int
-#line 744
+#line 752
 ncx_pad_getn_Iuint(const void **xpp, size_t nelems, uint *tp, nc_type type)
-#line 744
+#line 752
 {
-#line 744
+#line 752
 	switch(type) {
-#line 744
+#line 752
 	case NC_CHAR:
-#line 744
+#line 752
 		return NC_ECHAR;
-#line 744
+#line 752
 	case NC_BYTE:
-#line 744
+#line 752
 		return ncx_pad_getn_schar_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_SHORT:
-#line 744
+#line 752
 		return ncx_pad_getn_short_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_INT:
-#line 744
+#line 752
 		return ncx_getn_int_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_FLOAT:
-#line 744
+#line 752
 		return ncx_getn_float_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_DOUBLE:
-#line 744
+#line 752
 		return ncx_getn_double_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_UBYTE:
-#line 744
+#line 752
 		return ncx_pad_getn_uchar_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_USHORT:
-#line 744
+#line 752
 		return ncx_getn_ushort_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_UINT:
-#line 744
+#line 752
 		return ncx_getn_uint_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_INT64:
-#line 744
+#line 752
 		return ncx_getn_longlong_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	case NC_UINT64:
-#line 744
+#line 752
 		return ncx_getn_ulonglong_uint(xpp, nelems, tp);
-#line 744
+#line 752
 	default:
-#line 744
+#line 752
 	        assert("ncx_pad_getn_Iuint invalid type" == 0);
-#line 744
+#line 752
 	}
-#line 744
+#line 752
 	return NC_EBADTYPE;
-#line 744
+#line 752
 }
-#line 744
+#line 752
 
 
 static int
-#line 746
+#line 754
 ncx_pad_putn_Iulonglong(void **xpp, size_t nelems, const ulonglong *tp, nc_type type, void *fillp)
-#line 746
+#line 754
 {
-#line 746
+#line 754
 	switch(type) {
-#line 746
+#line 754
 	case NC_CHAR:
-#line 746
+#line 754
 		return NC_ECHAR;
-#line 746
+#line 754
 	case NC_BYTE:
-#line 746
+#line 754
 		return ncx_pad_putn_schar_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_SHORT:
-#line 746
+#line 754
 		return ncx_pad_putn_short_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_INT:
-#line 746
+#line 754
 		return ncx_putn_int_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_FLOAT:
-#line 746
+#line 754
 		return ncx_putn_float_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_DOUBLE:
-#line 746
+#line 754
 		return ncx_putn_double_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_UBYTE:
-#line 746
+#line 754
 		return ncx_pad_putn_uchar_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_USHORT:
-#line 746
+#line 754
 		return ncx_putn_ushort_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_UINT:
-#line 746
+#line 754
 		return ncx_putn_uint_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_INT64:
-#line 746
+#line 754
 		return ncx_putn_longlong_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	case NC_UINT64:
-#line 746
+#line 754
 		return ncx_putn_ulonglong_ulonglong(xpp, nelems, tp, fillp);
-#line 746
+#line 754
 	default:
-#line 746
+#line 754
                 assert("ncx_pad_putn_Iulonglong invalid type" == 0);
-#line 746
+#line 754
 	}
-#line 746
+#line 754
 	return NC_EBADTYPE;
-#line 746
+#line 754
 }
-#line 746
+#line 754
 
 static int
-#line 747
+#line 755
 ncx_pad_getn_Iulonglong(const void **xpp, size_t nelems, ulonglong *tp, nc_type type)
-#line 747
+#line 755
 {
-#line 747
+#line 755
 	switch(type) {
-#line 747
+#line 755
 	case NC_CHAR:
-#line 747
+#line 755
 		return NC_ECHAR;
-#line 747
+#line 755
 	case NC_BYTE:
-#line 747
+#line 755
 		return ncx_pad_getn_schar_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_SHORT:
-#line 747
+#line 755
 		return ncx_pad_getn_short_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_INT:
-#line 747
+#line 755
 		return ncx_getn_int_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_FLOAT:
-#line 747
+#line 755
 		return ncx_getn_float_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_DOUBLE:
-#line 747
+#line 755
 		return ncx_getn_double_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_UBYTE:
-#line 747
+#line 755
 		return ncx_pad_getn_uchar_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_USHORT:
-#line 747
+#line 755
 		return ncx_getn_ushort_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_UINT:
-#line 747
+#line 755
 		return ncx_getn_uint_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_INT64:
-#line 747
+#line 755
 		return ncx_getn_longlong_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	case NC_UINT64:
-#line 747
+#line 755
 		return ncx_getn_ulonglong_ulonglong(xpp, nelems, tp);
-#line 747
+#line 755
 	default:
-#line 747
+#line 755
 	        assert("ncx_pad_getn_Iulonglong invalid type" == 0);
-#line 747
+#line 755
 	}
-#line 747
+#line 755
 	return NC_EBADTYPE;
-#line 747
+#line 755
 }
-#line 747
+#line 755
 
 
 
@@ -2123,6 +2131,25 @@ NC3_put_att(
     if(nelems != 0 && value == NULL)
 	return NC_EINVAL; /* Null arg */
 
+    /* Temporarily removed to preserve extant
+       workflows (NCO based and others). See
+
+       https://github.com/Unidata/netcdf-c/issues/843
+
+       for more information. */
+
+//    if (varid != NC_GLOBAL && !strcmp(name, _FillValue)) {
+//        /* Fill value must be of the same data type */
+//        if (type != ncp->vars.value[varid]->type) return NC_EBADTYPE;
+//
+//        /* Fill value must have exactly one value */
+//        if (nelems != 1) return NC_EINVAL;
+//
+//        /* Only allow for variables defined in initial define mode */
+//        if (ncp->old != NULL && varid < ncp->old->vars.nelems)
+//            return NC_ELATEFILL; /* try put attribute for an old variable */
+//    }
+
     attrpp = NC_findattr(ncap, name);
 
     /* 4 cases: exists X indef */
@@ -2274,4 +2301,3 @@ NC3_get_att(
     status =  NC_EBADTYPE;
     return status;
 }
-
diff --git a/libsrc/attr.m4 b/libsrc/attr.m4
index c91a124..28523f8 100644
--- a/libsrc/attr.m4
+++ b/libsrc/attr.m4
@@ -553,7 +553,15 @@ NC3_rename_att( int ncid, int varid, const char *name, const char *unewname)
 		free_NC_string(old);
 		return NC_NOERR;
 	}
-	/* else */
+	/* else not in define mode */
+
+	/* If new name is longer than old, then complain,
+           but otherwise, no change (test is same as set_NC_string)*/
+	if(old->nchars < strlen(newname)) {
+	    free(newname);
+	    return NC_ENOTINDEFINE;
+	}
+
 	status = set_NC_string(old, newname);
 	free(newname);
 	if( status != NC_NOERR)
@@ -836,6 +844,25 @@ NC3_put_att(
     if(nelems != 0 && value == NULL)
 	return NC_EINVAL; /* Null arg */
 
+    /* Temporarily removed to preserve extant
+       workflows (NCO based and others). See
+
+       https://github.com/Unidata/netcdf-c/issues/843
+
+       for more information. */
+
+//    if (varid != NC_GLOBAL && !strcmp(name, _FillValue)) {
+//        /* Fill value must be of the same data type */
+//        if (type != ncp->vars.value[varid]->type) return NC_EBADTYPE;
+//
+//        /* Fill value must have exactly one value */
+//        if (nelems != 1) return NC_EINVAL;
+//
+//        /* Only allow for variables defined in initial define mode */
+//        if (ncp->old != NULL && varid < ncp->old->vars.nelems)
+//            return NC_ELATEFILL; /* try put attribute for an old variable */
+//    }
+
     attrpp = NC_findattr(ncap, name);
 
     /* 4 cases: exists X indef */
@@ -987,4 +1014,3 @@ NC3_get_att(
     status =  NC_EBADTYPE;
     return status;
 }
-
diff --git a/libsrc/nc3dispatch.c b/libsrc/nc3dispatch.c
index ec59367..19f1756 100644
--- a/libsrc/nc3dispatch.c
+++ b/libsrc/nc3dispatch.c
@@ -73,7 +73,6 @@ static int NC3_def_opaque(int,size_t,const char*,nc_type*);
 static int NC3_def_var_deflate(int,int,int,int,int);
 static int NC3_def_var_fletcher32(int,int,int);
 static int NC3_def_var_chunking(int,int,int,const size_t*);
-static int NC3_def_var_fill(int,int,int,const void*);
 static int NC3_def_var_endian(int,int,int);
 static int NC3_def_var_filter(int, int, unsigned int, size_t, const unsigned int*);
 
@@ -129,6 +128,7 @@ NCDEFAULT_put_varm,
 NC3_inq_var_all,
 
 NC3_var_par_access,
+NC3_def_var_fill,
 
 #ifdef USE_NETCDF4
 NC3_show_metadata,
@@ -164,7 +164,6 @@ NC3_def_opaque,
 NC3_def_var_deflate,
 NC3_def_var_fletcher32,
 NC3_def_var_chunking,
-NC3_def_var_fill,
 NC3_def_var_endian,
 NC3_def_var_filter,
 NC3_set_var_chunk_cache,
@@ -198,13 +197,12 @@ NC3_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
 	       unsigned int* idp, size_t* nparamsp, unsigned int* params
 	       )
 {
-    int stat = NC3_inq_var(ncid,varid,name,xtypep,ndimsp,dimidsp,nattsp);
+    int stat = NC3_inq_var(ncid,varid,name,xtypep,ndimsp,dimidsp,nattsp,no_fill,fill_valuep);
     if(stat) return stat;
     if(shufflep) *shufflep = 0;
     if(deflatep) *deflatep = 0;
     if(fletcher32p) *fletcher32p = 0;
     if(contiguousp) *contiguousp = NC_CONTIGUOUS;
-    if(no_fill) *no_fill = 1;
     if(endiannessp) return NC_ENOTNC4;
     if(idp) return NC_ENOTNC4;
     if(nparamsp) return NC_ENOTNC4;
@@ -507,12 +505,6 @@ NC3_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksiz
 }
 
 static int
-NC3_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
-{
-    return NC_ENOTNC4;
-}
-
-static int
 NC3_def_var_endian(int ncid, int varid, int endianness)
 {
     return NC_ENOTNC4;
diff --git a/libsrc/nc3internal.c b/libsrc/nc3internal.c
index bbb2a62..f9130f3 100644
--- a/libsrc/nc3internal.c
+++ b/libsrc/nc3internal.c
@@ -312,21 +312,23 @@ fprintf(stderr, "    REC %d %s: %ld\n", ii, (*vpp)->name->cp, (long)index);
 		    return NC_EVARSIZE;
 		}
 #endif
-		if((*vpp)->len != UINT32_MAX) /* flag for vars >= 2**32 bytes */
-		    ncp->recsize += (*vpp)->len;
+		ncp->recsize += (*vpp)->len;
 		last = (*vpp);
 	}
 
-	/*
-	 * for special case of
-	 */
-	if(last != NULL) {
-	    if(ncp->recsize == last->len) { /* exactly one record variable, pack value */
-		ncp->recsize = *last->dsizes * last->xsz;
-	    } else if(last->len == UINT32_MAX) { /* huge last record variable */
-		ncp->recsize += *last->dsizes * last->xsz;
-	    }
-	}
+    /*
+     * for special case (Check CDF-1 and CDF-2 file format specifications.)
+     * "A special case: Where there is exactly one record variable, we drop the
+     * requirement that each record be four-byte aligned, so in this case there
+     * is no record padding."
+     */
+    if (last != NULL) {
+        if (ncp->recsize == last->len) {
+            /* exactly one record variable, pack value */
+            ncp->recsize = *last->dsizes * last->xsz;
+        }
+    }
+
 	if(NC_IsNew(ncp))
 		NC_set_numrecs(ncp, 0);
 	return NC_NOERR;
@@ -490,12 +492,13 @@ fillerup(NC3_INFO *ncp)
 	NC_var **varpp;
 
 	assert(!NC_readonly(ncp));
-	assert(NC_dofill(ncp));
 
 	/* loop thru vars */
 	varpp = ncp->vars.value;
 	for(ii = 0; ii < ncp->vars.nelems; ii++, varpp++)
 	{
+		if ((*varpp)->no_fill) continue;
+
 		if(IS_RECVAR(*varpp))
 		{
 			/* skip record variables */
@@ -538,6 +541,9 @@ fill_added_recs(NC3_INFO *gnu, NC3_INFO *old)
 		for(; varid < (int)gnu->vars.nelems; varid++)
 		    {
 			const NC_var *const gnu_varp = *(gnu_varpp + varid);
+
+			if (gnu_varp->no_fill) continue;
+
 			if(!IS_RECVAR(gnu_varp))
 			    {
 				/* skip non-record variables */
@@ -566,6 +572,9 @@ fill_added(NC3_INFO *gnu, NC3_INFO *old)
 	for(; varid < (int)gnu->vars.nelems; varid++)
 	{
 		const NC_var *const gnu_varp = *(gnu_varpp + varid);
+
+		if (gnu_varp->no_fill) continue; 
+
 		if(IS_RECVAR(gnu_varp))
 		{
 			/* skip record variables */
@@ -702,17 +711,14 @@ NC_check_vlens(NC3_INFO *ncp)
     if(ncp->vars.nelems == 0)
 	return NC_NOERR;
 
-    if (fIsSet(ncp->flags,NC_64BIT_DATA)) {
-	/* CDF5 format allows many large vars */
-        return NC_NOERR;
-    }
-    if (fIsSet(ncp->flags,NC_64BIT_OFFSET) && sizeof(off_t) > 4) {
+    if (fIsSet(ncp->flags,NC_64BIT_DATA)) /* CDF-5 */
+	vlen_max = X_INT64_MAX - 3; /* "- 3" handles rounded-up size */
+    else if (fIsSet(ncp->flags,NC_64BIT_OFFSET) && sizeof(off_t) > 4)
 	/* CDF2 format and LFS */
 	vlen_max = X_UINT_MAX - 3; /* "- 3" handles rounded-up size */
-    } else {
-	/* CDF1 format */
+    else /* CDF1 format */
 	vlen_max = X_INT_MAX - 3;
-    }
+
     /* Loop through vars, first pass is for non-record variables.   */
     large_vars_count = 0;
     rec_vars_count = 0;
@@ -721,6 +727,8 @@ NC_check_vlens(NC3_INFO *ncp)
 	if( !IS_RECVAR(*vpp) ) {
 	    last = 0;
 	    if( NC_check_vlen(*vpp, vlen_max) == 0 ) {
+                if (fIsSet(ncp->flags,NC_64BIT_DATA)) /* too big for CDF-5 */
+                    return NC_EVARSIZE;
 		large_vars_count++;
 		last = 1;
 	    }
@@ -749,6 +757,8 @@ NC_check_vlens(NC3_INFO *ncp)
 	    if( IS_RECVAR(*vpp) ) {
 		last = 0;
 		if( NC_check_vlen(*vpp, vlen_max) == 0 ) {
+                    if (fIsSet(ncp->flags,NC_64BIT_DATA)) /* too big for CDF-5 */
+                        return NC_EVARSIZE;
 		    large_vars_count++;
 		    last = 1;
 		}
@@ -767,6 +777,59 @@ NC_check_vlens(NC3_INFO *ncp)
     return NC_NOERR;
 }
 
+/*----< NC_check_voffs() >---------------------------------------------------*/
+/*
+ * Given a valid ncp, check whether the file starting offsets (begin) of all
+ * variables follows the same increasing order as they were defined.
+ */
+int
+NC_check_voffs(NC3_INFO *ncp)
+{
+    size_t i;
+    off_t prev_off;
+    NC_var *varp;
+
+    if (ncp->vars.nelems == 0) return NC_NOERR;
+
+    /* Loop through vars, first pass is for non-record variables */
+    prev_off = ncp->begin_var;
+    for (i=0; i<ncp->vars.nelems; i++) {
+        varp = ncp->vars.value[i];
+        if (IS_RECVAR(varp)) continue;
+
+        if (varp->begin < prev_off) {
+#if 0
+            fprintf(stderr,"Variable \"%s\" begin offset (%lld) is less than previous variable end offset (%lld)\n", varp->name->cp, varp->begin, prev_off);
+#endif
+            return NC_ENOTNC;
+        }
+        prev_off = varp->begin + varp->len;
+    }
+
+    if (ncp->begin_rec < prev_off) {
+#if 0
+        fprintf(stderr,"Record variable section begin offset (%lld) is less than fix-sized variable section end offset (%lld)\n", varp->begin, prev_off);
+#endif
+        return NC_ENOTNC;
+    }
+
+    /* Loop through vars, second pass is for record variables */
+    prev_off = ncp->begin_rec;
+    for (i=0; i<ncp->vars.nelems; i++) {
+        varp = ncp->vars.value[i];
+        if (!IS_RECVAR(varp)) continue;
+
+        if (varp->begin < prev_off) {
+#if 0
+            fprintf(stderr,"Variable \"%s\" begin offset (%lld) is less than previous variable end offset (%lld)\n", varp->name->cp, varp->begin, prev_off);
+#endif
+            return NC_ENOTNC;
+        }
+        prev_off = varp->begin + varp->len;
+    }
+
+    return NC_NOERR;
+}
 
 /*
  *  End define mode.
@@ -789,6 +852,9 @@ NC_endef(NC3_INFO *ncp,
 	status = NC_begins(ncp, h_minfree, v_align, v_minfree, r_align);
 	if(status != NC_NOERR)
 	    return status;
+	status = NC_check_voffs(ncp);
+	if(status != NC_NOERR)
+	    return status;
 
 	if(ncp->old != NULL)
 	{
@@ -840,7 +906,7 @@ NC_endef(NC3_INFO *ncp,
 	if(status != NC_NOERR)
 		return status;
 
-	if(NC_dofill(ncp))
+	/* fill mode is now per variable */
 	{
 		if(NC_IsNew(ncp))
 		{
@@ -1432,7 +1498,7 @@ int
 NC3_set_fill(int ncid,
 	int fillmode, int *old_mode_ptr)
 {
-	int status;
+	int i, status;
 	NC *nc;
 	NC3_INFO* nc3;
 	int oldmode;
@@ -1473,6 +1539,14 @@ NC3_set_fill(int ncid,
 	if(old_mode_ptr != NULL)
 		*old_mode_ptr = oldmode;
 
+	/* loop thru all variables to set/overwrite its fill mode */
+	for (i=0; i<nc3->vars.nelems; i++)
+		nc3->vars.value[i]->no_fill = (fillmode == NC_NOFILL);
+
+	/* once the file's fill mode is set, any new variables defined after
+	 * this call will check NC_dofill(nc3) and set their no_fill accordingly.
+	 * See NC3_def_var() */
+
 	return NC_NOERR;
 }
 
diff --git a/libsrc/posixio.c b/libsrc/posixio.c
index 335d261..c6fa921 100644
--- a/libsrc/posixio.c
+++ b/libsrc/posixio.c
@@ -740,11 +740,7 @@ done:
 	pxp->bf_rflags |= rflags;
 	pxp->bf_refcount++;
 
-#ifndef __CHAR_UNSIGNED__
-    *vpp = (void *)((char *)pxp->bf_base + diff);
-#else
     *vpp = (void *)((signed char*)pxp->bf_base + diff);
-#endif
 	return NC_NOERR;
 }
 
diff --git a/libsrc/putget.c b/libsrc/putget.c
index c2d582d..0d5510e 100644
--- a/libsrc/putget.c
+++ b/libsrc/putget.c
@@ -20163,11 +20163,7 @@ readNCv(const NC3_INFO* ncp, const NC_var* varp, const size_t* start,
 
     case CASE(NC_CHAR,NC_CHAR):
     case CASE(NC_CHAR,NC_UBYTE):
-#ifndef __CHAR_UNSIGNED__
-       return getNCvx_char_char(ncp,varp,start,nelems,(char*)value);
-#else
     return getNCvx_schar_schar(ncp,varp,start,nelems,(signed char*)value);
-#endif
     break;
     case CASE(NC_BYTE,NC_BYTE):
         return getNCvx_schar_schar(ncp,varp,start,nelems, (schar*)value);
diff --git a/libsrc/putget.m4 b/libsrc/putget.m4
index 70987ba..192aeb3 100644
--- a/libsrc/putget.m4
+++ b/libsrc/putget.m4
@@ -1198,11 +1198,7 @@ readNCv(const NC3_INFO* ncp, const NC_var* varp, const size_t* start,
 
     case CASE(NC_CHAR,NC_CHAR):
     case CASE(NC_CHAR,NC_UBYTE):
-#ifndef __CHAR_UNSIGNED__
-       return getNCvx_char_char(ncp,varp,start,nelems,(char*)value);
-#else
     return getNCvx_schar_schar(ncp,varp,start,nelems,(signed char*)value);
-#endif
     break;
     case CASE(NC_BYTE,NC_BYTE):
         return getNCvx_schar_schar(ncp,varp,start,nelems, (schar*)value);
diff --git a/libsrc/v1hpg.c b/libsrc/v1hpg.c
index a691503..6b3a1da 100644
--- a/libsrc/v1hpg.c
+++ b/libsrc/v1hpg.c
@@ -7,11 +7,11 @@
 #include <config.h>
 #endif
 
-#include "nc3internal.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
+#include "nc3internal.h"
 #include "rnd.h"
 #include "ncx.h"
 
@@ -939,6 +939,7 @@ static int
 v1h_put_NC_var(v1hs *psp, const NC_var *varp)
 {
 	int status;
+    size_t vsize;
 
 	status = v1h_put_NC_string(psp, varp->name);
     if(status != NC_NOERR)
@@ -975,9 +976,19 @@ v1h_put_NC_var(v1hs *psp, const NC_var *varp)
     if(status != NC_NOERR)
 		return status;
 
-	status = v1h_put_size_t(psp, &varp->len);
-    if(status != NC_NOERR)
-		return status;
+    /* write vsize to header.
+     * CDF format specification: The vsize field is actually redundant, because
+     * its value may be computed from other information in the header. The
+     * 32-bit vsize field is not large enough to contain the size of variables
+     * that require more than 2^32 - 4 bytes, so 2^32 - 1 is used in the vsize
+     * field for such variables.
+     */
+    vsize = varp->len;
+    if (varp->len > 4294967292UL && (psp->version == NC_FORMAT_CLASSIC ||
+                                     psp->version == NC_FORMAT_64BIT_OFFSET))
+        vsize = 4294967295UL; /* 2^32-1 */
+    status = v1h_put_size_t(psp, &vsize);
+    if(status != NC_NOERR) return status;
 
 	status = check_v1hs(psp, psp->version == 1 ? 4 : 8); /*begin*/
     if(status != NC_NOERR)
@@ -1231,11 +1242,6 @@ NC_computeshapes(NC3_INFO* ncp)
 		{
 	  		if(first_rec == NULL)
 				first_rec = *vpp;
-			if((*vpp)->len == UINT32_MAX &&
-                           (fIsSet(ncp->flags, NC_64BIT_OFFSET) ||
-                            fIsSet(ncp->flags, NC_64BIT_DATA))) /* Flag for large last record */
-                            ncp->recsize += (*vpp)->dsizes[0] * (*vpp)->xsz;
-			else
 			    ncp->recsize += (*vpp)->len;
 		}
 		else
@@ -1538,6 +1544,10 @@ nc_get_NC(NC3_INFO* ncp)
     if(status != NC_NOERR)
 		goto unwind_get;
 
+	status = NC_check_voffs(ncp);
+    if(status != NC_NOERR)
+		goto unwind_get;
+
 unwind_get:
 	(void) rel_v1hs(&gs);
 	return status;
diff --git a/libsrc/var.c b/libsrc/var.c
index ca5b469..199472d 100644
--- a/libsrc/var.c
+++ b/libsrc/var.c
@@ -16,6 +16,7 @@
 #include "ncx.h"
 #include "rnd.h"
 #include "ncutf8.h"
+#include "nc3dispatch.h"
 
 #ifndef OFF_T_MAX
 #if 0
@@ -177,7 +178,7 @@ dup_NC_var(const NC_var *rvarp)
 	(void) memcpy(varp->shape, rvarp->shape,
 			 rvarp->ndims * sizeof(size_t));
 	(void) memcpy(varp->dsizes, rvarp->dsizes,
-			 rvarp->ndims * sizeof(size_t));
+			 rvarp->ndims * sizeof(off_t));
 	varp->xsz = rvarp->xsz;
 	varp->len = rvarp->len;
 	varp->begin = rvarp->begin;
@@ -484,29 +485,21 @@ NC_var_shape(NC_var *varp, const NC_dimarray *dims)
 
 
 out :
-    if( varp->xsz <= (X_UINT_MAX - 1) / product ) /* if integer multiply will not overflow */
-	{
-	        varp->len = product * varp->xsz;
-		switch(varp->type) {
-		case NC_BYTE :
-		case NC_CHAR :
-		case NC_UBYTE :
-		case NC_SHORT :
-		case NC_USHORT :
-		        if( varp->len%4 != 0 )
-			{
-			        varp->len += 4 - varp->len%4; /* round up */
-		/*		*dsp += 4 - *dsp%4; */
-		    }
-		    break;
-		default:
-			/* already aligned */
-			break;
-		}
-        } else
-	{	/* OK for last var to be "too big", indicated by this special len */
-	        varp->len = X_UINT_MAX;
-        }
+
+    /* No variable size can be > X_INT64_MAX - 3 */
+    if (0 == NC_check_vlen(varp, X_INT64_MAX-3)) return NC_EVARSIZE;
+
+    /*
+     * For CDF-1 and CDF-2 formats, the total number of array elements
+     * cannot exceed 2^32, unless this variable is the last fixed-size
+     * variable, there is no record variable, and the file starting
+     * offset of this variable is less than 2GiB.
+     * This will be checked in NC_check_vlens() during NC_endef()
+     */
+    varp->len = product * varp->xsz;
+    if (varp->len % 4 > 0)
+        varp->len += 4 - varp->len % 4; /* round up */
+
 #if 0
 	arrayp("\tshape", varp->ndims, varp->shape);
 	arrayp("\tdsizes", varp->ndims, varp->dsizes);
@@ -637,6 +630,13 @@ NC3_def_var( int ncid, const char *name, nc_type type,
 
 	if(varidp != NULL)
 		*varidp = (int)ncp->vars.nelems -1; /* varid */
+
+	/* set the variable's fill mode */
+	if (NC_dofill(ncp))
+		varp->no_fill = 0;
+	else
+		varp->no_fill = 1;
+
 	return NC_NOERR;
 }
 
@@ -673,7 +673,9 @@ NC3_inq_var(int ncid,
 	nc_type *typep,
 	int *ndimsp,
 	int *dimids,
-	int *nattsp)
+	int *nattsp,
+	int *no_fillp,
+	void *fill_valuep)
 {
 	int status;
 	NC *nc;
@@ -714,6 +716,18 @@ NC3_inq_var(int ncid,
 		*nattsp = (int) varp->attrs.nelems;
 	}
 
+	if (no_fillp != NULL) *no_fillp = varp->no_fill;
+
+	if (fill_valuep != NULL) {
+		status = nc_get_att(ncid, varid, _FillValue, fill_valuep);
+		if (status != NC_NOERR && status != NC_ENOTATT)
+			return status;
+		if (status == NC_ENOTATT) {
+			status = NC3_inq_default_fill_value(varp->type, fill_valuep);
+			if (status != NC_NOERR) return status;
+		}
+	}
+
 	return NC_NOERR;
 }
 
@@ -799,3 +813,54 @@ NC3_rename_var(int ncid, int varid, const char *unewname)
 
 	return NC_NOERR;
 }
+
+int
+NC3_def_var_fill(int ncid,
+	int varid,
+	int no_fill,
+	const void *fill_value)
+{
+	int status;
+	NC *nc;
+	NC3_INFO* ncp;
+	NC_var *varp;
+
+	status = NC_check_id(ncid, &nc);
+	if(status != NC_NOERR)
+		return status;
+	ncp = NC3_DATA(nc);
+
+	if(NC_readonly(ncp))
+	{
+		return NC_EPERM;
+	}
+
+	if(!NC_indef(ncp))
+	{
+		return NC_ENOTINDEFINE;
+	}
+
+	varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
+	if(varp == NULL)
+		return NC_ENOTVAR;
+
+	if (no_fill)
+		varp->no_fill = 1;
+	else
+		varp->no_fill = 0;
+
+	/* Are we setting a fill value? */
+	if (fill_value != NULL && !varp->no_fill) {
+
+		/* If there's a _FillValue attribute, delete it. */
+		status = NC3_del_att(ncid, varid, _FillValue);
+		if (status != NC_NOERR && status != NC_ENOTATT)
+			return status;
+
+		/* Create/overwrite attribute _FillValue */
+		status = NC3_put_att(ncid, varid, _FillValue, varp->type, 1, fill_value, varp->type);
+		if (status != NC_NOERR) return status;
+	}
+
+	return NC_NOERR;
+}
diff --git a/libsrc4/Makefile.in b/libsrc4/Makefile.in
index d74940e..152bad6 100644
--- a/libsrc4/Makefile.in
+++ b/libsrc4/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -145,7 +145,20 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/libnetcdf4_la-error4.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4attr.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4dim.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4dispatch.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4file.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4grp.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4hdf.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4info.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4internal.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4printer.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4type.Plo \
+	./$(DEPDIR)/libnetcdf4_la-nc4var.Plo \
+	./$(DEPDIR)/libnetcdf4_la-ncfunc.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -231,7 +244,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -240,6 +252,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -278,6 +291,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -407,8 +421,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -441,19 +455,25 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-error4.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4attr.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4dim.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4dispatch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4file.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4grp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4hdf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4info.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4internal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4printer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4type.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4var.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-ncfunc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-error4.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4attr.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4dim.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4dispatch.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4file.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4grp.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4hdf.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4info.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4internal.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4printer.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4type.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-nc4var.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdf4_la-ncfunc.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -628,7 +648,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -698,7 +721,19 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdf4_la-error4.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4attr.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4dim.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4dispatch.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4file.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4grp.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4hdf.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4info.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4internal.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4printer.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4type.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4var.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-ncfunc.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -744,7 +779,19 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdf4_la-error4.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4attr.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4dim.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4dispatch.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4file.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4grp.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4hdf.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4info.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4internal.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4printer.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4type.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-nc4var.Plo
+	-rm -f ./$(DEPDIR)/libnetcdf4_la-ncfunc.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -765,16 +812,16 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
diff --git a/libsrc4/nc4attr.c b/libsrc4/nc4attr.c
index ea7ba0f..0aae341 100644
--- a/libsrc4/nc4attr.c
+++ b/libsrc4/nc4attr.c
@@ -1,3 +1,6 @@
+/* Copyright 2003-2018, University Corporation for Atmospheric
+ * Research. See COPYRIGHT file for copying and redistribution
+ * conditions. */
 /**
  * @file
  *
@@ -10,10 +13,6 @@
  * Remember that with atts, type conversion can take place when
  * writing them, and when reading them.
  *
- * Copyright 2003-2011, University Corporation for Atmospheric
- * Research. See COPYRIGHT file for copying and redistribution
- * conditions.
- *
  * @author Ed Hartnett
  */
 #include "nc4internal.h"
@@ -24,7 +23,7 @@
 int nc4typelen(nc_type type);
 
 /**
- * @internal Get special informatation about the attrobute.
+ * @internal Get special informatation about the attribute.
  *
  * @param h5 Pointer to HDF5 file info struct.
  * @param name Name of attribute.
@@ -38,6 +37,7 @@ int nc4typelen(nc_type type);
  *
  * @return ::NC_NOERR No error.
  * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_ERANGE Data conversion out of range.
  * @author Dennis Heimbigner
  */
 static int
@@ -98,49 +98,44 @@ nc4_get_att_special(NC_HDF5_FILE_INFO_T* h5, const char* name,
  * The mem_type is ignored if data=NULL.
  *
  * @param ncid File and group ID.
- * @param nc Pointer to file's NC struct.
  * @param varid Variable ID.
  * @param name Name of attribute.
  * @param xtype Pointer that gets (file) type of attribute.
  * @param mem_type The type of attribute data in memory.
  * @param lenp Pointer that gets length of attribute array.
  * @param attnum Pointer that gets the index number of this attribute.
- * @param is_long True only if the type is NC_LONG.
  * @param data Pointer that gets attribute data.
  *
  * @return ::NC_NOERR No error.
  * @return ::NC_EBADID Bad ncid.
  * @author Ed Hartnett
  */
-int
-nc4_get_att(int ncid, NC *nc, int varid, const char *name, nc_type *xtype,
-            nc_type mem_type, size_t *lenp, int *attnum, int is_long,
-            void *data)
+static int
+nc4_get_att(int ncid, int varid, const char *name, nc_type *xtype,
+            nc_type mem_type, size_t *lenp, int *attnum, void *data)
 {
+   NC *nc;
    NC_GRP_INFO_T *grp;
    NC_HDF5_FILE_INFO_T *h5;
    NC_ATT_INFO_T *att = NULL;
    int my_attnum = -1;
-
    int need_to_convert = 0;
    int range_error = NC_NOERR;
    void *bufr = NULL;
    size_t type_size;
    char norm_name[NC_MAX_NAME + 1];
    int i;
-   int retval = NC_NOERR;
+   int retval;
 
-   if (attnum) {
+   if (attnum) 
       my_attnum = *attnum;
-   }
 
    LOG((3, "%s: ncid 0x%x varid %d name %s attnum %d mem_type %d",
         __func__, ncid, varid, name, my_attnum, mem_type));
 
-   /* Find info for this file and group, and set pointer to each. */
-   h5 = NC4_DATA(nc);
-   if (!(grp = nc4_rec_find_grp(h5->root_grp, (ncid & GRP_ID_MASK))))
-      BAIL(NC_EBADGRPID);
+   /* Find info for this file, group, and h5 info. */
+   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
+      return retval;
 
    /* Check varid */
    if (varid != NC_GLOBAL) {
@@ -158,24 +153,20 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name, nc_type *xtype,
    if ((retval = nc4_normalize_name(name, norm_name)))
       BAIL(retval);
 
-   if(nc->ext_ncid == ncid && varid == NC_GLOBAL) {
+   /* If this is one of the reserved atts, use nc_get_att_special. */
+   if (nc->ext_ncid == ncid && varid == NC_GLOBAL) {
       const char** sp;
-      for(sp = NC_RESERVED_SPECIAL_LIST;*sp;sp++) {
-         if(strcmp(name,*sp)==0) {
-            return nc4_get_att_special(h5, norm_name, xtype, mem_type, lenp, attnum, is_long, data);
+      for (sp = NC_RESERVED_SPECIAL_LIST; *sp; sp++) {
+         if (strcmp(name,*sp)==0) {
+            return nc4_get_att_special(h5, norm_name, xtype, mem_type, lenp,
+                                       attnum, 0, data);
          }
       }
    }
 
-   /* Find the attribute, if it exists.
-      <strike>If we don't find it, we are major failures.</strike>
-   */
-   if ((retval = nc4_find_grp_att(grp, varid, norm_name, my_attnum, &att))) {
-      if(retval == NC_ENOTATT)
-         return retval;
-      else
-         BAIL(retval);
-   }
+   /* Find the attribute, if it exists. */
+   if ((retval = nc4_find_grp_att(grp, varid, norm_name, my_attnum, &att))) 
+      return retval;
 
    /* If mem_type is NC_NAT, it means we want to use the attribute's
     * file type as the mem type as well. */
@@ -185,11 +176,11 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name, nc_type *xtype,
    /* If the attribute is NC_CHAR, and the mem_type isn't, or vice
     * versa, that's a freakish attempt to convert text to
     * numbers. Some pervert out there is trying to pull a fast one!
-    * Send him an NC_ECHAR error...*/
-   if (data && att->len &&
-       ((att->nc_typeid == NC_CHAR && mem_type != NC_CHAR) ||
-        (att->nc_typeid != NC_CHAR && mem_type == NC_CHAR)))
-      BAIL(NC_ECHAR); /* take that, you freak! */
+    * Send him an NC_ECHAR error. */
+   if (data && att->len)
+      if ((att->nc_typeid == NC_CHAR && mem_type != NC_CHAR) ||
+           (att->nc_typeid != NC_CHAR && mem_type == NC_CHAR))
+         BAIL(NC_ECHAR); /* take that, you freak! */
 
    /* Copy the info. */
    if (lenp)
@@ -205,7 +196,7 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name, nc_type *xtype,
       BAIL(NC_NOERR);
 
    /* Later on, we will need to know the size of this type. */
-   if ((retval = nc4_get_typelen_mem(h5, mem_type, is_long, &type_size)))
+   if ((retval = nc4_get_typelen_mem(h5, mem_type, 0, &type_size)))
       BAIL(retval);
 
    /* We may have to convert data. Treat NC_CHAR the same as
@@ -221,7 +212,7 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name, nc_type *xtype,
       need_to_convert++;
       if ((retval = nc4_convert_type(att->data, bufr, att->nc_typeid,
                                      mem_type, (size_t)att->len, &range_error,
-                                     NULL, (h5->cmode & NC_CLASSIC_MODEL), 0, is_long)))
+                                     NULL, (h5->cmode & NC_CLASSIC_MODEL), 0, 0)))
          BAIL(retval);
 
       /* For strict netcdf-3 rules, ignore erange errors between UBYTE
@@ -281,17 +272,7 @@ nc4_get_att(int ncid, NC *nc, int varid, const char *name, nc_type *xtype,
       }
       else
       {
-         /* For long types, we need to handle this special... */
-         if (is_long && att->nc_typeid == NC_INT)
-         {
-            long *lp = data;
-            int *ip = bufr;
-
-            for (i = 0; i < att->len; i++)
-               *lp++ = *ip++;
-         }
-         else
-            memcpy(data, bufr, (size_t)(att->len * type_size));
+         memcpy(data, bufr, (size_t)(att->len * type_size));
       }
    }
 
@@ -304,152 +285,458 @@ exit:
 }
 
 /**
- * @internal Put attribute metadata into our global metadata.
+ * @internal Learn about an att. All the nc4 nc_inq_ functions just
+ * call nc4_get_att to get the metadata on an attribute.
  *
  * @param ncid File and group ID.
- * @param nc Pointer to file's NC struct.
  * @param varid Variable ID.
  * @param name Name of attribute.
- * @param file_type Type of the attribute data in file.
- * @param mem_type Type of attribute data in memory.
- * @param len Length of attribute array.
- * @param is_long True if attribute is of type NC_LONG.
- * @param data Attribute data.
+ * @param xtypep Pointer that gets type of attribute.
+ * @param lenp Pointer that gets length of attribute data array.
  *
  * @return ::NC_NOERR No error.
  * @return ::NC_EBADID Bad ncid.
  * @author Ed Hartnett
  */
-static int
-nc4_put_att(int ncid, NC *nc, int varid, const char *name,
-            nc_type file_type, nc_type mem_type, size_t len, int is_long,
-            const void *data)
+int
+NC4_inq_att(int ncid, int varid, const char *name, nc_type *xtypep,
+            size_t *lenp)
+{
+   LOG((2, "%s: ncid 0x%x varid %d name %s", __func__, ncid, varid, name));
+   return nc4_get_att(ncid, varid, name, xtypep, NC_NAT, lenp, NULL, NULL);
+}
+
+/**
+ * @internal Learn an attnum, given a name.
+ *
+ * @param ncid File and group ID.
+ * @param varid Variable ID.
+ * @param name Name of attribute.
+ * @param attnump Pointer that gets the attribute index number.
+ *
+ * @return ::NC_NOERR No error.
+ * @author Ed Hartnett
+ */
+int
+NC4_inq_attid(int ncid, int varid, const char *name, int *attnump)
+{
+   LOG((2, "%s: ncid 0x%x varid %d name %s", __func__, ncid, varid, name));
+   return nc4_get_att(ncid, varid, name, NULL, NC_NAT, NULL, attnump, NULL);
+}
+
+
+/**
+ * @internal Given an attnum, find the att's name.
+ *
+ * @param ncid File and group ID.
+ * @param varid Variable ID.
+ * @param attnum The index number of the attribute.
+ * @param name Pointer that gets name of attrribute.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @author Ed Hartnett
+ */
+int
+NC4_inq_attname(int ncid, int varid, int attnum, char *name)
+{
+   NC *nc;
+   NC_ATT_INFO_T *att;
+   NC_HDF5_FILE_INFO_T *h5;
+   int retval = NC_NOERR;
+
+   LOG((2, "nc_inq_attname: ncid 0x%x varid %d attnum %d",
+        ncid, varid, attnum));
+
+   /* Find metadata. */
+   if (!(nc = nc4_find_nc_file(ncid,NULL)))
+      return NC_EBADID;
+
+   /* get netcdf-4 metadata */
+   h5 = NC4_DATA(nc);
+   assert(h5);
+
+   /* Handle netcdf-4 files. */
+   if ((retval = nc4_find_nc_att(ncid, varid, NULL, attnum, &att)))
+      return retval;
+
+   /* Get the name. */
+   if (name)
+      strcpy(name, att->name);
+
+   return NC_NOERR;
+}
+
+/**
+ * @internal I think all atts should be named the exact same thing, to
+ * avoid confusion!
+ *
+ * @param ncid File and group ID.
+ * @param varid Variable ID.
+ * @param name Name of attribute.
+ * @param newname New name for attribute.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @author Ed Hartnett
+ */
+int
+NC4_rename_att(int ncid, int varid, const char *name, const char *newname)
 {
+   NC *nc;
    NC_GRP_INFO_T *grp;
    NC_HDF5_FILE_INFO_T *h5;
    NC_VAR_INFO_T *var = NULL;
-   NC_ATT_INFO_T *att, **attlist = NULL;
-   char norm_name[NC_MAX_NAME + 1];
-   nc_bool_t new_att = NC_FALSE;
-   int retval = NC_NOERR, range_error = 0;
-   size_t type_size;
-   int i;
-   int res;
+   NC_ATT_INFO_T *att, *list;
+   char norm_newname[NC_MAX_NAME + 1], norm_name[NC_MAX_NAME + 1];
+   hid_t datasetid = 0;
+   int retval = NC_NOERR;
 
-   if (!name)
-      return NC_EBADNAME;
-   assert(nc && NC4_DATA(nc));
+   if (!name || !newname)
+      return NC_EINVAL;
 
-   LOG((1, "nc4_put_att: ncid 0x%x varid %d name %s "
-        "file_type %d mem_type %d len %d", ncid, varid,
-        name, file_type, mem_type, len));
+   LOG((2, "nc_rename_att: ncid 0x%x varid %d name %s newname %s",
+        ncid, varid, name, newname));
 
-   /* If len is not zero, then there must be some data. */
-   if (len && !data)
-      return NC_EINVAL;
+   /* If the new name is too long, that's an error. */
+   if (strlen(newname) > NC_MAX_NAME)
+      return NC_EMAXNAME;
 
-   /* Find info for this file and group, and set pointer to each. */
-   h5 = NC4_DATA(nc);
-   if (!(grp = nc4_rec_find_grp(h5->root_grp, (ncid & GRP_ID_MASK))))
-      return NC_EBADGRPID;
+   /* Find info for this file, group, and h5 info. */
+   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
+      return retval;
+   assert(h5 && grp && h5);
 
    /* If the file is read-only, return an error. */
    if (h5->no_write)
       return NC_EPERM;
 
-   /* Find att, if it exists. */
+   /* Check and normalize the name. */
+   if ((retval = nc4_check_name(newname, norm_newname)))
+      return retval;
+
+   /* Is norm_newname in use? */
    if (varid == NC_GLOBAL)
-      attlist = &grp->att;
+   {
+      list = grp->att;
+   }
    else
    {
       if (varid < 0 || varid >= grp->vars.nelems)
          return NC_ENOTVAR;
       var = grp->vars.value[varid];
       if (!var) return NC_ENOTVAR;
-      attlist = &var->att;
       assert(var->varid == varid);
+      list = var->att;
    }
+   for (att = list; att; att = att->l.next)
+      if (!strncmp(att->name, norm_newname, NC_MAX_NAME))
+         return NC_ENAMEINUSE;
 
-   if (!name)
-      return NC_EBADNAME;
-
-   /* Check and normalize the name. */
-   if ((retval = nc4_check_name(name, norm_name)))
+   /* Normalize name and find the attribute. */
+   if ((retval = nc4_normalize_name(name, norm_name)))
       return retval;
-
-   if(nc->ext_ncid == ncid && varid == NC_GLOBAL) {
-      const char** sp;
-      for(sp = NC_RESERVED_SPECIAL_LIST;*sp;sp++) {
-         if(strcmp(name,*sp)==0) {
-            return NC_ENOTATT; /* Not settable */
-         }
-      }
-   }
-
-   for (att = *attlist; att; att = att->l.next)
-      if (!strcmp(att->name, norm_name))
+   for (att = list; att; att = att->l.next)
+      if (!strncmp(att->name, norm_name, NC_MAX_NAME))
          break;
+   if (!att)
+      return NC_ENOTATT;
 
-   /* If len is not zero, then there must be some data. */
-   if (len && !data)
-      return NC_EINVAL;
-
-   LOG((1, "nc4_put_att: ncid 0x%x varid %d name %s "
-        "file_type %d mem_type %d len %d", ncid, varid,
-        name, file_type, mem_type, len));
+   /* If we're not in define mode, new name must be of equal or
+      less size, if complying with strict NC3 rules. */
+   if (!(h5->flags & NC_INDEF) && strlen(norm_newname) > strlen(att->name) &&
+       (h5->cmode & NC_CLASSIC_MODEL))
+      return NC_ENOTINDEFINE;
 
-   if (!att)
+   /* Delete the original attribute, if it exists in the HDF5 file. */
+   if (att->created)
    {
-      /* If this is a new att, require define mode. */
-      if (!(h5->flags & NC_INDEF))
+      if (varid == NC_GLOBAL)
       {
-         if (h5->cmode & NC_CLASSIC_MODEL)
-            return NC_EINDEFINE;
-         if ((retval = NC4_redef(ncid)))
-            BAIL(retval);
+         if (H5Adelete(grp->hdf_grpid, att->name) < 0)
+            return NC_EHDFERR;
       }
-      new_att = NC_TRUE;
-   }
-   else
-   {
-      /* For an existing att, if we're not in define mode, the len
-         must not be greater than the existing len for classic model. */
-      if (!(h5->flags & NC_INDEF) &&
-          len * nc4typelen(file_type) > (size_t)att->len * nc4typelen(att->nc_typeid))
+      else
       {
-         if (h5->cmode & NC_CLASSIC_MODEL)
-            return NC_EINDEFINE;
-         if ((retval = NC4_redef(ncid)))
-            BAIL(retval);
+         if ((retval = nc4_open_var_grp2(grp, varid, &datasetid)))
+            return retval;
+         if (H5Adelete(datasetid, att->name) < 0)
+            return NC_EHDFERR;
       }
+      att->created = NC_FALSE;
    }
 
-   /* We must have two valid types to continue. */
-   if (file_type == NC_NAT || mem_type == NC_NAT)
-      return NC_EBADTYPE;
+   /* Copy the new name into our metadata. */
+   free(att->name);
+   if (!(att->name = malloc((strlen(norm_newname) + 1) * sizeof(char))))
+      return NC_ENOMEM;
+   strcpy(att->name, norm_newname);
+   att->dirty = NC_TRUE;
 
-   /* Get information about this type. */
-   if ((retval = nc4_get_typelen_mem(h5, file_type, is_long, &type_size)))
-      return retval;
+   /* Mark attributes on variable dirty, so they get written */
+   if(var)
+      var->attr_dirty = NC_TRUE;
 
-   /* No character conversions are allowed. */
-   if (file_type != mem_type &&
-       (file_type == NC_CHAR || mem_type == NC_CHAR ||
-        file_type == NC_STRING || mem_type == NC_STRING))
-      return NC_ECHAR;
+   return retval;
+}
 
-   /* For classic mode file, only allow atts with classic types to be
-    * created. */
-   if (h5->cmode & NC_CLASSIC_MODEL && file_type > NC_DOUBLE)
-      return NC_ESTRICTNC3;
+/**
+ * @internal Delete an att. Rub it out. Push the button on
+ * it. Liquidate it. Bump it off. Take it for a one-way
+ * ride. Terminate it.
+ *
+ * @param ncid File and group ID.
+ * @param varid Variable ID.
+ * @param name Name of attribute to delete.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EBADID Bad ncid.
+ * @author Ed Hartnett
+ */
+int
+NC4_del_att(int ncid, int varid, const char *name)
+{
+   NC *nc;
+   NC_GRP_INFO_T *grp;
+   NC_HDF5_FILE_INFO_T *h5;
+   NC_ATT_INFO_T *att, *natt;
+   NC_VAR_INFO_T *var;
+   NC_ATT_INFO_T **attlist = NULL;
+   hid_t locid = 0, datasetid = 0;
+   int retval = NC_NOERR;
 
-   /* Add to the end of the attribute list, if this att doesn't
+   if (!name)
+      return NC_EINVAL;
+
+   LOG((2, "nc_del_att: ncid 0x%x varid %d name %s",
+        ncid, varid, name));
+
+   /* Find info for this file, group, and h5 info. */
+   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
+      return retval;
+
+   assert(h5 && grp);
+
+   /* If the file is read-only, return an error. */
+   if (h5->no_write)
+      return NC_EPERM;
+
+   /* If it's not in define mode, forget it. */
+   if (!(h5->flags & NC_INDEF))
+   {
+      if (h5->cmode & NC_CLASSIC_MODEL)
+         return NC_ENOTINDEFINE;
+      if ((retval = NC4_redef(ncid)))
+         BAIL(retval);
+   }
+
+   /* Get either the global or a variable attribute list. Also figure
+      out the HDF5 location it's attached to. */
+   if (varid == NC_GLOBAL)
+   {
+      attlist = &grp->att;
+      locid = grp->hdf_grpid;
+   }
+   else
+   {
+      if (varid < 0 || varid >= grp->vars.nelems)
+         return NC_ENOTVAR;
+      var = grp->vars.value[varid];
+      if (!var) return NC_ENOTVAR;
+      attlist = &var->att;
+      assert(var->varid == varid);
+      if (var->created)
+         locid = var->hdf_datasetid;
+   }
+
+   /* Now find the attribute by name or number. */
+   for (att = *attlist; att; att = att->l.next)
+      if (!strcmp(att->name, name))
+         break;
+
+   /* If att is NULL, we couldn't find the attribute. */
+   if (!att)
+      BAIL_QUIET(NC_ENOTATT);
+
+   /* Delete it from the HDF5 file, if it's been created. */
+   if (att->created)
+   {
+      assert(locid);
+
+      if(H5Adelete(locid, att->name) < 0)
+         BAIL(NC_EATTMETA);
+   }
+
+   /* Renumber all following attributes. */
+   for (natt = att->l.next; natt; natt = natt->l.next)
+      natt->attnum--;
+
+   /* Delete this attribute from this list. */
+   if ((retval = nc4_att_list_del(attlist, att)))
+      BAIL(retval);
+
+exit:
+   if (datasetid > 0) H5Dclose(datasetid);
+   return retval;
+}
+
+/**
+ * @internal Write an attribute to a netCDF-4/HDF5 file, converting
+ * data type if necessary.
+ *
+ * @param ncid File and group ID.
+ * @param varid Variable ID.
+ * @param name Name of attribute.
+ * @param file_type Type of the attribute data in file.
+ * @param len Number of elements in attribute array.
+ * @param data Attribute data.
+ * @param memtype Type of data in memory.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EINVAL Invalid parameters.
+ * @return ::NC_EBADID Bad ncid.
+ * @return ::NC_ENOTVAR Variable not found.
+ * @return ::NC_EBADNAME Name contains illegal characters.
+ * @return ::NC_ENAMEINUSE Name already in use.
+ * @author Ed Hartnett, Dennis Heimbigner
+ */
+int
+NC4_put_att(int ncid, int varid, const char *name, nc_type file_type,
+            size_t len, const void *data, nc_type mem_type)
+{
+   NC *nc;
+   NC_GRP_INFO_T *grp;
+   NC_HDF5_FILE_INFO_T *h5;
+   NC_VAR_INFO_T *var = NULL;
+   NC_ATT_INFO_T *att, **attlist = NULL;
+   char norm_name[NC_MAX_NAME + 1];
+   nc_bool_t new_att = NC_FALSE;
+   int retval = NC_NOERR, range_error = 0;
+   size_t type_size;
+   int i;
+   int ret;
+
+   /* Find info for this file, group, and h5 info. */
+   if ((ret = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
+      return ret;
+   assert(nc && grp && h5);
+
+   /* Find att, if it exists. (Must check varid first or nc_test will
+    * break.) */
+   if (varid == NC_GLOBAL)
+      attlist = &grp->att;
+   else
+   {
+      if (varid < 0 || varid >= grp->vars.nelems)
+         return NC_ENOTVAR;
+      var = grp->vars.value[varid];
+      if (!var) return NC_ENOTVAR;
+      attlist = &var->att;
+      assert(var->varid == varid);
+   }
+
+   /* The length needs to be positive (cast needed for braindead
+      systems with signed size_t). */
+   if((unsigned long) len > X_INT_MAX)
+      return NC_EINVAL;
+
+   /* Check name before LOG statement. */
+   if (!name || strlen(name) > NC_MAX_NAME)
+      return NC_EBADNAME;
+
+   LOG((1, "%s: ncid 0x%x varid %d name %s file_type %d mem_type %d len %d",
+        __func__, ncid, varid, name, file_type, mem_type, len));
+
+   /* If len is not zero, then there must be some data. */
+   if (len && !data)
+      return NC_EINVAL;
+
+   /* If the file is read-only, return an error. */
+   if (h5->no_write)
+      return NC_EPERM;
+
+   /* Check and normalize the name. */
+   if ((retval = nc4_check_name(name, norm_name)))
+      return retval;
+
+   /* Check that a reserved NC_GLOBAL att name is not being used. */
+   if (nc->ext_ncid == ncid && varid == NC_GLOBAL) {
+      const char** reserved = NC_RESERVED_ATT_LIST;
+      for ( ; *reserved; reserved++) {
+         if (strcmp(name, *reserved)==0)
+            return NC_ENAMEINUSE;
+      }
+   }
+
+   /* Check that a reserved variable att name is not being used. */
+   if (varid != NC_GLOBAL) {
+      const char** reserved = NC_RESERVED_VARATT_LIST;
+      for ( ; *reserved; reserved++) {
+         if (strcmp(name, *reserved) == 0)
+            return NC_ENAMEINUSE;
+      }
+   }
+
+   /* See if there is already an attribute with this name. */
+   for (att = *attlist; att; att = att->l.next)
+      if (!strcmp(att->name, norm_name))
+         break;
+
+   LOG((1, "%s: ncid 0x%x varid %d name %s file_type %d mem_type %d len %d",
+        __func__, ncid, varid, name, file_type, mem_type, len));
+
+   if (!att)
+   {
+      /* If this is a new att, require define mode. */
+      if (!(h5->flags & NC_INDEF))
+      {
+         if (h5->cmode & NC_CLASSIC_MODEL)
+            return NC_EINDEFINE;
+         if ((retval = NC4_redef(ncid)))
+            BAIL(retval);
+      }
+      new_att = NC_TRUE;
+   }
+   else
+   {
+      /* For an existing att, if we're not in define mode, the len
+         must not be greater than the existing len for classic model. */
+      if (!(h5->flags & NC_INDEF) &&
+          len * nc4typelen(file_type) > (size_t)att->len * nc4typelen(att->nc_typeid))
+      {
+         if (h5->cmode & NC_CLASSIC_MODEL)
+            return NC_EINDEFINE;
+         if ((retval = NC4_redef(ncid)))
+            BAIL(retval);
+      }
+   }
+
+   /* We must have two valid types to continue. */
+   if (file_type == NC_NAT || mem_type == NC_NAT)
+      return NC_EBADTYPE;
+
+   /* Get information about this type. */
+   if ((retval = nc4_get_typelen_mem(h5, file_type, 0, &type_size)))
+      return retval;
+
+   /* No character conversions are allowed. */
+   if (file_type != mem_type &&
+       (file_type == NC_CHAR || mem_type == NC_CHAR ||
+        file_type == NC_STRING || mem_type == NC_STRING))
+      return NC_ECHAR;
+
+   /* For classic mode file, only allow atts with classic types to be
+    * created. */
+   if (h5->cmode & NC_CLASSIC_MODEL && file_type > NC_DOUBLE)
+      return NC_ESTRICTNC3;
+
+   /* Add to the end of the attribute list, if this att doesn't
       already exist. */
    if (new_att)
    {
       LOG((3, "adding attribute %s to the list...", norm_name));
-      if ((res = nc4_att_list_add(attlist, &att)))
-         BAIL (res);
+      if ((ret = nc4_att_list_add(attlist, &att)))
+         BAIL (ret);
       if (!(att->name = strdup(norm_name)))
          return NC_ENOMEM;
    }
@@ -499,8 +786,7 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
       if (var->written_to)
          return NC_ELATEFILL;
 
-      /* If fill value hasn't been set, allocate space. Of course,
-       * vlens have to be different... */
+      /* Get the length of the veriable data type. */
       if ((retval = nc4_get_typelen_mem(grp->nc4_info, var->type_info->nc_typeid, 0,
                                         &type_size)))
          return retval;
@@ -522,7 +808,7 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
          free(var->fill_value);
       }
 
-      /* Allocate space for the fill value. */
+      /* Determine the size of the fill value in bytes. */
       if (var->type_info->nc_type_class == NC_VLEN)
          size = sizeof(hvl_t);
       else if (var->type_info->nc_type_class == NC_STRING)
@@ -530,6 +816,7 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
       else
          size = type_size;
 
+      /* Allocate space for the fill value. */
       if (!(var->fill_value = calloc(1, size)))
          return NC_ENOMEM;
 
@@ -546,7 +833,7 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
       }
       else if (var->type_info->nc_type_class == NC_STRING)
       {
-         if(NULL != (*(char **)data))
+         if (*(char **)data)
          {
             if (!(*(char **)(var->fill_value) = malloc(strlen(*(char **)data) + 1)))
                return NC_ENOMEM;
@@ -566,7 +853,7 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
 
    /* Copy the attribute data, if there is any. VLENs and string
     * arrays have to be handled specially. */
-   if(att->len)
+   if (att->len)
    {
       nc_type type_class;    /* Class of attribute's type */
 
@@ -642,7 +929,7 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
             /* Data types are like religions, in that one can convert.  */
             if ((retval = nc4_convert_type(data, att->data, mem_type, file_type,
                                            len, &range_error, NULL,
-                                           (h5->cmode & NC_CLASSIC_MODEL), is_long, 0)))
+                                           (h5->cmode & NC_CLASSIC_MODEL), 0, 0)))
                BAIL(retval);
          }
       }
@@ -665,470 +952,6 @@ exit:
 }
 
 /**
- * @internal Learn about an att. All the nc4 nc_inq_ functions just
- * call nc4_get_att to get the metadata on an attribute.
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param name Name of attribute.
- * @param xtypep Pointer that gets type of attribute.
- * @param lenp Pointer that gets length of attribute data array.
- *
- * @return ::NC_NOERR No error.
- * @return ::NC_EBADID Bad ncid.
- * @author Ed Hartnett
- */
-int
-NC4_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp)
-{
-   NC *nc;
-   NC_HDF5_FILE_INFO_T *h5;
-
-   LOG((2, "nc_inq_att: ncid 0x%x varid %d name %s", ncid, varid, name));
-
-   /* Find metadata. */
-   if (!(nc = nc4_find_nc_file(ncid,NULL)))
-      return NC_EBADID;
-
-   /* get netcdf-4 metadata */
-   h5 = NC4_DATA(nc);
-   assert(h5);
-
-   /* Handle netcdf-4 files. */
-   return nc4_get_att(ncid, nc, varid, name, xtypep, NC_NAT, lenp, NULL, 0, NULL);
-}
-
-/**
- * @internal Learn an attnum, given a name.
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param name Name of attribute.
- * @param attnump Pointer that gets the attribute index number.
- *
- * @return ::NC_NOERR No error.
- * @author Ed Hartnett
- */
-int
-NC4_inq_attid(int ncid, int varid, const char *name, int *attnump)
-{
-   NC *nc;
-   NC_HDF5_FILE_INFO_T *h5;
-   int stat;
-
-   LOG((2, "nc_inq_attid: ncid 0x%x varid %d name %s", ncid, varid, name));
-
-   /* Find metadata. */
-   if (!(nc = nc4_find_nc_file(ncid,NULL)))
-      return NC_EBADID;
-
-   /* get netcdf-4 metadata */
-   h5 = NC4_DATA(nc);
-   assert(h5);
-
-   /* Handle netcdf-4 files. */
-   stat = nc4_get_att(ncid, nc, varid, name, NULL, NC_NAT,
-                      NULL, attnump, 0, NULL);
-   return stat;
-}
-
-
-/**
- * @internal Given an attnum, find the att's name.
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param attnum The index number of the attribute.
- * @param name Pointer that gets name of attrribute.
- *
- * @return ::NC_NOERR No error.
- * @return ::NC_EBADID Bad ncid.
- * @author Ed Hartnett
- */
-int
-NC4_inq_attname(int ncid, int varid, int attnum, char *name)
-{
-   NC *nc;
-   NC_ATT_INFO_T *att;
-   NC_HDF5_FILE_INFO_T *h5;
-   int retval = NC_NOERR;
-
-   LOG((2, "nc_inq_attname: ncid 0x%x varid %d attnum %d",
-        ncid, varid, attnum));
-
-   /* Find metadata. */
-   if (!(nc = nc4_find_nc_file(ncid,NULL)))
-      return NC_EBADID;
-
-   /* get netcdf-4 metadata */
-   h5 = NC4_DATA(nc);
-   assert(h5);
-
-   /* Handle netcdf-4 files. */
-   if ((retval = nc4_find_nc_att(ncid, varid, NULL, attnum, &att)))
-      return retval;
-
-   /* Get the name. */
-   if (name)
-      strcpy(name, att->name);
-
-   return NC_NOERR;
-}
-
-/**
- * @internal I think all atts should be named the exact same thing, to
- * avoid confusion!
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param name Name of attribute.
- * @param newname New name for attribute.
- *
- * @return ::NC_NOERR No error.
- * @return ::NC_EBADID Bad ncid.
- * @author Ed Hartnett
- */
-int
-NC4_rename_att(int ncid, int varid, const char *name, const char *newname)
-{
-   NC *nc;
-   NC_GRP_INFO_T *grp;
-   NC_HDF5_FILE_INFO_T *h5;
-   NC_VAR_INFO_T *var = NULL;
-   NC_ATT_INFO_T *att, *list;
-   char norm_newname[NC_MAX_NAME + 1], norm_name[NC_MAX_NAME + 1];
-   hid_t datasetid = 0;
-   int retval = NC_NOERR;
-
-   if (!name || !newname)
-      return NC_EINVAL;
-
-   LOG((2, "nc_rename_att: ncid 0x%x varid %d name %s newname %s",
-        ncid, varid, name, newname));
-
-   /* If the new name is too long, that's an error. */
-   if (strlen(newname) > NC_MAX_NAME)
-      return NC_EMAXNAME;
-
-   /* Find metadata for this file. */
-   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
-      return retval;
-
-   assert(h5 && grp);
-
-   /* If the file is read-only, return an error. */
-   if (h5->no_write)
-      return NC_EPERM;
-
-   /* Check and normalize the name. */
-   if ((retval = nc4_check_name(newname, norm_newname)))
-      return retval;
-
-   /* Is norm_newname in use? */
-   if (varid == NC_GLOBAL)
-   {
-      list = grp->att;
-   }
-   else
-   {
-      if (varid < 0 || varid >= grp->vars.nelems)
-         return NC_ENOTVAR;
-      var = grp->vars.value[varid];
-      if (!var) return NC_ENOTVAR;
-      assert(var->varid == varid);
-      list = var->att;
-   }
-   for (att = list; att; att = att->l.next)
-      if (!strncmp(att->name, norm_newname, NC_MAX_NAME))
-         return NC_ENAMEINUSE;
-
-   /* Normalize name and find the attribute. */
-   if ((retval = nc4_normalize_name(name, norm_name)))
-      return retval;
-   for (att = list; att; att = att->l.next)
-      if (!strncmp(att->name, norm_name, NC_MAX_NAME))
-         break;
-   if (!att)
-      return NC_ENOTATT;
-
-   /* If we're not in define mode, new name must be of equal or
-      less size, if complying with strict NC3 rules. */
-   if (!(h5->flags & NC_INDEF) && strlen(norm_newname) > strlen(att->name) &&
-       (h5->cmode & NC_CLASSIC_MODEL))
-      return NC_ENOTINDEFINE;
-
-   /* Delete the original attribute, if it exists in the HDF5 file. */
-   if (att->created)
-   {
-      if (varid == NC_GLOBAL)
-      {
-         if (H5Adelete(grp->hdf_grpid, att->name) < 0)
-            return NC_EHDFERR;
-      }
-      else
-      {
-         if ((retval = nc4_open_var_grp2(grp, varid, &datasetid)))
-            return retval;
-         if (H5Adelete(datasetid, att->name) < 0)
-            return NC_EHDFERR;
-      }
-      att->created = NC_FALSE;
-   }
-
-   /* Copy the new name into our metadata. */
-   free(att->name);
-   if (!(att->name = malloc((strlen(norm_newname) + 1) * sizeof(char))))
-      return NC_ENOMEM;
-   strcpy(att->name, norm_newname);
-   att->dirty = NC_TRUE;
-
-   /* Mark attributes on variable dirty, so they get written */
-   if(var)
-      var->attr_dirty = NC_TRUE;
-
-   return retval;
-}
-
-/**
- * @internal Delete an att. Rub it out. Push the button on
- * it. Liquidate it. Bump it off. Take it for a one-way
- * ride. Terminate it.
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param name Name of attribute to delete.
- *
- * @return ::NC_NOERR No error.
- * @return ::NC_EBADID Bad ncid.
- * @author Ed Hartnett
- */
-int
-NC4_del_att(int ncid, int varid, const char *name)
-{
-   NC *nc;
-   NC_GRP_INFO_T *grp;
-   NC_HDF5_FILE_INFO_T *h5;
-   NC_ATT_INFO_T *att, *natt;
-   NC_VAR_INFO_T *var;
-   NC_ATT_INFO_T **attlist = NULL;
-   hid_t locid = 0, datasetid = 0;
-   int retval = NC_NOERR;
-
-   if (!name)
-      return NC_EINVAL;
-
-   LOG((2, "nc_del_att: ncid 0x%x varid %d name %s",
-        ncid, varid, name));
-
-   /* Find metadata for this file. */
-   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
-      return retval;
-
-   assert(h5 && grp);
-
-   /* If the file is read-only, return an error. */
-   if (h5->no_write)
-      return NC_EPERM;
-
-   /* If it's not in define mode, forget it. */
-   if (!(h5->flags & NC_INDEF))
-   {
-      if (h5->cmode & NC_CLASSIC_MODEL)
-         return NC_ENOTINDEFINE;
-      if ((retval = NC4_redef(ncid)))
-         BAIL(retval);
-   }
-
-   /* Get either the global or a variable attribute list. Also figure
-      out the HDF5 location it's attached to. */
-   if (varid == NC_GLOBAL)
-   {
-      attlist = &grp->att;
-      locid = grp->hdf_grpid;
-   }
-   else
-   {
-      if (varid < 0 || varid >= grp->vars.nelems)
-         return NC_ENOTVAR;
-      var = grp->vars.value[varid];
-      if (!var) return NC_ENOTVAR;
-      attlist = &var->att;
-      assert(var->varid == varid);
-      if (var->created)
-         locid = var->hdf_datasetid;
-   }
-
-   /* Now find the attribute by name or number. */
-   for (att = *attlist; att; att = att->l.next)
-      if (!strcmp(att->name, name))
-         break;
-
-   /* If att is NULL, we couldn't find the attribute. */
-   if (!att)
-      BAIL_QUIET(NC_ENOTATT);
-
-   /* Delete it from the HDF5 file, if it's been created. */
-   if (att->created)
-   {
-      assert(locid);
-
-      if(H5Adelete(locid, att->name) < 0)
-         BAIL(NC_EATTMETA);
-   }
-
-   /* Renumber all following attributes. */
-   for (natt = att->l.next; natt; natt = natt->l.next)
-      natt->attnum--;
-
-   /* Delete this attribute from this list. */
-   if ((retval = nc4_att_list_del(attlist, att)))
-      BAIL(retval);
-
-exit:
-   if (datasetid > 0) H5Dclose(datasetid);
-   return retval;
-}
-
-/**
- * @internal Write an attribute with type conversion.
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param name Name of attribute.
- * @param file_type Type of the attribute data in file.
- * @param mem_type Type of attribute data in memory.
- * @param mem_type_is_long True if attribute data in memory is of type
- * NC_LONG.
- * @param len Length of attribute array.
- * @param op Attribute data.
- *
- * @return ::NC_NOERR No error.
- * @return ::NC_EBADID Bad ncid.
- * @author Ed Hartnett
- */
-static int
-nc4_put_att_tc(int ncid, int varid, const char *name, nc_type file_type,
-               nc_type mem_type, int mem_type_is_long, size_t len,
-               const void *op)
-{
-   NC *nc;
-   NC_HDF5_FILE_INFO_T *h5;
-
-   /* The length needs to be positive (cast needed for braindead
-      systems with signed size_t). */
-   if((unsigned long) len > X_INT_MAX)
-      return NC_EINVAL;
-
-   /* Find metadata. */
-   if (!(nc = nc4_find_nc_file(ncid,NULL)))
-      return NC_EBADID;
-
-   /* get netcdf-4 metadata */
-   h5 = NC4_DATA(nc);
-   assert(h5);
-
-   /* Check varid */
-   if (varid != NC_GLOBAL) {
-      /* Find info for this file and group, and set pointer to each. */
-      NC_GRP_INFO_T *grp;
-      if (!(grp = nc4_rec_find_grp(h5->root_grp, (ncid & GRP_ID_MASK))))
-         return NC_EBADGRPID;
-
-      if (varid < 0 || varid >= grp->vars.nelems)
-         return NC_ENOTVAR;
-      if (grp->vars.value[varid] == NULL)
-         return NC_ENOTVAR;
-      assert(grp->vars.value[varid]->varid == varid);
-   }
-
-   if (!name || strlen(name) > NC_MAX_NAME)
-      return NC_EBADNAME;
-
-   LOG((3, "nc4_put_att_tc: ncid 0x%x varid %d name %s file_type %d "
-        "mem_type %d len %d", ncid, varid, name, file_type, mem_type, len));
-
-   if(nc->ext_ncid == ncid && varid == NC_GLOBAL) {
-      const char** reserved = NC_RESERVED_ATT_LIST;
-      for(;*reserved;reserved++) {
-         if(strcmp(name,*reserved)==0)
-            return NC_ENAMEINUSE;
-      }
-   }
-
-   if(varid != NC_GLOBAL) {
-      const char** reserved = NC_RESERVED_VARATT_LIST;
-      for(;*reserved;reserved++) {
-         if(strcmp(name,*reserved)==0)
-            return NC_ENAMEINUSE;
-      }
-   }
-
-   /* Otherwise, handle things the netcdf-4 way. */
-   return nc4_put_att(ncid, nc, varid, name, file_type, mem_type, len,
-                      mem_type_is_long, op);
-}
-
-/**
- * @internal Read an attribute of any type, with type conversion. This
- * may be called by any of the nc_get_att_* functions.
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param name Name of attribute.
- * @param mem_type Type of attribute data in memory.
- * @param mem_type_is_long True if attribute data in memory is of type
- * NC_LONG.
- * @param ip Attribute data.
- *
- * @return ::NC_NOERR No error.
- * @return ::NC_EBADID Bad ncid.
- * @author Ed Hartnett
- */
-int
-nc4_get_att_tc(int ncid, int varid, const char *name, nc_type mem_type,
-               int mem_type_is_long, void *ip)
-{
-   NC *nc;
-   NC_HDF5_FILE_INFO_T *h5;
-
-   LOG((3, "nc4_get_att_tc: ncid 0x%x varid %d name %s mem_type %d",
-        ncid, varid, name, mem_type));
-
-   /* Find metadata. */
-   if (!(nc = nc4_find_nc_file(ncid,NULL)))
-      return NC_EBADID;
-
-   /* get netcdf-4 metadata */
-   h5 = NC4_DATA(nc);
-   assert(h5);
-
-   return nc4_get_att(ncid, nc, varid, name, NULL, mem_type,
-                      NULL, NULL, mem_type_is_long, ip);
-}
-
-/**
- * @internal Write an attribute.
- *
- * @param ncid File and group ID.
- * @param varid Variable ID.
- * @param name Name of attribute.
- * @param xtype Type of the attribute.
- * @param nelems Number of elements in attribute array.
- * @param value Attribute data.
- * @param memtype Type of data in memory.
- *
- * @return ::NC_NOERR No error.
- * @return ::NC_EBADID Bad ncid.
- * @author Ed Hartnett
- */
-int
-NC4_put_att(int ncid, int varid, const char *name, nc_type xtype,
-            size_t nelems, const void *value, nc_type memtype)
-{
-   return nc4_put_att_tc(ncid, varid, name, xtype, memtype, 0, nelems, value);
-}
-
-/**
  * @internal Get an attribute.
  *
  * @param ncid File and group ID.
@@ -1144,5 +967,5 @@ NC4_put_att(int ncid, int varid, const char *name, nc_type xtype,
 int
 NC4_get_att(int ncid, int varid, const char *name, void *value, nc_type memtype)
 {
-   return nc4_get_att_tc(ncid, varid, name, memtype, 0, value);
+   return nc4_get_att(ncid, varid, name, NULL, memtype, NULL, NULL, value);
 }
diff --git a/libsrc4/nc4dim.c b/libsrc4/nc4dim.c
index 0841de3..b28abb7 100644
--- a/libsrc4/nc4dim.c
+++ b/libsrc4/nc4dim.c
@@ -2,7 +2,7 @@
  * Research. See the COPYRIGHT file for copying and redistribution
  * conditions. */
 /**
- * @file 
+ * @file
  * @internal This file is part of netcdf-4, a netCDF-like interface
  * for HDF5, or a HDF5 backend for netCDF, depending on your point of
  * view.
@@ -10,7 +10,7 @@
  * This file handles the nc4 dimension functions.
  *
  * @author Ed Hartnett
-*/
+ */
 
 #include "nc4internal.h"
 #include "nc4dispatch.h"
@@ -18,8 +18,8 @@
 /**
  * @internal Netcdf-4 files might have more than one unlimited
  * dimension, but return the first one anyway.
- *  
- * @note that this code is inconsistent with nc_inq 
+ *
+ * @note that this code is inconsistent with nc_inq
  *
  * @param ncid File and group ID.
  * @param unlimdimidp Pointer that gets ID of first unlimited
@@ -29,7 +29,7 @@
  * @return ::NC_EBADID Bad ncid.
  * @author Ed Hartnett
  */
-int 
+int
 NC4_inq_unlimdim(int ncid, int *unlimdimidp)
 {
    NC *nc;
@@ -38,26 +38,29 @@ NC4_inq_unlimdim(int ncid, int *unlimdimidp)
    NC_DIM_INFO_T *dim;
    int found = 0;
    int retval;
- 
+
    LOG((2, "%s: called", __func__));
 
    if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
       return retval;
-   assert(h5);
+   assert(h5 && nc && grp);
 
-   /* According to netcdf-3 manual, return -1 if there is no unlimited
-      dimension. */
-   *unlimdimidp = -1;
-   for (g = grp; g && !found; g = g->parent)
+   if (unlimdimidp)
    {
-      for (dim = g->dim; dim; dim = dim->l.next)
+      /* According to netcdf-3 manual, return -1 if there is no unlimited
+         dimension. */
+      *unlimdimidp = -1;
+      for (g = grp; g && !found; g = g->parent)
       {
-	 if (dim->unlimited)
-	 {
-	    *unlimdimidp = dim->dimid;
-	    found++;
-	    break;
-	 }
+         for (dim = g->dim; dim; dim = dim->l.next)
+         {
+            if (dim->unlimited)
+            {
+               *unlimdimidp = dim->dimid;
+               found++;
+               break;
+            }
+         }
       }
    }
 
@@ -84,6 +87,7 @@ NC4_inq_unlimdim(int ncid, int *unlimdimidp)
  * @return ::NC_ENOTINDEFINE Not in define mode.
  * @return ::NC_EDIMSIZE Dim length too large.
  * @return ::NC_ENAMEINUSE Name already in use in group.
+ * @return ::NC_ENOMEM Out of memory.
  * @author Ed Hartnett
  */
 int
@@ -97,8 +101,8 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
    int retval = NC_NOERR;
    uint32_t nn_hash;
 
-   LOG((2, "%s: ncid 0x%x name %s len %d", __func__, ncid, name, 
-	(int)len));
+   LOG((2, "%s: ncid 0x%x name %s len %d", __func__, ncid, name,
+        (int)len));
 
    /* Find our global metadata structure. */
    if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
@@ -107,26 +111,21 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
 
    /* If the file is read-only, return an error. */
    if (h5->no_write)
-     return NC_EPERM;
+      return NC_EPERM;
 
    /* Check some stuff if strict nc3 rules are in effect. */
    if (h5->cmode & NC_CLASSIC_MODEL)
    {
       /* Only one limited dimenson for strict nc3. */
       if (len == NC_UNLIMITED)
-	 for (dim = grp->dim; dim; dim = dim->l.next)
-	    if (dim->unlimited)
-	       return NC_EUNLIMIT;
+         for (dim = grp->dim; dim; dim = dim->l.next)
+            if (dim->unlimited)
+               return NC_EUNLIMIT;
 
       /* Must be in define mode for stict nc3. */
       if (!(h5->flags & NC_INDEF))
-	 return NC_ENOTINDEFINE;
-   }   
-
-   /* If it's not in define mode, enter define mode. */
-   if (!(h5->flags & NC_INDEF))
-      if ((retval = NC4_redef(ncid)))
-	 return retval;
+         return NC_ENOTINDEFINE;
+   }
 
    /* Make sure this is a valid netcdf name. */
    if ((retval = nc4_check_name(name, norm_name)))
@@ -136,18 +135,27 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
     * int, as permitted for 64-bit offset format. */
    if (h5->cmode & NC_CLASSIC_MODEL)
       if(len > X_UINT_MAX) /* Backward compat */
-	 return NC_EDIMSIZE;
+         return NC_EDIMSIZE;
 
+   /* Create a hash of the name. */
    nn_hash = hash_fast(norm_name, strlen(norm_name));
 
    /* Make sure the name is not already in use. */
    for (dim = grp->dim; dim; dim = dim->l.next)
       if (nn_hash == dim->hash && !strncmp(dim->name, norm_name, NC_MAX_NAME))
-	 return NC_ENAMEINUSE;
+         return NC_ENAMEINUSE;
+
+   /* If it's not in define mode, enter define mode. Do this only
+    * after checking all input data, so we only enter define mode if
+    * input is good. */
+   if (!(h5->flags & NC_INDEF))
+      if ((retval = NC4_redef(ncid)))
+         return retval;
 
    /* Add a dimension to the list. The ID must come from the file
     * information, since dimids are visible in more than one group. */
-   nc4_dim_list_add(&grp->dim, &dim);
+   if ((retval = nc4_dim_list_add(&grp->dim, &dim)))
+      return retval;
    dim->dimid = grp->nc4_info->next_dimid++;
 
    /* Initialize the metadata for this dimension. */
@@ -158,7 +166,7 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
       dim->unlimited = NC_TRUE;
 
    dim->hash = nn_hash;
-   
+
    /* Pass back the dimid. */
    if (idp)
       *idp = dim->dimid;
@@ -176,6 +184,7 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp)
  * @return ::NC_NOERR No error.
  * @return ::NC_EBADID Bad ncid.
  * @return ::NC_EBADDIM Dimension not found.
+ * @return ::NC_EINVAL Invalid input. Name must be provided.
  * @author Ed Hartnett
  */
 int
@@ -189,15 +198,17 @@ NC4_inq_dimid(int ncid, const char *name, int *idp)
    int finished = 0;
    int retval;
    uint32_t shash;
-   
+
    LOG((2, "%s: ncid 0x%x name %s", __func__, ncid, name));
 
+   /* Check input. */
+   if (!name)
+      return NC_EINVAL;
+
    /* Find metadata for this file. */
    if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
       return retval;
-
-   assert(h5);
-   assert(nc && grp);
+   assert(h5 && nc && grp);
 
    /* Normalize name. */
    if ((retval = nc4_normalize_name(name, norm_name)))
@@ -208,12 +219,12 @@ NC4_inq_dimid(int ncid, const char *name, int *idp)
    /* Go through each dim and check for a name match. */
    for (g = grp; g && !finished; g = g->parent)
       for (dim = g->dim; dim; dim = dim->l.next)
-	 if (dim->hash == shash && !strncmp(dim->name, norm_name, NC_MAX_NAME))
-	 {
-	    if (idp)
-	       *idp = dim->dimid;
-	    return NC_NOERR;
-	 }
+         if (dim->hash == shash && !strncmp(dim->name, norm_name, NC_MAX_NAME))
+         {
+            if (idp)
+               *idp = dim->dimid;
+            return NC_NOERR;
+         }
 
    return NC_EBADDIM;
 }
@@ -231,6 +242,7 @@ NC4_inq_dimid(int ncid, const char *name, int *idp)
  * @return ::NC_NOERR No error.
  * @return ::NC_EBADID Bad ncid.
  * @return ::NC_EDIMSIZE Dimension length too large.
+ * @return ::NC_EBADDIM Dimension not found.
  * @author Ed Hartnett
  */
 int
@@ -247,9 +259,7 @@ NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp)
    /* Find our global metadata structure. */
    if ((ret = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
       return ret;
-   
-   assert(h5);
-   assert(nc && grp);
+   assert(h5 && nc && grp);
 
    /* Find the dimension and its home group. */
    if ((ret = nc4_find_dim(grp, dimid, &dim, &dim_grp)))
@@ -257,31 +267,31 @@ NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp)
    assert(dim);
 
    /* Return the dimension name, if the caller wants it. */
-   if (name && dim->name) 
-      strcpy(name, dim->name);	    
-   
+   if (name && dim->name)
+      strcpy(name, dim->name);
+
    /* Return the dimension length, if the caller wants it. */
    if (lenp)
    {
       if (dim->unlimited)
       {
-	 /* Since this is an unlimited dimension, go to the file
-	    and see how many records there are. Take the max number
-	    of records from all the vars that share this
-	    dimension. */
-	 *lenp = 0;
-	 if ((ret = nc4_find_dim_len(dim_grp, dimid, &lenp)))
-	    return ret;
+         /* Since this is an unlimited dimension, go to the file
+            and see how many records there are. Take the max number
+            of records from all the vars that share this
+            dimension. */
+         *lenp = 0;
+         if ((ret = nc4_find_dim_len(dim_grp, dimid, &lenp)))
+            return ret;
       }
       else
       {
-	 if (dim->too_long)
-	 {
-	    ret = NC_EDIMSIZE;
-	    *lenp = NC_MAX_UINT;
-	 }
-	 else
-	    *lenp = dim->len;
+         if (dim->too_long)
+         {
+            ret = NC_EDIMSIZE;
+            *lenp = NC_MAX_UINT;
+         }
+         else
+            *lenp = dim->len;
       }
    }
 
@@ -320,14 +330,14 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
    if (!name)
       return NC_EINVAL;
 
-   LOG((2, "%s: ncid 0x%x dimid %d name %s", __func__, ncid, 
-	dimid, name));
+   LOG((2, "%s: ncid 0x%x dimid %d name %s", __func__, ncid,
+        dimid, name));
 
    /* Find info for this file and group, and set pointer to each. */
-   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))      
+   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
       return retval;
    assert(nc && h5 && grp);
-   
+
    /* Trying to write to a read-only file? No way, Jose! */
    if (h5->no_write)
       return NC_EPERM;
@@ -341,15 +351,15 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
    for (dim = grp->dim; dim; dim = dim->l.next)
    {
       if (!strncmp(dim->name, norm_name, NC_MAX_NAME))
-	 return NC_ENAMEINUSE;
+         return NC_ENAMEINUSE;
       if (dim->dimid == dimid)
-	 tmp_dim = dim;
+         tmp_dim = dim;
    }
    if (!tmp_dim)
       return NC_EBADDIM;
    dim = tmp_dim;
 
-   /* Check for renaming dimension w/o variable. */
+   /* Check for renaming dimension w/o variable */
    if (dim->hdf_dimscaleid)
    {
       /* Sanity check */
@@ -370,7 +380,7 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
    strcpy(dim->name, norm_name);
    dim->hash = hash_fast(norm_name, strlen(norm_name));
    LOG((3, "dim is now named %s", dim->name));
-   
+
    /* Check if dimension was a coordinate variable, but names are
     * different now */
    if (dim->coord_var && strcmp(dim->name, dim->coord_var->name))
@@ -394,12 +404,12 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
        * dimension in index 0. */
       if (var && var->dim[0] == dim)
       {
-          /* Sanity check */
-          assert(var->dimids[0] == dim->dimid);
+         /* Sanity check */
+         assert(var->dimids[0] == dim->dimid);
 
-          /* Reform the coordinate variable. */
-          if ((retval = nc4_reform_coord_var(grp, var, dim)))
-             return retval;
+         /* Reform the coordinate variable. */
+         if ((retval = nc4_reform_coord_var(grp, var, dim)))
+            return retval;
       }
    }
 
@@ -421,33 +431,34 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
  * @return ::NC_EBADID Bad ncid.
  * @author Ed Hartnett, Dennis Heimbigner
  */
-int 
-NC4_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) 
+int
+NC4_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
 {
-  NC_DIM_INFO_T *dim;
-  NC_GRP_INFO_T *grp;
-  NC *nc;
-  NC_HDF5_FILE_INFO_T *h5;
-  int num_unlim = 0;
-  int retval;
-
-  LOG((2, "%s: ncid 0x%x", __func__, ncid));
-
-  /* Find info for this file and group, and set pointer to each. */
-  if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
-    return retval;
-  
+   NC_DIM_INFO_T *dim;
+   NC_GRP_INFO_T *grp;
+   NC *nc;
+   NC_HDF5_FILE_INFO_T *h5;
+   int num_unlim = 0;
+   int retval;
+
+   LOG((2, "%s: ncid 0x%x", __func__, ncid));
+
+   /* Find info for this file and group, and set pointer to each. */
+   if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
+      return retval;
+   assert(h5 && nc && grp);
+
    /* Get our dim info. */
    assert(h5);
    {
       for (dim=grp->dim; dim; dim=dim->l.next)
       {
-	 if (dim->unlimited)
-	 {
-	    if (unlimdimidsp)
-	       unlimdimidsp[num_unlim] = dim->dimid;
-	    num_unlim++;
-	 }
+         if (dim->unlimited)
+         {
+            if (unlimdimidsp)
+               unlimdimidsp[num_unlim] = dim->dimid;
+            num_unlim++;
+         }
       }
    }
 
@@ -457,5 +468,3 @@ NC4_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp)
 
    return NC_NOERR;
 }
-
-
diff --git a/libsrc4/nc4dispatch.c b/libsrc4/nc4dispatch.c
index 24f8310..8b7cccb 100644
--- a/libsrc4/nc4dispatch.c
+++ b/libsrc4/nc4dispatch.c
@@ -57,7 +57,9 @@ NCDEFAULT_put_varm,
 NC4_inq_var_all,
 
 NC4_var_par_access,
+NC4_def_var_fill,
 
+#ifdef USE_NETCDF4
 NC4_show_metadata,
 NC4_inq_unlimdims,
 
@@ -92,11 +94,11 @@ NC4_def_opaque,
 NC4_def_var_deflate,
 NC4_def_var_fletcher32,
 NC4_def_var_chunking,
-NC4_def_var_fill,
 NC4_def_var_endian,
 NC4_def_var_filter,
 NC4_set_var_chunk_cache,
 NC4_get_var_chunk_cache,
+#endif
 
 };
 
diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c
index cb26bf9..489c842 100644
--- a/libsrc4/nc4file.c
+++ b/libsrc4/nc4file.c
@@ -1,3 +1,6 @@
+/* Copyright 2003-2018, University Corporation for Atmospheric
+ * Research. See COPYRIGHT file for copying and redistribution
+ * conditions. */
 /**
  * @file
  * @internal The netCDF-4 file functions.
@@ -5,10 +8,9 @@
  * This file is part of netcdf-4, a netCDF-like interface for HDF5, or
  * a HDF5 backend for netCDF, depending on your point of view.
  *
- * Copyright 2003, University Corporation for Atmospheric Research. See
- * COPYRIGHT file for copying and redistribution conditions.
  * @author Ed Hartnett
  */
+
 #include "config.h"
 #include <errno.h>  /* netcdf functions sometimes return system errors */
 #include "nc.h"
@@ -16,13 +18,8 @@
 #include "nc4dispatch.h"
 #include <H5DSpublic.h> /* must be after nc4internal.h */
 #include <H5Fpublic.h>
-#ifdef USE_HDF4
-#include <mfhdf.h>
-#endif
 #include <hdf5_hl.h>
 
-extern int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var);
-
 /** @internal When we have open objects at file close, should
     we log them or print to stdout. Default is to log. */
 #define LOGOPEN 1
@@ -582,54 +579,44 @@ close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort)
       goto exit;
 
    /* Close hdf file. */
-#ifdef USE_HDF4
-   if (h5->hdf4)
+#ifdef USE_PARALLEL4
+   /* Free the MPI Comm & Info objects, if we opened the file in parallel */
+   if(h5->parallel)
    {
-      if (SDend(h5->sdid))
-         BAIL_QUIET(NC_EHDFERR);
+      if(MPI_COMM_NULL != h5->comm)
+         MPI_Comm_free(&h5->comm);
+      if(MPI_INFO_NULL != h5->info)
+         MPI_Info_free(&h5->info);
    }
-   else
-#endif /* USE_HDF4 */
-   {
-#ifdef USE_PARALLEL4
-      /* Free the MPI Comm & Info objects, if we opened the file in parallel */
-      if(h5->parallel)
-      {
-         if(MPI_COMM_NULL != h5->comm)
-            MPI_Comm_free(&h5->comm);
-         if(MPI_INFO_NULL != h5->info)
-            MPI_Info_free(&h5->info);
-      }
 #endif
-
-      if(h5->fileinfo) free(h5->fileinfo);
-
-      if (H5Fclose(h5->hdfid) < 0)
-      {
-         int nobjs;
-
-         nobjs = H5Fget_obj_count(h5->hdfid, H5F_OBJ_ALL);
-         /* Apparently we can get an error even when nobjs == 0 */
-         if(nobjs < 0) {
-            BAIL_QUIET(NC_EHDFERR);
-         } else if(nobjs > 0) {
+   
+   if(h5->fileinfo) free(h5->fileinfo);
+   
+   if (H5Fclose(h5->hdfid) < 0)
+   {
+      int nobjs;
+      
+      nobjs = H5Fget_obj_count(h5->hdfid, H5F_OBJ_ALL);
+      /* Apparently we can get an error even when nobjs == 0 */
+      if(nobjs < 0) {
+         BAIL_QUIET(NC_EHDFERR);
+      } else if(nobjs > 0) {
 #ifdef LOGGING
-            char msg[1024];
-            int logit = 1;
-            /* If the close doesn't work, probably there are still some HDF5
-             * objects open, which means there's a bug in the library. So
-             * print out some info on to help the poor programmer figure it
-             * out. */
-            snprintf(msg,sizeof(msg),"There are %d HDF5 objects open!", nobjs);
+         char msg[1024];
+         int logit = 1;
+         /* If the close doesn't work, probably there are still some HDF5
+          * objects open, which means there's a bug in the library. So
+          * print out some info on to help the poor programmer figure it
+          * out. */
+         snprintf(msg,sizeof(msg),"There are %d HDF5 objects open!", nobjs);
 #ifdef LOGOPEN
-            LOG((0, msg));
+         LOG((0, msg));
 #else
-            fprintf(stdout,msg);
-            logit = 0;
+         fprintf(stdout,msg);
+         logit = 0;
 #endif
-            reportopenobjects(logit,h5->hdfid);
+         reportopenobjects(logit,h5->hdfid);
 #endif
-         }
       }
    }
 exit:
@@ -2627,453 +2614,6 @@ exit:
    return retval;
 }
 
-#ifdef USE_HDF4
-/**
- * @internal Given an HDF4 type, set a pointer to netcdf type.
- *
- * See http://www.hdfgroup.org/training/HDFtraining/UsersGuide/Fundmtls.fm3.html
- * for more information re: HDF4 types.
- *
- * @param h5 Pointer to HDF5 file info struct.
- * @param hdf4_typeid Type ID for hdf4 datatype.
- * @param xtype Pointer to netcdf type, where result will be stored.
- * @param type_info Pointer to type info for the variable.
- *
- * @return ::NC_NOERR No error.
- * @author Ed Hartnett
- */
-static int
-get_netcdf_type_from_hdf4(NC_HDF5_FILE_INFO_T *h5, int32 hdf4_typeid,
-                          nc_type *xtype, NC_TYPE_INFO_T *type_info)
-{
-   int t = 0;
-
-   /* Added this variable in the course of fixing NCF-332.
-    * Prior to the fix, all data types were assigned
-    * NC_ENDIAN_BIG, so I am preserving that here for now.
-    * Not sure why it wouldn't be NC_ENDIAN_NATIVE, although
-    * I can hazard a guess or two.
-    */
-   int endianness = NC_ENDIAN_BIG;
-   assert(h5 && xtype);
-
-   switch(hdf4_typeid)
-   {
-   case DFNT_CHAR:
-      *xtype = NC_CHAR;
-      t = 0;
-      break;
-   case DFNT_UCHAR:
-   case DFNT_UINT8:
-      *xtype = NC_UBYTE;
-      t = 6;
-      break;
-   case DFNT_LUINT8:
-      *xtype = NC_UBYTE;
-      t = 6;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   case DFNT_INT8:
-      *xtype = NC_BYTE;
-      t = 1;
-      break;
-   case DFNT_LINT8:
-      *xtype = NC_BYTE;
-      t = 1;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   case DFNT_INT16:
-      *xtype = NC_SHORT;
-      t = 2;
-      break;
-   case DFNT_LINT16:
-      *xtype = NC_SHORT;
-      t = 2;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   case DFNT_UINT16:
-      *xtype = NC_USHORT;
-      t = 7;
-      break;
-   case DFNT_LUINT16:
-      *xtype = NC_USHORT;
-      t = 7;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   case DFNT_INT32:
-      *xtype = NC_INT;
-      t = 3;
-      break;
-   case DFNT_LINT32:
-      *xtype = NC_INT;
-      t = 3;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   case DFNT_UINT32:
-      *xtype = NC_UINT;
-      t = 8;
-      break;
-   case DFNT_LUINT32:
-      *xtype = NC_UINT;
-      t = 8;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   case DFNT_FLOAT32:
-      *xtype = NC_FLOAT;
-      t = 4;
-      break;
-   case DFNT_LFLOAT32:
-      *xtype = NC_FLOAT;
-      t = 4;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   case DFNT_FLOAT64:
-      *xtype = NC_DOUBLE;
-      t = 5;
-      break;
-   case DFNT_LFLOAT64:
-      *xtype = NC_DOUBLE;
-      t = 5;
-      endianness = NC_ENDIAN_LITTLE;
-      break;
-   default:
-      *xtype = NC_NAT;
-      return NC_EBADTYPID;
-   }
-
-   if (type_info)
-   {
-      if (hdf4_typeid == DFNT_FLOAT32)
-         type_info->nc_type_class = NC_FLOAT;
-      else if (hdf4_typeid == DFNT_FLOAT64)
-         type_info->nc_type_class = NC_DOUBLE;
-      else if (hdf4_typeid == DFNT_CHAR)
-         type_info->nc_type_class = NC_STRING;
-      else
-         type_info->nc_type_class = NC_INT;
-      type_info->endianness = endianness;
-      type_info->nc_typeid = *xtype;
-      type_info->size = nc_type_size_g[t];
-      if (!(type_info->name = strdup(nc_type_name_g[t])))
-         return NC_ENOMEM;
-   }
-
-   return NC_NOERR;
-}
-
-/**
- * @internal Open a HDF4 file. Things have already been kicked off in
- * nc_open, but here the netCDF-4 part of opening a file is
- * handled. 
- *
- * @param path The file name of the new file.
- * @param mode The open mode flag.
- * @param nc Pointer that gets the NC file info struct.
- *
- * @return ::NC_NOERR No error.
- * @author Ed Hartnett
-*/
-static int
-nc4_open_hdf4_file(const char *path, int mode, NC *nc)
-{
-   NC_HDF5_FILE_INFO_T *h5;
-   NC_GRP_INFO_T *grp;
-   NC_ATT_INFO_T *att;
-   int32 num_datasets, num_gatts;
-   int32 rank;
-   int v, d, a;
-   int retval;
-   NC_HDF5_FILE_INFO_T* nc4_info = NULL;
-
-   LOG((3, "%s: path %s mode %d", __func__, path, mode));
-   assert(path && nc);
-
-   /* Must be read-only access to hdf4 files. */
-   if (mode & NC_WRITE)
-      return NC_EINVAL;
-
-   /* Add necessary structs to hold netcdf-4 file data. */
-   if ((retval = nc4_nc4f_list_add(nc, path, mode)))
-      return retval;
-   nc4_info = NC4_DATA(nc);
-   assert(nc4_info && nc4_info->root_grp);
-   h5 = nc4_info;
-   h5->hdf4 = NC_TRUE;
-   grp = h5->root_grp;
-   h5->no_write = NC_TRUE;
-
-   /* Open the file and initialize SD interface. */
-   if ((h5->sdid = SDstart(path, DFACC_READ)) == FAIL)
-      return NC_EHDFERR;
-
-   /* Learn how many datasets and global atts we have. */
-   if (SDfileinfo(h5->sdid, &num_datasets, &num_gatts))
-      return NC_EHDFERR;
-
-   /* Read the atts. */
-   for (a = 0; a < num_gatts; a++)
-   {
-      int32 att_data_type, att_count;
-      size_t att_type_size;
-
-      /* Add to the end of the list of atts for this var. */
-      if ((retval = nc4_att_list_add(&h5->root_grp->att, &att)))
-         return retval;
-      att->attnum = grp->natts++;
-      att->created = NC_TRUE;
-
-      /* Learn about this attribute. */
-      if (!(att->name = malloc(NC_MAX_HDF4_NAME * sizeof(char))))
-         return NC_ENOMEM;
-      if (SDattrinfo(h5->sdid, a, att->name, &att_data_type, &att_count))
-         return NC_EATTMETA;
-      if ((retval = get_netcdf_type_from_hdf4(h5, att_data_type,
-                                              &att->nc_typeid, NULL)))
-         return retval;
-      att->len = att_count;
-
-      /* Allocate memory to hold the data. */
-      if ((retval = nc4_get_typelen_mem(h5, att->nc_typeid, 0, &att_type_size)))
-         return retval;
-      if (!(att->data = malloc(att_type_size * att->len)))
-         return NC_ENOMEM;
-
-      /* Read the data. */
-      if (SDreadattr(h5->sdid, a, att->data))
-         return NC_EHDFERR;
-   }
-
-   /* Read each dataset. */
-   for (v = 0; v < num_datasets; v++)
-   {
-      NC_VAR_INFO_T *var;
-      int32 data_type, num_atts;
-      /* Problem: Number of dims is returned by the call that requires
-         a pre-allocated array, 'dimsize'.
-         From SDS_SD website:
-         http://www.hdfgroup.org/training/HDFtraining/UsersGuide/SDS_SD.fm3.html
-         The maximum rank is 32, or MAX_VAR_DIMS (as defined in netcdf.h).
-
-         int32 dimsize[MAX_VAR_DIMS];
-      */
-      int32 *dimsize = NULL;
-      size_t var_type_size;
-      int a;
-
-      /* Add a variable. */
-      if ((retval = nc4_var_add(&var)))
-         return retval;
-
-      var->varid = grp->nvars++;
-      var->created = NC_TRUE;
-      var->written_to = NC_TRUE;
-
-      /* Add a var to the variable array, growing it as needed. */
-      if ((retval = nc4_vararray_add(grp, var)))
-         return retval;
-
-      /* Open this dataset in HDF4 file. */
-      if ((var->sdsid = SDselect(h5->sdid, v)) == FAIL)
-         return NC_EVARMETA;
-
-      /* Get shape, name, type, and attribute info about this dataset. */
-      if (!(var->name = malloc(NC_MAX_HDF4_NAME + 1)))
-         return NC_ENOMEM;
-
-      /* Invoke SDgetInfo with null dimsize to get rank. */
-      if (SDgetinfo(var->sdsid, var->name, &rank, NULL, &data_type, &num_atts))
-         return NC_EVARMETA;
-
-      var->hash = hash_fast(var->name, strlen(var->name));
-
-      if(!(dimsize = (int32*)malloc(sizeof(int32)*rank)))
-         return NC_ENOMEM;
-
-      if (SDgetinfo(var->sdsid, var->name, &rank, dimsize, &data_type, &num_atts)) {
-         if(dimsize) free(dimsize);
-         return NC_EVARMETA;
-      }
-
-      var->ndims = rank;
-      var->hdf4_data_type = data_type;
-
-      /* Fill special type_info struct for variable type information. */
-      if (!(var->type_info = calloc(1, sizeof(NC_TYPE_INFO_T)))) {
-         if(dimsize) free(dimsize);
-         return NC_ENOMEM;
-      }
-
-      if ((retval = get_netcdf_type_from_hdf4(h5, data_type, &var->type_info->nc_typeid, var->type_info))) {
-         if(dimsize) free(dimsize);
-         return retval;
-      }
-
-      /* Indicate that the variable has a pointer to the type */
-      var->type_info->rc++;
-
-      if ((retval = nc4_get_typelen_mem(h5, var->type_info->nc_typeid, 0, &var_type_size))) {
-         if(dimsize) free(dimsize);
-         return retval;
-      }
-
-      var->type_info->size = var_type_size;
-      LOG((3, "reading HDF4 dataset %s, rank %d netCDF type %d", var->name,
-           rank, var->type_info->nc_typeid));
-
-      /* Get the fill value. */
-      if (!(var->fill_value = malloc(var_type_size))) {
-         if(dimsize) free(dimsize);
-         return NC_ENOMEM;
-      }
-
-      if (SDgetfillvalue(var->sdsid, var->fill_value))
-      {
-         /* Whoops! No fill value! */
-         free(var->fill_value);
-         var->fill_value = NULL;
-      }
-
-      /* Allocate storage for dimension info in this variable. */
-      if (var->ndims)
-      {
-         if (!(var->dim = malloc(sizeof(NC_DIM_INFO_T *) * var->ndims))) {
-            if(dimsize) free(dimsize);
-            return NC_ENOMEM;
-         }
-
-         if (!(var->dimids = malloc(sizeof(int) * var->ndims))) {
-            if(dimsize) free(dimsize);
-            return NC_ENOMEM;
-         }
-      }
-
-
-      /* Find its dimensions. */
-      for (d = 0; d < var->ndims; d++)
-      {
-         int32 dimid, dim_len, dim_data_type, dim_num_attrs;
-         char dim_name[NC_MAX_NAME + 1];
-         NC_DIM_INFO_T *dim;
-
-         if ((dimid = SDgetdimid(var->sdsid, d)) == FAIL) {
-            if(dimsize) free(dimsize);
-            return NC_EDIMMETA;
-         }
-         if (SDdiminfo(dimid, dim_name, &dim_len, &dim_data_type,
-                       &dim_num_attrs))
-         {
-            if(dimsize) free(dimsize);
-            return NC_EDIMMETA;
-         }
-
-         /* Do we already have this dimension? HDF4 explicitly uses
-          * the name to tell. */
-         for (dim = grp->dim; dim; dim = dim->l.next)
-            if (!strcmp(dim->name, dim_name))
-               break;
-
-         /* If we didn't find this dimension, add one. */
-         if (!dim)
-         {
-            LOG((4, "adding dimension %s for HDF4 dataset %s",
-                 dim_name, var->name));
-            if ((retval = nc4_dim_list_add(&grp->dim, &dim)))
-               return retval;
-            dim->dimid = grp->nc4_info->next_dimid++;
-            if (strlen(dim_name) > NC_MAX_HDF4_NAME)
-               return NC_EMAXNAME;
-            if (!(dim->name = strdup(dim_name)))
-               return NC_ENOMEM;
-            if (dim_len)
-               dim->len = dim_len;
-            else
-               dim->len = *dimsize;
-            dim->hash = hash_fast(dim_name, strlen(dim_name));
-         }
-
-         /* Tell the variable the id of this dimension. */
-         var->dimids[d] = dim->dimid;
-         var->dim[d] = dim;
-      }
-
-      /* Read the atts. */
-      for (a = 0; a < num_atts; a++)
-      {
-         int32 att_data_type, att_count;
-         size_t att_type_size;
-
-         /* Add to the end of the list of atts for this var. */
-         if ((retval = nc4_att_list_add(&var->att, &att))) {
-            if(dimsize) free(dimsize);
-            return retval;
-         }
-         att->attnum = var->natts++;
-         att->created = NC_TRUE;
-
-         /* Learn about this attribute. */
-         if (!(att->name = malloc(NC_MAX_HDF4_NAME * sizeof(char)))) {
-            if(dimsize) free(dimsize);
-            return NC_ENOMEM;
-         }
-         if (SDattrinfo(var->sdsid, a, att->name, &att_data_type, &att_count)) {
-            if(dimsize) free(dimsize);
-            return NC_EATTMETA;
-         }
-         if ((retval = get_netcdf_type_from_hdf4(h5, att_data_type,
-                                                 &att->nc_typeid, NULL))) {
-            if(dimsize) free(dimsize);
-            return retval;
-         }
-
-         att->len = att_count;
-
-         /* Allocate memory to hold the data. */
-         if ((retval = nc4_get_typelen_mem(h5, att->nc_typeid, 0, &att_type_size))) {
-            if(dimsize) free(dimsize);
-            return retval;
-         }
-         if (!(att->data = malloc(att_type_size * att->len))) {
-            if(dimsize) free(dimsize);
-            return NC_ENOMEM;
-         }
-
-         /* Read the data. */
-         if (SDreadattr(var->sdsid, a, att->data)) {
-            if(dimsize) free(dimsize);
-            return NC_EHDFERR;
-         }
-      }
-      if(dimsize) free(dimsize);
-
-      {
-         /* HDF4 files can be chunked */
-         HDF_CHUNK_DEF chunkdefs;
-         int flag;
-         if(!SDgetchunkinfo(var->sdsid, &chunkdefs, &flag)) {
-            if(flag == HDF_NONE)
-               var->contiguous = NC_TRUE;
-            else if((flag & HDF_CHUNK) != 0) {
-               var->contiguous = NC_FALSE;
-               if (!(var->chunksizes = malloc(var->ndims * sizeof(size_t))))
-                  return NC_ENOMEM;
-               for (d = 0; d < var->ndims; d++) {
-                  var->chunksizes[d] = chunkdefs.chunk_lengths[d];
-               }
-            }
-         }
-      }
-
-   } /* next var */
-
-#ifdef LOGGING
-   /* This will print out the names, types, lens, etc of the vars and
-      atts in the file, if the logging level is 2 or greater. */
-   log_metadata_nc(h5->root_grp->nc4_info->controller);
-#endif
-   return NC_NOERR;
-}
-#endif /* USE_HDF4 */
-
 /**
  * @internal Open a netCDF-4 file.
  *
@@ -3095,14 +2635,10 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
          int use_parallel, void *parameters, NC_Dispatch *dispatch, NC *nc_file)
 {
    int res;
-   int is_hdf5_file = 0;
-#ifdef USE_HDF4
-   int is_hdf4_file = 0;
-#endif /* USE_HDF4 */
 #ifdef USE_PARALLEL4
    NC_MPI_INFO mpidfalt = {MPI_COMM_WORLD, MPI_INFO_NULL};
 #endif
-#if defined USE_PARALLEL4 || defined USE_HDF4
+#if defined USE_PARALLEL4
    int inmemory = ((mode & NC_INMEMORY) == NC_INMEMORY);
 #endif
 
@@ -3139,25 +2675,13 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
    }
 #endif /* USE_PARALLEL_POSIX */
 
-   /* Figure out if this is a hdf4 or hdf5 file. */
-   if(nc_file->model == NC_FORMATX_NC4)
-      is_hdf5_file = 1;
-#ifdef USE_HDF4
-   else if(nc_file->model == NC_FORMATX_NC_HDF4)
-      is_hdf4_file = 1;
-#endif /* USE_HDF4 */
-   /* Depending on the type of file, open it. */
+   /* This is a hdf5 file. */
+   assert(nc_file->model == NC_FORMATX_NC4);
+
+   /* Open the file. */
    nc_file->int_ncid = nc_file->ext_ncid;
-   if (is_hdf5_file)
-      res = nc4_open_file(path, mode, parameters, nc_file);
-#ifdef USE_HDF4
-   else if (is_hdf4_file && inmemory)
-   {res = NC_EDISKLESS; goto done;}
-   else if (is_hdf4_file)
-      res = nc4_open_hdf4_file(path, mode, nc_file);
-#endif /* USE_HDF4 */
-   else
-      res = NC_ENOTNC;
+   res = nc4_open_file(path, mode, parameters, nc_file);
+
 done:
    return res;
 }
diff --git a/libsrc4/nc4grp.c b/libsrc4/nc4grp.c
index a422fd7..f3af56d 100644
--- a/libsrc4/nc4grp.c
+++ b/libsrc4/nc4grp.c
@@ -478,7 +478,7 @@ NC4_inq_varids(int ncid, int *nvars, int *varids)
    NC_GRP_INFO_T *grp;
    NC_HDF5_FILE_INFO_T *h5;
    NC_VAR_INFO_T *var;
-   int v, num_vars = 0;
+   int num_vars = 0;
    int retval;
    int i;
 
@@ -547,7 +547,7 @@ NC4_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents)
    NC_GRP_INFO_T *grp, *g;
    NC_HDF5_FILE_INFO_T *h5;
    NC_DIM_INFO_T *dim;
-   int d, num = 0;
+   int num = 0;
    int retval;
 
    LOG((2, "nc_inq_dimids: ncid 0x%x include_parents: %d", ncid, 
diff --git a/libsrc4/nc4hdf.c b/libsrc4/nc4hdf.c
index e98a9e6..597f7eb 100644
--- a/libsrc4/nc4hdf.c
+++ b/libsrc4/nc4hdf.c
@@ -21,6 +21,11 @@
 #include <H5DSpublic.h>
 #include <math.h>
 
+#ifdef HAVE_INTTYPES_H
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+#endif
+
 #ifdef USE_PARALLEL
 #include "netcdf_par.h"
 #endif
@@ -1768,17 +1773,9 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid
       /* If there are no unlimited dims, and no filters, and the user
        * has not specified chunksizes, use contiguous variable for
        * better performance. */
-
-      if(!var->shuffle && !var->deflate &&
-         !var->fletcher32 && (var->chunksizes == NULL || !var->chunksizes[0])) {
-#ifdef USE_HDF4
-         NC_HDF5_FILE_INFO_T *h5 = grp->nc4_info;
-         if(h5->hdf4 || !unlimdim)
-#else
-            if(!unlimdim)
-#endif
-               var->contiguous = NC_TRUE;
-      }
+      if (!var->shuffle && !var->deflate && !var->fletcher32 &&
+          (var->chunksizes == NULL || !var->chunksizes[0]) && !unlimdim)
+         var->contiguous = NC_TRUE;
 
       /* Gather current & maximum dimension sizes, along with chunk sizes */
       for (d = 0; d < var->ndims; d++)
@@ -2290,6 +2287,55 @@ var_exists(hid_t grpid, char *name, nc_bool_t *exists)
 }
 
 /**
+ * @internal Convert a coordinate variable HDF5 dataset into one that
+ * is not a coordinate variable. This happens during renaming of vars
+ * and dims. This function removes the HDF5 NAME and CLASS attributes
+ * associated with dimension scales, and also the NC_DIMID_ATT_NAME
+ * attribute which may be present, and, if it does, holds the dimid of
+ * the coordinate variable.
+ *
+ * @param hdf_datasetid The HDF5 dataset ID of the coordinate variable dataset.
+ *
+ * @return ::NC_NOERR No error.
+ * @return ::NC_EHDFERR HDF5 error.
+ * @author Ed Hartnett
+ */
+int
+remove_coord_atts(hid_t hdf_datasetid)
+{
+   htri_t attr_exists;
+
+   /* If the variable dataset has an optional NC_DIMID_ATT_NAME
+    * attribute, delete it. */
+   if ((attr_exists = H5Aexists(hdf_datasetid, NC_DIMID_ATT_NAME)) < 0)
+      return NC_EHDFERR;
+   if (attr_exists)
+   {
+      if (H5Adelete(hdf_datasetid, NC_DIMID_ATT_NAME) < 0)
+         return NC_EHDFERR;
+   }
+
+   /* (We could do a better job here and verify that the attributes are
+    * really dimension scale 'CLASS' & 'NAME' attributes, but that would be
+    * poking about in the HDF5 DimScale internal data) */
+   if ((attr_exists = H5Aexists(hdf_datasetid, HDF5_DIMSCALE_CLASS_ATT_NAME)) < 0)
+      return NC_EHDFERR;
+   if (attr_exists)
+   {
+      if (H5Adelete(hdf_datasetid, HDF5_DIMSCALE_CLASS_ATT_NAME) < 0)
+         return NC_EHDFERR;
+   }
+   if ((attr_exists = H5Aexists(hdf_datasetid, HDF5_DIMSCALE_NAME_ATT_NAME)) < 0)
+      return NC_EHDFERR;
+   if (attr_exists)
+   {
+      if (H5Adelete(hdf_datasetid, HDF5_DIMSCALE_NAME_ATT_NAME) < 0)
+         return NC_EHDFERR;
+   }
+   return NC_NOERR;
+}
+
+/**
  * @internal This function writes a variable. The principle difficulty
  * comes from the possibility that this is a coordinate variable, and
  * was already written to the file as a dimension-only dimscale. If
@@ -2301,7 +2347,7 @@ var_exists(hid_t grpid, char *name, nc_bool_t *exists)
  *
  * @returns NC_NOERR No error.
  * @returns NC_EHDFERR HDF5 returned an error.
- * @author Ed Hartnett
+ * @author Ed Hartnett, Quincey Koziol
 */
 static int
 write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
@@ -2402,25 +2448,8 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
        * for making a dataset not a scale. -QAK) */
       if (var->created)
       {
-         htri_t attr_exists;
-
-         /* (We could do a better job here and verify that the attributes are
-          * really dimension scale 'CLASS' & 'NAME' attributes, but that would be
-          * poking about in the HDF5 DimScale internal data) */
-         if ((attr_exists = H5Aexists(var->hdf_datasetid, "CLASS")) < 0)
-            BAIL(NC_EHDFERR);
-         if (attr_exists)
-         {
-            if (H5Adelete(var->hdf_datasetid, "CLASS") < 0)
-               BAIL(NC_EHDFERR);
-         }
-         if ((attr_exists = H5Aexists(var->hdf_datasetid, "NAME")) < 0)
-            BAIL(NC_EHDFERR);
-         if (attr_exists)
-         {
-            if (H5Adelete(var->hdf_datasetid, "NAME") < 0)
-               BAIL(NC_EHDFERR);
-         }
+         if ((retval = remove_coord_atts(var->hdf_datasetid)))
+            BAIL(retval);
       }
 
       if (var->dimscale_attached)
@@ -4194,10 +4223,10 @@ reportobject(int log, hid_t id, unsigned int type)
    }
    if(log) {
 #ifdef LOGGING
-      LOG((0,"Type = %s(%8u) name='%s'",typename,id,name));
+      LOG((0,"Type = %s(%8" PRId64 ") name='%s'",typename,id,name));
 #endif
    } else {
-      fprintf(stderr,"Type = %s(%8u) name='%s'",typename,(unsigned int)id,name);
+      fprintf(stderr,"Type = %s(%8" PRId64 ") name='%s'",typename,id,name);
    }
 }
 
@@ -4221,10 +4250,10 @@ reportopenobjectsT(int log, hid_t fid, int ntypes, unsigned int* otypes)
 
    if(log) {
 #ifdef LOGGING
-      LOG((0,"\nReport: open objects on %d\n",fid));
+      LOG((0,"\nReport: open objects on %" PRId64 "\n",fid));
 #endif
    } else {
-      fprintf(stdout,"\nReport: open objects on %d\n",(int)fid);
+      fprintf(stdout,"\nReport: open objects on %" PRId64 "\n",fid);
    }
    maxobjs = H5Fget_obj_count(fid,H5F_OBJ_ALL);
    if(idlist != NULL) free(idlist);
diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c
index c865de5..69cc521 100644
--- a/libsrc4/nc4internal.c
+++ b/libsrc4/nc4internal.c
@@ -1,3 +1,7 @@
+/* Copyright 2003-2018, University Corporation for Atmospheric
+ * Research. See the COPYRIGHT file for copying and redistribution
+ * conditions.
+ */
 /**
  * @file
  * @internal
@@ -9,9 +13,6 @@
  * buffer of metadata information, i.e. the linked list of NC
  * structs.
  *
- * Copyright 2003-2011, University Corporation for Atmospheric
- * Research. See the COPYRIGHT file for copying and redistribution
- * conditions.
  * @author Ed Hartnett
  */
 #include "config.h"
@@ -101,13 +102,13 @@ nc4_check_name(const char *name, char *norm_name)
 {
    char *temp;
    int retval;
-   
+
    /* Check for NULL. */
    if (!name)
       return NC_EINVAL;
 
    assert(norm_name);
-   
+
    /* Check for NULL. */
    if (!name)
       return NC_EINVAL;
@@ -574,7 +575,7 @@ nc4_rec_find_named_type(NC_GRP_INFO_T *start_grp, char *name)
 }
 
 /**
- * @internal Recursively hunt for a netCDF type id. 
+ * @internal Recursively hunt for a netCDF type id.
  *
  * @param start_grp Pointer to starting group info.
  * @param target_nc_typeid NetCDF type ID to find.
@@ -689,9 +690,8 @@ nc4_find_dim_len(NC_GRP_INFO_T *grp, int dimid, size_t **len)
    return NC_NOERR;
 }
 
-/* Given a group, find an att. */
 /**
- * @internal
+ * @internal Given a group, find an att. 
  *
  * @param grp Pointer to group info struct.
  * @param varid Variable ID.
@@ -1633,7 +1633,7 @@ nc4_att_list_del(NC_ATT_INFO_T **list, NC_ATT_INFO_T *att)
 
 /**
  * @internal Break a coordinate variable to separate the dimension and
- * the variable. 
+ * the variable.
  *
  * This is called from nc_rename_dim() and nc_rename_var(). In some
  * renames, the coord variable must stay, but it is no longer a coord
@@ -1682,7 +1682,7 @@ nc4_break_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *coord_var, NC_DIM_INFO_T
    /* Remove the atts that go with being a coordinate var. */
    /* if ((retval = remove_coord_atts(coord_var->hdf_datasetid))) */
    /*    return retval; */
-   
+
    /* Detach dimension from variable */
    coord_var->dimscale = NC_FALSE;
    dim->coord_var = NULL;
@@ -1722,20 +1722,20 @@ delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *d
    assert(grp && dim);
    LOG((2, "%s: deleting dimscale dataset %s dimid %d", __func__, dim->name,
         dimid));
-   
+
    /* Detach dimscale from any variables using it */
    if ((retval = rec_detach_scales(grp, dimid, dim->hdf_dimscaleid)) < 0)
       return retval;
-      
+
    /* Close the HDF5 dataset */
-   if (H5Dclose(dim->hdf_dimscaleid) < 0) 
+   if (H5Dclose(dim->hdf_dimscaleid) < 0)
       return NC_EHDFERR;
    dim->hdf_dimscaleid = 0;
-            
+
    /* Now delete the dataset. */
    if (H5Gunlink(grp->hdf_grpid, dim->name) < 0)
       return NC_EHDFERR;
-   
+
    return NC_NOERR;
 }
 
@@ -1758,7 +1758,7 @@ nc4_reform_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, NC_DIM_INFO_T *dim)
 
    assert(grp && var && dim);
    LOG((3, "%s: dim->name %s var->name %s", __func__, dim->name, var->name));
-   
+
    /* Detach dimscales from the [new] coordinate variable */
    if(var->dimscale_attached)
    {
diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c
index 0e1f4f9..b6cf802 100644
--- a/libsrc4/nc4var.c
+++ b/libsrc4/nc4var.c
@@ -265,11 +265,7 @@ check_chunksizes(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, const size_t *chunksize
    else
       dprod = (double)type_len;
    for (d = 0; d < var->ndims; d++)
-   {
-      if (chunksizes[d] < 1)
-         return NC_EINVAL;
-      dprod *= (double) chunksizes[d];
-   }
+      dprod *= (double)chunksizes[d];
 
    if (dprod > (double) NC_MAX_UINT)
       return NC_EBADCHUNK;
@@ -410,7 +406,8 @@ nc4_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
  * @returns ::NC_ENOMEM Out of memory.
  * @author Dennis Heimbigner
  */
-int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
+int
+nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
 {
    NC_VAR_INFO_T **vp = NULL;
 
@@ -431,11 +428,10 @@ int nc4_vararray_add(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
       grp->vars.nalloc += NC_ARRAY_GROWBY;
    }
 
-   if(var != NULL) {
-      assert(var->varid == grp->vars.nelems);
-      grp->vars.value[grp->vars.nelems] = var;
-      grp->vars.nelems++;
-   }
+   assert(var->varid == grp->vars.nelems);
+   grp->vars.value[grp->vars.nelems] = var;
+   grp->vars.nelems++;
+
    return NC_NOERR;
 }
 
@@ -524,7 +520,7 @@ NC4_def_var(int ncid, const char *name, nc_type xtype,
    if ((retval = nc4_check_dup_name(grp, norm_name)))
       BAIL(retval);
 
-   /* If there for non-scalar vars, dim IDs must be provided. */
+   /* For non-scalar vars, dim IDs must be provided. */
    if (ndims && !dimidsp)
       BAIL(NC_EINVAL);      
 
@@ -727,7 +723,7 @@ NC4_def_var(int ncid, const char *name, nc_type xtype,
     * remember whether dimension scales have been attached to each
     * dimension. */
    if (!var->dimscale && ndims)
-      if (ndims && !(var->dimscale_attached = calloc(ndims, sizeof(nc_bool_t))))
+      if (!(var->dimscale_attached = calloc(ndims, sizeof(nc_bool_t))))
          BAIL(NC_ENOMEM);
 
    /* Return the varid. */
@@ -885,19 +881,16 @@ NC4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
       {
          if (var->type_info->nc_type_class == NC_STRING)
          {
-            if (*(char **)var->fill_value) {
-
-               if (!(fill_valuep = calloc(1, sizeof(char *))))
-                  return NC_ENOMEM;
-
-               if (!(*(char **)fill_valuep = strdup(*(char **)var->fill_value)))
-               {
-                  free(fill_valuep);
-                  return NC_ENOMEM;
-               }
+            assert(*(char **)var->fill_value);
+            /* This will allocate memeory and copy the string. */
+            if (!(*(char **)fill_valuep = strdup(*(char **)var->fill_value)))
+            {
+               free(*(char **)fill_valuep);
+               return NC_ENOMEM;
             }
          }
-         else {
+         else
+         {
             assert(var->type_info->size);
             memcpy(fill_valuep, var->fill_value, var->type_info->size);
          }
@@ -906,15 +899,13 @@ NC4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
       {
          if (var->type_info->nc_type_class == NC_STRING)
          {
-            if (!(fill_valuep = calloc(1, sizeof(char *))))
+            if (!(*(char **)fill_valuep = calloc(1, sizeof(char *))))
                return NC_ENOMEM;
 
             if ((retval = nc4_get_default_fill_value(var->type_info, (char **)fill_valuep)))
             {
-               free(fill_valuep);
+               free(*(char **)fill_valuep);
                return retval;
-            } else {
-               free(fill_valuep);
             }
          }
          else
@@ -1013,7 +1004,7 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
       return NC_EINVAL;
 
    /* Valid deflate level? */
-   if (deflate && deflate_level)
+   if (deflate)
    {
       if (*deflate)
          if (*deflate_level < NC_MIN_DEFLATE_LEVEL ||
@@ -1104,7 +1095,16 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate,
    if (no_fill)
    {
       if (*no_fill)
+      {
+         /* NC_STRING types may not turn off fill mode. It's disallowed
+          * by HDF5 and will cause a HDF5 error later. */
+         if (*no_fill)
+            if (var->type_info->nc_typeid == NC_STRING)
+               return NC_EINVAL;
+
+         /* Set the no-fill mode. */
          var->no_fill = NC_TRUE;
+      }
       else
          var->no_fill = NC_FALSE;
    }
@@ -1310,11 +1310,6 @@ nc_def_var_chunking_ints(int ncid, int varid, int contiguous, int *chunksizesp)
       return retval;
    assert(nc);
 
-#ifdef USE_HDF4
-   if(h5->hdf4)
-      return NC_NOERR;
-#endif
-
    /* Find var cause I need the number of dims. */
    if ((retval = nc4_find_g_var_nc(nc, ncid, varid, &grp, &var)))
       return retval;
@@ -1659,11 +1654,12 @@ NC4_rename_var(int ncid, int varid, const char *name)
           */
          if ((retval = nc4_find_dim(grp, var->dimids[0], &dim, &dim_grp)))
             return retval;
-         if (strcmp(dim->name, name) == 0 && dim_grp == grp)
+         if (!strcmp(dim->name, name) && dim_grp == grp)
          {
             /* Reform the coordinate variable */
             if ((retval = nc4_reform_coord_var(grp, var, dim)))
                return retval;
+            var->became_coord_var = NC_TRUE;
          }
       }
    }
@@ -1731,50 +1727,6 @@ NC4_var_par_access(int ncid, int varid, int par_access)
 #endif /* USE_PARALLEL4 */
 }
 
-#ifdef USE_HDF4
-/**
- * @internal Get data from an HDF4 SD dataset.
- *
- * @param ncid File ID.
- * @param varid Variable ID.
- * @param startp Array of start indicies.
- * @param countp Array of counts.
- * @param mem_nc_type The type of these data after it is read into memory.
- * @param is_long Ignored for HDF4.
- * @param data pointer that gets the data.
- * @returns ::NC_NOERR for success
- * @author Ed Hartnett
- */
-static int
-nc4_get_hdf4_vara(NC *nc, int ncid, int varid, const size_t *startp,
-                  const size_t *countp, nc_type mem_nc_type, int is_long, void *data)
-{
-   NC_GRP_INFO_T *grp;
-   NC_HDF5_FILE_INFO_T *h5;
-   NC_VAR_INFO_T *var;
-   int32 start32[NC_MAX_VAR_DIMS], edge32[NC_MAX_VAR_DIMS];
-   int retval, d;
-
-   /* Find our metadata for this file, group, and var. */
-   assert(nc);
-   if ((retval = nc4_find_g_var_nc(nc, ncid, varid, &grp, &var)))
-      return retval;
-   h5 = NC4_DATA(nc);
-   assert(grp && h5 && var && var->name);
-
-   for (d = 0; d < var->ndims; d++)
-   {
-      start32[d] = startp[d];
-      edge32[d] = countp[d];
-   }
-
-   if (SDreaddata(var->sdsid, start32, NULL, edge32, data))
-      return NC_EHDFERR;
-
-   return NC_NOERR;
-}
-#endif /* USE_HDF4 */
-
 /**
  * @internal Write an array of data to a variable. This is called by
  * nc_put_vara() and other nc_put_vara_* functions, for netCDF-4
@@ -1805,7 +1757,7 @@ NC4_put_vara(int ncid, int varid, const size_t *startp,
 /**
  * Read an array of values. This is called by nc_get_vara() for
  * netCDF-4 files, as well as all the other nc_get_vara_*
- * functions. HDF4 files are handled as a special case.
+ * functions.
  *
  * @param ncid File ID.
  * @param varid Variable ID.
@@ -1830,14 +1782,7 @@ NC4_get_vara(int ncid, int varid, const size_t *startp,
    if (!(nc = nc4_find_nc_file(ncid, &h5)))
       return NC_EBADID;
 
-#ifdef USE_HDF4
-   /* Handle HDF4 cases. */
-   if (h5->hdf4)
-      return nc4_get_hdf4_vara(nc, ncid, varid, startp, countp, memtype,
-                               0, (void *)ip);
-#endif /* USE_HDF4 */
-
-   /* Handle HDF5 cases. */
+   /* Get the data. */
    return nc4_get_vara(nc, ncid, varid, startp, countp, memtype,
                        0, (void *)ip);
 }
diff --git a/libsrc4/ncfunc.c b/libsrc4/ncfunc.c
index 9e3b050..f8ee091 100644
--- a/libsrc4/ncfunc.c
+++ b/libsrc4/ncfunc.c
@@ -92,8 +92,7 @@ NC4_inq_format(int ncid, int *formatp)
  * @param formatp a pointer that gets the extended format. Note that
  * this is not the same as the format provided by nc_inq_format(). The
  * extended foramt indicates the dispatch layer model. NetCDF-4 files
- * will always get NC_FORMATX_NC4 for netCDF files, NC_FORMATX_HDF4
- * for HDF4 files.
+ * will always get NC_FORMATX_NC4.
  * @param modep a pointer that gets the open/create mode associated with
  * this file. Ignored if NULL.
 
@@ -107,7 +106,7 @@ NC4_inq_format_extended(int ncid, int *formatp, int *modep)
    NC *nc;
    NC_HDF5_FILE_INFO_T* h5;
 
-   LOG((2, "nc_inq_format_extended: ncid 0x%x", ncid));
+   LOG((2, "%s: ncid 0x%x", __func__, ncid));
 
    /* Find the file metadata. */
    if (!(nc = nc4_find_nc_file(ncid,&h5)))
@@ -115,13 +114,8 @@ NC4_inq_format_extended(int ncid, int *formatp, int *modep)
 
    if(modep) *modep = (nc->mode|NC_NETCDF4);
 
-   if(formatp) {
-#ifdef USE_HDF4
-      /* Distinguish HDF5 from HDF4 */
-      *formatp = (h5->hdf4 ? NC_FORMATX_NC_HDF4 : NC_FORMATX_NC_HDF5);
-#else /* USE_HDF4 */
+   if (formatp) 
       *formatp = NC_FORMATX_NC_HDF5;
-#endif /* USE_HDF4 */
-   }
+
    return NC_NOERR;
 }
diff --git a/libsrcp/Makefile.in b/libsrcp/Makefile.in
index 38f979a..324fc9b 100644
--- a/libsrcp/Makefile.in
+++ b/libsrcp/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -138,7 +138,8 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -224,7 +225,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -233,6 +233,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -271,6 +272,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -400,8 +402,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -434,7 +436,13 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -525,7 +533,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -595,7 +606,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -641,7 +652,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/libnetcdfp_la-ncpdispatch.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -662,16 +673,16 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
diff --git a/libsrcp/ncpdispatch.c b/libsrcp/ncpdispatch.c
index 5d4d14c..92b324c 100644
--- a/libsrcp/ncpdispatch.c
+++ b/libsrcp/ncpdispatch.c
@@ -1171,7 +1171,7 @@ NCP_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
     if(deflatep) *deflatep = 0;
     if(fletcher32p) *fletcher32p = 0;
     if(contiguousp) *contiguousp = NC_CONTIGUOUS;
-    if(no_fill) *no_fill = 1;
+    if(no_fill) ncmpi_inq_var_fill(nc->int_ncid, varid, no_fill, fill_valuep);
     if(endiannessp) return NC_ENOTNC4;
     if(idp) return NC_ENOTNC4;
     if(nparamsp) return NC_ENOTNC4;
@@ -1180,6 +1180,15 @@ NCP_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
 }
 
 static int
+NCP_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
+{
+    NC* nc;
+    int status = NC_check_id(ncid, &nc);
+    if(status != NC_NOERR) return status;
+    return ncmpi_def_var_fill(nc->int_ncid, varid, no_fill, fill_value);
+}
+
+static int
 NCP_var_par_access(int ncid, int varid, int par_access)
 {
     NC *nc;
@@ -1493,12 +1502,6 @@ NCP_def_var_chunking(int ncid, int varid, int contiguous, const size_t *chunksiz
 }
 
 static int
-NCP_def_var_fill(int ncid, int varid, int no_fill, const void *fill_value)
-{
-    return NC_ENOTNC4;
-}
-
-static int
 NCP_def_var_endian(int ncid, int varid, int endianness)
 {
     return NC_ENOTNC4;
@@ -1563,6 +1566,7 @@ NCP_put_varm,
 NCP_inq_var_all,
 
 NCP_var_par_access,
+NCP_def_var_fill,
 
 #ifdef USE_NETCDF4
 NCP_show_metadata,
@@ -1599,7 +1603,6 @@ NCP_def_opaque,
 NCP_def_var_deflate,
 NCP_def_var_fletcher32,
 NCP_def_var_chunking,
-NCP_def_var_fill,
 NCP_def_var_endian,
 NCP_def_var_filter,
 NCP_set_var_chunk_cache,
diff --git a/missing b/missing
index c6e3795..625aeb1 100755
--- a/missing
+++ b/missing
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2016-01-11.22; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@ scriptversion=2016-01-11.22; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -101,9 +101,9 @@ else
   exit $st
 fi
 
-perl_URL=http://www.perl.org/
-flex_URL=http://flex.sourceforge.net/
-gnu_software_URL=http://www.gnu.org/software
+perl_URL=https://www.perl.org/
+flex_URL=https://github.com/westes/flex
+gnu_software_URL=https://www.gnu.org/software
 
 program_details ()
 {
@@ -207,7 +207,7 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \
 exit $st
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt
index 09f0261..06943c5 100644
--- a/nc_test/CMakeLists.txt
+++ b/nc_test/CMakeLists.txt
@@ -30,7 +30,7 @@ TARGET_LINK_LIBRARIES(nc_test
   )
 
 # Some extra stand-alone tests
-SET(TESTS t_nc tst_small tst_misc tst_norm tst_names tst_nofill tst_nofill2 tst_nofill3 tst_meta tst_inq_type tst_global_fillval)
+SET(TESTS t_nc tst_small tst_misc tst_norm tst_names tst_nofill tst_nofill2 tst_nofill3 tst_meta tst_inq_type tst_utf8_validate tst_utf8_phrases tst_global_fillval tst_max_var_dims tst_formats tst_def_var_fill)
 
 IF(NOT HAVE_BASH)
   SET(TESTS ${TESTS} tst_atts3)
diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am
index b8fbf16..d78b3c0 100644
--- a/nc_test/Makefile.am
+++ b/nc_test/Makefile.am
@@ -12,7 +12,6 @@ AM_CPPFLAGS += -DTOPBINDIR=${abs_top_bindir}
 LDADD = ${top_builddir}/liblib/libnetcdf.la
 AM_CPPFLAGS += -I$(top_builddir)/liblib -I$(top_builddir)/include -I$(top_srcdir)/libsrc
 
-
 # Note which tests depend on other tests. necessary for make -j check
 TEST_EXTENSIONS = .sh
 
@@ -20,7 +19,7 @@ TEST_EXTENSIONS = .sh
 TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names       \
 tst_nofill tst_nofill2 tst_nofill3 tst_atts3 tst_meta tst_inq_type      \
 tst_utf8_validate tst_utf8_phrases tst_global_fillval                   \
-tst_max_var_dims tst_formats
+tst_max_var_dims tst_formats tst_def_var_fill
 
 if USE_NETCDF4
 TESTPROGRAMS += tst_atts tst_put_vars tst_elatefill
@@ -46,7 +45,7 @@ test_write.c util.c error.h tests.h
 # If the user asked for large file tests, then add them.
 if LARGE_FILE_TESTS
 TESTPROGRAMS += quick_large_files tst_big_var6 tst_big_var2	\
-tst_big_rvar tst_big_var tst_large large_files tst_large_cdf5
+tst_big_rvar tst_big_var tst_large large_files
 endif # LARGE_FILE_TESTS
 
 if BUILD_BENCHMARKS
@@ -84,23 +83,11 @@ if USE_PNETCDF
 TESTS += run_pnetcdf_test.sh
 endif
 
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
-if USE_VALGRIND_TESTS
-if USE_NETCDF4
-    TESTS_ENVIRONMENT = USE_NETCDF4=1
-else
-    TESTS_ENVIRONMENT = USE_NETCDF4=0
-endif
-TESTS += run_valgrind_tests.sh
-endif # USE_VALGRIND_TESTS
-
 # Distribute the .c files so that m4 isn't required on the users
 # machine.
-EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh		\
-run_diskless.sh run_diskless2.sh run_diskless5.sh run_mmap.sh		\
-run_pnetcdf_test.sh test_read.m4 test_write.m4 ref_tst_diskless2.cdl	\
-tst_diskless5.cdl CMakeLists.txt
+EXTRA_DIST = test_get.m4 test_put.m4 run_diskless.sh run_diskless2.sh	\
+run_diskless5.sh run_mmap.sh run_pnetcdf_test.sh test_read.m4		\
+test_write.m4 ref_tst_diskless2.cdl tst_diskless5.cdl CMakeLists.txt
 
 # These files are created by the tests.
 CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc     \
@@ -109,7 +96,20 @@ tst_diskless2.nc tst_diskless3.nc tst_diskless3_file.cdl                \
 tst_diskless3_memory.cdl tst_diskless4.cdl tst_diskless4.nc             \
 tst_formatx.nc nc_test_cdf5.nc unlim.nc tst_inq_type.nc                 \
 tst_elatefill.nc tst_global_fillval.nc tst_large_cdf5.nc                \
-tst_max_var_dims.nc benchmark.nc
+tst_max_var_dims.nc benchmark.nc tst_def_var_fill.nc
+
+EXTRA_DIST += bad_cdf5_begin.nc run_cdf5.sh
+if ENABLE_CDF5
+   # bad_cdf5_begin.nc is a corrupted CDF-5 file with bad variable starting
+   # file offsets. It is to be used by tst_open_cdf5.c to check if it can
+   # detect and report error code NC_ENOTNC.
+   TESTS          += run_cdf5.sh
+   check_PROGRAMS += tst_open_cdf5
+if LARGE_FILE_TESTS
+   TESTPROGRAMS   += tst_large_cdf5 tst_cdf5_begin
+   CLEANFILES     += tst_large_cdf5.nc tst_cdf5_begin.nc
+endif
+endif
 
 # Only clean these on maintainer-clean, because they require m4 to
 # regenerate.
diff --git a/nc_test/Makefile.in b/nc_test/Makefile.in
index db392b1..f9321d6 100644
--- a/nc_test/Makefile.in
+++ b/nc_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -108,21 +108,25 @@ target_triplet = @target@
 
 # If the user asked for large file tests, then add them.
 @LARGE_FILE_TESTS_TRUE at am__append_5 = quick_large_files tst_big_var6 tst_big_var2	\
- at LARGE_FILE_TESTS_TRUE@tst_big_rvar tst_big_var tst_large large_files tst_large_cdf5
+ at LARGE_FILE_TESTS_TRUE@tst_big_rvar tst_big_var tst_large large_files
 
 @BUILD_BENCHMARKS_TRUE at am__append_6 = testnc3perf
-check_PROGRAMS = $(am__EXEEXT_6) $(am__EXEEXT_7) $(am__EXEEXT_8)
+check_PROGRAMS = $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
+	$(am__EXEEXT_10)
 
 # Build Diskless test helpers
 @BUILD_DISKLESS_TRUE at am__append_7 = tst_diskless tst_diskless3 tst_diskless4 tst_diskless5
 @BUILD_DISKLESS_TRUE@@USE_NETCDF4_TRUE at am__append_8 = tst_diskless2
-TESTS = $(am__EXEEXT_6) $(am__append_9) $(am__append_10) \
+TESTS = $(am__EXEEXT_7) $(am__append_9) $(am__append_10) \
 	$(am__append_11) $(am__append_12) $(am__append_13)
 @BUILD_DISKLESS_TRUE@@BUILD_UTILITIES_TRUE at am__append_9 = run_diskless.sh run_diskless5.sh
 @BUILD_DISKLESS_TRUE@@BUILD_MMAP_TRUE@@BUILD_UTILITIES_TRUE at am__append_10 = run_mmap.sh
 @BUILD_DISKLESS_TRUE@@BUILD_UTILITIES_TRUE@@LARGE_FILE_TESTS_TRUE at am__append_11 = run_diskless2.sh
 @USE_PNETCDF_TRUE at am__append_12 = run_pnetcdf_test.sh
- at USE_VALGRIND_TESTS_TRUE@am__append_13 = run_valgrind_tests.sh
+ at ENABLE_CDF5_TRUE@am__append_13 = run_cdf5.sh
+ at ENABLE_CDF5_TRUE@am__append_14 = tst_open_cdf5
+ at ENABLE_CDF5_TRUE@@LARGE_FILE_TESTS_TRUE at am__append_15 = tst_large_cdf5 tst_cdf5_begin
+ at ENABLE_CDF5_TRUE@@LARGE_FILE_TESTS_TRUE at am__append_16 = tst_large_cdf5.nc tst_cdf5_begin.nc
 subdir = nc_test
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -147,23 +151,26 @@ CONFIG_CLEAN_VPATH_FILES =
 @LARGE_FILE_TESTS_TRUE@	tst_big_var2$(EXEEXT) \
 @LARGE_FILE_TESTS_TRUE@	tst_big_rvar$(EXEEXT) \
 @LARGE_FILE_TESTS_TRUE@	tst_big_var$(EXEEXT) tst_large$(EXEEXT) \
- at LARGE_FILE_TESTS_TRUE@	large_files$(EXEEXT) \
- at LARGE_FILE_TESTS_TRUE@	tst_large_cdf5$(EXEEXT)
+ at LARGE_FILE_TESTS_TRUE@	large_files$(EXEEXT)
 @BUILD_BENCHMARKS_TRUE at am__EXEEXT_5 = testnc3perf$(EXEEXT)
-am__EXEEXT_6 = t_nc$(EXEEXT) tst_small$(EXEEXT) nc_test$(EXEEXT) \
+ at ENABLE_CDF5_TRUE@@LARGE_FILE_TESTS_TRUE at am__EXEEXT_6 = tst_large_cdf5$(EXEEXT) \
+ at ENABLE_CDF5_TRUE@@LARGE_FILE_TESTS_TRUE@	tst_cdf5_begin$(EXEEXT)
+am__EXEEXT_7 = t_nc$(EXEEXT) tst_small$(EXEEXT) nc_test$(EXEEXT) \
 	tst_misc$(EXEEXT) tst_norm$(EXEEXT) tst_names$(EXEEXT) \
 	tst_nofill$(EXEEXT) tst_nofill2$(EXEEXT) tst_nofill3$(EXEEXT) \
 	tst_atts3$(EXEEXT) tst_meta$(EXEEXT) tst_inq_type$(EXEEXT) \
 	tst_utf8_validate$(EXEEXT) tst_utf8_phrases$(EXEEXT) \
 	tst_global_fillval$(EXEEXT) tst_max_var_dims$(EXEEXT) \
-	tst_formats$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
-	$(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5)
- at BUILD_DISKLESS_TRUE@am__EXEEXT_7 = tst_diskless$(EXEEXT) \
+	tst_formats$(EXEEXT) tst_def_var_fill$(EXEEXT) $(am__EXEEXT_1) \
+	$(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \
+	$(am__EXEEXT_5) $(am__EXEEXT_6)
+ at BUILD_DISKLESS_TRUE@am__EXEEXT_8 = tst_diskless$(EXEEXT) \
 @BUILD_DISKLESS_TRUE@	tst_diskless3$(EXEEXT) \
 @BUILD_DISKLESS_TRUE@	tst_diskless4$(EXEEXT) \
 @BUILD_DISKLESS_TRUE@	tst_diskless5$(EXEEXT)
- at BUILD_DISKLESS_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_8 =  \
+ at BUILD_DISKLESS_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_9 =  \
 @BUILD_DISKLESS_TRUE@@USE_NETCDF4_TRUE@	tst_diskless2$(EXEEXT)
+ at ENABLE_CDF5_TRUE@am__EXEEXT_10 = tst_open_cdf5$(EXEEXT)
 large_files_SOURCES = large_files.c
 large_files_OBJECTS = large_files.$(OBJEXT)
 large_files_LDADD = $(LDADD)
@@ -219,10 +226,18 @@ tst_big_var6_SOURCES = tst_big_var6.c
 tst_big_var6_OBJECTS = tst_big_var6.$(OBJEXT)
 tst_big_var6_LDADD = $(LDADD)
 tst_big_var6_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
+tst_cdf5_begin_SOURCES = tst_cdf5_begin.c
+tst_cdf5_begin_OBJECTS = tst_cdf5_begin.$(OBJEXT)
+tst_cdf5_begin_LDADD = $(LDADD)
+tst_cdf5_begin_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
 tst_cdf5format_SOURCES = tst_cdf5format.c
 tst_cdf5format_OBJECTS = tst_cdf5format.$(OBJEXT)
 tst_cdf5format_LDADD = $(LDADD)
 tst_cdf5format_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
+tst_def_var_fill_SOURCES = tst_def_var_fill.c
+tst_def_var_fill_OBJECTS = tst_def_var_fill.$(OBJEXT)
+tst_def_var_fill_LDADD = $(LDADD)
+tst_def_var_fill_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
 tst_diskless_SOURCES = tst_diskless.c
 tst_diskless_OBJECTS = tst_diskless.$(OBJEXT)
 tst_diskless_LDADD = $(LDADD)
@@ -304,6 +319,10 @@ tst_norm_SOURCES = tst_norm.c
 tst_norm_OBJECTS = tst_norm.$(OBJEXT)
 tst_norm_LDADD = $(LDADD)
 tst_norm_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
+tst_open_cdf5_SOURCES = tst_open_cdf5.c
+tst_open_cdf5_OBJECTS = tst_open_cdf5.$(OBJEXT)
+tst_open_cdf5_LDADD = $(LDADD)
+tst_open_cdf5_DEPENDENCIES = ${top_builddir}/liblib/libnetcdf.la
 tst_parallel2_SOURCES = tst_parallel2.c
 tst_parallel2_OBJECTS = tst_parallel2.$(OBJEXT)
 tst_parallel2_LDADD = $(LDADD)
@@ -342,7 +361,31 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/error.Po ./$(DEPDIR)/large_files.Po \
+	./$(DEPDIR)/nc_test.Po ./$(DEPDIR)/quick_large_files.Po \
+	./$(DEPDIR)/t_nc.Po ./$(DEPDIR)/test_get.Po \
+	./$(DEPDIR)/test_put.Po ./$(DEPDIR)/test_read.Po \
+	./$(DEPDIR)/test_write.Po ./$(DEPDIR)/testnc3perf.Po \
+	./$(DEPDIR)/tst_addvar.Po ./$(DEPDIR)/tst_atts.Po \
+	./$(DEPDIR)/tst_atts3.Po ./$(DEPDIR)/tst_big_rvar.Po \
+	./$(DEPDIR)/tst_big_var.Po ./$(DEPDIR)/tst_big_var2.Po \
+	./$(DEPDIR)/tst_big_var6.Po ./$(DEPDIR)/tst_cdf5_begin.Po \
+	./$(DEPDIR)/tst_cdf5format.Po ./$(DEPDIR)/tst_def_var_fill.Po \
+	./$(DEPDIR)/tst_diskless.Po ./$(DEPDIR)/tst_diskless2.Po \
+	./$(DEPDIR)/tst_diskless3.Po ./$(DEPDIR)/tst_diskless4.Po \
+	./$(DEPDIR)/tst_diskless5.Po ./$(DEPDIR)/tst_elatefill.Po \
+	./$(DEPDIR)/tst_formats.Po ./$(DEPDIR)/tst_formatx_pnetcdf.Po \
+	./$(DEPDIR)/tst_global_fillval.Po ./$(DEPDIR)/tst_inq_type.Po \
+	./$(DEPDIR)/tst_large.Po ./$(DEPDIR)/tst_large_cdf5.Po \
+	./$(DEPDIR)/tst_max_var_dims.Po ./$(DEPDIR)/tst_meta.Po \
+	./$(DEPDIR)/tst_misc.Po ./$(DEPDIR)/tst_names.Po \
+	./$(DEPDIR)/tst_nofill.Po ./$(DEPDIR)/tst_nofill2.Po \
+	./$(DEPDIR)/tst_nofill3.Po ./$(DEPDIR)/tst_norm.Po \
+	./$(DEPDIR)/tst_open_cdf5.Po ./$(DEPDIR)/tst_parallel2.Po \
+	./$(DEPDIR)/tst_pnetcdf.Po ./$(DEPDIR)/tst_put_vars.Po \
+	./$(DEPDIR)/tst_small.Po ./$(DEPDIR)/tst_utf8_phrases.Po \
+	./$(DEPDIR)/tst_utf8_validate.Po ./$(DEPDIR)/util.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -365,25 +408,28 @@ am__v_CCLD_1 =
 SOURCES = large_files.c $(nc_test_SOURCES) quick_large_files.c t_nc.c \
 	$(testnc3perf_SOURCES) tst_addvar.c tst_atts.c tst_atts3.c \
 	tst_big_rvar.c tst_big_var.c tst_big_var2.c tst_big_var6.c \
-	tst_cdf5format.c tst_diskless.c tst_diskless2.c \
-	tst_diskless3.c tst_diskless4.c tst_diskless5.c \
-	tst_elatefill.c tst_formats.c tst_formatx_pnetcdf.c \
-	tst_global_fillval.c tst_inq_type.c tst_large.c \
-	tst_large_cdf5.c tst_max_var_dims.c tst_meta.c tst_misc.c \
-	tst_names.c tst_nofill.c tst_nofill2.c tst_nofill3.c \
-	tst_norm.c tst_parallel2.c tst_pnetcdf.c tst_put_vars.c \
-	tst_small.c tst_utf8_phrases.c tst_utf8_validate.c
+	tst_cdf5_begin.c tst_cdf5format.c tst_def_var_fill.c \
+	tst_diskless.c tst_diskless2.c tst_diskless3.c tst_diskless4.c \
+	tst_diskless5.c tst_elatefill.c tst_formats.c \
+	tst_formatx_pnetcdf.c tst_global_fillval.c tst_inq_type.c \
+	tst_large.c tst_large_cdf5.c tst_max_var_dims.c tst_meta.c \
+	tst_misc.c tst_names.c tst_nofill.c tst_nofill2.c \
+	tst_nofill3.c tst_norm.c tst_open_cdf5.c tst_parallel2.c \
+	tst_pnetcdf.c tst_put_vars.c tst_small.c tst_utf8_phrases.c \
+	tst_utf8_validate.c
 DIST_SOURCES = large_files.c $(nc_test_SOURCES) quick_large_files.c \
 	t_nc.c $(am__testnc3perf_SOURCES_DIST) tst_addvar.c tst_atts.c \
 	tst_atts3.c tst_big_rvar.c tst_big_var.c tst_big_var2.c \
-	tst_big_var6.c tst_cdf5format.c tst_diskless.c tst_diskless2.c \
+	tst_big_var6.c tst_cdf5_begin.c tst_cdf5format.c \
+	tst_def_var_fill.c tst_diskless.c tst_diskless2.c \
 	tst_diskless3.c tst_diskless4.c tst_diskless5.c \
 	tst_elatefill.c tst_formats.c tst_formatx_pnetcdf.c \
 	tst_global_fillval.c tst_inq_type.c tst_large.c \
 	tst_large_cdf5.c tst_max_var_dims.c tst_meta.c tst_misc.c \
 	tst_names.c tst_nofill.c tst_nofill2.c tst_nofill3.c \
-	tst_norm.c tst_parallel2.c tst_pnetcdf.c tst_put_vars.c \
-	tst_small.c tst_utf8_phrases.c tst_utf8_validate.c
+	tst_norm.c tst_open_cdf5.c tst_parallel2.c tst_pnetcdf.c \
+	tst_put_vars.c tst_small.c tst_utf8_phrases.c \
+	tst_utf8_validate.c
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -655,7 +701,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -664,6 +709,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -702,6 +748,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -811,8 +858,9 @@ TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names \
 	tst_nofill tst_nofill2 tst_nofill3 tst_atts3 tst_meta \
 	tst_inq_type tst_utf8_validate tst_utf8_phrases \
 	tst_global_fillval tst_max_var_dims tst_formats \
-	$(am__append_2) $(am__append_3) $(am__append_4) \
-	$(am__append_5) $(am__append_6)
+	tst_def_var_fill $(am__append_2) $(am__append_3) \
+	$(am__append_4) $(am__append_5) $(am__append_6) \
+	$(am__append_15)
 
 # These are the source files for the main workhorse test program,
 # nc_test. If you pass nc_test, you are doing well.
@@ -820,29 +868,23 @@ nc_test_SOURCES = nc_test.c error.c test_get.c test_put.c test_read.c	\
 test_write.c util.c error.h tests.h
 
 @BUILD_BENCHMARKS_TRUE at testnc3perf_SOURCES = testnc3perf.c
- at USE_NETCDF4_FALSE@@USE_VALGRIND_TESTS_TRUE at TESTS_ENVIRONMENT = USE_NETCDF4=0
-
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
- at USE_NETCDF4_TRUE@@USE_VALGRIND_TESTS_TRUE at TESTS_ENVIRONMENT = USE_NETCDF4=1
 
 # Distribute the .c files so that m4 isn't required on the users
 # machine.
-EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh		\
-run_diskless.sh run_diskless2.sh run_diskless5.sh run_mmap.sh		\
-run_pnetcdf_test.sh test_read.m4 test_write.m4 ref_tst_diskless2.cdl	\
-tst_diskless5.cdl CMakeLists.txt
-
+EXTRA_DIST = test_get.m4 test_put.m4 run_diskless.sh run_diskless2.sh \
+	run_diskless5.sh run_mmap.sh run_pnetcdf_test.sh test_read.m4 \
+	test_write.m4 ref_tst_diskless2.cdl tst_diskless5.cdl \
+	CMakeLists.txt bad_cdf5_begin.nc run_cdf5.sh
 
 # These files are created by the tests.
-CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc     \
-tst_*.nc t_nc.nc large_files.nc quick_large_files.nc tst_diskless.nc    \
-tst_diskless2.nc tst_diskless3.nc tst_diskless3_file.cdl                \
-tst_diskless3_memory.cdl tst_diskless4.cdl tst_diskless4.nc             \
-tst_formatx.nc nc_test_cdf5.nc unlim.nc tst_inq_type.nc                 \
-tst_elatefill.nc tst_global_fillval.nc tst_large_cdf5.nc                \
-tst_max_var_dims.nc benchmark.nc
-
+CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
+	tst_*.nc t_nc.nc large_files.nc quick_large_files.nc \
+	tst_diskless.nc tst_diskless2.nc tst_diskless3.nc \
+	tst_diskless3_file.cdl tst_diskless3_memory.cdl \
+	tst_diskless4.cdl tst_diskless4.nc tst_formatx.nc \
+	nc_test_cdf5.nc unlim.nc tst_inq_type.nc tst_elatefill.nc \
+	tst_global_fillval.nc tst_large_cdf5.nc tst_max_var_dims.nc \
+	benchmark.nc tst_def_var_fill.nc $(am__append_16)
 all: all-am
 
 .SUFFIXES:
@@ -864,8 +906,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -935,10 +977,18 @@ tst_big_var6$(EXEEXT): $(tst_big_var6_OBJECTS) $(tst_big_var6_DEPENDENCIES) $(EX
 	@rm -f tst_big_var6$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_big_var6_OBJECTS) $(tst_big_var6_LDADD) $(LIBS)
 
+tst_cdf5_begin$(EXEEXT): $(tst_cdf5_begin_OBJECTS) $(tst_cdf5_begin_DEPENDENCIES) $(EXTRA_tst_cdf5_begin_DEPENDENCIES) 
+	@rm -f tst_cdf5_begin$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_cdf5_begin_OBJECTS) $(tst_cdf5_begin_LDADD) $(LIBS)
+
 tst_cdf5format$(EXEEXT): $(tst_cdf5format_OBJECTS) $(tst_cdf5format_DEPENDENCIES) $(EXTRA_tst_cdf5format_DEPENDENCIES) 
 	@rm -f tst_cdf5format$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_cdf5format_OBJECTS) $(tst_cdf5format_LDADD) $(LIBS)
 
+tst_def_var_fill$(EXEEXT): $(tst_def_var_fill_OBJECTS) $(tst_def_var_fill_DEPENDENCIES) $(EXTRA_tst_def_var_fill_DEPENDENCIES) 
+	@rm -f tst_def_var_fill$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_def_var_fill_OBJECTS) $(tst_def_var_fill_LDADD) $(LIBS)
+
 tst_diskless$(EXEEXT): $(tst_diskless_OBJECTS) $(tst_diskless_DEPENDENCIES) $(EXTRA_tst_diskless_DEPENDENCIES) 
 	@rm -f tst_diskless$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_diskless_OBJECTS) $(tst_diskless_LDADD) $(LIBS)
@@ -1019,6 +1069,10 @@ tst_norm$(EXEEXT): $(tst_norm_OBJECTS) $(tst_norm_DEPENDENCIES) $(EXTRA_tst_norm
 	@rm -f tst_norm$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_norm_OBJECTS) $(tst_norm_LDADD) $(LIBS)
 
+tst_open_cdf5$(EXEEXT): $(tst_open_cdf5_OBJECTS) $(tst_open_cdf5_DEPENDENCIES) $(EXTRA_tst_open_cdf5_DEPENDENCIES) 
+	@rm -f tst_open_cdf5$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_open_cdf5_OBJECTS) $(tst_open_cdf5_LDADD) $(LIBS)
+
 tst_parallel2$(EXEEXT): $(tst_parallel2_OBJECTS) $(tst_parallel2_DEPENDENCIES) $(EXTRA_tst_parallel2_DEPENDENCIES) 
 	@rm -f tst_parallel2$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_parallel2_OBJECTS) $(tst_parallel2_LDADD) $(LIBS)
@@ -1049,51 +1103,60 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/large_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nc_test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/quick_large_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_nc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_get.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_put.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_read.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_write.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/testnc3perf.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_addvar.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_rvar.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_var.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_var2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_var6.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cdf5format.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless5.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_elatefill.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_formats.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_formatx_pnetcdf.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_global_fillval.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_inq_type.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large_cdf5.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_max_var_dims.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_meta.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_misc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_names.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nofill.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nofill2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nofill3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_norm.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_pnetcdf.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_put_vars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_small.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8_phrases.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8_validate.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/util.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/large_files.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nc_test.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/quick_large_files.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_nc.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_get.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_put.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_read.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_write.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/testnc3perf.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_addvar.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_rvar.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_var.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_var2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_var6.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cdf5_begin.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cdf5format.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_def_var_fill.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_diskless5.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_elatefill.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_formats.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_formatx_pnetcdf.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_global_fillval.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_inq_type.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large_cdf5.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_max_var_dims.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_meta.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_misc.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_names.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nofill.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nofill2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nofill3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_norm.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_open_cdf5.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_pnetcdf.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_put_vars.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_small.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8_phrases.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8_validate.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/util.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1297,7 +1360,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1437,6 +1500,13 @@ tst_formats.log: tst_formats$(EXEEXT)
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+tst_def_var_fill.log: tst_def_var_fill$(EXEEXT)
+	@p='tst_def_var_fill$(EXEEXT)'; \
+	b='tst_def_var_fill'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 tst_atts.log: tst_atts$(EXEEXT)
 	@p='tst_atts$(EXEEXT)'; \
 	b='tst_atts'; \
@@ -1542,6 +1612,13 @@ large_files.log: large_files$(EXEEXT)
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+testnc3perf.log: testnc3perf$(EXEEXT)
+	@p='testnc3perf$(EXEEXT)'; \
+	b='testnc3perf'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 tst_large_cdf5.log: tst_large_cdf5$(EXEEXT)
 	@p='tst_large_cdf5$(EXEEXT)'; \
 	b='tst_large_cdf5'; \
@@ -1549,9 +1626,9 @@ tst_large_cdf5.log: tst_large_cdf5$(EXEEXT)
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
-testnc3perf.log: testnc3perf$(EXEEXT)
-	@p='testnc3perf$(EXEEXT)'; \
-	b='testnc3perf'; \
+tst_cdf5_begin.log: tst_cdf5_begin$(EXEEXT)
+	@p='tst_cdf5_begin$(EXEEXT)'; \
+	b='tst_cdf5_begin'; \
 	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
@@ -1571,7 +1648,10 @@ testnc3perf.log: testnc3perf$(EXEEXT)
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1647,7 +1727,54 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/error.Po
+	-rm -f ./$(DEPDIR)/large_files.Po
+	-rm -f ./$(DEPDIR)/nc_test.Po
+	-rm -f ./$(DEPDIR)/quick_large_files.Po
+	-rm -f ./$(DEPDIR)/t_nc.Po
+	-rm -f ./$(DEPDIR)/test_get.Po
+	-rm -f ./$(DEPDIR)/test_put.Po
+	-rm -f ./$(DEPDIR)/test_read.Po
+	-rm -f ./$(DEPDIR)/test_write.Po
+	-rm -f ./$(DEPDIR)/testnc3perf.Po
+	-rm -f ./$(DEPDIR)/tst_addvar.Po
+	-rm -f ./$(DEPDIR)/tst_atts.Po
+	-rm -f ./$(DEPDIR)/tst_atts3.Po
+	-rm -f ./$(DEPDIR)/tst_big_rvar.Po
+	-rm -f ./$(DEPDIR)/tst_big_var.Po
+	-rm -f ./$(DEPDIR)/tst_big_var2.Po
+	-rm -f ./$(DEPDIR)/tst_big_var6.Po
+	-rm -f ./$(DEPDIR)/tst_cdf5_begin.Po
+	-rm -f ./$(DEPDIR)/tst_cdf5format.Po
+	-rm -f ./$(DEPDIR)/tst_def_var_fill.Po
+	-rm -f ./$(DEPDIR)/tst_diskless.Po
+	-rm -f ./$(DEPDIR)/tst_diskless2.Po
+	-rm -f ./$(DEPDIR)/tst_diskless3.Po
+	-rm -f ./$(DEPDIR)/tst_diskless4.Po
+	-rm -f ./$(DEPDIR)/tst_diskless5.Po
+	-rm -f ./$(DEPDIR)/tst_elatefill.Po
+	-rm -f ./$(DEPDIR)/tst_formats.Po
+	-rm -f ./$(DEPDIR)/tst_formatx_pnetcdf.Po
+	-rm -f ./$(DEPDIR)/tst_global_fillval.Po
+	-rm -f ./$(DEPDIR)/tst_inq_type.Po
+	-rm -f ./$(DEPDIR)/tst_large.Po
+	-rm -f ./$(DEPDIR)/tst_large_cdf5.Po
+	-rm -f ./$(DEPDIR)/tst_max_var_dims.Po
+	-rm -f ./$(DEPDIR)/tst_meta.Po
+	-rm -f ./$(DEPDIR)/tst_misc.Po
+	-rm -f ./$(DEPDIR)/tst_names.Po
+	-rm -f ./$(DEPDIR)/tst_nofill.Po
+	-rm -f ./$(DEPDIR)/tst_nofill2.Po
+	-rm -f ./$(DEPDIR)/tst_nofill3.Po
+	-rm -f ./$(DEPDIR)/tst_norm.Po
+	-rm -f ./$(DEPDIR)/tst_open_cdf5.Po
+	-rm -f ./$(DEPDIR)/tst_parallel2.Po
+	-rm -f ./$(DEPDIR)/tst_pnetcdf.Po
+	-rm -f ./$(DEPDIR)/tst_put_vars.Po
+	-rm -f ./$(DEPDIR)/tst_small.Po
+	-rm -f ./$(DEPDIR)/tst_utf8_phrases.Po
+	-rm -f ./$(DEPDIR)/tst_utf8_validate.Po
+	-rm -f ./$(DEPDIR)/util.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1693,7 +1820,54 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/error.Po
+	-rm -f ./$(DEPDIR)/large_files.Po
+	-rm -f ./$(DEPDIR)/nc_test.Po
+	-rm -f ./$(DEPDIR)/quick_large_files.Po
+	-rm -f ./$(DEPDIR)/t_nc.Po
+	-rm -f ./$(DEPDIR)/test_get.Po
+	-rm -f ./$(DEPDIR)/test_put.Po
+	-rm -f ./$(DEPDIR)/test_read.Po
+	-rm -f ./$(DEPDIR)/test_write.Po
+	-rm -f ./$(DEPDIR)/testnc3perf.Po
+	-rm -f ./$(DEPDIR)/tst_addvar.Po
+	-rm -f ./$(DEPDIR)/tst_atts.Po
+	-rm -f ./$(DEPDIR)/tst_atts3.Po
+	-rm -f ./$(DEPDIR)/tst_big_rvar.Po
+	-rm -f ./$(DEPDIR)/tst_big_var.Po
+	-rm -f ./$(DEPDIR)/tst_big_var2.Po
+	-rm -f ./$(DEPDIR)/tst_big_var6.Po
+	-rm -f ./$(DEPDIR)/tst_cdf5_begin.Po
+	-rm -f ./$(DEPDIR)/tst_cdf5format.Po
+	-rm -f ./$(DEPDIR)/tst_def_var_fill.Po
+	-rm -f ./$(DEPDIR)/tst_diskless.Po
+	-rm -f ./$(DEPDIR)/tst_diskless2.Po
+	-rm -f ./$(DEPDIR)/tst_diskless3.Po
+	-rm -f ./$(DEPDIR)/tst_diskless4.Po
+	-rm -f ./$(DEPDIR)/tst_diskless5.Po
+	-rm -f ./$(DEPDIR)/tst_elatefill.Po
+	-rm -f ./$(DEPDIR)/tst_formats.Po
+	-rm -f ./$(DEPDIR)/tst_formatx_pnetcdf.Po
+	-rm -f ./$(DEPDIR)/tst_global_fillval.Po
+	-rm -f ./$(DEPDIR)/tst_inq_type.Po
+	-rm -f ./$(DEPDIR)/tst_large.Po
+	-rm -f ./$(DEPDIR)/tst_large_cdf5.Po
+	-rm -f ./$(DEPDIR)/tst_max_var_dims.Po
+	-rm -f ./$(DEPDIR)/tst_meta.Po
+	-rm -f ./$(DEPDIR)/tst_misc.Po
+	-rm -f ./$(DEPDIR)/tst_names.Po
+	-rm -f ./$(DEPDIR)/tst_nofill.Po
+	-rm -f ./$(DEPDIR)/tst_nofill2.Po
+	-rm -f ./$(DEPDIR)/tst_nofill3.Po
+	-rm -f ./$(DEPDIR)/tst_norm.Po
+	-rm -f ./$(DEPDIR)/tst_open_cdf5.Po
+	-rm -f ./$(DEPDIR)/tst_parallel2.Po
+	-rm -f ./$(DEPDIR)/tst_pnetcdf.Po
+	-rm -f ./$(DEPDIR)/tst_put_vars.Po
+	-rm -f ./$(DEPDIR)/tst_small.Po
+	-rm -f ./$(DEPDIR)/tst_utf8_phrases.Po
+	-rm -f ./$(DEPDIR)/tst_utf8_validate.Po
+	-rm -f ./$(DEPDIR)/util.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1714,16 +1888,16 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	recheck tags tags-am uninstall uninstall-am
@@ -1731,6 +1905,9 @@ uninstall-am:
 .PRECIOUS: Makefile
 
 @BUILD_DISKLESS_TRUE@@BUILD_MMAP_TRUE@@BUILD_UTILITIES_TRUE at run_mmap.log: run_diskless.log
+ at ENABLE_CDF5_TRUE@   # bad_cdf5_begin.nc is a corrupted CDF-5 file with bad variable starting
+ at ENABLE_CDF5_TRUE@   # file offsets. It is to be used by tst_open_cdf5.c to check if it can
+ at ENABLE_CDF5_TRUE@   # detect and report error code NC_ENOTNC.
 
 # Only clean these on maintainer-clean, because they require m4 to
 # regenerate.
diff --git a/nc_test/bad_cdf5_begin.nc b/nc_test/bad_cdf5_begin.nc
new file mode 100644
index 0000000..da0a0a2
Binary files /dev/null and b/nc_test/bad_cdf5_begin.nc differ
diff --git a/nc_test/run_cdf5.sh b/nc_test/run_cdf5.sh
new file mode 100755
index 0000000..396aaa6
--- /dev/null
+++ b/nc_test/run_cdf5.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+
+./tst_open_cdf5 ${srcdir}/bad_cdf5_begin.nc
+
diff --git a/nc_test/run_valgrind_tests.sh b/nc_test/run_valgrind_tests.sh
deleted file mode 100755
index c172039..0000000
--- a/nc_test/run_valgrind_tests.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# This shell runs the tests with valgrind.
-
-# $Id: run_valgrind_tests.sh,v 1.9 2010/01/26 20:24:18 ed Exp $
-
-set -e
-echo ""
-echo "Testing programs with valgrind..."
-
-# These are my test programs.
-list='t_nc tst_norm tst_names tst_misc nc_test'
-# If we are running with netcdf4, then add tst_atts
-if test "x$USE_NETCDF4" = "x1" ; then
-list="$list tst_atts"
-fi
-
-# These don't work yet: tst_fills tst_xplatform2 tst_interops6 tst_strings 
-
-for tst in $list; do
-    echo ""
-    cmd1="valgrind -q --error-exitcode=2 --leak-check=full ./$tst"
-    echo "$cmd1:"
-    $cmd1
-done
-
-echo "SUCCESS!!!"
-
-exit 0
diff --git a/nc_test/test_write.c b/nc_test/test_write.c
index 70e6cfc..9266810 100644
--- a/nc_test/test_write.c
+++ b/nc_test/test_write.c
@@ -2220,6 +2220,23 @@ IF (err)
             ELSE_NOK
         }
     }
+
+    /* enter redef mode and add a new variable, check NC_ELATEFILL */
+    err = nc_redef(ncid);
+    IF (err != NC_NOERR)
+        error("redef: %s", nc_strerror(err));
+
+    /* it is not allowed to define fill value when variable already exists */
+    err = nc_def_var_fill(ncid, 0, 0, &value);
+    IF (err != NC_ELATEFILL)
+        error("redef: expect NC_ELATEFILL but got %s", nc_err_code_name(err));
+    err = nc_def_var(ncid, "new_var", NC_INT, 0, NULL, &varid);
+    IF (err != NC_NOERR)
+        error("redef: %s", nc_strerror(err));
+    err = nc_def_var_fill(ncid, varid, 0, &value);
+    IF (err != NC_NOERR)
+        error("def_var_fill: %s", nc_strerror(err));
+
     err = nc_close(ncid);
     IF (err != NC_NOERR)
         error("close: %s", nc_strerror(err));
diff --git a/nc_test/test_write.m4 b/nc_test/test_write.m4
index 936d99b..edc303a 100644
--- a/nc_test/test_write.m4
+++ b/nc_test/test_write.m4
@@ -2361,6 +2361,23 @@ ifdef(`PNETCDF', `
             ELSE_NOK
         }
     }
+
+    /* enter redef mode and add a new variable, check NC_ELATEFILL */
+    err = APIFunc(redef)(ncid);
+    IF (err != NC_NOERR)
+        error("redef: %s", APIFunc(strerror)(err));
+
+    /* it is not allowed to define fill value when variable already exists */
+    err = APIFunc(def_var_fill)(ncid, 0, 0, &value);
+    IF (err != NC_ELATEFILL)
+        error("redef: expect NC_ELATEFILL but got %s", nc_err_code_name(err));
+    err = APIFunc(def_var)(ncid, "new_var", NC_INT, 0, NULL, &varid);
+    IF (err != NC_NOERR)
+        error("redef: %s", APIFunc(strerror)(err));
+    err = APIFunc(def_var_fill)(ncid, varid, 0, &value);
+    IF (err != NC_NOERR)
+        error("def_var_fill: %s", APIFunc(strerror)(err));
+
     err = APIFunc(close)(ncid);
     IF (err != NC_NOERR)
         error("close: %s", APIFunc(strerror)(err));
diff --git a/nc_test/tst_cdf5_begin.c b/nc_test/tst_cdf5_begin.c
new file mode 100644
index 0000000..d704d9a
--- /dev/null
+++ b/nc_test/tst_cdf5_begin.c
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <netcdf.h>
+
+/* When using NetCDF 4.4.1 ad prior to create a CDF-5 file and defining a small
+ * variable after a big variable (> 2^32-3 bytes), the file starting offset of
+ * the small variable (and all variables defined after the big variable) is
+ * calculated incorrectly. This test program detects this bug by checking the
+ * contents of the possible overlaps between the two variables.
+ */
+
+#define ERR {if(err!=NC_NOERR){printf("Error at line %d in %s: %s\n", __LINE__,__FILE__, nc_strerror(err));nerrs++;}}
+
+#define FILE_NAME "tst_cdf5_begin.nc"
+
+int main(int argc, char *argv[])
+{
+    int i, err, nerrs=0, ncid, dimid[2], varid[2];
+    short buf[10];
+    size_t start, count;
+  
+    err = nc_create(FILE_NAME, NC_CLOBBER|NC_64BIT_DATA, &ncid); ERR;
+    err = nc_def_dim(ncid, "dim0", NC_MAX_UINT, &dimid[0]); ERR
+    err = nc_def_dim(ncid, "dim1", 10,          &dimid[1]); ERR
+
+    /* define one small variable after one big variable */
+    err = nc_def_var(ncid, "var_big",   NC_SHORT, 1, &dimid[0], &varid[0]); ERR
+    err = nc_def_var(ncid, "var_small", NC_SHORT, 1, &dimid[1], &varid[1]); ERR
+    err = nc_set_fill(ncid, NC_NOFILL, NULL); ERR
+    err = nc_enddef(ncid); ERR
+
+    /* write to var_big in location overlapping with var_small when using
+     * netCDF 4.4.x or prior */
+    start = NC_MAX_UINT/sizeof(short);
+    count = 10;
+    for (i=0; i<10; i++) buf[i] = i;
+    err = nc_put_vara_short(ncid, varid[0], &start, &count, buf); ERR
+
+    /* write var_small */
+    for (i=0; i<10; i++) buf[i] = -1;
+    err = nc_put_var_short(ncid, varid[1], buf); ERR
+
+    /* read back var_big and check contents */
+    for (i=0; i<10; i++) buf[i] = -1;
+    err = nc_get_vara_short(ncid, varid[0], &start, &count,buf); ERR
+    for (i=0; i<10; i++) {
+        if (buf[i] != i) {
+            printf("Error at buf[%d] expect %d but got %hd\n",i,i,buf[i]);
+            nerrs++;
+        }
+    }
+    err = nc_close(ncid); ERR
+
+    return (nerrs > 0);
+}
+
diff --git a/nc_test/tst_def_var_fill.c b/nc_test/tst_def_var_fill.c
new file mode 100644
index 0000000..30d256b
--- /dev/null
+++ b/nc_test/tst_def_var_fill.c
@@ -0,0 +1,151 @@
+/* This is part of the netCDF package.
+ * Copyright 2005 University Corporation for Atmospheric Research/Unidata
+ * See COPYRIGHT file for conditions of use.
+ *
+ * Test per-variable fill mode for classic file formats.
+ *
+ * Author: Wei-keng Liao.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h> /* basename() */
+#else
+#define basename(X) X
+#endif
+#include <netcdf.h>
+
+
+#define CHECK_ERR { \
+    if (err != NC_NOERR) { \
+        nerrs++; \
+        printf("Error at line %d in %s: (%s)\n", \
+        __LINE__,__FILE__,nc_strerror(err)); \
+    } \
+}
+
+#define EXP_ERR(exp) { \
+    if (err != exp) { \
+        nerrs++; \
+        printf("Error at line %d in %s: expecting %s but got %s\n", \
+        __LINE__,__FILE__,#exp, nc_strerror(err)); \
+    } \
+}
+
+#define NY 8
+#define NX 5
+
+int main(int argc, char** argv) {
+    char filename[256];
+    int i, j, k, err, nerrs=0, ncid, varid[2], dimid[2], *buf;
+    size_t start[2], count[2];
+    int formats[5]={NC_FORMAT_CLASSIC, NC_FORMAT_64BIT_OFFSET, NC_FORMAT_CDF5,
+                    NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC};
+
+    if (argc > 2) {
+        printf("Usage: %s [filename]\n",argv[0]);
+        return 1;
+    }
+    if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
+    else           strcpy(filename, "tst_def_var_fill.nc");
+
+    char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
+    sprintf(cmd_str, "*** TESTING C   %s for def_var_fill ", basename(argv[0]));
+    printf("%-66s ------ ", cmd_str); fflush(stdout);
+    free(cmd_str);
+
+    buf = (int*) malloc(NY*NX * sizeof(int));
+
+    for (k=0; k<5; k++) {
+#ifndef USE_CDF5
+        if (formats[k] == NC_FORMAT_CDF5) continue;
+#endif
+#ifndef USE_NETCDF4
+        if (formats[k] == NC_FORMAT_NETCDF4 ||
+            formats[k] == NC_FORMAT_NETCDF4_CLASSIC)
+            continue;
+#endif
+        nc_set_default_format(formats[k], NULL);
+
+        /* create a new file for writing ------------------------------------*/
+        err = nc_create(filename, NC_CLOBBER, &ncid); CHECK_ERR
+
+        /* define dimension */
+        err = nc_def_dim(ncid, "Y", NY, &dimid[0]); CHECK_ERR
+        err = nc_def_dim(ncid, "X", NX, &dimid[1]); CHECK_ERR
+
+        /* define variables */
+        err = nc_def_var(ncid, "var_nofill", NC_INT, 2, dimid, &varid[0]); CHECK_ERR
+        err = nc_def_var(ncid, "var_fill",   NC_INT, 2, dimid, &varid[1]); CHECK_ERR
+
+        /* set fill mode for variables */
+        err = nc_def_var_fill(ncid, NC_GLOBAL, 0, NULL); EXP_ERR(NC_EGLOBAL)
+        err = nc_def_var_fill(ncid, varid[0], 1, NULL); CHECK_ERR
+        err = nc_def_var_fill(ncid, varid[1], 0, NULL); CHECK_ERR
+
+        err = nc_enddef(ncid); CHECK_ERR
+
+        /* write a subarray to both variables */
+        for (i=0; i<NY*NX; i++) buf[i] = 5;
+        start[0] = 0;
+        start[1] = 2;
+        count[0] = NY;
+        count[1] = 2;
+        err = nc_put_vara_int(ncid, varid[0], start, count, buf); CHECK_ERR
+        err = nc_put_vara_int(ncid, varid[1], start, count, buf); CHECK_ERR
+        err = nc_close(ncid); CHECK_ERR
+
+        /* Now, reopen the file and read variables back */
+        err = nc_open(filename, NC_WRITE, &ncid); CHECK_ERR
+
+        /* get variable IDs */
+        err = nc_inq_varid(ncid, "var_nofill", &varid[0]); CHECK_ERR
+        err = nc_inq_varid(ncid, "var_fill",   &varid[1]); CHECK_ERR
+
+        /* read variable "var_nofill" and check contents */
+        for (i=0; i<NY*NX; i++) buf[i] = -1;
+        err = nc_get_var_int(ncid, varid[0], buf); CHECK_ERR
+        for (i=0; i<NY; i++) {
+            for (j=0; j<NX; j++) {
+                if (2 <= j && j < 4) {
+                    if (buf[i*NX+j] != 5) {
+                        printf("Error at line %d in %s: expect get buf[%d]=%d but got %d\n",
+                               __LINE__,__FILE__,i*NX+j, 5, buf[i*NX+j]);
+                        nerrs++;
+                    }
+                }
+                else if (buf[i*NX+j] == NC_FILL_INT) {
+                    printf("Warning at line %d in %s: get buf[%d] same as NC_FILL_INT\n",
+                           __LINE__,__FILE__,i*NX+j);
+                }
+            }
+        }
+
+        /* read variable "var_fill" and check contents */
+        for (i=0; i<NY*NX; i++) buf[i] = -1;
+        err = nc_get_var_int(ncid, varid[1], buf); CHECK_ERR
+        for (i=0; i<NY; i++) {
+            for (j=0; j<NX; j++) {
+                int expect = NC_FILL_INT;
+                if (2 <= j && j< 4) expect = 5;
+
+                if (buf[i*NX+j] != expect) {
+                    printf("Error at line %d in %s: expect get buf[%d]=%d but got %d\n",
+                           __LINE__,__FILE__,i*NX+j, expect, buf[i*NX+j]);
+                    nerrs++;
+                }
+            }
+        }
+
+        err = nc_close(ncid); CHECK_ERR
+    }
+    free(buf);
+
+    if (nerrs) printf("fail with %d mismatches\n",nerrs);
+    else       printf("pass\n");
+
+    return (nerrs > 0);
+}
+
diff --git a/nc_test/tst_meta.c b/nc_test/tst_meta.c
index cde11f5..7653953 100644
--- a/nc_test/tst_meta.c
+++ b/nc_test/tst_meta.c
@@ -14,7 +14,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <netcdf.h>
+
+#if defined(NC_HAVE_META_H)
 #include <netcdf_meta.h>
+#endif
 
 int main(int argc, char **argv) {
 
@@ -24,7 +27,11 @@ int main(int argc, char **argv) {
   */
 
 #ifndef NETCDF_META_H
+#ifndef NC_HAVE_META_H
+  printf("Error! NC_HAVE_META_H not defined. Check netcdf.h.\n");
+#else
   printf("Error! NETCDF_META_H not defined. Check netcdf_meta.h.\n");
+#endif
   return -1;
 #else
   printf("Success! NETCDF_META_H defined.\n");
diff --git a/nc_test/tst_names.c b/nc_test/tst_names.c
index a6de352..8127f1b 100644
--- a/nc_test/tst_names.c
+++ b/nc_test/tst_names.c
@@ -24,8 +24,8 @@
 #define NDIMS 1
 #define DIMLEN 1
 
-#define ERROR {printf("Error at line %d: %s\n",__LINE__,nc_strerror(res)); continue;}
-#define ERRORI {printf("Error at line %d (loop=%d): %s\n",__LINE__,i,nc_strerror(res)); continue;}
+#define ERROR {printf("Error at line %d: %s\n",__LINE__,nc_strerror(res)); nerrs++; continue;}
+#define ERRORI {printf("Error at line %d (loop=%d): %s\n",__LINE__,i,nc_strerror(res)); nerrs++; continue;}
 
 int
 main(int argc, char **argv)
@@ -197,10 +197,14 @@ main(int argc, char **argv)
        "x\xED\xAE\x80\xED\xB0\x80",
        "x\xED\xAE\x80\xED\xBF\xBF",
        "x\xED\xAF\xBF\xED\xB0\x80",
-       "x\xED\xAF\xBF\xED\xBF\xBF",
-       "x\xEF\xBF\xBE",		/* other illegal code positions */
+       "x\xED\xAF\xBF\xED\xBF\xBF"
+#if 0
+       /* The two below is legal since UTF8PROC_VERSION_MAJOR 2 */
+       "x\xEF\xBF\xBE",         /* other illegal code positions */
        "x\xEF\xBF\xBF"
+#endif
    };
+   int nerrs=0;
    int i, j;
 #define NUM_BAD (sizeof notvalid / sizeof notvalid[0])
 #define NUM_GOOD (sizeof valid / sizeof valid[0])
@@ -221,8 +225,10 @@ main(int argc, char **argv)
        NC_FORMAT_CLASSIC
        ,
        NC_FORMAT_64BIT_OFFSET
+#ifdef USE_CDF5
        ,
        NC_FORMAT_CDF5
+#endif
 #ifdef USE_NETCDF4
        ,
        NC_FORMAT_NETCDF4
@@ -327,6 +333,7 @@ main(int argc, char **argv)
 
        SUMMARIZE_ERR;
    }
+   total_err += nerrs;
    FINAL_RESULTS;
 
 #ifdef TEST_PNETCDF
diff --git a/nc_test/tst_open_cdf5.c b/nc_test/tst_open_cdf5.c
new file mode 100644
index 0000000..1d5e9b5
--- /dev/null
+++ b/nc_test/tst_open_cdf5.c
@@ -0,0 +1,25 @@
+#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <netcdf.h>
+
+#define FILE_NAME "bad_cdf5_begin.nc"
+
+int main(int argc, char *argv[])
+{
+    char *fname=FILE_NAME;
+    int err, nerrs=0, ncid;
+
+    if (argc == 2) fname = argv[1];
+
+    err = nc_open(fname, NC_NOWRITE, &ncid);
+    if (err != NC_ENOTNC) {
+        printf("Error: nc_open() expect NC_ENOTNC but got (%s)\n",
+               nc_strerror(err));
+        nerrs++;
+    }
+    else if (err == NC_NOERR) /* close file */
+        nc_close(ncid);
+
+    return (nerrs > 0);
+}
diff --git a/nc_test/util.c b/nc_test/util.c
index d3cb4f0..811f7ea 100644
--- a/nc_test/util.c
+++ b/nc_test/util.c
@@ -342,11 +342,7 @@ int dbl2nc ( const double d, const nc_type xtype, void *p)
              * reporting it as a range error.
              */
             if ( r < X_CHAR_MIN || r > X_CHAR_MAX ) return 2;
-#if defined(__CHAR_UNSIGNED__) && __CHAR_UNSIGNED__ != 0
             *((signed char*) p) = (signed char)r;
-#else
-            *((char   *) p) = (char)r;
-#endif
             break;
         case NC_BYTE:
             r = floor(0.5+d);
diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt
index a2ea6a3..7502d16 100644
--- a/nc_test4/CMakeLists.txt
+++ b/nc_test4/CMakeLists.txt
@@ -8,8 +8,8 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4
   tst_fillbug tst_xplatform2 tst_endian_fill tst_atts t_type
   cdm_sea_soundings tst_vl tst_atts1 tst_atts2 tst_vars2 tst_files5
   tst_files6 tst_sync tst_h_strbug tst_h_refs tst_h_scalar tst_rename
-  tst_h5_endians tst_atts_string_rewrite tst_put_vars_two_unlim_dim
-  tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash tst_types)
+  tst_rename2 tst_h5_endians tst_atts_string_rewrite tst_put_vars_two_unlim_dim
+  tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash tst_types tst_bug324)
 
 
 # Note, renamegroup needs to be compiled before run_grp_rename
@@ -72,7 +72,7 @@ IF(BUILD_BENCHMARKS)
 ENDIF()
 
 # Copy some test files from current source dir to out-of-tree build dir.
-FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/ref_bzip2.c ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.hdf4 ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
+FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/ref_bzip2.c ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
 FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
 IF(MSVC)
   FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
@@ -83,21 +83,6 @@ FOREACH(CTEST ${NC4_TESTS})
   add_bin_test(nc_test4 ${CTEST})
 ENDFOREACH()
 
-# This must go after the 'foreach' stanza
-# immediately above this comment.
-IF(USE_HDF4_FILE_TESTS AND NOT MSVC)
-    add_bin_test_no_prefix(tst_interops2)
-    build_bin_test_no_prefix(tst_interops3)
-    add_sh_test(nc_test4 run_get_hdf4_files)
-    add_bin_test(nc_test4 tst_bug324)
-    add_sh_test(nc_test4 tst_formatx_hdf4)
-    build_bin_test(tst_chunk_hdf4)
-    add_sh_test(nc_test4 run_chunk_hdf4)
-    add_bin_test(nc_test4 tst_h4_lendian)
-    add_sh_test(nc_test4 tst_hdf4_read_var)
-    SET_TESTS_PROPERTIES(nc_test4_tst_hdf4_read_var PROPERTIES DEPENDS tst_interops2)
-ENDIF()
-
 IF(TEST_PARALLEL4)
   build_bin_test(tst_mpi_parallel)
   build_bin_test(tst_parallel)
diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am
index 7632fb2..417a0c6 100644
--- a/nc_test4/Makefile.am
+++ b/nc_test4/Makefile.am
@@ -28,8 +28,9 @@ tst_vars4 tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2		\
 tst_fillbug tst_xplatform tst_xplatform2 tst_endian_fill tst_atts	\
 t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2		\
 tst_vars2 tst_files5 tst_files6 tst_sync tst_h_scalar tst_rename	\
-tst_h5_endians tst_atts_string_rewrite tst_hdf5_file_compat		\
-tst_fill_attr_vanish tst_rehash tst_filterparser tst_bug324 tst_types
+tst_rename2 tst_h5_endians tst_atts_string_rewrite			\
+tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash tst_filterparser	\
+tst_bug324 tst_types
 
 # Temporary I hope
 if !ISCYGWIN
@@ -94,26 +95,6 @@ benchmarks: check
 	./run_bm_ar4.sh
 endif # BUILD_BENCHMARKS
 
-# These are the tests for HDF4.
-if USE_HDF4
-check_PROGRAMS += tst_interops2 tst_chunk_hdf4 tst_h4_lendian
-
-if BUILD_UTILITIES
-# This test script depends on ncdump.
-TESTS += tst_interops2 tst_formatx_hdf4.sh
-tst_formatx_hdf4.log: tst_interops2.log
-endif # BUILD_UTILITIES
-
-TESTS += run_chunk_hdf4.sh tst_h4_lendian
-if USE_HDF4_FILE_TESTS
-check_PROGRAMS += tst_interops3
-TESTS += run_get_hdf4_files.sh tst_hdf4_read_var.sh
-
-tst_hdf4_read_var.log: tst_interops2.log
-
-endif # USE_HDF4_FILE_TESTS
-endif # USE_HDF4
-
 # Szip Tests (requires ncdump)
 if USE_SZIP
 if BUILD_UTILITIES
@@ -130,15 +111,6 @@ TESTS += tst_filter.sh
 endif
 endif
 
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
-if USE_VALGRIND_TESTS
-TESTS += run_valgrind_tests.sh run_valgrind_tests2.sh
-if USE_HDF4
-TESTS += run_hdf4_valgrind_tests.sh
-endif # USE_HDF4
-endif # USE_VALGRIND_TESTS
-
 # This are extra tests that will only be run if netcdf-4 is configured
 # with --enable-parallel-tests.
 if TEST_PARALLEL4
@@ -147,23 +119,19 @@ tst_parallel4 tst_nc4perf tst_mode tst_simplerw_coll_r
 TESTS += run_par_test.sh
 endif
 
-EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh                  \
-run_bm_test2.sh run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh      \
-run_par_bm_test.sh run_bm_elena.sh run_par_bm_radar_2D.sh               \
-run_bm_radar_2D_endianness1.sh run_tst_chunks.sh ref_chunks1.cdl        \
-ref_chunks2.cdl run_get_hdf4_files.sh run_valgrind_tests.sh             \
-run_valgrind_tests2.sh run_bm_ar4.sh ref_tst_compounds.nc               \
-run_hdf4_valgrind_tests.sh ref_tst_xplatform2_1.nc                      \
-ref_tst_xplatform2_2.nc ref_tst_dims.nc ref_tst_interops4.nc            \
-run_get_knmi_files.sh CMakeLists.txt run_grp_rename.sh                  \
-tst_formatx_hdf4.sh run_chunk_hdf4.sh tst_h5_endians.c                  \
-tst_h4_lendian.c tst_atts_string_rewrite.c                              \
-tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c                     \
-run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc          \
-ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_hdf4_read_var.sh           \
-ref_contiguous.hdf4 ref_chunked.hdf4 tst_szip.sh ref_szip.h5 ref_szip.cdl \
-tst_filter.sh bzip2.cdl filtered.cdl unfiltered.cdl ref_bzip2.c         \
-findplugin.in
+EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh			\
+run_bm_test2.sh run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh	\
+run_par_bm_test.sh run_bm_elena.sh run_par_bm_radar_2D.sh		\
+run_bm_radar_2D_endianness1.sh run_tst_chunks.sh ref_chunks1.cdl	\
+ref_chunks2.cdl run_bm_ar4.sh ref_tst_compounds.nc			\
+ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc		\
+ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt		\
+run_grp_rename.sh tst_h5_endians.c tst_atts_string_rewrite.c		\
+tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c			\
+run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc		\
+ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_szip.sh ref_szip.h5	\
+ref_szip.cdl tst_filter.sh bzip2.cdl filtered.cdl unfiltered.cdl	\
+ref_bzip2.c findplugin.in
 
 CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc   \
 bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt                  \
@@ -181,12 +149,4 @@ szip_dump.cdl
 
 DISTCLEANFILES = findplugin.sh
 
-if USE_HDF4_FILE_TESTS
-DISTCLEANFILES += AMSR_E_L2_Rain_V10_200905312326_A.hdf	\
-AMSR_E_L3_DailyLand_V06_20020619.hdf			\
-MYD29.A2009152.0000.005.2009153124331.hdf		\
-MYD29.A2002185.0000.005.2007160150627.hdf		\
-MOD29.A2000055.0005.005.2006267200024.hdf
-endif # HDF4_FILE_TESTS
-
 SUBDIRS=hdf5plugins
diff --git a/nc_test4/Makefile.in b/nc_test4/Makefile.in
index 8c1b24d..ca1f9cf 100644
--- a/nc_test4/Makefile.in
+++ b/nc_test4/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -110,13 +110,11 @@ target_triplet = @target@
 @ISCYGWIN_FALSE at am__append_2 = tst_h_strbug tst_h_refs
 check_PROGRAMS = $(am__EXEEXT_2) renamegroup$(EXEEXT) \
 	tst_empty_vlen_unlim$(EXEEXT) $(am__EXEEXT_3) $(am__EXEEXT_4) \
-	$(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \
-	$(am__EXEEXT_8) $(am__EXEEXT_9)
+	$(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7)
 TESTS = $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__append_5) \
-	run_empty_vlen_test.sh $(am__EXEEXT_4) $(am__EXEEXT_10) \
-	$(am__append_10) $(am__EXEEXT_11) $(am__EXEEXT_12) \
-	$(am__append_15) $(am__append_17) $(am__append_18) \
-	$(am__append_19) $(am__append_20) $(am__append_22)
+	run_empty_vlen_test.sh $(am__EXEEXT_4) $(am__EXEEXT_8) \
+	$(am__append_10) $(am__append_12) $(am__append_13) \
+	$(am__append_15)
 
 # Add these if large file tests are turned on.
 @LARGE_FILE_TESTS_TRUE at am__append_3 = tst_large tst_large2
@@ -143,39 +141,19 @@ TESTS = $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__append_5) \
 # This will run a parallel I/O benchmark for parallel builds.
 @BUILD_BENCHMARKS_TRUE@@TEST_PARALLEL4_TRUE at am__append_10 = run_par_bm_test.sh
 
-# These are the tests for HDF4.
- at USE_HDF4_TRUE@am__append_11 = tst_interops2 tst_chunk_hdf4 tst_h4_lendian
-
-# This test script depends on ncdump.
- at BUILD_UTILITIES_TRUE@@USE_HDF4_TRUE at am__append_12 = tst_interops2 tst_formatx_hdf4.sh
- at USE_HDF4_TRUE@am__append_13 = run_chunk_hdf4.sh tst_h4_lendian
- at USE_HDF4_FILE_TESTS_TRUE@@USE_HDF4_TRUE at am__append_14 = tst_interops3
- at USE_HDF4_FILE_TESTS_TRUE@@USE_HDF4_TRUE at am__append_15 = run_get_hdf4_files.sh tst_hdf4_read_var.sh
-
 # Szip Tests (requires ncdump)
- at BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE at am__append_16 = test_szip h5testszip
- at BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE at am__append_17 = tst_szip.sh
+ at BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE at am__append_11 = test_szip h5testszip
+ at BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE at am__append_12 = tst_szip.sh
 @BUILD_UTILITIES_TRUE@@ENABLE_FILTER_TESTING_TRUE at extra_PROGRAMS = test_filter$(EXEEXT) \
 @BUILD_UTILITIES_TRUE@@ENABLE_FILTER_TESTING_TRUE@	test_filter_misc$(EXEEXT)
- at BUILD_UTILITIES_TRUE@@ENABLE_FILTER_TESTING_TRUE at am__append_18 = tst_filter.sh
-
-# This will run a bunch of the test programs with valgrind, the memory
-# checking tool. (Valgrind must be present for this to work.)
- at USE_VALGRIND_TESTS_TRUE@am__append_19 = run_valgrind_tests.sh run_valgrind_tests2.sh
- at USE_HDF4_TRUE@@USE_VALGRIND_TESTS_TRUE at am__append_20 = run_hdf4_valgrind_tests.sh
+ at BUILD_UTILITIES_TRUE@@ENABLE_FILTER_TESTING_TRUE at am__append_13 = tst_filter.sh
 
 # This are extra tests that will only be run if netcdf-4 is configured
 # with --enable-parallel-tests.
- at TEST_PARALLEL4_TRUE@am__append_21 = tst_mpi_parallel tst_parallel tst_parallel3	\
+ at TEST_PARALLEL4_TRUE@am__append_14 = tst_mpi_parallel tst_parallel tst_parallel3	\
 @TEST_PARALLEL4_TRUE at tst_parallel4 tst_nc4perf tst_mode tst_simplerw_coll_r
 
- at TEST_PARALLEL4_TRUE@am__append_22 = run_par_test.sh
- at USE_HDF4_FILE_TESTS_TRUE@am__append_23 = AMSR_E_L2_Rain_V10_200905312326_A.hdf	\
- at USE_HDF4_FILE_TESTS_TRUE@AMSR_E_L3_DailyLand_V06_20020619.hdf			\
- at USE_HDF4_FILE_TESTS_TRUE@MYD29.A2009152.0000.005.2009153124331.hdf		\
- at USE_HDF4_FILE_TESTS_TRUE@MYD29.A2002185.0000.005.2007160150627.hdf		\
- at USE_HDF4_FILE_TESTS_TRUE@MOD29.A2000055.0005.005.2006267200024.hdf
-
+ at TEST_PARALLEL4_TRUE@am__append_15 = run_par_test.sh
 subdir = nc_test4
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -189,7 +167,7 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES = findplugin.sh
 CONFIG_CLEAN_VPATH_FILES = ref_hdf5_compat1.nc ref_hdf5_compat2.nc \
-	ref_hdf5_compat3.nc ref_chunked.hdf4 ref_contiguous.hdf4
+	ref_hdf5_compat3.nc
 @ISCYGWIN_FALSE at am__EXEEXT_1 = tst_h_strbug$(EXEEXT) \
 @ISCYGWIN_FALSE@	tst_h_refs$(EXEEXT)
 am__EXEEXT_2 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(EXEEXT) \
@@ -211,11 +189,11 @@ am__EXEEXT_2 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(EXEEXT) \
 	tst_camrun$(EXEEXT) tst_vl$(EXEEXT) tst_atts1$(EXEEXT) \
 	tst_atts2$(EXEEXT) tst_vars2$(EXEEXT) tst_files5$(EXEEXT) \
 	tst_files6$(EXEEXT) tst_sync$(EXEEXT) tst_h_scalar$(EXEEXT) \
-	tst_rename$(EXEEXT) tst_h5_endians$(EXEEXT) \
-	tst_atts_string_rewrite$(EXEEXT) tst_hdf5_file_compat$(EXEEXT) \
-	tst_fill_attr_vanish$(EXEEXT) tst_rehash$(EXEEXT) \
-	tst_filterparser$(EXEEXT) tst_bug324$(EXEEXT) \
-	tst_types$(EXEEXT) $(am__EXEEXT_1)
+	tst_rename$(EXEEXT) tst_rename2$(EXEEXT) \
+	tst_h5_endians$(EXEEXT) tst_atts_string_rewrite$(EXEEXT) \
+	tst_hdf5_file_compat$(EXEEXT) tst_fill_attr_vanish$(EXEEXT) \
+	tst_rehash$(EXEEXT) tst_filterparser$(EXEEXT) \
+	tst_bug324$(EXEEXT) tst_types$(EXEEXT) $(am__EXEEXT_1)
 @LARGE_FILE_TESTS_TRUE at am__EXEEXT_3 = tst_large$(EXEEXT) \
 @LARGE_FILE_TESTS_TRUE@	tst_large2$(EXEEXT)
 @BUILD_V2_TRUE at am__EXEEXT_4 = tst_v2$(EXEEXT)
@@ -230,13 +208,10 @@ am__EXEEXT_2 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(EXEEXT) \
 @BUILD_BENCHMARKS_TRUE@	tst_ar5$(EXEEXT) tst_mem$(EXEEXT) \
 @BUILD_BENCHMARKS_TRUE@	tst_knmi$(EXEEXT) \
 @BUILD_BENCHMARKS_TRUE@	bm_netcdf4_recs$(EXEEXT)
- at USE_HDF4_TRUE@am__EXEEXT_6 = tst_interops2$(EXEEXT) \
- at USE_HDF4_TRUE@	tst_chunk_hdf4$(EXEEXT) tst_h4_lendian$(EXEEXT)
- at USE_HDF4_FILE_TESTS_TRUE@@USE_HDF4_TRUE at am__EXEEXT_7 = tst_interops3$(EXEEXT)
- at BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE at am__EXEEXT_8 =  \
+ at BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE at am__EXEEXT_6 =  \
 @BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE@	test_szip$(EXEEXT) \
 @BUILD_UTILITIES_TRUE@@USE_SZIP_TRUE@	h5testszip$(EXEEXT)
- at TEST_PARALLEL4_TRUE@am__EXEEXT_9 = tst_mpi_parallel$(EXEEXT) \
+ at TEST_PARALLEL4_TRUE@am__EXEEXT_7 = tst_mpi_parallel$(EXEEXT) \
 @TEST_PARALLEL4_TRUE@	tst_parallel$(EXEEXT) \
 @TEST_PARALLEL4_TRUE@	tst_parallel3$(EXEEXT) \
 @TEST_PARALLEL4_TRUE@	tst_parallel4$(EXEEXT) \
@@ -328,9 +303,6 @@ tst_bug324_LDADD = $(LDADD)
 tst_camrun_SOURCES = tst_camrun.c
 tst_camrun_OBJECTS = tst_camrun.$(OBJEXT)
 tst_camrun_LDADD = $(LDADD)
-tst_chunk_hdf4_SOURCES = tst_chunk_hdf4.c
-tst_chunk_hdf4_OBJECTS = tst_chunk_hdf4.$(OBJEXT)
-tst_chunk_hdf4_LDADD = $(LDADD)
 tst_chunks_SOURCES = tst_chunks.c
 tst_chunks_OBJECTS = tst_chunks.$(OBJEXT)
 tst_chunks_LDADD = $(LDADD)
@@ -426,9 +398,6 @@ tst_grps_LDADD = $(LDADD)
 tst_grps2_SOURCES = tst_grps2.c
 tst_grps2_OBJECTS = tst_grps2.$(OBJEXT)
 tst_grps2_LDADD = $(LDADD)
-tst_h4_lendian_SOURCES = tst_h4_lendian.c
-tst_h4_lendian_OBJECTS = tst_h4_lendian.$(OBJEXT)
-tst_h4_lendian_LDADD = $(LDADD)
 tst_h5_endians_SOURCES = tst_h5_endians.c
 tst_h5_endians_OBJECTS = tst_h5_endians.$(OBJEXT)
 tst_h5_endians_LDADD = $(LDADD)
@@ -453,12 +422,6 @@ tst_hdf5_file_compat_LDADD = $(LDADD)
 tst_interops_SOURCES = tst_interops.c
 tst_interops_OBJECTS = tst_interops.$(OBJEXT)
 tst_interops_LDADD = $(LDADD)
-tst_interops2_SOURCES = tst_interops2.c
-tst_interops2_OBJECTS = tst_interops2.$(OBJEXT)
-tst_interops2_LDADD = $(LDADD)
-tst_interops3_SOURCES = tst_interops3.c
-tst_interops3_OBJECTS = tst_interops3.$(OBJEXT)
-tst_interops3_LDADD = $(LDADD)
 tst_interops4_SOURCES = tst_interops4.c
 tst_interops4_OBJECTS = tst_interops4.$(OBJEXT)
 tst_interops4_LDADD = $(LDADD)
@@ -509,6 +472,9 @@ tst_rehash_LDADD = $(LDADD)
 tst_rename_SOURCES = tst_rename.c
 tst_rename_OBJECTS = tst_rename.$(OBJEXT)
 tst_rename_LDADD = $(LDADD)
+tst_rename2_SOURCES = tst_rename2.c
+tst_rename2_OBJECTS = tst_rename2.$(OBJEXT)
+tst_rename2_LDADD = $(LDADD)
 tst_simplerw_coll_r_SOURCES = tst_simplerw_coll_r.c
 tst_simplerw_coll_r_OBJECTS = tst_simplerw_coll_r.$(OBJEXT)
 tst_simplerw_coll_r_LDADD = $(LDADD)
@@ -571,7 +537,56 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/bm_file.Po \
+	./$(DEPDIR)/bm_many_atts.Po ./$(DEPDIR)/bm_many_objs.Po \
+	./$(DEPDIR)/bm_netcdf4_recs.Po \
+	./$(DEPDIR)/cdm_sea_soundings.Po ./$(DEPDIR)/h5testszip.Po \
+	./$(DEPDIR)/renamegroup.Po ./$(DEPDIR)/t_type.Po \
+	./$(DEPDIR)/test_filter.Po ./$(DEPDIR)/test_filter_misc.Po \
+	./$(DEPDIR)/test_szip.Po ./$(DEPDIR)/tst_ar4.Po \
+	./$(DEPDIR)/tst_ar4_3d.Po ./$(DEPDIR)/tst_ar4_4d.Po \
+	./$(DEPDIR)/tst_ar5.Po ./$(DEPDIR)/tst_atts.Po \
+	./$(DEPDIR)/tst_atts1.Po ./$(DEPDIR)/tst_atts2.Po \
+	./$(DEPDIR)/tst_atts_string_rewrite.Po \
+	./$(DEPDIR)/tst_bug324.Po ./$(DEPDIR)/tst_camrun.Po \
+	./$(DEPDIR)/tst_chunks.Po ./$(DEPDIR)/tst_chunks2.Po \
+	./$(DEPDIR)/tst_chunks3.Po ./$(DEPDIR)/tst_compounds.Po \
+	./$(DEPDIR)/tst_compounds2.Po ./$(DEPDIR)/tst_compounds3.Po \
+	./$(DEPDIR)/tst_converts.Po ./$(DEPDIR)/tst_converts2.Po \
+	./$(DEPDIR)/tst_coords.Po ./$(DEPDIR)/tst_coords2.Po \
+	./$(DEPDIR)/tst_coords3.Po ./$(DEPDIR)/tst_create_files.Po \
+	./$(DEPDIR)/tst_dims.Po ./$(DEPDIR)/tst_dims2.Po \
+	./$(DEPDIR)/tst_dims3.Po ./$(DEPDIR)/tst_empty_vlen_unlim.Po \
+	./$(DEPDIR)/tst_endian_fill.Po ./$(DEPDIR)/tst_enums.Po \
+	./$(DEPDIR)/tst_files.Po ./$(DEPDIR)/tst_files2.Po \
+	./$(DEPDIR)/tst_files3.Po ./$(DEPDIR)/tst_files4.Po \
+	./$(DEPDIR)/tst_files5.Po ./$(DEPDIR)/tst_files6.Po \
+	./$(DEPDIR)/tst_fill_attr_vanish.Po ./$(DEPDIR)/tst_fillbug.Po \
+	./$(DEPDIR)/tst_fills.Po ./$(DEPDIR)/tst_fills2.Po \
+	./$(DEPDIR)/tst_filterparser.Po ./$(DEPDIR)/tst_grps.Po \
+	./$(DEPDIR)/tst_grps2.Po ./$(DEPDIR)/tst_h5_endians.Po \
+	./$(DEPDIR)/tst_h_many_atts.Po ./$(DEPDIR)/tst_h_refs.Po \
+	./$(DEPDIR)/tst_h_scalar.Po ./$(DEPDIR)/tst_h_strbug.Po \
+	./$(DEPDIR)/tst_hdf5_file_compat.Po \
+	./$(DEPDIR)/tst_interops.Po ./$(DEPDIR)/tst_interops4.Po \
+	./$(DEPDIR)/tst_interops5.Po ./$(DEPDIR)/tst_interops6.Po \
+	./$(DEPDIR)/tst_knmi.Po ./$(DEPDIR)/tst_large.Po \
+	./$(DEPDIR)/tst_large2.Po ./$(DEPDIR)/tst_mem.Po \
+	./$(DEPDIR)/tst_mode.Po ./$(DEPDIR)/tst_mpi_parallel.Po \
+	./$(DEPDIR)/tst_nc4perf.Po ./$(DEPDIR)/tst_opaques.Po \
+	./$(DEPDIR)/tst_parallel.Po ./$(DEPDIR)/tst_parallel3.Po \
+	./$(DEPDIR)/tst_parallel4.Po ./$(DEPDIR)/tst_rehash.Po \
+	./$(DEPDIR)/tst_rename.Po ./$(DEPDIR)/tst_rename2.Po \
+	./$(DEPDIR)/tst_simplerw_coll_r.Po ./$(DEPDIR)/tst_strings.Po \
+	./$(DEPDIR)/tst_strings2.Po ./$(DEPDIR)/tst_sync.Po \
+	./$(DEPDIR)/tst_types.Po ./$(DEPDIR)/tst_unlim_vars.Po \
+	./$(DEPDIR)/tst_utf8.Po ./$(DEPDIR)/tst_utils.Po \
+	./$(DEPDIR)/tst_v2.Po ./$(DEPDIR)/tst_varms.Po \
+	./$(DEPDIR)/tst_vars.Po ./$(DEPDIR)/tst_vars2.Po \
+	./$(DEPDIR)/tst_vars3.Po ./$(DEPDIR)/tst_vars4.Po \
+	./$(DEPDIR)/tst_vl.Po ./$(DEPDIR)/tst_xplatform.Po \
+	./$(DEPDIR)/tst_xplatform2.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -598,26 +613,26 @@ SOURCES = $(bm_file_SOURCES) $(bm_many_atts_SOURCES) \
 	$(tst_ar4_SOURCES) $(tst_ar4_3d_SOURCES) $(tst_ar4_4d_SOURCES) \
 	tst_ar5.c tst_atts.c tst_atts1.c tst_atts2.c \
 	tst_atts_string_rewrite.c tst_bug324.c tst_camrun.c \
-	tst_chunk_hdf4.c tst_chunks.c tst_chunks2.c tst_chunks3.c \
-	tst_compounds.c tst_compounds2.c tst_compounds3.c \
-	tst_converts.c tst_converts2.c tst_coords.c tst_coords2.c \
-	tst_coords3.c tst_create_files.c tst_dims.c tst_dims2.c \
-	tst_dims3.c tst_empty_vlen_unlim.c tst_endian_fill.c \
-	tst_enums.c tst_files.c $(tst_files2_SOURCES) tst_files3.c \
-	tst_files4.c tst_files5.c tst_files6.c tst_fill_attr_vanish.c \
-	tst_fillbug.c tst_fills.c tst_fills2.c tst_filterparser.c \
-	tst_grps.c tst_grps2.c tst_h4_lendian.c tst_h5_endians.c \
-	$(tst_h_many_atts_SOURCES) tst_h_refs.c tst_h_scalar.c \
-	tst_h_strbug.c tst_hdf5_file_compat.c tst_interops.c \
-	tst_interops2.c tst_interops3.c tst_interops4.c \
+	tst_chunks.c tst_chunks2.c tst_chunks3.c tst_compounds.c \
+	tst_compounds2.c tst_compounds3.c tst_converts.c \
+	tst_converts2.c tst_coords.c tst_coords2.c tst_coords3.c \
+	tst_create_files.c tst_dims.c tst_dims2.c tst_dims3.c \
+	tst_empty_vlen_unlim.c tst_endian_fill.c tst_enums.c \
+	tst_files.c $(tst_files2_SOURCES) tst_files3.c tst_files4.c \
+	tst_files5.c tst_files6.c tst_fill_attr_vanish.c tst_fillbug.c \
+	tst_fills.c tst_fills2.c tst_filterparser.c tst_grps.c \
+	tst_grps2.c tst_h5_endians.c $(tst_h_many_atts_SOURCES) \
+	tst_h_refs.c tst_h_scalar.c tst_h_strbug.c \
+	tst_hdf5_file_compat.c tst_interops.c tst_interops4.c \
 	tst_interops5.c tst_interops6.c $(tst_knmi_SOURCES) \
 	tst_large.c tst_large2.c tst_mem.c tst_mode.c \
 	tst_mpi_parallel.c tst_nc4perf.c tst_opaques.c tst_parallel.c \
 	tst_parallel3.c tst_parallel4.c tst_rehash.c tst_rename.c \
-	tst_simplerw_coll_r.c tst_strings.c tst_strings2.c tst_sync.c \
-	tst_types.c tst_unlim_vars.c tst_utf8.c tst_v2.c tst_varms.c \
-	tst_vars.c tst_vars2.c tst_vars3.c tst_vars4.c tst_vl.c \
-	tst_xplatform.c tst_xplatform2.c
+	tst_rename2.c tst_simplerw_coll_r.c tst_strings.c \
+	tst_strings2.c tst_sync.c tst_types.c tst_unlim_vars.c \
+	tst_utf8.c tst_v2.c tst_varms.c tst_vars.c tst_vars2.c \
+	tst_vars3.c tst_vars4.c tst_vl.c tst_xplatform.c \
+	tst_xplatform2.c
 DIST_SOURCES = $(am__bm_file_SOURCES_DIST) \
 	$(am__bm_many_atts_SOURCES_DIST) \
 	$(am__bm_many_objs_SOURCES_DIST) \
@@ -627,27 +642,26 @@ DIST_SOURCES = $(am__bm_file_SOURCES_DIST) \
 	$(am__tst_ar4_3d_SOURCES_DIST) $(am__tst_ar4_4d_SOURCES_DIST) \
 	tst_ar5.c tst_atts.c tst_atts1.c tst_atts2.c \
 	tst_atts_string_rewrite.c tst_bug324.c tst_camrun.c \
-	tst_chunk_hdf4.c tst_chunks.c tst_chunks2.c tst_chunks3.c \
-	tst_compounds.c tst_compounds2.c tst_compounds3.c \
-	tst_converts.c tst_converts2.c tst_coords.c tst_coords2.c \
-	tst_coords3.c tst_create_files.c tst_dims.c tst_dims2.c \
-	tst_dims3.c tst_empty_vlen_unlim.c tst_endian_fill.c \
-	tst_enums.c tst_files.c $(am__tst_files2_SOURCES_DIST) \
-	tst_files3.c tst_files4.c tst_files5.c tst_files6.c \
-	tst_fill_attr_vanish.c tst_fillbug.c tst_fills.c tst_fills2.c \
-	tst_filterparser.c tst_grps.c tst_grps2.c tst_h4_lendian.c \
-	tst_h5_endians.c $(am__tst_h_many_atts_SOURCES_DIST) \
-	tst_h_refs.c tst_h_scalar.c tst_h_strbug.c \
-	tst_hdf5_file_compat.c tst_interops.c tst_interops2.c \
-	tst_interops3.c tst_interops4.c tst_interops5.c \
-	tst_interops6.c $(am__tst_knmi_SOURCES_DIST) tst_large.c \
-	tst_large2.c tst_mem.c tst_mode.c tst_mpi_parallel.c \
-	tst_nc4perf.c tst_opaques.c tst_parallel.c tst_parallel3.c \
-	tst_parallel4.c tst_rehash.c tst_rename.c \
-	tst_simplerw_coll_r.c tst_strings.c tst_strings2.c tst_sync.c \
-	tst_types.c tst_unlim_vars.c tst_utf8.c tst_v2.c tst_varms.c \
-	tst_vars.c tst_vars2.c tst_vars3.c tst_vars4.c tst_vl.c \
-	tst_xplatform.c tst_xplatform2.c
+	tst_chunks.c tst_chunks2.c tst_chunks3.c tst_compounds.c \
+	tst_compounds2.c tst_compounds3.c tst_converts.c \
+	tst_converts2.c tst_coords.c tst_coords2.c tst_coords3.c \
+	tst_create_files.c tst_dims.c tst_dims2.c tst_dims3.c \
+	tst_empty_vlen_unlim.c tst_endian_fill.c tst_enums.c \
+	tst_files.c $(am__tst_files2_SOURCES_DIST) tst_files3.c \
+	tst_files4.c tst_files5.c tst_files6.c tst_fill_attr_vanish.c \
+	tst_fillbug.c tst_fills.c tst_fills2.c tst_filterparser.c \
+	tst_grps.c tst_grps2.c tst_h5_endians.c \
+	$(am__tst_h_many_atts_SOURCES_DIST) tst_h_refs.c \
+	tst_h_scalar.c tst_h_strbug.c tst_hdf5_file_compat.c \
+	tst_interops.c tst_interops4.c tst_interops5.c tst_interops6.c \
+	$(am__tst_knmi_SOURCES_DIST) tst_large.c tst_large2.c \
+	tst_mem.c tst_mode.c tst_mpi_parallel.c tst_nc4perf.c \
+	tst_opaques.c tst_parallel.c tst_parallel3.c tst_parallel4.c \
+	tst_rehash.c tst_rename.c tst_rename2.c tst_simplerw_coll_r.c \
+	tst_strings.c tst_strings2.c tst_sync.c tst_types.c \
+	tst_unlim_vars.c tst_utf8.c tst_v2.c tst_varms.c tst_vars.c \
+	tst_vars2.c tst_vars3.c tst_vars4.c tst_vl.c tst_xplatform.c \
+	tst_xplatform2.c
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
 	ctags-recursive dvi-recursive html-recursive info-recursive \
 	install-data-recursive install-dvi-recursive \
@@ -668,7 +682,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	check recheck distdir
+	check recheck distdir distdir-am
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -871,18 +885,13 @@ am__set_TESTS_bases = \
   bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
   bases=`echo $$bases`
 RECHECK_LOGS = $(TEST_LOGS)
- at BUILD_BENCHMARKS_TRUE@am__EXEEXT_10 = tst_ar4_3d$(EXEEXT) \
+ at BUILD_BENCHMARKS_TRUE@am__EXEEXT_8 = tst_ar4_3d$(EXEEXT) \
 @BUILD_BENCHMARKS_TRUE@	tst_create_files$(EXEEXT) \
 @BUILD_BENCHMARKS_TRUE@	run_bm_test1.sh run_bm_elena.sh \
 @BUILD_BENCHMARKS_TRUE@	run_bm_test2.sh run_tst_chunks.sh \
 @BUILD_BENCHMARKS_TRUE@	tst_files2$(EXEEXT) tst_files3$(EXEEXT) \
 @BUILD_BENCHMARKS_TRUE@	tst_ar5$(EXEEXT) tst_mem$(EXEEXT) \
 @BUILD_BENCHMARKS_TRUE@	run_get_knmi_files.sh tst_knmi$(EXEEXT)
- at BUILD_UTILITIES_TRUE@@USE_HDF4_TRUE at am__EXEEXT_11 =  \
- at BUILD_UTILITIES_TRUE@@USE_HDF4_TRUE@	tst_interops2$(EXEEXT) \
- at BUILD_UTILITIES_TRUE@@USE_HDF4_TRUE@	tst_formatx_hdf4.sh
- at USE_HDF4_TRUE@am__EXEEXT_12 = run_chunk_hdf4.sh \
- at USE_HDF4_TRUE@	tst_h4_lendian$(EXEEXT)
 TEST_SUITE_LOG = test-suite.log
 LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
 LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
@@ -903,7 +912,6 @@ SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
 SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
 DIST_SUBDIRS = $(SUBDIRS)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/findplugin.in \
-	$(srcdir)/ref_chunked.hdf4 $(srcdir)/ref_contiguous.hdf4 \
 	$(srcdir)/ref_hdf5_compat1.nc $(srcdir)/ref_hdf5_compat2.nc \
 	$(srcdir)/ref_hdf5_compat3.nc $(top_srcdir)/depcomp \
 	$(top_srcdir)/lib_flags.am $(top_srcdir)/test-driver
@@ -971,7 +979,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -980,6 +987,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -1018,6 +1026,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -1139,7 +1148,7 @@ NC4_TESTS = tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars \
 	tst_xplatform tst_xplatform2 tst_endian_fill tst_atts t_type \
 	cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \
 	tst_vars2 tst_files5 tst_files6 tst_sync tst_h_scalar \
-	tst_rename tst_h5_endians tst_atts_string_rewrite \
+	tst_rename tst_rename2 tst_h5_endians tst_atts_string_rewrite \
 	tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash \
 	tst_filterparser tst_bug324 tst_types $(am__append_2)
 @BUILD_BENCHMARKS_TRUE at bm_netcdf4_recs_SOURCES = bm_netcdf4_recs.c tst_utils.c
@@ -1152,23 +1161,19 @@ NC4_TESTS = tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars \
 @BUILD_BENCHMARKS_TRUE at tst_h_many_atts_SOURCES = tst_h_many_atts.c tst_utils.c
 @BUILD_BENCHMARKS_TRUE at bm_file_SOURCES = bm_file.c tst_utils.c
 @BUILD_BENCHMARKS_TRUE at tst_knmi_SOURCES = tst_knmi.c tst_utils.c
-EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh                  \
-run_bm_test2.sh run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh      \
-run_par_bm_test.sh run_bm_elena.sh run_par_bm_radar_2D.sh               \
-run_bm_radar_2D_endianness1.sh run_tst_chunks.sh ref_chunks1.cdl        \
-ref_chunks2.cdl run_get_hdf4_files.sh run_valgrind_tests.sh             \
-run_valgrind_tests2.sh run_bm_ar4.sh ref_tst_compounds.nc               \
-run_hdf4_valgrind_tests.sh ref_tst_xplatform2_1.nc                      \
-ref_tst_xplatform2_2.nc ref_tst_dims.nc ref_tst_interops4.nc            \
-run_get_knmi_files.sh CMakeLists.txt run_grp_rename.sh                  \
-tst_formatx_hdf4.sh run_chunk_hdf4.sh tst_h5_endians.c                  \
-tst_h4_lendian.c tst_atts_string_rewrite.c                              \
-tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c                     \
-run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc          \
-ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_hdf4_read_var.sh           \
-ref_contiguous.hdf4 ref_chunked.hdf4 tst_szip.sh ref_szip.h5 ref_szip.cdl \
-tst_filter.sh bzip2.cdl filtered.cdl unfiltered.cdl ref_bzip2.c         \
-findplugin.in
+EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh			\
+run_bm_test2.sh run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh	\
+run_par_bm_test.sh run_bm_elena.sh run_par_bm_radar_2D.sh		\
+run_bm_radar_2D_endianness1.sh run_tst_chunks.sh ref_chunks1.cdl	\
+ref_chunks2.cdl run_bm_ar4.sh ref_tst_compounds.nc			\
+ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc		\
+ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt		\
+run_grp_rename.sh tst_h5_endians.c tst_atts_string_rewrite.c		\
+tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c			\
+run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc		\
+ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_szip.sh ref_szip.h5	\
+ref_szip.cdl tst_filter.sh bzip2.cdl filtered.cdl unfiltered.cdl	\
+ref_bzip2.c findplugin.in
 
 CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc   \
 bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt                  \
@@ -1184,7 +1189,7 @@ tst_empty_vlen_lim.nc tst_parallel4_simplerw_coll.nc                    \
 tst_fill_attr_vanish.nc tst_rehash.nc testszip.nc test.h5               \
 szip_dump.cdl
 
-DISTCLEANFILES = findplugin.sh $(am__append_23)
+DISTCLEANFILES = findplugin.sh
 SUBDIRS = hdf5plugins
 all: all-recursive
 
@@ -1207,8 +1212,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -1365,10 +1370,6 @@ tst_camrun$(EXEEXT): $(tst_camrun_OBJECTS) $(tst_camrun_DEPENDENCIES) $(EXTRA_ts
 	@rm -f tst_camrun$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_camrun_OBJECTS) $(tst_camrun_LDADD) $(LIBS)
 
-tst_chunk_hdf4$(EXEEXT): $(tst_chunk_hdf4_OBJECTS) $(tst_chunk_hdf4_DEPENDENCIES) $(EXTRA_tst_chunk_hdf4_DEPENDENCIES) 
-	@rm -f tst_chunk_hdf4$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(tst_chunk_hdf4_OBJECTS) $(tst_chunk_hdf4_LDADD) $(LIBS)
-
 tst_chunks$(EXEEXT): $(tst_chunks_OBJECTS) $(tst_chunks_DEPENDENCIES) $(EXTRA_tst_chunks_DEPENDENCIES) 
 	@rm -f tst_chunks$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_chunks_OBJECTS) $(tst_chunks_LDADD) $(LIBS)
@@ -1493,10 +1494,6 @@ tst_grps2$(EXEEXT): $(tst_grps2_OBJECTS) $(tst_grps2_DEPENDENCIES) $(EXTRA_tst_g
 	@rm -f tst_grps2$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_grps2_OBJECTS) $(tst_grps2_LDADD) $(LIBS)
 
-tst_h4_lendian$(EXEEXT): $(tst_h4_lendian_OBJECTS) $(tst_h4_lendian_DEPENDENCIES) $(EXTRA_tst_h4_lendian_DEPENDENCIES) 
-	@rm -f tst_h4_lendian$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(tst_h4_lendian_OBJECTS) $(tst_h4_lendian_LDADD) $(LIBS)
-
 tst_h5_endians$(EXEEXT): $(tst_h5_endians_OBJECTS) $(tst_h5_endians_DEPENDENCIES) $(EXTRA_tst_h5_endians_DEPENDENCIES) 
 	@rm -f tst_h5_endians$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_h5_endians_OBJECTS) $(tst_h5_endians_LDADD) $(LIBS)
@@ -1525,14 +1522,6 @@ tst_interops$(EXEEXT): $(tst_interops_OBJECTS) $(tst_interops_DEPENDENCIES) $(EX
 	@rm -f tst_interops$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_interops_OBJECTS) $(tst_interops_LDADD) $(LIBS)
 
-tst_interops2$(EXEEXT): $(tst_interops2_OBJECTS) $(tst_interops2_DEPENDENCIES) $(EXTRA_tst_interops2_DEPENDENCIES) 
-	@rm -f tst_interops2$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(tst_interops2_OBJECTS) $(tst_interops2_LDADD) $(LIBS)
-
-tst_interops3$(EXEEXT): $(tst_interops3_OBJECTS) $(tst_interops3_DEPENDENCIES) $(EXTRA_tst_interops3_DEPENDENCIES) 
-	@rm -f tst_interops3$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(tst_interops3_OBJECTS) $(tst_interops3_LDADD) $(LIBS)
-
 tst_interops4$(EXEEXT): $(tst_interops4_OBJECTS) $(tst_interops4_DEPENDENCIES) $(EXTRA_tst_interops4_DEPENDENCIES) 
 	@rm -f tst_interops4$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_interops4_OBJECTS) $(tst_interops4_LDADD) $(LIBS)
@@ -1597,6 +1586,10 @@ tst_rename$(EXEEXT): $(tst_rename_OBJECTS) $(tst_rename_DEPENDENCIES) $(EXTRA_ts
 	@rm -f tst_rename$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_rename_OBJECTS) $(tst_rename_LDADD) $(LIBS)
 
+tst_rename2$(EXEEXT): $(tst_rename2_OBJECTS) $(tst_rename2_DEPENDENCIES) $(EXTRA_tst_rename2_DEPENDENCIES) 
+	@rm -f tst_rename2$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_rename2_OBJECTS) $(tst_rename2_LDADD) $(LIBS)
+
 tst_simplerw_coll_r$(EXEEXT): $(tst_simplerw_coll_r_OBJECTS) $(tst_simplerw_coll_r_DEPENDENCIES) $(EXTRA_tst_simplerw_coll_r_DEPENDENCIES) 
 	@rm -f tst_simplerw_coll_r$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_simplerw_coll_r_OBJECTS) $(tst_simplerw_coll_r_LDADD) $(LIBS)
@@ -1667,102 +1660,105 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_file.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_many_atts.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_many_objs.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_netcdf4_recs.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdm_sea_soundings.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/h5testszip.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/renamegroup.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_type.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_filter.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_filter_misc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_szip.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar4_3d.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar4_4d.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar5.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts1.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts_string_rewrite.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_bug324.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_camrun.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunk_hdf4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunks.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunks2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunks3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compounds.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compounds2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compounds3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_converts.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_converts2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_create_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_empty_vlen_unlim.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_endian_fill.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_enums.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files5.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files6.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fill_attr_vanish.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fillbug.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fills.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fills2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_filterparser.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_grps.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_grps2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h4_lendian.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h5_endians.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_many_atts.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_refs.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_scalar.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strbug.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_hdf5_file_compat.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops5.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops6.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_knmi.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mem.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mode.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mpi_parallel.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nc4perf.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_opaques.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rehash.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rename.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_simplerw_coll_r.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_strings.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_strings2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_sync.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_types.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_unlim_vars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utils.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_v2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_varms.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars3.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars4.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vl.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_xplatform.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_xplatform2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_file.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_many_atts.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_many_objs.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bm_netcdf4_recs.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdm_sea_soundings.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/h5testszip.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/renamegroup.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_type.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_filter.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_filter_misc.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_szip.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar4_3d.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar4_4d.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_ar5.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts1.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts_string_rewrite.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_bug324.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_camrun.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunks.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunks2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunks3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compounds.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compounds2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compounds3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_converts.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_converts2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_create_files.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dims3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_empty_vlen_unlim.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_endian_fill.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_enums.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files5.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files6.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fill_attr_vanish.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fillbug.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fills.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fills2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_filterparser.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_grps.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_grps2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h5_endians.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_many_atts.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_refs.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_scalar.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_strbug.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_hdf5_file_compat.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops5.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_interops6.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_knmi.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_large2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mem.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mode.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mpi_parallel.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nc4perf.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_opaques.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_parallel4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rehash.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rename.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rename2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_simplerw_coll_r.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_strings.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_strings2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_sync.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_types.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_unlim_vars.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utils.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_v2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_varms.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars3.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars4.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vl.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_xplatform.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_xplatform2.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -2013,7 +2009,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -2384,6 +2380,13 @@ tst_rename.log: tst_rename$(EXEEXT)
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+tst_rename2.log: tst_rename2$(EXEEXT)
+	@p='tst_rename2$(EXEEXT)'; \
+	b='tst_rename2'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 tst_h5_endians.log: tst_h5_endians$(EXEEXT)
 	@p='tst_h5_endians$(EXEEXT)'; \
 	b='tst_h5_endians'; \
@@ -2524,20 +2527,6 @@ tst_knmi.log: tst_knmi$(EXEEXT)
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
-tst_interops2.log: tst_interops2$(EXEEXT)
-	@p='tst_interops2$(EXEEXT)'; \
-	b='tst_interops2'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
-tst_h4_lendian.log: tst_h4_lendian$(EXEEXT)
-	@p='tst_h4_lendian$(EXEEXT)'; \
-	b='tst_h4_lendian'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
 .sh.log:
 	@p='$<'; \
 	$(am__set_b); \
@@ -2553,7 +2542,10 @@ tst_h4_lendian.log: tst_h4_lendian$(EXEEXT)
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -2659,7 +2651,99 @@ clean-am: clean-checkPROGRAMS clean-extraPROGRAMS clean-generic \
 	clean-libtool mostlyclean-am
 
 distclean: distclean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/bm_file.Po
+	-rm -f ./$(DEPDIR)/bm_many_atts.Po
+	-rm -f ./$(DEPDIR)/bm_many_objs.Po
+	-rm -f ./$(DEPDIR)/bm_netcdf4_recs.Po
+	-rm -f ./$(DEPDIR)/cdm_sea_soundings.Po
+	-rm -f ./$(DEPDIR)/h5testszip.Po
+	-rm -f ./$(DEPDIR)/renamegroup.Po
+	-rm -f ./$(DEPDIR)/t_type.Po
+	-rm -f ./$(DEPDIR)/test_filter.Po
+	-rm -f ./$(DEPDIR)/test_filter_misc.Po
+	-rm -f ./$(DEPDIR)/test_szip.Po
+	-rm -f ./$(DEPDIR)/tst_ar4.Po
+	-rm -f ./$(DEPDIR)/tst_ar4_3d.Po
+	-rm -f ./$(DEPDIR)/tst_ar4_4d.Po
+	-rm -f ./$(DEPDIR)/tst_ar5.Po
+	-rm -f ./$(DEPDIR)/tst_atts.Po
+	-rm -f ./$(DEPDIR)/tst_atts1.Po
+	-rm -f ./$(DEPDIR)/tst_atts2.Po
+	-rm -f ./$(DEPDIR)/tst_atts_string_rewrite.Po
+	-rm -f ./$(DEPDIR)/tst_bug324.Po
+	-rm -f ./$(DEPDIR)/tst_camrun.Po
+	-rm -f ./$(DEPDIR)/tst_chunks.Po
+	-rm -f ./$(DEPDIR)/tst_chunks2.Po
+	-rm -f ./$(DEPDIR)/tst_chunks3.Po
+	-rm -f ./$(DEPDIR)/tst_compounds.Po
+	-rm -f ./$(DEPDIR)/tst_compounds2.Po
+	-rm -f ./$(DEPDIR)/tst_compounds3.Po
+	-rm -f ./$(DEPDIR)/tst_converts.Po
+	-rm -f ./$(DEPDIR)/tst_converts2.Po
+	-rm -f ./$(DEPDIR)/tst_coords.Po
+	-rm -f ./$(DEPDIR)/tst_coords2.Po
+	-rm -f ./$(DEPDIR)/tst_coords3.Po
+	-rm -f ./$(DEPDIR)/tst_create_files.Po
+	-rm -f ./$(DEPDIR)/tst_dims.Po
+	-rm -f ./$(DEPDIR)/tst_dims2.Po
+	-rm -f ./$(DEPDIR)/tst_dims3.Po
+	-rm -f ./$(DEPDIR)/tst_empty_vlen_unlim.Po
+	-rm -f ./$(DEPDIR)/tst_endian_fill.Po
+	-rm -f ./$(DEPDIR)/tst_enums.Po
+	-rm -f ./$(DEPDIR)/tst_files.Po
+	-rm -f ./$(DEPDIR)/tst_files2.Po
+	-rm -f ./$(DEPDIR)/tst_files3.Po
+	-rm -f ./$(DEPDIR)/tst_files4.Po
+	-rm -f ./$(DEPDIR)/tst_files5.Po
+	-rm -f ./$(DEPDIR)/tst_files6.Po
+	-rm -f ./$(DEPDIR)/tst_fill_attr_vanish.Po
+	-rm -f ./$(DEPDIR)/tst_fillbug.Po
+	-rm -f ./$(DEPDIR)/tst_fills.Po
+	-rm -f ./$(DEPDIR)/tst_fills2.Po
+	-rm -f ./$(DEPDIR)/tst_filterparser.Po
+	-rm -f ./$(DEPDIR)/tst_grps.Po
+	-rm -f ./$(DEPDIR)/tst_grps2.Po
+	-rm -f ./$(DEPDIR)/tst_h5_endians.Po
+	-rm -f ./$(DEPDIR)/tst_h_many_atts.Po
+	-rm -f ./$(DEPDIR)/tst_h_refs.Po
+	-rm -f ./$(DEPDIR)/tst_h_scalar.Po
+	-rm -f ./$(DEPDIR)/tst_h_strbug.Po
+	-rm -f ./$(DEPDIR)/tst_hdf5_file_compat.Po
+	-rm -f ./$(DEPDIR)/tst_interops.Po
+	-rm -f ./$(DEPDIR)/tst_interops4.Po
+	-rm -f ./$(DEPDIR)/tst_interops5.Po
+	-rm -f ./$(DEPDIR)/tst_interops6.Po
+	-rm -f ./$(DEPDIR)/tst_knmi.Po
+	-rm -f ./$(DEPDIR)/tst_large.Po
+	-rm -f ./$(DEPDIR)/tst_large2.Po
+	-rm -f ./$(DEPDIR)/tst_mem.Po
+	-rm -f ./$(DEPDIR)/tst_mode.Po
+	-rm -f ./$(DEPDIR)/tst_mpi_parallel.Po
+	-rm -f ./$(DEPDIR)/tst_nc4perf.Po
+	-rm -f ./$(DEPDIR)/tst_opaques.Po
+	-rm -f ./$(DEPDIR)/tst_parallel.Po
+	-rm -f ./$(DEPDIR)/tst_parallel3.Po
+	-rm -f ./$(DEPDIR)/tst_parallel4.Po
+	-rm -f ./$(DEPDIR)/tst_rehash.Po
+	-rm -f ./$(DEPDIR)/tst_rename.Po
+	-rm -f ./$(DEPDIR)/tst_rename2.Po
+	-rm -f ./$(DEPDIR)/tst_simplerw_coll_r.Po
+	-rm -f ./$(DEPDIR)/tst_strings.Po
+	-rm -f ./$(DEPDIR)/tst_strings2.Po
+	-rm -f ./$(DEPDIR)/tst_sync.Po
+	-rm -f ./$(DEPDIR)/tst_types.Po
+	-rm -f ./$(DEPDIR)/tst_unlim_vars.Po
+	-rm -f ./$(DEPDIR)/tst_utf8.Po
+	-rm -f ./$(DEPDIR)/tst_utils.Po
+	-rm -f ./$(DEPDIR)/tst_v2.Po
+	-rm -f ./$(DEPDIR)/tst_varms.Po
+	-rm -f ./$(DEPDIR)/tst_vars.Po
+	-rm -f ./$(DEPDIR)/tst_vars2.Po
+	-rm -f ./$(DEPDIR)/tst_vars3.Po
+	-rm -f ./$(DEPDIR)/tst_vars4.Po
+	-rm -f ./$(DEPDIR)/tst_vl.Po
+	-rm -f ./$(DEPDIR)/tst_xplatform.Po
+	-rm -f ./$(DEPDIR)/tst_xplatform2.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -2705,7 +2789,99 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/bm_file.Po
+	-rm -f ./$(DEPDIR)/bm_many_atts.Po
+	-rm -f ./$(DEPDIR)/bm_many_objs.Po
+	-rm -f ./$(DEPDIR)/bm_netcdf4_recs.Po
+	-rm -f ./$(DEPDIR)/cdm_sea_soundings.Po
+	-rm -f ./$(DEPDIR)/h5testszip.Po
+	-rm -f ./$(DEPDIR)/renamegroup.Po
+	-rm -f ./$(DEPDIR)/t_type.Po
+	-rm -f ./$(DEPDIR)/test_filter.Po
+	-rm -f ./$(DEPDIR)/test_filter_misc.Po
+	-rm -f ./$(DEPDIR)/test_szip.Po
+	-rm -f ./$(DEPDIR)/tst_ar4.Po
+	-rm -f ./$(DEPDIR)/tst_ar4_3d.Po
+	-rm -f ./$(DEPDIR)/tst_ar4_4d.Po
+	-rm -f ./$(DEPDIR)/tst_ar5.Po
+	-rm -f ./$(DEPDIR)/tst_atts.Po
+	-rm -f ./$(DEPDIR)/tst_atts1.Po
+	-rm -f ./$(DEPDIR)/tst_atts2.Po
+	-rm -f ./$(DEPDIR)/tst_atts_string_rewrite.Po
+	-rm -f ./$(DEPDIR)/tst_bug324.Po
+	-rm -f ./$(DEPDIR)/tst_camrun.Po
+	-rm -f ./$(DEPDIR)/tst_chunks.Po
+	-rm -f ./$(DEPDIR)/tst_chunks2.Po
+	-rm -f ./$(DEPDIR)/tst_chunks3.Po
+	-rm -f ./$(DEPDIR)/tst_compounds.Po
+	-rm -f ./$(DEPDIR)/tst_compounds2.Po
+	-rm -f ./$(DEPDIR)/tst_compounds3.Po
+	-rm -f ./$(DEPDIR)/tst_converts.Po
+	-rm -f ./$(DEPDIR)/tst_converts2.Po
+	-rm -f ./$(DEPDIR)/tst_coords.Po
+	-rm -f ./$(DEPDIR)/tst_coords2.Po
+	-rm -f ./$(DEPDIR)/tst_coords3.Po
+	-rm -f ./$(DEPDIR)/tst_create_files.Po
+	-rm -f ./$(DEPDIR)/tst_dims.Po
+	-rm -f ./$(DEPDIR)/tst_dims2.Po
+	-rm -f ./$(DEPDIR)/tst_dims3.Po
+	-rm -f ./$(DEPDIR)/tst_empty_vlen_unlim.Po
+	-rm -f ./$(DEPDIR)/tst_endian_fill.Po
+	-rm -f ./$(DEPDIR)/tst_enums.Po
+	-rm -f ./$(DEPDIR)/tst_files.Po
+	-rm -f ./$(DEPDIR)/tst_files2.Po
+	-rm -f ./$(DEPDIR)/tst_files3.Po
+	-rm -f ./$(DEPDIR)/tst_files4.Po
+	-rm -f ./$(DEPDIR)/tst_files5.Po
+	-rm -f ./$(DEPDIR)/tst_files6.Po
+	-rm -f ./$(DEPDIR)/tst_fill_attr_vanish.Po
+	-rm -f ./$(DEPDIR)/tst_fillbug.Po
+	-rm -f ./$(DEPDIR)/tst_fills.Po
+	-rm -f ./$(DEPDIR)/tst_fills2.Po
+	-rm -f ./$(DEPDIR)/tst_filterparser.Po
+	-rm -f ./$(DEPDIR)/tst_grps.Po
+	-rm -f ./$(DEPDIR)/tst_grps2.Po
+	-rm -f ./$(DEPDIR)/tst_h5_endians.Po
+	-rm -f ./$(DEPDIR)/tst_h_many_atts.Po
+	-rm -f ./$(DEPDIR)/tst_h_refs.Po
+	-rm -f ./$(DEPDIR)/tst_h_scalar.Po
+	-rm -f ./$(DEPDIR)/tst_h_strbug.Po
+	-rm -f ./$(DEPDIR)/tst_hdf5_file_compat.Po
+	-rm -f ./$(DEPDIR)/tst_interops.Po
+	-rm -f ./$(DEPDIR)/tst_interops4.Po
+	-rm -f ./$(DEPDIR)/tst_interops5.Po
+	-rm -f ./$(DEPDIR)/tst_interops6.Po
+	-rm -f ./$(DEPDIR)/tst_knmi.Po
+	-rm -f ./$(DEPDIR)/tst_large.Po
+	-rm -f ./$(DEPDIR)/tst_large2.Po
+	-rm -f ./$(DEPDIR)/tst_mem.Po
+	-rm -f ./$(DEPDIR)/tst_mode.Po
+	-rm -f ./$(DEPDIR)/tst_mpi_parallel.Po
+	-rm -f ./$(DEPDIR)/tst_nc4perf.Po
+	-rm -f ./$(DEPDIR)/tst_opaques.Po
+	-rm -f ./$(DEPDIR)/tst_parallel.Po
+	-rm -f ./$(DEPDIR)/tst_parallel3.Po
+	-rm -f ./$(DEPDIR)/tst_parallel4.Po
+	-rm -f ./$(DEPDIR)/tst_rehash.Po
+	-rm -f ./$(DEPDIR)/tst_rename.Po
+	-rm -f ./$(DEPDIR)/tst_rename2.Po
+	-rm -f ./$(DEPDIR)/tst_simplerw_coll_r.Po
+	-rm -f ./$(DEPDIR)/tst_strings.Po
+	-rm -f ./$(DEPDIR)/tst_strings2.Po
+	-rm -f ./$(DEPDIR)/tst_sync.Po
+	-rm -f ./$(DEPDIR)/tst_types.Po
+	-rm -f ./$(DEPDIR)/tst_unlim_vars.Po
+	-rm -f ./$(DEPDIR)/tst_utf8.Po
+	-rm -f ./$(DEPDIR)/tst_utils.Po
+	-rm -f ./$(DEPDIR)/tst_v2.Po
+	-rm -f ./$(DEPDIR)/tst_varms.Po
+	-rm -f ./$(DEPDIR)/tst_vars.Po
+	-rm -f ./$(DEPDIR)/tst_vars2.Po
+	-rm -f ./$(DEPDIR)/tst_vars3.Po
+	-rm -f ./$(DEPDIR)/tst_vars4.Po
+	-rm -f ./$(DEPDIR)/tst_vl.Po
+	-rm -f ./$(DEPDIR)/tst_xplatform.Po
+	-rm -f ./$(DEPDIR)/tst_xplatform2.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -2726,21 +2902,22 @@ uninstall-am: uninstall-extraPROGRAMS
 
 .MAKE: $(am__recursive_targets) check-am install-am install-strip
 
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-	check-TESTS check-am clean clean-checkPROGRAMS \
-	clean-extraPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-extraPROGRAMS install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \
-	uninstall uninstall-am uninstall-extraPROGRAMS
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--depfiles check check-TESTS check-am clean \
+	clean-checkPROGRAMS clean-extraPROGRAMS clean-generic \
+	clean-libtool cscopelist-am ctags ctags-am distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am \
+	install-extraPROGRAMS install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am recheck tags tags-am uninstall \
+	uninstall-am uninstall-extraPROGRAMS
 
 .PRECIOUS: Makefile
 
@@ -2751,9 +2928,6 @@ uninstall-am: uninstall-extraPROGRAMS
 @BUILD_BENCHMARKS_TRUE@	./run_bm.sh
 @BUILD_BENCHMARKS_TRUE@	./run_tst_chunks.sh
 @BUILD_BENCHMARKS_TRUE@	./run_bm_ar4.sh
- at BUILD_UTILITIES_TRUE@@USE_HDF4_TRUE at tst_formatx_hdf4.log: tst_interops2.log
-
- at USE_HDF4_FILE_TESTS_TRUE@@USE_HDF4_TRUE at tst_hdf4_read_var.log: tst_interops2.log
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/nc_test4/hdf5plugins/CMakeLists.txt b/nc_test4/hdf5plugins/CMakeLists.txt
index f61b227..e5ba4e2 100644
--- a/nc_test4/hdf5plugins/CMakeLists.txt
+++ b/nc_test4/hdf5plugins/CMakeLists.txt
@@ -15,11 +15,14 @@ SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}")
 SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}")
 ENDIF()
 
-ADD_LIBRARY(bzip2 MODULE ${libbzip2_SOURCES})
-SET_TARGET_PROPERTIES(bzip2 PROPERTIES LIBRARY_OUTPUT_NAME "bzip2")
-SET_TARGET_PROPERTIES(bzip2 PROPERTIES ARCHIVE_OUTPUT_NAME "bzip2")
-SET_TARGET_PROPERTIES(bzip2 PROPERTIES RUNTIME_OUTPUT_NAME "bzip2")
-TARGET_LINK_LIBRARIES(bzip2 ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES})
+# Note we use name test_bzip2 instead of bzip2 to avoid logical
+# target name clash with examples/C/hdf5plugins
+ADD_LIBRARY(test_bzip2 MODULE ${libbzip2_SOURCES})
+SET_TARGET_PROPERTIES(test_bzip2 PROPERTIES OUTPUT_NAME "bzip2")
+SET_TARGET_PROPERTIES(test_bzip2 PROPERTIES LIBRARY_OUTPUT_NAME "bzip2")
+SET_TARGET_PROPERTIES(test_bzip2 PROPERTIES ARCHIVE_OUTPUT_NAME "bzip2")
+SET_TARGET_PROPERTIES(test_bzip2 PROPERTIES RUNTIME_OUTPUT_NAME "bzip2")
+TARGET_LINK_LIBRARIES(test_bzip2 ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES})
 
 ADD_LIBRARY(misc MODULE ${libmisc_SOURCES})
 SET_TARGET_PROPERTIES(misc PROPERTIES LIBRARY_OUTPUT_NAME "misc")
diff --git a/nc_test4/hdf5plugins/H5Zmisc.c b/nc_test4/hdf5plugins/H5Zmisc.c
index b267051..3ea8736 100644
--- a/nc_test4/hdf5plugins/H5Zmisc.c
+++ b/nc_test4/hdf5plugins/H5Zmisc.c
@@ -13,14 +13,13 @@
 
 #include "h5misc.h"
 
-#if defined  _MSC_VER || defined __APPLE__
-#define DBLVAL 12345678.12345678
-#else
-#define DBLVAL 12345678.12345678d
-#endif
-
 #undef DEBUG
 
+/* The C standard apparently defines all floating point constants as double;
+   we rely on that in this code.
+*/
+#define DBLVAL 12345678.12345678
+
 static int paramcheck(size_t nparams, const unsigned int* params);
 static void byteswap8(unsigned char* mem);
 static void mismatch(size_t i, const char* which);
diff --git a/nc_test4/hdf5plugins/Makefile.am b/nc_test4/hdf5plugins/Makefile.am
index 044e14b..6ec7552 100644
--- a/nc_test4/hdf5plugins/Makefile.am
+++ b/nc_test4/hdf5plugins/Makefile.am
@@ -18,9 +18,9 @@ DLLSRC=${PLUGINSRC} ${BZIP2SRC} ${PLUGINHDRS} ${BZIP2HDRS}
 lib_LTLIBRARIES = libbzip2.la libmisc.la
 
 libbzip2_la_SOURCES = ${DLLSRC}
-libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined
+libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined -rpath ${abs_builddir}
 
 libmisc_la_SOURCES = H5Zmisc.c h5misc.h
-libmisc_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined
+libmisc_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined -rpath ${abs_builddir}
 
 endif #ENABLE_FILTER_TESTING
diff --git a/nc_test4/hdf5plugins/Makefile.in b/nc_test4/hdf5plugins/Makefile.in
index 5e70130..1f7173e 100644
--- a/nc_test4/hdf5plugins/Makefile.in
+++ b/nc_test4/hdf5plugins/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -177,7 +177,12 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/H5Zbzip2.Plo ./$(DEPDIR)/H5Zmisc.Plo \
+	./$(DEPDIR)/blocksort.Plo ./$(DEPDIR)/bzlib.Plo \
+	./$(DEPDIR)/compress.Plo ./$(DEPDIR)/crctable.Plo \
+	./$(DEPDIR)/decompress.Plo ./$(DEPDIR)/huffman.Plo \
+	./$(DEPDIR)/randtable.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -263,7 +268,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -272,6 +276,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -310,6 +315,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -418,9 +424,9 @@ EXTRA_DIST = ${PLUGINSRC} ${BZIP2SRC} ${PLUGINHDRS} ${BZIP2HDRS} \
 @ENABLE_FILTER_TESTING_TRUE at DLLSRC = ${PLUGINSRC} ${BZIP2SRC} ${PLUGINHDRS} ${BZIP2HDRS}
 @ENABLE_FILTER_TESTING_TRUE at lib_LTLIBRARIES = libbzip2.la libmisc.la
 @ENABLE_FILTER_TESTING_TRUE at libbzip2_la_SOURCES = ${DLLSRC}
- at ENABLE_FILTER_TESTING_TRUE@libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined
+ at ENABLE_FILTER_TESTING_TRUE@libbzip2_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined -rpath ${abs_builddir}
 @ENABLE_FILTER_TESTING_TRUE at libmisc_la_SOURCES = H5Zmisc.c h5misc.h
- at ENABLE_FILTER_TESTING_TRUE@libmisc_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined
+ at ENABLE_FILTER_TESTING_TRUE@libmisc_la_LDFLAGS = -module -avoid-version -shared -export-dynamic -no-undefined -rpath ${abs_builddir}
 all: all-am
 
 .SUFFIXES:
@@ -442,8 +448,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -502,15 +508,21 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/H5Zbzip2.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/H5Zmisc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/blocksort.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzlib.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compress.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crctable.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/decompress.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/huffman.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/randtable.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/H5Zbzip2.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/H5Zmisc.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/blocksort.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bzlib.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compress.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crctable.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/decompress.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/huffman.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/randtable.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -594,7 +606,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -667,7 +682,15 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/H5Zbzip2.Plo
+	-rm -f ./$(DEPDIR)/H5Zmisc.Plo
+	-rm -f ./$(DEPDIR)/blocksort.Plo
+	-rm -f ./$(DEPDIR)/bzlib.Plo
+	-rm -f ./$(DEPDIR)/compress.Plo
+	-rm -f ./$(DEPDIR)/crctable.Plo
+	-rm -f ./$(DEPDIR)/decompress.Plo
+	-rm -f ./$(DEPDIR)/huffman.Plo
+	-rm -f ./$(DEPDIR)/randtable.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -713,7 +736,15 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/H5Zbzip2.Plo
+	-rm -f ./$(DEPDIR)/H5Zmisc.Plo
+	-rm -f ./$(DEPDIR)/blocksort.Plo
+	-rm -f ./$(DEPDIR)/bzlib.Plo
+	-rm -f ./$(DEPDIR)/compress.Plo
+	-rm -f ./$(DEPDIR)/crctable.Plo
+	-rm -f ./$(DEPDIR)/decompress.Plo
+	-rm -f ./$(DEPDIR)/huffman.Plo
+	-rm -f ./$(DEPDIR)/randtable.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -734,9 +765,9 @@ uninstall-am: uninstall-libLTLIBRARIES
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \
+	ctags ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
diff --git a/nc_test4/run_chunk_hdf4.sh b/nc_test4/run_chunk_hdf4.sh
deleted file mode 100755
index 5debe5f..0000000
--- a/nc_test4/run_chunk_hdf4.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-# Run test_chunk_hdf4 passing ${srcdir}
-
-
-
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
-set -e
-
-echo ""
-echo "*** Testing hdf4 chunking..."
-
-if test "x${srcdir}" = "x" ; then
-srcdir="."
-fi
-
-if ./tst_chunk_hdf4 ; then
-  echo "***SUCCESS!! tst_chunk_hdf4"
-else
-  RES=$?
-  echo "***FAIL: tst_chunk_hdf4"
-  exit $RES
-fi
-
-exit 0
diff --git a/nc_test4/run_hdf4_valgrind_tests.sh b/nc_test4/run_hdf4_valgrind_tests.sh
deleted file mode 100755
index ba3c9c7..0000000
--- a/nc_test4/run_hdf4_valgrind_tests.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
-# This shell runs the HDF4 tests with valgrind.
-
-# $Id: run_hdf4_valgrind_tests.sh,v 1.1 2009/07/13 14:53:52 ed Exp $
-
-set -e
-echo ""
-echo "Testing programs with valgrind..."
-
-# These are my test programs.
-list='tst_interops2 '
-
-for tst in $list; do
-    echo ""
-    echo "Memory testing with $tst:"
-    valgrind -q --error-exitcode=2 --leak-check=full ./$tst
-done
-
-echo "SUCCESS!!!"
-
-exit 0
diff --git a/nc_test4/run_valgrind_tests.sh b/nc_test4/run_valgrind_tests.sh
deleted file mode 100755
index 1a8da11..0000000
--- a/nc_test4/run_valgrind_tests.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
-
-# This shell runs the tests with valgrind.
-
-set -e
-echo ""
-echo "Testing programs with valgrind..."
-
-# These are my test programs.
-list='tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars '\
-'tst_varms tst_unlim_vars tst_converts tst_converts2 tst_grps '\
-'tst_compounds tst_compounds2 tst_compounds3 tst_opaques tst_strings '\
-'tst_strings2 tst_interops tst_interops4 tst_interops5 tst_interops6 '\
-'tst_coords tst_coords2 tst_coords3 tst_vars3 tst_chunks '\
-'tst_utf8 tst_fills tst_fills2 tst_fillbug tst_xplatform  '\
-'tst_h_atts2 tst_endian_fill tst_atts'
-
-# These don't work yet: tst_grps2 tst_xplatform2 tst_enums
-
-for tst in $list; do
-    echo ""
-    cmd1="valgrind -q --error-exitcode=2 --leak-check=full ./$tst"
-    echo "$cmd1:"
-    $cmd1
-done
-
-echo "SUCCESS!!!"
-exit 0
diff --git a/nc_test4/run_valgrind_tests2.sh b/nc_test4/run_valgrind_tests2.sh
deleted file mode 100755
index 796ea95..0000000
--- a/nc_test4/run_valgrind_tests2.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-# This shell runs the tests with valgrind.
-
-# $Id: run_valgrind_tests.sh,v 1.9 2010/01/26 20:24:18 ed Exp $
-
-set -e
-echo ""
-echo "Testing programs with valgrind..."
-
-# These are my test programs.
-list="t_type tst_camrun tst_vl tst_v2 tst_vars2 \
-tst_atts2 tst_files tst_atts"
-
-for tst in $list; do
-    echo ""
-    echo "Memory testing with $tst:"
-    valgrind -q --error-exitcode=2 --leak-check=full ./$tst
-done
-
-echo "SUCCESS!!!"
-
-exit 0
diff --git a/nc_test4/test_filter_misc.c b/nc_test4/test_filter_misc.c
index fdec17e..83b1c27 100644
--- a/nc_test4/test_filter_misc.c
+++ b/nc_test4/test_filter_misc.c
@@ -11,11 +11,10 @@
 #include <hdf5.h>
 #include "netcdf.h"
 
-#if defined  _MSC_VER || defined __APPLE__
+/* The C standard apparently defines all floating point constants as double;
+   we rely on that in this code.
+*/
 #define DBLVAL 12345678.12345678
-#else
-#define DBLVAL 12345678.12345678d
-#endif
 
 #define TEST_ID 32768
 
diff --git a/nc_test4/tst_atts.c b/nc_test4/tst_atts.c
index 76ae57d..a3490d1 100644
--- a/nc_test4/tst_atts.c
+++ b/nc_test4/tst_atts.c
@@ -1,52 +1,376 @@
-/* This is part of the netCDF package.
-   Copyright 2006 University Corporation for Atmospheric Research/Unidata.
-   See COPYRIGHT file for conditions of use.
+/* This is part of the netCDF package. Copyright 2006-2018 University
+   Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
+   for conditions of use.
 
-   This is a very simple example which writes a netCDF file with
-   Unicode names encoded with UTF-8. It is the NETCDF3 equivalent
-   of tst_unicode.c
+   Test the netCDF-4 attribute code.
 
-   $Id$
+   Ed Hartnett
 */
 
 #include <config.h>
-#include <stdlib.h>
 #include <nc_tests.h>
 #include "err_macros.h"
-#include <netcdf.h>
-#include <string.h>
+#include "nc4internal.h"
 
 /* The data file we will create. */
 #define FILE_NAME "tst_atts.nc"
 
+/* Names of attributes. */
+#define OLD_NAME "Constantinople"
+#define OLD_NAME_2 "Constantinopolis"
+#define NEW_NAME "Istanbul"
+
+/* Contents of attributes. */
+#define CONTENTS "Lots of people!"
+#define CONTENTS_2 "Lots of people!!" /* 1 longer than CONTENTS */
+#define CONTENTS_3 "Lots 0f pe0ple!"  /* same len as CONTENTS */
+#define VAR_NAME "Earth"
+
+#ifdef _MSC_VER /* otherwise defined in nc4internal/nc4file */
+/**
+ * @internal Define the names of attributes to ignore added by the
+ * HDF5 dimension scale; these attached to variables. They cannot be
+ * modified thru the netcdf-4 API.
+ */
+const char* NC_RESERVED_VARATT_LIST[] = {
+   NC_ATT_REFERENCE_LIST,
+   NC_ATT_CLASS,
+   NC_ATT_DIMENSION_LIST,
+   NC_ATT_NAME,
+   NC_ATT_COORDINATES,
+   NC_DIMID_ATT_NAME,
+   NULL
+};
+
+/**
+ * @internal Define the names of attributes to ignore because they are
+ * "hidden" global attributes. They can be read, but not modified thru
+ * the netcdf-4 API.
+ */
+const char* NC_RESERVED_ATT_LIST[] = {
+   NC_ATT_FORMAT,
+   NC3_STRICT_ATT_NAME,
+   NCPROPS,
+   ISNETCDF4ATT,
+   SUPERBLOCKATT,
+   NULL
+};
+
+/**
+ * @internal Define the subset of the reserved list that is readable
+ * by name only
+*/
+const char* NC_RESERVED_SPECIAL_LIST[] = {
+   ISNETCDF4ATT,
+   SUPERBLOCKATT,
+   NCPROPS,
+   NULL
+};
+
+#endif /*_MSC_VER*/
+
 int
 main(int argc, char **argv)
 {
    printf("\n*** Testing netCDF-4 attributes.\n");
-   printf("*** testing attribute renaming for a global attribute...");
+   nc_set_log_level(3);
+   printf("*** testing attribute renaming for read-only file...");
    {
-#define OLD_NAME "Constantinople"
-#define NEW_NAME "Istanbul"
-#define CONTENTS "Lots of people!"
+      int ncid;
+
+      /* Create a file with an att. */
+      if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+                          CONTENTS)) ERR;
+      if (nc_close(ncid)) ERR;
+
+      /* Reopen the file read-only. */
+      if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+
+      /* Try to rename the att, but it won't work. */
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, NEW_NAME) != NC_EPERM) ERR;
+
+      /* Try to create another att, it also won't work. */
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME_2, strlen(CONTENTS),
+                          CONTENTS) != NC_EPERM) ERR;
+
+      /* Try to delete the att. More failure ensues. */
+      if (nc_del_att(ncid, NC_GLOBAL, OLD_NAME) != NC_EPERM) ERR;
+
+      if (nc_close(ncid)) ERR;
+   }
+   SUMMARIZE_ERR;
+   printf("*** testing deleting atts...");
+   {
+      int ncid;
+      int natts;
+
+      /* Create a file with two atts. */
+      if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+                          CONTENTS)) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME_2, 0, NULL)) ERR;
+
+      /* These will not work. */
+      if (nc_del_att(ncid + TEST_VAL_42, NC_GLOBAL, OLD_NAME) != NC_EBADID) ERR;
+      if (nc_del_att(ncid, TEST_VAL_42, OLD_NAME) != NC_ENOTVAR) ERR;
+      if (nc_del_att(ncid, NC_GLOBAL, NULL) != NC_EINVAL) ERR;
+      if (nc_del_att(ncid, NC_GLOBAL, NEW_NAME) != NC_ENOTATT) ERR;
+
+      /* End define mode. It redef will be called automatically. */
+      if (nc_enddef(ncid)) ERR;
+
+      /* Delete the attribute. */
+      if (nc_del_att(ncid, NC_GLOBAL, OLD_NAME)) ERR;
+      if (nc_close(ncid)) ERR;
+
+      /* Reopen the file. */
+      if (nc_open(FILE_NAME, 0, &ncid)) ERR;
+      if (nc_inq_natts(ncid, &natts)) ERR;
+      if (natts != 1) ERR;
+      if (nc_close(ncid)) ERR;
+   }
+   SUMMARIZE_ERR;
+   printf("*** testing deleting atts classic model...");
+   {
+      int ncid;
+      int natts;
+
+      /* Create a file with an att. */
+      if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+                          CONTENTS)) ERR;
+
+      /* End define mode. */
+      if (nc_enddef(ncid)) ERR;
 
+      /* This will not work. */
+      if (nc_del_att(ncid, NC_GLOBAL, OLD_NAME) != NC_ENOTINDEFINE) ERR;
+
+      /* Delete the attribute. Redef is needed since this is a classic
+       * model file. */
+      if (nc_redef(ncid)) ERR;
+      if (nc_del_att(ncid, NC_GLOBAL, OLD_NAME)) ERR;
+      if (nc_close(ncid)) ERR;
+
+      /* Reopen the file. */
+      if (nc_open(FILE_NAME, 0, &ncid)) ERR;
+      if (nc_inq_natts(ncid, &natts)) ERR;
+      if (natts) ERR;
+      if (nc_close(ncid)) ERR;
+   }
+   SUMMARIZE_ERR;
+   printf("*** testing over-writing atts classic model...");
+   {
+      int ncid;
+      int natts;
+      char *data_in;
+
+      if (!(data_in = malloc(strlen(CONTENTS) + 1))) ERR;
+
+      /* Create a file with an att. */
+      if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+                          CONTENTS)) ERR;
+
+      /* End define mode. */
+      if (nc_enddef(ncid)) ERR;
+
+      /* Try and write a new att. Won't work. */
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME_2, strlen(CONTENTS_2),
+                          CONTENTS_2) != NC_EINDEFINE) ERR;
+
+      /* This will not work. Overwriting att must be same length or
+       * shorter if not in define mode. */
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS_2),
+                          CONTENTS_2) != NC_EINDEFINE) ERR;
+
+      /* Now overwrite the att. */
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS_3),
+                          CONTENTS_3)) ERR;
+
+      /* Delete the attribute. Redef is needed since this is a classic
+       * model file. This should work but does not. */
+      if (nc_redef(ncid)) ERR;
+      if (nc_del_att(ncid, NC_GLOBAL, OLD_NAME)) ERR;
+      if (nc_close(ncid)) ERR;
+
+      /* Reopen the file. */
+      if (nc_open(FILE_NAME, 0, &ncid)) ERR;
+      if (nc_inq_natts(ncid, &natts)) ERR;
+      /* If delete worked, natts would be 0. */
+      /* if (natts != 0) ERR; */
+      if (natts != 1) ERR;
+
+      /* Get the attribute. */
+      if (nc_get_att_text(ncid, NC_GLOBAL, OLD_NAME, data_in)) ERR;
+      /* if (strncmp(CONTENTS_3, data_in, strlen(CONTENTS))) ERR; */
+      free(data_in);
+      if (nc_close(ncid)) ERR;
+   }
+   SUMMARIZE_ERR;
+   printf("*** testing attribute renaming for a global attribute...");
+   {
       int ncid, attid;
       char *data_in;
+      char too_long_name[NC_MAX_NAME + 2];
+      char name_in[NC_MAX_NAME + 1];
+
+      /* Set up a name that is too long for netCDF. */
+      memset(too_long_name, 'a', NC_MAX_NAME + 1);
+      too_long_name[NC_MAX_NAME + 1] = 0;
 
       if (!(data_in = malloc(strlen(CONTENTS) + 1))) ERR;
 
       /* Create a file with an att. */
       if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
+      if (nc_def_var(ncid, VAR_NAME, NC_INT, 0, NULL, NULL)) ERR;
+
+      /* These will not work. */
+      if (nc_put_att_text(ncid + TEST_VAL_42, NC_GLOBAL, OLD_NAME,
+                          strlen(CONTENTS), CONTENTS) != NC_EBADID) ERR;
+      if (nc_put_att_text(ncid, TEST_VAL_42, OLD_NAME, strlen(CONTENTS),
+                          CONTENTS) != NC_ENOTVAR) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, NULL, strlen(CONTENTS),
+                          CONTENTS) != NC_EBADNAME) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, BAD_NAME, strlen(CONTENTS),
+                          CONTENTS) != NC_EBADNAME) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, too_long_name, strlen(CONTENTS),
+                          CONTENTS) != NC_EBADNAME) ERR;
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+                          NULL) != NC_EINVAL) ERR;
+      {
+         /* Check that the NC_GLOBAL reserved words are rejected. */
+         const char** reserved = NC_RESERVED_ATT_LIST;
+         for ( ; *reserved; reserved++)
+         {
+            if (nc_put_att_text(ncid, NC_GLOBAL, *reserved, strlen(CONTENTS),
+                                CONTENTS) != NC_ENAMEINUSE) ERR;
+         }
+      }
+      {
+         /* Check that the variable reserved words are rejected. */
+         const char** reserved = NC_RESERVED_VARATT_LIST;
+         for ( ; *reserved; reserved++)
+         {
+            if (nc_put_att_text(ncid, 0, *reserved, strlen(CONTENTS),
+                                CONTENTS) != NC_ENAMEINUSE) ERR;
+         }
+      }
+      {
+         /* Check that the read-only reserved words are rejected. */
+         const char** reserved = NC_RESERVED_SPECIAL_LIST;
+         for ( ; *reserved; reserved++)
+         {
+            if (nc_put_att_text(ncid, NC_GLOBAL, *reserved, strlen(CONTENTS),
+                                CONTENTS) != NC_ENAMEINUSE) ERR;
+         }
+      }
+
+      /* Write the attribute at last. */
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+                          CONTENTS)) ERR;
+
+      /* Write another with different name. */
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME_2, strlen(CONTENTS),
+                          CONTENTS)) ERR;
+
+      /* These will not work. */
+      if (nc_rename_att(ncid + TEST_VAL_42, NC_GLOBAL, OLD_NAME, NEW_NAME) != NC_EBADID) ERR;
+      if (nc_rename_att(ncid, TEST_VAL_42, OLD_NAME, NEW_NAME) != NC_ENOTVAR) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, NULL) != NC_EINVAL) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, NULL, NEW_NAME) != NC_EINVAL) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, NULL, NULL) != NC_EINVAL) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, BAD_NAME) != NC_EBADNAME) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, too_long_name) != NC_EMAXNAME) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, OLD_NAME_2) != NC_ENAMEINUSE) ERR;
+
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
+                          NULL) != NC_EINVAL) ERR;
+      {
+         /* Check that the NC_GLOBAL reserved words are rejected. */
+         const char** reserved = NC_RESERVED_ATT_LIST;
+         for ( ; *reserved; reserved++)
+         {
+            if (nc_put_att_text(ncid, NC_GLOBAL, *reserved, strlen(CONTENTS),
+                                CONTENTS) != NC_ENAMEINUSE) ERR;
+         }
+      }
+      {
+         /* Check that the variable reserved words are rejected. */
+         const char** reserved = NC_RESERVED_VARATT_LIST;
+         for ( ; *reserved; reserved++)
+         {
+            if (nc_put_att_text(ncid, 0, *reserved, strlen(CONTENTS),
+                                CONTENTS) != NC_ENAMEINUSE) ERR;
+         }
+      }
+      {
+         /* Check that the read-only reserved words are rejected. */
+         const char** reserved = NC_RESERVED_SPECIAL_LIST;
+         for ( ; *reserved; reserved++)
+         {
+            if (nc_put_att_text(ncid, NC_GLOBAL, *reserved, strlen(CONTENTS),
+                                CONTENTS) != NC_ENAMEINUSE) ERR;
+         }
+      }
+      
+      /* Write the attribute at last. */
       if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME, strlen(CONTENTS),
-			  CONTENTS)) ERR;
+                          CONTENTS)) ERR;
+      
+      /* Write another with different name. */
+      if (nc_put_att_text(ncid, NC_GLOBAL, OLD_NAME_2, strlen(CONTENTS),
+                          CONTENTS)) ERR;
 
+      /* These will not work. */
+      if (nc_rename_att(ncid + TEST_VAL_42, NC_GLOBAL, OLD_NAME, NEW_NAME) != NC_EBADID) ERR;
+      if (nc_rename_att(ncid, TEST_VAL_42, OLD_NAME, NEW_NAME) != NC_ENOTVAR) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, NULL) != NC_EINVAL) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, NULL, NEW_NAME) != NC_EINVAL) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, NULL, NULL) != NC_EINVAL) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, BAD_NAME) != NC_EBADNAME) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, too_long_name) != NC_EMAXNAME) ERR;
+      if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, OLD_NAME_2) != NC_ENAMEINUSE) ERR;
+      
       /* Rename the att. */
       if (nc_rename_att(ncid, NC_GLOBAL, OLD_NAME, NEW_NAME)) ERR;
 
+      /* These will not work. */
+      if (nc_inq_attid(ncid + TEST_VAL_42, NC_GLOBAL, NEW_NAME, &attid) != NC_EBADID) ERR;
+      if (nc_inq_attid(ncid, TEST_VAL_42, NEW_NAME, &attid) != NC_ENOTVAR) ERR;
+      if (nc_inq_attid(ncid, NC_GLOBAL, NULL, &attid) != NC_EBADNAME) ERR;
+
       /* Check the file. */
       if (nc_inq_attid(ncid, NC_GLOBAL, NEW_NAME, &attid)) ERR;
       if (attid != 0) ERR;
+
+      /* This also works. */
+      if (nc_inq_attid(ncid, NC_GLOBAL, NEW_NAME, NULL)) ERR;
+
+      /* These won't work. */
+      if (nc_inq_attname(ncid + TEST_VAL_42, NC_GLOBAL, attid, name_in) != NC_EBADID) ERR;
+      if (nc_inq_attname(ncid, TEST_VAL_42, attid, name_in) != NC_ENOTVAR) ERR;
+      if (nc_inq_attname(ncid, NC_GLOBAL, -1, name_in) != NC_ENOTATT) ERR;
+
+      /* Get the name from the ID. */
+      if (nc_inq_attname(ncid, NC_GLOBAL, attid, name_in)) ERR;
+      if (strcmp(name_in, NEW_NAME)) ERR;
+
+      /* Also works but does little. */
+      if (nc_inq_attname(ncid, NC_GLOBAL, attid, NULL)) ERR;
+
+      /* These will not work. */
+      if (nc_get_att_text(ncid + TEST_VAL_42, NC_GLOBAL, NEW_NAME, data_in) != NC_EBADID) ERR;
+      if (nc_get_att_text(ncid, TEST_VAL_42, NEW_NAME, data_in) != NC_ENOTVAR) ERR;
+      if (nc_get_att_text(ncid, NC_GLOBAL, NULL, data_in) != NC_EBADNAME) ERR;
+
+      /* Get the attribute at last. */
       if (nc_get_att_text(ncid, NC_GLOBAL, NEW_NAME, data_in)) ERR;
       if (strncmp(CONTENTS, data_in, strlen(CONTENTS))) ERR;
+
+      /* This also works. */
+      if (nc_get_att_text(ncid, NC_GLOBAL, NEW_NAME, NULL)) ERR;
       if (nc_close(ncid)) ERR;
 
       /* Reopen the file and check again. */
@@ -63,7 +387,6 @@ main(int argc, char **argv)
    SUMMARIZE_ERR;
    printf("*** testing attribute renaming for a variable attribute...");
    {
-#define VAR_NAME "var_name"
 #define OLD_NAME1 "Constantinople"
 #define NEW_NAME1 "Istanbul____________"
 #define CONTENTS1 "Lots of people!"
@@ -77,7 +400,7 @@ main(int argc, char **argv)
       if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLOBBER, &ncid)) ERR;
       if (nc_def_var(ncid, VAR_NAME, NC_INT, 0, NULL, &varid)) ERR;
       if (nc_put_att_text(ncid, varid, OLD_NAME1, strlen(CONTENTS1),
-			  CONTENTS1)) ERR;
+                          CONTENTS1)) ERR;
 
       /* Rename the att. */
       if (nc_rename_att(ncid, varid, OLD_NAME1, NEW_NAME1)) ERR;
diff --git a/nc_test4/tst_atts2.c b/nc_test4/tst_atts2.c
index 53de6d3..591aca2 100644
--- a/nc_test4/tst_atts2.c
+++ b/nc_test4/tst_atts2.c
@@ -1,10 +1,10 @@
-/* This is part of the netCDF package. Copyright 2005-2007 University
+/* This is part of the netCDF package. Copyright 2005-2018 University
    Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
    for conditions of use.
 
    Test copy of attributes.
 
-   $Id: tst_atts2.c,v 1.7 2010/05/05 22:15:32 dmh Exp $
+   Ed Hartnett, Denis Heimbigner, Ward Fisher
 */
 
 #include <nc_tests.h>
@@ -96,6 +96,15 @@ main(int argc, char **argv)
 
       /* Create another file, and copy the att. */
       if (nc_create(FILE_NAME2, NC_NETCDF4, &ncid2)) ERR;
+
+      /* These will not work. */
+      if (nc_copy_att(ncid1 + TEST_VAL_42, NC_GLOBAL, ATT_NAME, ncid2, NC_GLOBAL) != NC_EBADID) ERR;
+      if (nc_copy_att(ncid1, TEST_VAL_42, ATT_NAME, ncid2, NC_GLOBAL) != NC_ENOTVAR) ERR;
+      if (nc_copy_att(ncid1, NC_GLOBAL, NULL, ncid2, NC_GLOBAL) != NC_EBADNAME) ERR;
+      if (nc_copy_att(ncid1, NC_GLOBAL, ATT_NAME, ncid2 + TEST_VAL_42, NC_GLOBAL) != NC_EBADID) ERR;
+      if (nc_copy_att(ncid1, NC_GLOBAL, ATT_NAME, ncid2, TEST_VAL_42) != NC_ENOTVAR) ERR;
+
+      /* Copy the attribute. */
       if (nc_copy_att(ncid1, NC_GLOBAL, ATT_NAME, ncid2, NC_GLOBAL)) ERR;
 
       /* Close up. */
diff --git a/nc_test4/tst_chunks.c b/nc_test4/tst_chunks.c
index 2ae73bf..a22976b 100644
--- a/nc_test4/tst_chunks.c
+++ b/nc_test4/tst_chunks.c
@@ -3,7 +3,7 @@
    See COPYRIGHT file for conditions of use.
 
    Test netcdf-4 variables.
-   $Id: tst_chunks.c,v 1.3 2010/01/21 16:00:18 ed Exp $
+   Ed Hartnett
 */
 
 #include <nc_tests.h>
@@ -24,7 +24,6 @@
 int
 main(int argc, char **argv)
 {
-
    printf("\n*** Testing netcdf-4 variable chunking.\n");
    printf("**** testing that fixed vars with filter end up being chunked, with good sizes...");
    {
@@ -287,45 +286,86 @@ main(int argc, char **argv)
       if (nc_abort(ncid)) ERR;
    }
    SUMMARIZE_ERR;
-   printf("**** testing different chunksizes on an unlimited dimension with existing data...");
+   printf("**** testing cache size smaller than chunk size...");
    {
-#define D_UNLIM "unlimited_dim"
-#define V_UNLIM_ONE "unlimited_var_one"
-#define V_UNLIM_TWO "unlimited_var_two"
-    int ncid;
-    int unlim_dimid;
-    int first_unlim_varid;
-    int second_unlim_varid;
-    size_t first_chunks[1];
-    size_t second_chunks[1];
-    size_t start[1], count[1];
-    unsigned short first_data[2] = {0, 1}, second_data[3] = {2, 3, 4};
-
-    /* Create a netcdf4 file with 1 dimension. */
-    if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
-    if (nc_def_dim(ncid, D_UNLIM, NC_UNLIMITED, &unlim_dimid)) ERR;
-
-    /* Add one var with one chunksize */
-    if (nc_def_var(ncid, V_UNLIM_ONE, NC_USHORT, NDIMS1, &unlim_dimid, &first_unlim_varid)) ERR;
-    first_chunks[0] = 2;
-    if (nc_def_var_chunking(ncid, first_unlim_varid, NC_CHUNKED, first_chunks)) ERR;
-
-    /* Add a record to the first variable. */
-    start[0] = 0;
-    count[0] = 1;
-    if (nc_put_vara(ncid, first_unlim_varid, start, count, first_data)) ERR;
-
-    /* Add second var with second chunksize */
-    if (nc_def_var(ncid, V_UNLIM_TWO, NC_USHORT, NDIMS1, &unlim_dimid, &second_unlim_varid)) ERR;
-    second_chunks[0] = 3;
-    if (nc_def_var_chunking(ncid, second_unlim_varid, NC_CHUNKED, second_chunks)) ERR;
-
-    /* Add a record to the second variable. */
-    start[0] = 0;
-    count[0] = 2;
-    if (nc_put_vara(ncid, second_unlim_varid, start, count, second_data)) ERR;
-
-    if (nc_close(ncid)) ERR;
+#define NDIM2 2
+#define DIM_X_LEN 10000
+#define DIM_Y_LEN 10000
+#define DIM_NAME_X_CACHE_CHUNK "Height"
+#define DIM_NAME_Y_CACHE_CHUNK "Width"
+#define VAR_NAME_CACHE_CHUNK "House_Size"
+#define VAR_NAME_CACHE_CHUNK_2 "Boat_Size"
+#define VAR_NAME_CACHE_CHUNK_3 "Deck_Size"
+
+      int ncid;
+      int dimid[NDIM2];
+      int varid, varid2, varid3;
+      size_t chunks[NDIM2] = {100, 100};
+      size_t chunks_big[NDIM2] = {DIM_X_LEN, DIM_Y_LEN};
+      size_t chunks_in[NDIM2];
+      int contiguous;
+      size_t cache_size = 16;
+      size_t cache_nelems = 1;
+      float cache_preemption = 0.5;
+      size_t cache_size_in;
+      size_t cache_nelems_in;
+      float cache_preemption_in;
+
+      /* Create a netcdf-4 file with two dimensions. */
+      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+      if (nc_def_dim(ncid, DIM_NAME_X_CACHE_CHUNK, DIM_X_LEN, &dimid[0])) ERR;
+      if (nc_def_dim(ncid, DIM_NAME_Y_CACHE_CHUNK, DIM_Y_LEN, &dimid[1])) ERR;
+
+      /* Add vars. */
+      if (nc_def_var(ncid, VAR_NAME_CACHE_CHUNK, NC_INT64, NDIM2, dimid, &varid)) ERR;
+      if (nc_def_var(ncid, VAR_NAME_CACHE_CHUNK_2, NC_INT64, NDIM2, dimid, &varid2)) ERR;
+      if (nc_def_var(ncid, VAR_NAME_CACHE_CHUNK_3, NC_INT64, NDIM2, dimid, &varid3)) ERR;
+
+      /* Set the var cache. */
+      if (nc_set_var_chunk_cache(ncid, varid, cache_size, cache_nelems,
+                                 cache_preemption)) ERR;
+
+      /* Set the chunking. */
+      if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, chunks)) ERR;
+      if (nc_inq_var_chunking(ncid, varid, &contiguous, chunks_in)) ERR;
+      if (contiguous || chunks_in[0] != chunks[0] || chunks_in[1] != chunks[1]) ERR;
+      if (nc_def_var_chunking(ncid, varid2, NC_CHUNKED, chunks)) ERR;
+      if (nc_inq_var_chunking(ncid, varid2, &contiguous, chunks_in)) ERR;
+      if (contiguous || chunks_in[0] != chunks[0] || chunks_in[1] != chunks[1]) ERR;
+      if (nc_def_var_chunking(ncid, varid3, NC_CHUNKED, chunks_big)) ERR;
+      if (nc_inq_var_chunking(ncid, varid3, &contiguous, chunks_in)) ERR;
+      if (contiguous || chunks_in[0] != chunks_big[0] || chunks_in[1] != chunks_big[1]) ERR;
+
+      /* Get the var cache values. */
+      if (nc_get_var_chunk_cache(ncid, varid, &cache_size_in, &cache_nelems_in,
+                                 &cache_preemption_in)) ERR;
+      if (cache_size_in != cache_size || cache_nelems_in != cache_nelems ||
+          cache_preemption_in != cache_preemption) ERR;
+      if (nc_get_var_chunk_cache(ncid, varid2, &cache_size_in, &cache_nelems_in,
+                                 &cache_preemption_in)) ERR;
+      if (cache_size_in != CHUNK_CACHE_SIZE || cache_nelems_in != CHUNK_CACHE_NELEMS ||
+          cache_preemption_in != CHUNK_CACHE_PREEMPTION) ERR;
+
+      /* The cache_size has been increased due to larger chunksizes
+       * for varid3. */
+      if (nc_get_var_chunk_cache(ncid, varid3, &cache_size_in, &cache_nelems_in,
+                                 &cache_preemption_in)) ERR;
+      if (cache_nelems_in != CHUNK_CACHE_NELEMS ||
+          cache_preemption_in != CHUNK_CACHE_PREEMPTION) ERR;
+      /* printf("cache_size_in %ld\n", cache_size_in); */
+#ifndef USE_PARALLEL
+      /* THe cache size does not change under parallel. Not sure why. */
+      if (cache_size_in <= CHUNK_CACHE_SIZE) ERR;
+#endif
+
+      /* Close the file. */
+      if (nc_close(ncid)) ERR;
+
+      /* Reopen the file. */
+      if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+      
+      /* Close the file. */
+      if (nc_close(ncid)) ERR;
    }
    SUMMARIZE_ERR;
    FINAL_RESULTS;
diff --git a/nc_test4/tst_dims.c b/nc_test4/tst_dims.c
index 0edae99..bd652d1 100644
--- a/nc_test4/tst_dims.c
+++ b/nc_test4/tst_dims.c
@@ -4,14 +4,16 @@
 
    Test netcdf-4 dimensions.
 
-   $Id: tst_dims.c,v 1.30 2010/05/25 13:53:04 ed Exp $
+   Ed Hartnett, Quincey Koziol, Russ Rew, Ward Fisher
 */
 #include <config.h>
 #include <nc_tests.h>
+#include <nc4internal.h>
 #include "err_macros.h"
 
 #define FILE_NAME "tst_dims.nc"
 #define LAT_NAME "lat"
+#define LAT_NAME_2 "lat_2"
 #define LON_NAME "lon"
 #define LEVEL_NAME "level"
 #define TIME_NAME "time"
@@ -34,7 +36,6 @@
 #define ELEV_NAME "Elevation"
 #define HP_NAME "Number_of_Harry_Potter_Books"
 #define BUBBA "Bubba"
-
 #define MAX_DIMS 5
 
 int
@@ -49,6 +50,8 @@ main(int argc, char **argv)
       /* Create a netcdf-3 file with one dim. */
       if (nc_create(FILE_NAME, 0, &ncid)) ERR;
       if (nc_def_dim(ncid, LAT_NAME, LAT_LEN, &dimid)) ERR;
+      if (nc_def_dim(ncid + TEST_VAL_42, LAT_NAME, LAT_LEN, &dimid) != NC_EBADID) ERR;
+
       if (nc_close(ncid)) ERR;
 
       /* Open the file and make sure nc_inq_dimids yeilds correct
@@ -80,7 +83,7 @@ main(int argc, char **argv)
       if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 3 || dimids_in[0] != 0 || dimids_in[1] != 1 ||
-	 dimids_in[2] != 2) ERR;
+          dimids_in[2] != 2) ERR;
       if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
       if (ndims_in != 1 || dimids_in[0] != 0) ERR;
       if (nc_close(ncid)) ERR;
@@ -88,7 +91,7 @@ main(int argc, char **argv)
    SUMMARIZE_ERR;
    printf("*** Testing file with just one dimension...");
    {
-      int ncid, dimid;
+      int ncid, dimid, dimid2;
       int ndims_in, dimids_in[MAX_DIMS];
       size_t len_in;
       char name_in[NC_MAX_NAME + 1];
@@ -96,25 +99,70 @@ main(int argc, char **argv)
 
       /* Create a file with one dim and nothing else. */
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+
+      /* These will not work. */
+      if (nc_def_dim(ncid + TEST_VAL_42, LAT_NAME, LAT_LEN, &dimid) != NC_EBADID) ERR;
+      if (nc_def_dim(ncid, NULL, LAT_LEN, &dimid) != NC_EINVAL) ERR;
+      if (nc_def_dim(ncid, BAD_NAME, LAT_LEN, &dimid) != NC_EBADNAME) ERR;
+      
+      /* Turn off define mode. It will be turned back on
+       * automatically. */
+      if (nc_enddef(ncid)) ERR;
+
+      /* Create the dim. */
       if (nc_def_dim(ncid, LAT_NAME, LAT_LEN, &dimid)) ERR;
 
+      /* This will not work. */
+      if (nc_def_dim(ncid, LAT_NAME, LAT_LEN, &dimid2) != NC_ENAMEINUSE) ERR;
+
+      /* These also won't work. */
+      if (nc_inq_dim(ncid + TEST_VAL_42, dimid, name_in, &len_in) != NC_EBADID) ERR;
+      if (nc_inq_dim(ncid, -1, name_in, &len_in) != NC_EBADDIM) ERR;
+
       /* Check out what we've got. */
       if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
       if (len_in != LAT_LEN || strcmp(name_in, LAT_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 1) ERR;
+
+      /* These will also work. */
+      if (nc_inq_dim(ncid, dimid, NULL, NULL)) ERR;
+      if (nc_inq_dim(ncid, dimid, NULL, &len_in)) ERR;
+      if (len_in != LAT_LEN) ERR;
+      if (nc_inq_dim(ncid, dimid, name_in, NULL)) ERR;
+      if (strcmp(name_in, LAT_NAME)) ERR;
+
+      /* These will not work. */
+      if (nc_inq_dimid(ncid + TEST_VAL_42, LAT_NAME, &dimid_in) != NC_EBADID) ERR;
+      if (nc_inq_dimid(ncid, NULL, &dimid_in) != NC_EINVAL) ERR;
+      if (nc_inq_dimid(ncid, LAT_NAME_2, &dimid_in) != NC_EBADDIM) ERR;
+
+      /* This will work. */
+      if (nc_inq_dimid(ncid, LAT_NAME, NULL)) ERR;
       if (nc_inq_dimid(ncid, LAT_NAME, &dimid_in)) ERR;
       if (dimid_in != 0) ERR;
       if (nc_inq_dimname(ncid, 0, name_in)) ERR;
       if (strcmp(name_in, LAT_NAME)) ERR;
       if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
       if (len_in != LAT_LEN) ERR;
+
+      /* These won't work. */
+      if (nc_inq_unlimdims(ncid + TEST_VAL_42, &ndims_in, dimids_in) != NC_EBADID) ERR;
+
+      /* This will work. */
       if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
       if (ndims_in != 0) ERR;
+      if (nc_inq_unlimdims(ncid, &ndims_in, NULL)) ERR;
+      if (ndims_in != 0) ERR;
+      if (nc_inq_unlimdims(ncid, NULL, NULL)) ERR;
       if (nc_close(ncid)) ERR;
 
       /* Reopen and check it out again. */
       if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+
+      /* This will not work. */
+      if (nc_def_dim(ncid, LAT_NAME_2, LAT_LEN, &dimid) != NC_EPERM) ERR;
+      
       if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
       if (len_in != LAT_LEN || strcmp(name_in, LAT_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
@@ -130,6 +178,70 @@ main(int argc, char **argv)
       if (nc_close(ncid)) ERR;
    }
    SUMMARIZE_ERR;
+   printf("*** Testing with NULL id pointer...");
+   {
+      int ncid;
+      int ndims_in, dimids_in[MAX_DIMS];
+      size_t len_in;
+      char name_in[NC_MAX_NAME + 1];
+      int dimid_in;
+
+      /* Create a file with one dim and nothing else. */
+      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+      if (nc_def_dim(ncid, LAT_NAME, LAT_LEN, NULL)) ERR;
+
+      /* Check out what we've got. */
+      if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
+      if (len_in != LAT_LEN || strcmp(name_in, LAT_NAME)) ERR;
+      if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
+      if (ndims_in != 1) ERR;
+      if (nc_inq_dimid(ncid, LAT_NAME, &dimid_in)) ERR;
+      if (dimid_in != 0) ERR;
+      if (nc_close(ncid)) ERR;
+   }
+   SUMMARIZE_ERR;
+   printf("*** Testing classic model file with just one unlimited dimension...");
+   {
+      int ncid, dimid;
+      int ndims_in, dimids_in[MAX_DIMS];
+      size_t len_in;
+      char name_in[NC_MAX_NAME + 1];
+
+      /* Create a file with one dim and nothing else. */
+      if (nc_create(FILE_NAME, NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
+
+      /* Turn off define mode. */
+      if (nc_enddef(ncid)) ERR;
+
+      /* This will not work. */
+      if (nc_def_dim(ncid, LAT_NAME, NC_UNLIMITED, &dimid) != NC_ENOTINDEFINE) ERR;
+     
+      /* Turn on define mode. */
+      if (nc_redef(ncid)) ERR;
+
+      /* Create the dim. */
+      if (nc_def_dim(ncid, LAT_NAME, NC_UNLIMITED, &dimid)) ERR;
+
+      /* This will not work because of classic model. */
+      if (nc_def_dim(ncid, LAT_NAME_2, NC_UNLIMITED, &dimid) != NC_EUNLIMIT) ERR;
+      /* if (nc_def_dim(ncid, LAT_NAME_2, X_UINT_MAX + 10, &dimid) != NC_EDIMSIZE) ERR;*/
+
+      /* Check out what we've got. */
+      if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
+      if (len_in != 0 || strcmp(name_in, LAT_NAME)) ERR;
+      if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
+      if (ndims_in != 1) ERR;
+      if (nc_close(ncid)) ERR;
+
+      /* Reopen and check it out again. */
+      if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+      if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
+      if (len_in != 0 || strcmp(name_in, LAT_NAME)) ERR;
+      if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
+      if (ndims_in != 1) ERR;
+      if (nc_close(ncid)) ERR;
+   }
+   SUMMARIZE_ERR;
    printf("*** Testing renaming of one dimension...");
    {
       int ncid, dimid, dimid_in;
@@ -137,8 +249,20 @@ main(int argc, char **argv)
       size_t len_in;
       int ndims_in, dimids_in[MAX_DIMS];
 
+      /* Create a file with one dim and nothing else. */
+      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+      if (nc_def_dim(ncid, LAT_NAME, LAT_LEN, &dimid)) ERR;
+      if (nc_close(ncid)) ERR;
+
       /* Reopen the file with one dim, and change the name of the dim. */
       if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
+
+      /* These will not work. */
+      if (nc_rename_dim(ncid + TEST_VAL_42, 0, BUBBA) != NC_EBADID) ERR;
+      if (nc_rename_dim(ncid, TEST_VAL_42, BUBBA) != NC_EBADDIM) ERR;
+      if (nc_rename_dim(ncid, 0, NULL) != NC_EINVAL) ERR;
+
+      /* Rename the dimension. */
       if (nc_rename_dim(ncid, 0, BUBBA)) ERR;
 
       /* Check out what we've got. */
@@ -190,9 +314,9 @@ main(int argc, char **argv)
       int lat_T42_dims[RANK_lat_T42];
       char name[NC_MAX_NAME + 1];
 
-    /* =========== */
-    /* Sub-test #1 */
-    /* =========== */
+      /* =========== */
+      /* Sub-test #1 */
+      /* =========== */
       /* create file with dimension and associated coordinate variable */
       if (nc_create(FILE_NAME1, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM_NAME, lat_T42_len, &lat_T42_dim)) ERR;
@@ -224,9 +348,9 @@ main(int argc, char **argv)
       if (nc_close(ncid)) ERR;
 
 
-    /* =========== */
-    /* Sub-test #2 */
-    /* =========== */
+      /* =========== */
+      /* Sub-test #2 */
+      /* =========== */
       /* create file with dimension and associated coordinate variable */
       if (nc_create(FILE_NAME1, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM_NAME, lat_T42_len, &lat_T42_dim)) ERR;
@@ -254,9 +378,9 @@ main(int argc, char **argv)
       if (nc_close(ncid)) ERR;
 
 
-    /* =========== */
-    /* Sub-test #3 */
-    /* =========== */
+      /* =========== */
+      /* Sub-test #3 */
+      /* =========== */
       /* create file with dimension and associated coordinate variable */
       if (nc_create(FILE_NAME1, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM_NAME, lat_T42_len, &lat_T42_dim)) ERR;
@@ -284,9 +408,9 @@ main(int argc, char **argv)
       if (nc_close(ncid)) ERR;
 
 
-    /* =========== */
-    /* Sub-test #4 */
-    /* =========== */
+      /* =========== */
+      /* Sub-test #4 */
+      /* =========== */
       /* create file with dimension and associated coordinate variable */
       if (nc_create(FILE_NAME1, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM_NAME, lat_T42_len, &lat_T42_dim)) ERR;
@@ -337,8 +461,14 @@ main(int argc, char **argv)
       if (len_in != NC_UNLIMITED || strcmp(name_in, LEVEL_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 1 || dimids_in[0] != 0) ERR;
+
+      /* Th1s won't work. */
+      if (nc_inq_unlimdim(ncid + TEST_VAL_42, &unlimdimid_in) != NC_EBADID) ERR;
+
+      /* This will work. */
       if (nc_inq_unlimdim(ncid, &unlimdimid_in)) ERR;
       if (unlimdimid_in != 0) ERR;
+      if (nc_inq_unlimdim(ncid, NULL)) ERR;
       if (nc_inq_unlimdims(ncid, &nunlimdims_in, &unlimdimid_in)) ERR;
       if (nunlimdims_in != 1 || unlimdimid_in != 0) ERR;
 
@@ -438,7 +568,7 @@ main(int argc, char **argv)
       if (len_in != A_LEN || strcmp(name_in, A_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 2 || dimids_in[0] != 0 ||
-	  dimids_in[1] != 1) ERR;
+          dimids_in[1] != 1) ERR;
       if (nc_close(ncid)) ERR;
    }
 
@@ -479,7 +609,7 @@ main(int argc, char **argv)
       if (varid_in != 0) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LEVEL_NAME) || xtype_in != NC_UINT64 || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
       if (nc_inq_varname(ncid, 0, name_in)) ERR;
       if (strcmp(name_in, LEVEL_NAME)) ERR;
 
@@ -507,7 +637,7 @@ main(int argc, char **argv)
       if (varid_in != 0) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LEVEL_NAME) || xtype_in != NC_UINT64 || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
       if (nc_inq_varname(ncid, 0, name_in)) ERR;
       if (strcmp(name_in, LEVEL_NAME)) ERR;
 
@@ -531,7 +661,7 @@ main(int argc, char **argv)
       if (varid_in != 0) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LEVEL_NAME) || xtype_in != NC_UINT64 || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
       if (nc_inq_varname(ncid, 0, name_in)) ERR;
       if (strcmp(name_in, LEVEL_NAME)) ERR;
       if (nc_close(ncid)) ERR;
@@ -555,7 +685,7 @@ main(int argc, char **argv)
       /* Check out what we've got. */
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 0 || natts_in != 0 ||
-	 unlimdimid_in != -1) ERR;
+          unlimdimid_in != -1) ERR;
       if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
       if (len_in != DIM5_LEN || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
@@ -567,7 +697,7 @@ main(int argc, char **argv)
       if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 0 || natts_in != 0 ||
-	 unlimdimid_in != -1) ERR;
+          unlimdimid_in != -1) ERR;
       if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
       if (len_in != DIM5_LEN || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
@@ -580,14 +710,14 @@ main(int argc, char **argv)
       /* Check it out. */
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 1 || natts_in != 0 ||
-	 unlimdimid_in != -1) ERR;
+          unlimdimid_in != -1) ERR;
       if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
       if (len_in != DIM5_LEN || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 1 || dimids_in[0] != 0) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, DIM5_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
 
       if (nc_close(ncid)) ERR;
 
@@ -595,14 +725,14 @@ main(int argc, char **argv)
       if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 1 || natts_in != 0 ||
-	 unlimdimid_in != -1) ERR;
+          unlimdimid_in != -1) ERR;
       if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
       if (len_in != DIM5_LEN || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 1 || dimids_in[0] != 0) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, DIM5_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
 
       if (nc_close(ncid)) ERR;
    }
@@ -632,14 +762,14 @@ main(int argc, char **argv)
       /* Check out what we've got. */
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 1 || natts_in != 0 ||
-	 unlimdimid_in != 0) ERR;
+          unlimdimid_in != 0) ERR;
       if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
       if (len_in != 0 || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 1 || dimids_in[0] != 0) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, HP_NAME) || xtype_in != NC_USHORT || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
 
       /* Add a record to the HP variable. */
       start[0] = 0;
@@ -661,7 +791,7 @@ main(int argc, char **argv)
       if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 1 || natts_in != 0 ||
-	 unlimdimid_in != 0) ERR;
+          unlimdimid_in != 0) ERR;
       if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
       if (len_in != 1 || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
@@ -674,14 +804,14 @@ main(int argc, char **argv)
       /* Check it out. */
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 2 || natts_in != 0 ||
-	 unlimdimid_in != 0) ERR;
+          unlimdimid_in != 0) ERR;
       if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
       if (len_in != 1 || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 1 || dimids_in[0] != 0) ERR;
       if (nc_inq_var(ncid, dim5_varid, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, DIM5_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
 
       if (nc_close(ncid)) ERR;
 
@@ -689,14 +819,14 @@ main(int argc, char **argv)
       if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
       if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
       if (ndims_in != 1 || nvars_in != 2 || natts_in != 0 ||
-	 unlimdimid_in != 0) ERR;
+          unlimdimid_in != 0) ERR;
       if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR;
       if (len_in != 1 || strcmp(name_in, DIM5_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
       if (ndims_in != 1 || dimids_in[0] != 0) ERR;
       if (nc_inq_var(ncid, dim5_varid, name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, DIM5_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != 0 || natts_in != 0) ERR;
+          dimids_in[0] != 0 || natts_in != 0) ERR;
 
       if (nc_close(ncid)) ERR;
    }
@@ -719,14 +849,14 @@ main(int argc, char **argv)
 
       /* Lats and lons suitable for some South American data. */
       for (lat[0] = 40.0, i = 1; i < LAT_LEN; i++)
-	 lat[i] = lat[i - 1] + .5;
+         lat[i] = lat[i - 1] + .5;
       for (lon[0] = 20.0, i = 1; i < LON_LEN; i++)
-	 lon[i] = lon[i - 1] + 1.5;
+         lon[i] = lon[i - 1] + 1.5;
 
       /* Some phoney 2D pressure data. */
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    pres[i][j] = 1013.1 + j;
+         for (j = 0; j < LON_LEN; j++)
+            pres[i][j] = 1013.1 + j;
 
       /* Create a file. */
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
@@ -751,19 +881,19 @@ main(int argc, char **argv)
       if (nc_inq_dim(ncid, lon_dimid, name_in, &len_in)) ERR;
       if (len_in != LON_LEN || strcmp(name_in, LON_NAME)) ERR;
       if (nc_inq_var(ncid, lat_varid, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LAT_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != lat_dimid || natts_in != 0) ERR;
+          dimids_in[0] != lat_dimid || natts_in != 0) ERR;
       if (nc_inq_var(ncid, lon_varid, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != lon_dimid || natts_in != 0) ERR;
+          dimids_in[0] != lon_dimid || natts_in != 0) ERR;
 
       /* Check our data variable. */
       if (nc_inq_var(ncid, pres_varid, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, PRES_NAME) || xtype_in != NC_DOUBLE || ndims_in != 2 ||
-	  dimids_in[0] != lat_dimid || dimids_in[1] != lon_dimid || natts_in != 0) ERR;
+          dimids_in[0] != lat_dimid || dimids_in[1] != lon_dimid || natts_in != 0) ERR;
 
       /* Write our latitude and longitude values. This writes all
        * metadata to disk too. */
@@ -776,16 +906,16 @@ main(int argc, char **argv)
       /* Check our latitude and longitude values. */
       if (nc_get_var(ncid, lat_varid, lat_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 if (lat[i] != lat_in[i]) ERR;
+         if (lat[i] != lat_in[i]) ERR;
       if (nc_get_var_float(ncid, lon_varid, lon_in)) ERR;
       for (i = 0; i < LON_LEN; i++)
-	 if (lon[i] != lon_in[i]) ERR;
+         if (lon[i] != lon_in[i]) ERR;
 
       /* Check our pressure values. */
       if (nc_get_var_double(ncid, pres_varid, (double *)pres_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    if (pres[i][j] != pres_in[i][j]) ERR;
+         for (j = 0; j < LON_LEN; j++)
+            if (pres[i][j] != pres_in[i][j]) ERR;
 
       /* Close the file. */
       if (nc_close(ncid)) ERR;
@@ -799,33 +929,33 @@ main(int argc, char **argv)
       if (nc_inq_dim(ncid, lon_dimid, name_in, &len_in)) ERR;
       if (len_in != LON_LEN || strcmp(name_in, LON_NAME)) ERR;
       if (nc_inq_var(ncid, lat_varid, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LAT_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != lat_dimid || natts_in != 0) ERR;
+          dimids_in[0] != lat_dimid || natts_in != 0) ERR;
       if (nc_inq_var(ncid, lon_varid, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != lon_dimid || natts_in != 0) ERR;
+          dimids_in[0] != lon_dimid || natts_in != 0) ERR;
 
       /* Check our data variable. */
       if (nc_inq_var(ncid, pres_varid, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, PRES_NAME) || xtype_in != NC_DOUBLE || ndims_in != 2 ||
-	  dimids_in[0] != lat_dimid || dimids_in[1] != lon_dimid || natts_in != 0) ERR;
+          dimids_in[0] != lat_dimid || dimids_in[1] != lon_dimid || natts_in != 0) ERR;
 
       /* Check our latitude and longitude values. */
       if (nc_get_var(ncid, lat_varid, lat_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 if (lat[i] != lat_in[i]) ERR;
+         if (lat[i] != lat_in[i]) ERR;
       if (nc_get_var_float(ncid, lon_varid, lon_in)) ERR;
       for (i = 0; i < LON_LEN; i++)
-	 if (lon[i] != lon_in[i]) ERR;
+         if (lon[i] != lon_in[i]) ERR;
 
       /* Check our pressure values. */
       if (nc_get_var_double(ncid, pres_varid, (double *)pres_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    if (pres[i][j] != pres_in[i][j]) ERR;
+         for (j = 0; j < LON_LEN; j++)
+            if (pres[i][j] != pres_in[i][j]) ERR;
 
       if (nc_close(ncid)) ERR;
    }
@@ -854,27 +984,27 @@ main(int argc, char **argv)
 
       /* Some phony 4D pressure data. */
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    for (k = 0; k < LEVEL_LEN; k++)
-	       for (l = 0; l <TIME_LEN; l++)
-		  pres[i][j][k][l] = 1013.1 + j;
+         for (j = 0; j < LON_LEN; j++)
+            for (k = 0; k < LEVEL_LEN; k++)
+               for (l = 0; l <TIME_LEN; l++)
+                  pres[i][j][k][l] = 1013.1 + j;
 
       /* Some phony 3D hp data. */
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    for (l = 0; l <TIME_LEN; l++)
-	       hp[i][j][l] = 100 + l;
+         for (j = 0; j < LON_LEN; j++)
+            for (l = 0; l <TIME_LEN; l++)
+               hp[i][j][l] = 100 + l;
 
       /* Some phony 2D elevaton data. */
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    elev[i][j] = 1010101022223333ULL  + i + j;
+         for (j = 0; j < LON_LEN; j++)
+            elev[i][j] = 1010101022223333ULL  + i + j;
 
       /* Some phony 1D lats and lons. */
       for (i = 0; i < LAT_LEN; i++)
-	 lat[i] = i * 5.;
+         lat[i] = i * 5.;
       for (i = 0; i < LON_LEN; i++)
-	 lon[i] = i * 5.;
+         lon[i] = i * 5.;
 
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
 
@@ -932,31 +1062,31 @@ main(int argc, char **argv)
 
       /* Check our coordinate variables. */
       if (nc_inq_var(ncid, LAT_VARID, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LAT_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != LAT_DIMID || natts_in != 0) ERR;
+          dimids_in[0] != LAT_DIMID || natts_in != 0) ERR;
       if (nc_inq_var(ncid, LON_VARID, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, LON_NAME) || xtype_in != NC_FLOAT || ndims_in != 1 ||
-	  dimids_in[0] != LON_DIMID || natts_in != 0) ERR;
+          dimids_in[0] != LON_DIMID || natts_in != 0) ERR;
 
       /* Check our data variables. */
       if (nc_inq_var(ncid, PRES_VARID, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, PRES_NAME) || xtype_in != NC_DOUBLE || ndims_in != 4 ||
-	  dimids_in[0] != LAT_DIMID || dimids_in[1] != LON_DIMID ||
-	  dimids_in[2] != LEVEL_DIMID || dimids_in[3] != TIME_DIMID ||
-	  natts_in != 0) ERR;
+          dimids_in[0] != LAT_DIMID || dimids_in[1] != LON_DIMID ||
+          dimids_in[2] != LEVEL_DIMID || dimids_in[3] != TIME_DIMID ||
+          natts_in != 0) ERR;
       if (nc_inq_var(ncid, ELEV_VARID, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, ELEV_NAME) || xtype_in != NC_INT64 || ndims_in != 2 ||
-	  dimids_in[0] != LAT_DIMID || dimids_in[1] != LON_DIMID ||
-	  natts_in != 0) ERR;
+          dimids_in[0] != LAT_DIMID || dimids_in[1] != LON_DIMID ||
+          natts_in != 0) ERR;
       if (nc_inq_var(ncid, HP_VARID, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (strcmp(name_in, HP_NAME) || xtype_in != NC_USHORT || ndims_in != 3 ||
-	  dimids_in[0] != LAT_DIMID || dimids_in[1] != LON_DIMID ||
-	  dimids_in[2] != TIME_DIMID || natts_in != 0) ERR;
+          dimids_in[0] != LAT_DIMID || dimids_in[1] != LON_DIMID ||
+          dimids_in[2] != TIME_DIMID || natts_in != 0) ERR;
 
       /* Write our latitude and longitude values. This writes all
        * metadata to disk too. */
@@ -975,16 +1105,16 @@ main(int argc, char **argv)
       /* Check our latitude and longitude values. */
       if (nc_get_var(ncid, lat_varid, lat_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 if (lat[i] != lat_in[i]) ERR;
+         if (lat[i] != lat_in[i]) ERR;
       if (nc_get_var_float(ncid, lon_varid, lon_in)) ERR;
       for (i = 0; i < LON_LEN; i++)
-	 if (lon[i] != lon_in[i]) ERR;
+         if (lon[i] != lon_in[i]) ERR;
 
       /* Make sure our pressure and hp variables are still
        * empty. get_var calls will return no error, but fetch no
        * data. */
       if (nc_inq_var(ncid, pres_varid, name_in, &xtype_in, &ndims_in,
-		     dimids_in, &natts_in)) ERR;
+                     dimids_in, &natts_in)) ERR;
       if (nc_inq_dim(ncid, dimids_in[3], NULL, &len_in)) ERR;
       if (len_in != 0) ERR;
       memset(pres_in, 0, sizeof(pres_in));
@@ -992,13 +1122,13 @@ main(int argc, char **argv)
 
       /* Check our pressure values. */
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    for (k = 0; k < LEVEL_LEN; k++)
-	       for (l = 0; l <TIME_LEN; l++)
-		  if (0 != pres_in[i][j][k][l]) ERR;
+         for (j = 0; j < LON_LEN; j++)
+            for (k = 0; k < LEVEL_LEN; k++)
+               for (l = 0; l <TIME_LEN; l++)
+                  if (0 != pres_in[i][j][k][l]) ERR;
 
       if (nc_inq_var(ncid, hp_varid, NULL, NULL, &ndims_in,
-		     dimids_in, NULL)) ERR;
+                     dimids_in, NULL)) ERR;
       if (nc_inq_dim(ncid, dimids_in[2], NULL, &len_in)) ERR;
       if (len_in != 0) ERR;
       memset(hp_in, 0, sizeof(hp_in));
@@ -1006,9 +1136,9 @@ main(int argc, char **argv)
 
       /* Check our hp values. */
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    for (l = 0; l <TIME_LEN; l++)
-	       if (0 != hp_in[i][j][l]) ERR;
+         for (j = 0; j < LON_LEN; j++)
+            for (l = 0; l <TIME_LEN; l++)
+               if (0 != hp_in[i][j][l]) ERR;
 
       /* Now use nc_put_vara to really write pressure and hp
        * data. Write TIME_LEN (4) records of each. */
@@ -1018,31 +1148,31 @@ main(int argc, char **argv)
       count[2] = LEVEL_LEN;
       count[3] = TIME_LEN;
       if (nc_put_vara(ncid, pres_varid, start, count,
-		      (double *)pres)) ERR;
+                      (double *)pres)) ERR;
       count[2] = TIME_LEN;
       if (nc_put_vara(ncid, hp_varid, start, count,
-		      (double *)hp)) ERR;
+                      (double *)hp)) ERR;
 
       /* Check our pressure values. */
       if (nc_get_var_double(ncid, pres_varid, (double *)pres_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    for (k = 0; k < LEVEL_LEN; k++)
-	       for (l = 0; l <TIME_LEN; l++)
-		  if (pres[i][j][k][l] != pres_in[i][j][k][l]) ERR;
+         for (j = 0; j < LON_LEN; j++)
+            for (k = 0; k < LEVEL_LEN; k++)
+               for (l = 0; l <TIME_LEN; l++)
+                  if (pres[i][j][k][l] != pres_in[i][j][k][l]) ERR;
 
       /* Check our elevation values. */
       if (nc_get_var_ulonglong(ncid, elev_varid, (unsigned long long *)elev_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    if (elev[i][j] != elev_in[i][j]) ERR;
+         for (j = 0; j < LON_LEN; j++)
+            if (elev[i][j] != elev_in[i][j]) ERR;
 
       /* Check our hp values. */
       if (nc_get_var_ushort(ncid, hp_varid, (unsigned short *)hp_in)) ERR;
       for (i = 0; i < LAT_LEN; i++)
-	 for (j = 0; j < LON_LEN; j++)
-	    for (l = 0; l <TIME_LEN; l++)
-	       if (hp[i][j][l] != hp_in[i][j][l]) ERR;
+         for (j = 0; j < LON_LEN; j++)
+            for (l = 0; l <TIME_LEN; l++)
+               if (hp[i][j][l] != hp_in[i][j][l]) ERR;
 
       /* Close the file. */
       if (nc_close(ncid)) ERR;
@@ -1108,7 +1238,7 @@ main(int argc, char **argv)
 
       /* Define a coordinate var. */
       if (nc_def_var(ncid, LON_NAME_EX, NC_FLOAT, 1, &lon_dimid,
-			       &lon_varid)) ERR;
+                     &lon_varid)) ERR;
 
       /* Close the file. */
       if (nc_close(ncid)) ERR;
@@ -1121,11 +1251,11 @@ main(int argc, char **argv)
       if (ndims_in != 2) ERR;
       for (i = 0; i < 2; i++)
       {
-	 if (dimid[i] != i) ERR;
-	 if (nc_inq_dimname(ncid, i, dim_name_in[i])) ERR;
+         if (dimid[i] != i) ERR;
+         if (nc_inq_dimname(ncid, i, dim_name_in[i])) ERR;
       }
       if (strcmp(dim_name_in[0], LAT_NAME_EX) ||
-	  strcmp(dim_name_in[1], LON_NAME_EX)) ERR;
+          strcmp(dim_name_in[1], LON_NAME_EX)) ERR;
 
       /* Close the file. */
       if (nc_close(ncid)) ERR;
@@ -1142,43 +1272,43 @@ main(int argc, char **argv)
 
       if (SIZEOF_SIZE_T == 8)
       {
-	 /* Create a file with one dim and nothing else. */
-	 if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
-	 if (nc_def_dim(ncid, LAT_NAME, VERY_LONG_LEN, &dimid)) ERR;
-
-	 /* Check it out. */
-	 if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
-	 if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
-	     strcmp(name_in, LAT_NAME)) ERR;
-	 if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
-	 if (ndims_in != 1) ERR;
-	 if (nc_inq_dimid(ncid, LAT_NAME, &varid_in)) ERR;
-	 if (varid_in != 0) ERR;
-	 if (nc_inq_dimname(ncid, 0, name_in)) ERR;
-	 if (strcmp(name_in, LAT_NAME)) ERR;
-	 if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
-	 if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT)) ERR;
-	 if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
-	 if (ndims_in != 0) ERR;
-	 if (nc_close(ncid)) ERR;
-
-	 /* Reopen and check it out again. */
-	 if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
-	 /* Check it out. */
-	 if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
-	 if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
-	     strcmp(name_in, LAT_NAME)) ERR;
-	 if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
-	 if (ndims_in != 1) ERR;
-	 if (nc_inq_dimid(ncid, LAT_NAME, &varid_in)) ERR;
-	 if (varid_in != 0) ERR;
-	 if (nc_inq_dimname(ncid, 0, name_in)) ERR;
-	 if (strcmp(name_in, LAT_NAME)) ERR;
-	 if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
-	 if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT)) ERR;
-	 if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
-	 if (ndims_in != 0) ERR;
-	 if (nc_close(ncid)) ERR;
+         /* Create a file with one dim and nothing else. */
+         if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+         if (nc_def_dim(ncid, LAT_NAME, VERY_LONG_LEN, &dimid)) ERR;
+
+         /* Check it out. */
+         if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
+         if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
+             strcmp(name_in, LAT_NAME)) ERR;
+         if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
+         if (ndims_in != 1) ERR;
+         if (nc_inq_dimid(ncid, LAT_NAME, &varid_in)) ERR;
+         if (varid_in != 0) ERR;
+         if (nc_inq_dimname(ncid, 0, name_in)) ERR;
+         if (strcmp(name_in, LAT_NAME)) ERR;
+         if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
+         if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT)) ERR;
+         if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
+         if (ndims_in != 0) ERR;
+         if (nc_close(ncid)) ERR;
+
+         /* Reopen and check it out again. */
+         if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
+         /* Check it out. */
+         if (nc_inq_dim(ncid, dimid, name_in, &len_in)) ERR;
+         if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT) ||
+             strcmp(name_in, LAT_NAME)) ERR;
+         if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
+         if (ndims_in != 1) ERR;
+         if (nc_inq_dimid(ncid, LAT_NAME, &varid_in)) ERR;
+         if (varid_in != 0) ERR;
+         if (nc_inq_dimname(ncid, 0, name_in)) ERR;
+         if (strcmp(name_in, LAT_NAME)) ERR;
+         if (nc_inq_dimlen(ncid, 0, &len_in)) ERR;
+         if (len_in != ((SIZEOF_SIZE_T == 8) ? VERY_LONG_LEN : NC_MAX_UINT)) ERR;
+         if (nc_inq_unlimdims(ncid, &ndims_in, dimids_in)) ERR;
+         if (ndims_in != 0) ERR;
+         if (nc_close(ncid)) ERR;
       }
    }
    SUMMARIZE_ERR;
@@ -1196,8 +1326,8 @@ main(int argc, char **argv)
       strcpy(file_in, "");
       if (getenv("srcdir"))
       {
-	 strcat(file_in, getenv("srcdir"));
-	 strcat(file_in, "/");
+         strcat(file_in, getenv("srcdir"));
+         strcat(file_in, "/");
       }
       strcat(file_in, REF_FILE_NAME);
 
@@ -1207,14 +1337,14 @@ main(int argc, char **argv)
       /* Check it out. */
       ret = nc_inq_dim(ncid, dimid, name_in, &len_in);
       if ((SIZEOF_SIZE_T >= 8 && ret) ||
-	  (SIZEOF_SIZE_T < 8 && ret != NC_EDIMSIZE)) ERR;
+          (SIZEOF_SIZE_T < 8 && ret != NC_EDIMSIZE)) ERR;
       if (SIZEOF_SIZE_T < 8)
       {
-	 if (len_in != NC_MAX_UINT) ERR;
+         if (len_in != NC_MAX_UINT) ERR;
       }
       else
       {
-	 if (len_in != VERY_LONG_LEN) ERR;
+         if (len_in != VERY_LONG_LEN) ERR;
       }
       if (strcmp(name_in, LAT_NAME)) ERR;
       if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
diff --git a/nc_test4/tst_filter.sh b/nc_test4/tst_filter.sh
index 2accb83..1dc5df1 100755
--- a/nc_test4/tst_filter.sh
+++ b/nc_test4/tst_filter.sh
@@ -55,11 +55,11 @@ if ! test -f ${MISCPATH} ; then echo "Unable to locate ${MISCPATH}"; exit 1; fi
 
 if test "x$API" = x1 ; then
 echo "*** Testing dynamic filters using API"
-rm -f ./bzip2.nc ./bzip2.dump ./tmp
+rm -f ./bzip2.nc ./bzip2.dump ./tst_filter.txt
 ${execdir}/test_filter
-${NCDUMP} -s bzip2.nc > ./tmp
+${NCDUMP} -s bzip2.nc > ./tst_filter.txt
 # Remove irrelevant -s output
-sclean ./tmp ./bzip2.dump
+sclean ./tst_filter.txt ./bzip2.dump
 diff -b -w ${srcdir}/bzip2.cdl ./bzip2.dump
 echo "*** Pass: API dynamic filter"
 fi
@@ -67,61 +67,88 @@ fi
 if test "x$MISC" = x1 ; then
 echo
 echo "*** Testing dynamic filters parameter passing"
-rm -f ./testmisc.nc tmp tmp2
+rm -f ./testmisc.nc tst_filter.txt tst_filter2.txt
 ${execdir}/test_filter_misc
 # Verify the parameters via ncdump
-${NCDUMP} -s testmisc.nc > ./tmp
+${NCDUMP} -s testmisc.nc > ./tst_filter.txt
 # Extract the parameters
-getfilterattr ./tmp ./tmp2
-rm -f ./tmp
-trimleft ./tmp2 ./tmp
-rm -f ./tmp2
-cat >./tmp2 <<EOF
+getfilterattr ./tst_filter.txt ./tst_filter2.txt
+rm -f ./tst_filter.txt
+trimleft ./tst_filter2.txt ./tst_filter.txt
+rm -f ./tst_filter2.txt
+cat >./tst_filter2.txt <<EOF
 var:_Filter = "32768,1,239,23,65511,27,77,93,1145389056,3287505826,1097305129,1,2147483648,4294967295,4294967295" ;
 EOF
-diff -b -w ./tmp ./tmp2
+diff -b -w ./tst_filter.txt ./tst_filter2.txt
 echo "*** Pass: parameter passing"
 fi
 
 if test "x$NG" = x1 ; then
 echo "*** Testing dynamic filters using ncgen"
-rm -f ./bzip2.nc ./bzip2.dump ./tmp
+rm -f ./bzip2.nc ./bzip2.dump ./tst_filter.txt
 ${NCGEN} -lb -4 -o bzip2.nc ${srcdir}/bzip2.cdl
-${NCDUMP} -s bzip2.nc > ./tmp
+${NCDUMP} -s bzip2.nc > ./tst_filter.txt
 # Remove irrelevant -s output
-sclean ./tmp ./bzip2.dump
+sclean ./tst_filter.txt ./bzip2.dump
 diff -b -w ${srcdir}/bzip2.cdl ./bzip2.dump
 echo "*** Pass: ncgen dynamic filter"
 fi
 
 if test "x$NCP" = x1 ; then
 echo "*** Testing dynamic filters using nccopy"
-rm -f ./unfiltered.nc ./filtered.nc ./filtered.dump ./tmp
+rm -f ./unfiltered.nc ./filtered.nc ./tmp.nc ./filtered.dump ./tst_filter.txt
 ${NCGEN} -4 -lb -o unfiltered.nc ${srcdir}/unfiltered.cdl
+echo "	*** Testing simple filter application"
 ${NCCOPY} -F "/g/var,307,9,4" unfiltered.nc filtered.nc
-${NCDUMP} -s filtered.nc > ./tmp
+${NCDUMP} -s filtered.nc > ./tst_filter.txt
 # Remove irrelevant -s output
-sclean ./tmp ./filtered.dump
+sclean ./tst_filter.txt ./filtered.dump
 diff -b -w ${srcdir}/filtered.cdl ./filtered.dump
-echo "*** Pass: nccopy dynamic filter"
+echo "	*** Pass: nccopy simple filter"
+
+echo "	*** Testing pass-thru of filters"
+rm -f ./tst_filter.txt tst_filter2.txt ./tst_filter2.nc
+${NCCOPY} ./filtered.nc ./tst_filter2.nc
+${NCDUMP} -s tst_filter2.nc > ./tst_filter.txt
+sed -e '/_Filter/p' -e d < ./tst_filter.txt >tst_filter2.txt
+test -s tst_filter2.txt
+echo "	*** Pass: pass-thru of filters"
+
+echo "	*** Testing -F none"
+rm -f ./tst_filter.txt ./tst_filter2.txt ./tst_filter.nc
+${NCCOPY} -F none ./filtered.nc ./tst_filter.nc
+${NCDUMP} -s tst_filter.nc > ./tst_filter.txt
+sed -e '/_Filter/p' -e d < ./tst_filter.txt >./tst_filter2.txt
+test ! -s tst_filter2.txt
+echo "	*** Pass: -F none"
+
+echo "	*** Testing -F var,none "
+rm -f ./tst_filter.txt ./tst_filter.nc
+${NCCOPY} -F "/g/var,none" ./filtered.nc ./tst_filter.nc
+${NCDUMP} -s tst_filter.nc > ./tst_filter.txt
+sed -e '/_Filter/p' -e d < ./tst_filter.txt >tst_filter2.txt
+test ! -s tst_filter2.txt
+echo "	*** Pass: -F var,none"
+
+echo "*** Pass: all nccopy filter tests"
 fi
 
 if test "x$UNK" = x1 ; then
 echo "*** Testing access to filter info when filter dll is not available"
-rm -f bzip2.nc ./tmp
+rm -f bzip2.nc ./tst_filter.txt
 # build bzip2.nc
 ${NCGEN} -lb -4 -o bzip2.nc ${srcdir}/bzip2.cdl
 # dump and clean bzip2.nc header only when filter is avail
-${NCDUMP} -hs bzip2.nc > ./tmp
+${NCDUMP} -hs bzip2.nc > ./tst_filter.txt
 # Remove irrelevant -s output
-sclean ./tmp bzip2.dump
+sclean ./tst_filter.txt bzip2.dump
 # Now hide the filter code
 mv ${BZIP2PATH} ${BZIP2PATH}.save
 # dump and clean bzip2.nc header only when filter is not avail
-rm -f ./tmp
-${NCDUMP} -hs bzip2.nc > ./tmp
+rm -f ./tst_filter.txt
+${NCDUMP} -hs bzip2.nc > ./tst_filter.txt
 # Remove irrelevant -s output
-sclean ./tmp bzip2x.dump
+sclean ./tst_filter.txt bzip2x.dump
 # Restore the filter code
 mv ${BZIP2PATH}.save ${BZIP2PATH}
 diff -b -w ./bzip2.dump ./bzip2x.dump
@@ -137,10 +164,10 @@ echo "*** Pass: ncgen dynamic filter"
 fi
 
 #cleanup
-rm -f ./bzip*.nc ./unfiltered.nc ./filtered.nc ./tmp ./tmp2 *.dump bzip*hdr.*
-rm -fr ./test_bzip2.c
-rm -fr ./testmisc.nc
-
+rm -f ./bzip*.nc ./unfiltered.nc ./filtered.nc ./tst_filter.txt ./tst_filter2.txt *.dump bzip*hdr.*
+rm -f ./test_bzip2.c
+rm -f ./testmisc.nc
+rm -f ./tst_filter2.nc
 echo "*** Pass: all selected tests passed"
 
 exit 0
diff --git a/nc_test4/tst_filterparser.c b/nc_test4/tst_filterparser.c
index 16226ac..166bfa8 100644
--- a/nc_test4/tst_filterparser.c
+++ b/nc_test4/tst_filterparser.c
@@ -13,11 +13,10 @@
 
 #define PARAMS_ID 32768
 
-#if defined  _MSC_VER || defined __APPLE__
+/* The C standard apparently defines all floating point constants as double;
+   we rely on that in this code.
+*/
 #define DBLVAL 12345678.12345678
-#else
-#define DBLVAL 12345678.12345678d
-#endif
 
 #define MAXPARAMS 32
 #define NPARAMS 16 /* # of unsigned ints in params */
@@ -64,7 +63,7 @@ mismatch(size_t i, unsigned int *params, const char* tag)
 static void
 mismatch2(size_t i, unsigned int *params, const char* tag)
 {
-    fprintf(stderr,"mismatch2: %s [%d-%d] baseline=%ud,%ud params=%u,%u\n",
+    fprintf(stderr,"mismatch2: %s [%d-%ld] baseline=%ud,%ud params=%u,%u\n",
 	tag,(int)i,i+1,baseline[i],baseline[i+1],params[i],params[i+1]);
     fflush(stderr);
     nerrs++;
diff --git a/nc_test4/tst_formatx_hdf4.sh b/nc_test4/tst_formatx_hdf4.sh
deleted file mode 100755
index f008fe3..0000000
--- a/nc_test4/tst_formatx_hdf4.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-# This shell script tests the output several previous tests.
-# Ed Hartnett
-
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
-FILE=tst_interops2.h4
-
-ECODE=0
-
-echo ""
-echo "*** Testing extended file format output."
-set -e
-
-echo "Creating HDF4 file"
-${execdir}/tst_interops2
-
-echo "Test extended format output for a HDF4 file"
-rm -f tmp_tst_formatx_hdf4
-${NCDUMP} -K $FILE >tmp_tst_formatx_hdf4
-if ! fgrep 'HDF4 mode=00001000' <tmp_tst_formatx_hdf4 ; then
-TMP=`cat tmp_tst_formatx_hdf4`
-echo "*** Fail: extended format for an HDF4 file: result=" $TMP
-ECODE=1
-fi
-
-rm -f tmp_tst_formatx_hdf4
-
-exit $ECODE
-
-
diff --git a/nc_test4/tst_grps.c b/nc_test4/tst_grps.c
index a404214..7dc8c25 100644
--- a/nc_test4/tst_grps.c
+++ b/nc_test4/tst_grps.c
@@ -41,7 +41,7 @@ main(int argc, char **argv)
       int henry_vii_id;
       int henry_viii_id;
       int grpid_in[MAX_SIBLING_GROUPS], varids_in[MAX_SIBLING_GROUPS];
-      int dimids_in[MAX_SIBLING_GROUPS], nvars_in, ndims_in, ncid_in;
+      int nvars_in, ncid_in;
       int parent_ncid;
       char name_out[NC_MAX_NAME + 1];
       int num_grps;
@@ -114,13 +114,13 @@ main(int argc, char **argv)
       /* Create a classic model file. No groups will be allowed. */
       if (nc_create(FILE_NAME_CLASSIC_MODEL, NC_NETCDF4|NC_CLASSIC_MODEL, &ncid2)) ERR;
       if (nc_def_grp(ncid2, HENRY_VII, &henry_vii_id) != NC_ESTRICTNC3) ERR;
-      if (nc_def_var(ncid2, HENRY_IV, NC_INT, 0, NULL, NULL));
+      if (nc_def_var(ncid2, HENRY_IV, NC_INT, 0, NULL, NULL)) ERR;
       if (nc_close(ncid2)) ERR;
 
       /* Create a file with one group, a group to contain data about
        * Henry VII. */
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
-      if (nc_def_var(ncid, HENRY_IV, NC_INT, 0, NULL, NULL));      
+      if (nc_def_var(ncid, HENRY_IV, NC_INT, 0, NULL, NULL)) ERR;      
 
       /* Turn off define mode. It will automatically be turned back on
        * when nc_def_grp is called. */
diff --git a/nc_test4/tst_h5_endians.c b/nc_test4/tst_h5_endians.c
index 3d9d839..081f878 100644
--- a/nc_test4/tst_h5_endians.c
+++ b/nc_test4/tst_h5_endians.c
@@ -7,10 +7,8 @@
  * Test contributed by Jeff Whitaker
  */
 
-#include <string.h>
-#include <netcdf.h>
-#include <stdio.h>
 #include <nc_tests.h>
+#include <string.h>
 #include "nc_logging.h"
 
 #define FILE_NAME_NC "tst_h5_endians.nc"
diff --git a/nc_test4/tst_hdf4_read_var.sh b/nc_test4/tst_hdf4_read_var.sh
deleted file mode 100755
index a59d96f..0000000
--- a/nc_test4/tst_hdf4_read_var.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-# This shell script tests that an hdf4 file can be read a
-# variable at a time.
-#
-# this was added in support of https://github.com/Unidata/netcdf-c/issues/264
-
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
-
-FILE=tst_interops2.h4
-
-set -e
-
-echo ""
-echo "*** Testing reading an individual variable from an HDF4 file."
-
-${NCDUMP} -v hdf4_dataset_type_0 $FILE
-${NCDUMP} -v hdf4_dataset_type_1 $FILE
-${NCDUMP} -v hdf4_dataset_type_2 $FILE
-${NCDUMP} -v hdf4_dataset_type_3 $FILE
-${NCDUMP} -v hdf4_dataset_type_4 $FILE
-${NCDUMP} -v hdf4_dataset_type_5 $FILE
-${NCDUMP} -v hdf4_dataset_type_6 $FILE
-${NCDUMP} -v hdf4_dataset_type_7 $FILE
-
-echo "*** Success."
diff --git a/nc_test4/tst_nc_test_file.c b/nc_test4/tst_nc_test_file.c
deleted file mode 100644
index 70d3f4a..0000000
--- a/nc_test4/tst_nc_test_file.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* This is a quickie tester for netcdf-4. 
-   $Id: tst_nc_test_file.c,v 1.7 2005/12/29 19:16:19 ed Exp $
-*/
-
-#include <tests.h>
-
-#define FILE_NAME "../nc_test/nc_test_netcdf4.nc"
-
-int
-main()
-{
-   int ncid;
-   int retval; 
-   size_t start[1] = {0}, count[1] = {2};
-   ptrdiff_t stride[1] = {2};
-   short short_data[256];
-   float float_data[256];
-
-   printf("\n*** Testing with file %s\n", FILE_NAME);
-
-   /*nc_set_log_level(4);*/
-
-   printf("*** Testing whether we can open and read from it...");
-   if ((retval = nc_open(FILE_NAME, 0, &ncid))) ERR;
-   if ((retval = nc_get_vars_short(ncid, 35, start, count, stride, 
-				   short_data)) != NC_ERANGE) ERR;
-   if ((retval = nc_get_vars(ncid, 35, start, count, stride, short_data))) ERR;
-   if ((retval = nc_close(ncid))) ERR;
-
-   SUMMARIZE_ERR;
-
-   FINAL_RESULTS;
-}
diff --git a/nc_test4/tst_put_vars_two_unlim_dim.c b/nc_test4/tst_put_vars_two_unlim_dim.c
index 98a9b13..785d0d5 100644
--- a/nc_test4/tst_put_vars_two_unlim_dim.c
+++ b/nc_test4/tst_put_vars_two_unlim_dim.c
@@ -3,6 +3,7 @@
  * https://github.com/Unidata/netcdf-c/issues/160
  */
 
+#include <config.h>
 #include "netcdf.h"
 
 #include <stdio.h>
diff --git a/nc_test4/tst_rehash.c b/nc_test4/tst_rehash.c
index 460dee9..c594bd1 100644
--- a/nc_test4/tst_rehash.c
+++ b/nc_test4/tst_rehash.c
@@ -8,10 +8,11 @@
    Tests to see if the hashmap is being properly updated.
 
    */
+#include <config.h>
+#include <netcdf.h>
 
 #define FILENAME "tst_rehash.nc"
 
-#include <netcdf.h>
 int main()
 {
   int  status;
diff --git a/nc_test4/tst_rename.c b/nc_test4/tst_rename.c
index 87ba17e..83e79db 100644
--- a/nc_test4/tst_rename.c
+++ b/nc_test4/tst_rename.c
@@ -22,6 +22,13 @@
 #define VAR_RANK 1              /* all vars in this test are of same rank */
 #define DIM_LEN 2               /* all dims in this test are of same len */
 
+/* For the tests based on Charlie Zender's rename bug test. */
+#define CHARLIE_TEST_FILE "tst_charlie_rename_coord_dim.nc"
+#define LON "lon"
+#define LONGITUDE "longitude"
+#define DIM1_LEN 4
+#define NDIM1 1
+
 /* Test data. */
 int lats[DIM_LEN] = {-90, 90};
 float rh[DIM_LEN] = {0.25, 0.75};
@@ -61,7 +68,7 @@ check_file(int ncid, char *var0_name, char *var1_name, char *dim_name)
 
    /* printf("checking for vars %s and %s, dim %s\n", var0_name, var1_name, */
    /*        dim_name); */
-   
+
    /* Check vars. Ids will change because of rename. */
    if (nc_inq_varid(ncid, var0_name, &varid)) ERR;
    if (nc_inq_varid(ncid, var1_name, &var2id)) ERR;
@@ -69,7 +76,7 @@ check_file(int ncid, char *var0_name, char *var1_name, char *dim_name)
    /* Check dim. */
    if (nc_inq_dimid(ncid, dim_name, &dimid)) ERR;
    if (dimid != 0) ERR;
-   
+
    /* Check the lats. */
    if (nc_get_var_int(ncid, varid, lats_in)) ERR;
    for (ii = 0; ii < DIM_LEN; ii++)
@@ -92,7 +99,7 @@ check_charlies_file(char *file, char *dim_name, char *var_name)
 {
    int ncid;
    int varid, dimid;
-   
+
    if (nc_open(file, 0, &ncid)) ERR;
    if (nc_inq_varid(ncid, var_name, &varid)) ERR;
    if (nc_inq_dimid(ncid, dim_name, &dimid)) ERR;
@@ -101,6 +108,19 @@ check_charlies_file(char *file, char *dim_name, char *var_name)
    return NC_NOERR;
 }
 
+/* Check a data-free version of the already-open file created in a
+ * test. */
+int
+check_charlies_no_enddef_file(int ncid, char *dim_name, char *var_name)
+{
+   int varid, dimid;
+
+   if (nc_inq_varid(ncid, var_name, &varid)) ERR;
+   if (nc_inq_dimid(ncid, dim_name, &dimid)) ERR;
+   if (varid || dimid) ERR;
+   return NC_NOERR;
+}
+
 int
 main(int argc, char **argv)
 {
@@ -111,10 +131,9 @@ main(int argc, char **argv)
    int format;
 
    fprintf(stderr,"*** Testing netcdf rename bugs and fixes.\n");
-   nc_set_log_level(5);
+   /* nc_set_log_level(5); */
 
    for (format = 0; format < NUM_FORMATS; format++)
-   /* for (format = 0; format < 1; format++) */
    {
       int ncid, dimid, varid, var2id;
       int lats[DIM_LEN] = {-90, 90};
@@ -123,13 +142,79 @@ main(int argc, char **argv)
       float rh_in[DIM_LEN];
       int ii;
 
-      fprintf(stderr,"*** Test Charlie's test for renaming...");
+      fprintf(stderr,"*** Test Charlie's test for renaming without enddef...");
+      {
+         int ncid, dimid, varid;
+
+         /* Create a nice, simple file. This file will contain one
+          * dataset, "lon", which is a dimscale. */
+         if (nc_create(CHARLIE_TEST_FILE, NC_NETCDF4, &ncid)) ERR;
+         if (nc_def_dim(ncid, LON, DIM1_LEN, &dimid)) ERR;
+         if (nc_def_var(ncid, LON, NC_FLOAT, NDIM1, &dimid, &varid)) ERR;
+
+         /* Check the file. */
+         if (check_charlies_no_enddef_file(ncid, LON, LON)) ERR;
+
+         /* Rename the dimension. This will cause lon to stop being a
+          * coord var and dimscale, and prepare to create a new
+          * dimscale without var dataset "longitude". Dataset "lon"
+          * will point to "longitude" as its dimscale. */
+         if (nc_rename_dim(ncid, 0, LONGITUDE)) ERR;
+         if (check_charlies_no_enddef_file(ncid, LONGITUDE, LON)) ERR;
+
+         /* Rename the variable. This will remove the (as yet
+          * unwritten) dimscale-only dataset "longitude" and rename
+          * the extisting dataset "lon" to "longitude". Variable
+          * "longitude" will become a coordinate var. */
+         if (nc_rename_var(ncid, 0, LONGITUDE)) ERR;
+         if (check_charlies_no_enddef_file(ncid, LONGITUDE, LONGITUDE)) ERR;
+         if (nc_close(ncid)) ERR;
+
+         /* Reopen the file and check. */
+         if (check_charlies_file(CHARLIE_TEST_FILE, LONGITUDE, LONGITUDE)) ERR;
+
+      }
+      SUMMARIZE_ERR;
+      fprintf(stderr,"*** Test Charlie's test for renaming with one enddef...");
+      {
+         int ncid, dimid, varid;
+
+         /* Create a nice, simple file. This file will contain one
+          * dataset, "lon", which is a dimscale. */
+         if (nc_create(CHARLIE_TEST_FILE, NC_NETCDF4, &ncid)) ERR;
+         if (nc_def_dim(ncid, LON, DIM1_LEN, &dimid)) ERR;
+         if (nc_def_var(ncid, LON, NC_FLOAT, NDIM1, &dimid, &varid)) ERR;
+
+         /* Check the file. */
+         if (check_charlies_no_enddef_file(ncid, LON, LON)) ERR;
+
+         /* Rename the dimension. This will cause lon to stop being a
+          * coord var and dimscale, and prepare to create a new
+          * dimscale without var dataset "longitude". Dataset "lon"
+          * will point to "longitude" as its dimscale. */
+         if (nc_rename_dim(ncid, 0, LONGITUDE)) ERR;
+         if (check_charlies_no_enddef_file(ncid, LONGITUDE, LON)) ERR;
+
+         /* Trigger write to disk. */
+         if (nc_enddef(ncid)) ERR;
+         if (nc_redef(ncid)) ERR;
+         if (check_charlies_no_enddef_file(ncid, LONGITUDE, LON)) ERR;
+
+         /* Rename the variable. This will remove the (as yet
+          * unwritten) dimscale-only dataset "longitude" and rename
+          * the extisting dataset "lon" to "longitude". Variable
+          * "longitude" will become a coordinate var. */
+         if (nc_rename_var(ncid, 0, LONGITUDE)) ERR;
+         if (check_charlies_no_enddef_file(ncid, LONGITUDE, LONGITUDE)) ERR;
+         if (nc_close(ncid)) ERR;
+
+         /* Reopen the file and check. */
+         if (check_charlies_file(CHARLIE_TEST_FILE, LONGITUDE, LONGITUDE)) ERR;
+
+      }
+      SUMMARIZE_ERR;
+      fprintf(stderr,"*** Test Charlie's test for renaming with enddef...");
       {
-#define CHARLIE_TEST_FILE "tst_charlie_rename_coord_dim.nc"
-#define LON "lon"
-#define LONGITUDE "longitude"
-#define DIM1_LEN 4
-#define NDIM1 1
          int ncid, dimid, varid;
          float data[DIM1_LEN] = {0, 90.0, 180.0, 270.0};
 
@@ -162,14 +247,14 @@ main(int argc, char **argv)
           * the dimscale-only dataset "longitude" and rename the
           * extisting dataset "lon" to "longitude". Variable
           * "longitude" will become a coordinate var. */
-         /* if (nc_open(CHARLIE_TEST_FILE, NC_WRITE, &ncid)) ERR; */
-         /* if (nc_redef(ncid)) ERR; */
-         /* if (nc_rename_var(ncid, 0, LONGITUDE)) ERR; */
-         /* if (nc_enddef(ncid)) ERR; */
-         /* if (nc_close(ncid)) ERR; */
+         if (nc_open(CHARLIE_TEST_FILE, NC_WRITE, &ncid)) ERR;
+         if (nc_redef(ncid)) ERR;
+         if (nc_rename_var(ncid, 0, LONGITUDE)) ERR;
+         if (nc_enddef(ncid)) ERR;
+         if (nc_close(ncid)) ERR;
 
          /* Reopen the file to check. */
-         /* if (check_charlies_file(CHARLIE_TEST_FILE, LONGITUDE, LONGITUDE)) ERR; */
+         if (check_charlies_file(CHARLIE_TEST_FILE, LONGITUDE, LONGITUDE)) ERR;
       }
       SUMMARIZE_ERR;
 
@@ -177,7 +262,7 @@ main(int argc, char **argv)
       {
          int ncid, varid, var2id;
          int dimid;
-         
+
          if (nc_set_default_format(formats[format], NULL)) ERR;
          if (nc_create(file_names[format], 0, &ncid)) ERR;
          if (nc_def_dim(ncid, LAT, DIM_LEN, &dimid)) ERR;
@@ -187,7 +272,7 @@ main(int argc, char **argv)
          /* Now rename the dim. */
          if (nc_rename_dim(ncid, dimid, TAL)) ERR;
          if (nc_rename_var(ncid, varid, TAL)) ERR;
-         
+
          if (nc_enddef(ncid)) ERR;    /* not necessary for netCDF-4 files */
          if (nc_put_var_int(ncid, varid, lats)) ERR;
          if (nc_put_var_float(ncid, var2id, rh)) ERR;
@@ -204,7 +289,7 @@ main(int argc, char **argv)
       {
          int ncid, varid, var2id;
          int dimid;
-         
+
          if (nc_set_default_format(formats[format], NULL)) ERR;
          if (nc_create(file_names[format], 0, &ncid)) ERR;
          if (nc_def_dim(ncid, LAT, DIM_LEN, &dimid)) ERR;
@@ -216,7 +301,7 @@ main(int argc, char **argv)
          if (nc_rename_var(ncid, varid, TAL2)) ERR;
          if (nc_rename_dim(ncid, dimid, TAL)) ERR;
          if (nc_enddef(ncid)) ERR;
-         
+
          if (nc_put_var_int(ncid, varid, lats)) ERR;
          if (nc_put_var_float(ncid, var2id, rh)) ERR;
          if (nc_close(ncid)) ERR;
@@ -231,7 +316,7 @@ main(int argc, char **argv)
       {
          int ncid, varid, var2id;
          int dimid;
-         
+
          /* This will create a HDF5 file with two datasets, RH, and
           * LAT. LAT is a dimscale. RH points to dimscale LAT. Life is
           * so simple. */
@@ -278,7 +363,7 @@ main(int argc, char **argv)
       {
          int ncid, varid, var2id;
          int dimid;
-         
+
          if (nc_set_default_format(formats[format], NULL)) ERR;
          if (nc_create(file_names[format], 0, &ncid)) ERR;
          if (nc_def_dim(ncid, LAT, DIM_LEN, &dimid)) ERR;
@@ -291,19 +376,18 @@ main(int argc, char **argv)
          if (nc_rename_dim(ncid, dimid, TAL)) ERR;
          if (nc_rename_var(ncid, varid, TAL)) ERR;
          if (nc_enddef(ncid)) ERR;    /* not necessary for netCDF-4 files */
-         
+
          if (nc_put_var_int(ncid, varid, lats)) ERR;
          if (nc_put_var_float(ncid, var2id, rh)) ERR;
          if (nc_close(ncid)) ERR;
 
          /* Reopen and check. */
          if (nc_open(file_names[format], NC_WRITE, &ncid)) ERR;
-         /* if (check_file(ncid, LAT, RH, TAL)) ERR; */
-         /* if (check_file(ncid, TAL, RH, TAL)) ERR; */
+         if (check_file(ncid, TAL, RH, TAL)) ERR;
          if (nc_close(ncid)) ERR;
       }
       SUMMARIZE_ERR;
-      
+
       printf("*** testing renaming after enddef for %s...", fmt_names[format]);
       {
          /* Create a file with datasets LAT, RH. LAT is a dimscale. RH
@@ -327,10 +411,13 @@ main(int argc, char **argv)
           * TAL. LAT will become a dimscale. RH will point to LAT. */
          if (nc_rename_var(ncid, varid, TAL)) ERR;
          if (nc_enddef(ncid)) ERR;
+         /* This should work but does not. It is a known rename
+          * bug. Rename is coming! */
          /* if (check_file(ncid, LAT, RH, TAL)) ERR; */
          if (nc_close(ncid)) ERR;
 
          if (nc_open(file_names[format], NC_WRITE, &ncid)) ERR;
+         /* Should work but does not. Raname issues. */
          /* if (check_file(ncid, LAT, RH, TAL)) ERR; */
          if (nc_close(ncid)) ERR;
       }
@@ -344,8 +431,7 @@ main(int argc, char **argv)
          if (nc_inq_dimid(ncid, ODIM_NAME, &dimid)) ERR;
          if (nc_inq_varid(ncid, OVAR_NAME, &varid)) ERR;
          if (nc_inq_varid(ncid, OVAR2_NAME, &var2id)) ERR;
-         if (nc_redef(ncid)) ERR;  /* omitting this and nc_enddef call eliminates bug */
-         /* if (nc_rename_dim(ncid, dimid, NDIM_NAME)) ERR; */
+         if (nc_redef(ncid)) ERR;
          if (nc_rename_var(ncid, varid, NVAR_NAME)) ERR;
          if (nc_enddef(ncid)) ERR;
          if (nc_get_var_int(ncid, varid, lats_in)) ERR;
@@ -370,9 +456,8 @@ main(int argc, char **argv)
          if (nc_inq_dimid(ncid, ODIM_NAME, &dimid)) ERR;
          if (nc_inq_varid(ncid, OVAR_NAME, &varid)) ERR;
          if (nc_inq_varid(ncid, OVAR2_NAME, &var2id)) ERR;
-         if (nc_redef(ncid)) ERR; /* omitting this and nc_enddef call eliminates bug */
+         if (nc_redef(ncid)) ERR;
          if (nc_rename_dim(ncid, dimid, NDIM_NAME)) ERR;
-         /* if (nc_rename_var(ncid, varid, NVAR_NAME)) ERR; */
          if (nc_enddef(ncid)) ERR;
          if (nc_get_var_int(ncid, varid, lats_in)) ERR;
          for (ii = 0; ii < DIM_LEN; ii++) {
diff --git a/nc_test4/tst_rename2.c b/nc_test4/tst_rename2.c
new file mode 100644
index 0000000..53213ca
--- /dev/null
+++ b/nc_test4/tst_rename2.c
@@ -0,0 +1,140 @@
+/*
+ * Test more renames of vars and dims.
+ *
+ * Ed Hartnett
+ */
+
+#include "nc_tests.h"
+#include "err_macros.h"
+
+#define TEST_NAME "tst_rename"
+#define LAT "lat"
+#define LON "lon"
+#define LEV "lev"
+#define DIM_X "x"
+#define DIM_Y "y"
+#define DIM_Z "z"
+
+#define DIM1_LEN 4
+#define NDIM1 1
+#define NDIM3 3
+#define NUM_ENDDEF_SETTINGS 2
+
+int
+main(int argc, char **argv)
+{
+#define NUM_FORMATS 2
+   int formats[NUM_FORMATS] = {NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC};
+   int format;
+
+   fprintf(stderr,"*** Testing more renames\n");
+
+   for (format = 0; format < NUM_FORMATS; format++)
+   {
+      fprintf(stderr,"*** test renaming 3 dimensions with format %d...",
+              formats[format]);
+      {
+         char filename[NC_MAX_NAME + 1];
+         int ncid, dimid[NDIM3];
+         int dimid_in;
+         int enddef_setting;
+
+         if (nc_set_default_format(formats[format], NULL)) ERR;
+
+         for (enddef_setting = 0; enddef_setting < NUM_ENDDEF_SETTINGS;
+              enddef_setting++)
+         {
+            sprintf(filename, "%s_%d_%d.nc", TEST_NAME, formats[format],
+                    enddef_setting);
+            
+            /* Create file with three dims. */
+            if (nc_create(filename, 0, &ncid)) ERR;
+            if (nc_def_dim(ncid, LAT, DIM1_LEN, &dimid[0])) ERR;
+            if (nc_def_dim(ncid, LON, DIM1_LEN, &dimid[1])) ERR;
+            if (nc_def_dim(ncid, LEV, DIM1_LEN, &dimid[2])) ERR;
+
+            if (enddef_setting)
+            {
+               if (nc_enddef(ncid)) ERR;
+               if (nc_redef(ncid)) ERR;
+            }
+            
+            /* Rename the dimensions. */
+            if (nc_rename_dim(ncid, 0, DIM_X)) ERR;
+            if (nc_rename_dim(ncid, 1, DIM_Y)) ERR;
+            if (nc_rename_dim(ncid, 2, DIM_Z)) ERR;
+            
+            /* Close the file. */
+            if (nc_close(ncid)) ERR;
+            
+            /* Reopen the file and check. */
+            if (nc_open(filename, NC_NOWRITE, &ncid)) ERR;
+            if (nc_inq_dimid(ncid, DIM_X, &dimid_in)) ERR;
+            if (dimid_in != 0) ERR;
+            if (nc_inq_dimid(ncid, DIM_Y, &dimid_in)) ERR;
+            if (dimid_in != 1) ERR;
+            if (nc_inq_dimid(ncid, DIM_Z, &dimid_in)) ERR;
+            if (dimid_in != 2) ERR;
+            if (nc_close(ncid)) ERR;
+         } /* next enddef setting */
+      }
+      SUMMARIZE_ERR;
+
+      fprintf(stderr,"*** test renaming 3 dims with coord data format %d...",
+              formats[format]);
+      {
+         char filename[NC_MAX_NAME + 1];
+         int ncid, dimid[NDIM3], varid[NDIM3];
+         int dimid_in;
+         int lat_data[DIM1_LEN] = {0, 1, 2, 3};
+         int lon_data[DIM1_LEN] = {0, 10, 20, 30};
+         int lev_data[DIM1_LEN] = {0, 100, 200, 300};
+
+         if (nc_set_default_format(formats[format], NULL)) ERR;
+
+         sprintf(filename, "%s_data_%d.nc", TEST_NAME, formats[format]);
+         
+         /* Create file with three dims. */
+         if (nc_create(filename, 0, &ncid)) ERR;
+         if (nc_def_dim(ncid, LAT, DIM1_LEN, &dimid[0])) ERR;
+         if (nc_def_dim(ncid, LON, DIM1_LEN, &dimid[1])) ERR;
+         if (nc_def_dim(ncid, LEV, DIM1_LEN, &dimid[2])) ERR;
+
+         /* Define coordinate data vars. */
+         if (nc_def_var(ncid, LAT, NC_INT, NDIM1, &dimid[0], &varid[0])) ERR;
+         if (nc_def_var(ncid, LON, NC_INT, NDIM1, &dimid[1], &varid[1])) ERR;
+         if (nc_def_var(ncid, LEV, NC_INT, NDIM1, &dimid[2], &varid[2])) ERR;
+
+         if (nc_enddef(ncid)) ERR;
+
+         if (nc_put_var(ncid, 0, lat_data)) ERR;
+         if (nc_put_var(ncid, 1, lon_data)) ERR;
+         if (nc_put_var(ncid, 2, lev_data)) ERR;
+
+         if (nc_close(ncid)) ERR;
+         if (nc_open(filename, NC_WRITE, &ncid)) ERR;
+         if (nc_redef(ncid)) ERR;
+         
+         /* Rename the dimensions. */
+         if (nc_rename_dim(ncid, 0, DIM_X)) ERR;
+         if (nc_rename_dim(ncid, 1, DIM_Y)) ERR;
+         if (nc_rename_dim(ncid, 2, DIM_Z)) ERR;
+         
+         /* Close the file. */
+         if (nc_close(ncid)) ERR;
+         
+         /* Reopen the file and check. */
+         if (nc_open(filename, NC_NOWRITE, &ncid)) ERR;
+         if (nc_inq_dimid(ncid, DIM_X, &dimid_in)) ERR;
+         if (dimid_in != 0) ERR;
+         if (nc_inq_dimid(ncid, DIM_Y, &dimid_in)) ERR;
+         if (dimid_in != 1) ERR;
+         if (nc_inq_dimid(ncid, DIM_Z, &dimid_in)) ERR;
+         if (dimid_in != 2) ERR;
+         if (nc_close(ncid)) ERR;
+      }
+      SUMMARIZE_ERR;
+      
+   } /* next format */
+   FINAL_RESULTS;
+}
diff --git a/nc_test4/tst_strings.c b/nc_test4/tst_strings.c
index 30c951f..176df80 100644
--- a/nc_test4/tst_strings.c
+++ b/nc_test4/tst_strings.c
@@ -4,13 +4,14 @@
 
    Test netcdf-4 string types.
 
-   $Id: tst_strings.c,v 1.34 2010/05/25 13:53:04 ed Exp $
+   Ed Hartnett
 */
 
 #include <config.h>
 #include <nc_tests.h>
 #include "err_macros.h"
 
+#define TEST_NAME "tst_strings"
 #define FILE_NAME "tst_strings.nc"
 #define DIM_LEN 9
 #define ATT_NAME "measure_for_measure_att"
@@ -243,7 +244,7 @@ main(int argc, char **argv)
       if (nc_close(ncid)) ERR;
    }
    SUMMARIZE_ERR;
-   printf("*** testing long string variable...");
+   printf("*** testing string variables with fill values...");
    {
 #define VAR_NAME2 "empty"
 #define ATT_NAME2 "empty"
@@ -256,7 +257,6 @@ main(int argc, char **argv)
       char var_name[NC_MAX_NAME + 1];
       int var_natts, var_ndims;
       int ncid, varid, i, dimids[NDIMS], varid2;
-      char *data_in[DHR_LEN];
       char *data[DHR_LEN] = {
 	 "All human beings are born free and equal in dignity and rights. "
 	 "They are endowed with reason and "
@@ -426,56 +426,177 @@ main(int argc, char **argv)
 	 "any of the rights and freedoms set forth herein."
       };
       char *empty_string[] = {""};
+      char *my_string_fill[] = {"fill_string"};
 
-      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
-
-      /* Create an array of strings for the Universal Declaraion of Human Rights. */
-      if (nc_def_dim(ncid, DIM_NAME1, DHR_LEN, dimids)) ERR;
-      if (nc_def_var(ncid, VAR_NAME1, NC_STRING, NDIMS, dimids, &varid)) ERR;
-
-      /* Create a scalar variable for the empty string. */
-      if (nc_def_var(ncid, VAR_NAME2, NC_STRING, 0, NULL, &varid2)) ERR;
-
-      /* Check some stuff. */
-      if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
-      if (ndims != NDIMS || nvars != 2 || natts != 0 || unlimdimid != -1) ERR;
-      if (nc_inq_var(ncid, varid, var_name, &var_type, &var_ndims,
-      		     var_dimids, &var_natts)) ERR;
-      if (var_type != NC_STRING || strcmp(var_name, VAR_NAME1) || var_ndims != NDIMS ||
-      	  var_dimids[0] != dimids[0]) ERR;
+#define NUM_DIM_COMBOS 4
+      int dim_combo;
 
-      /* Write the universal declaraion of human rights. */
-      if (nc_put_var(ncid, varid, data)) ERR;
-
-      /* Write an empty string with an empty attribute. */
-      if (nc_put_var(ncid, varid2, empty_string)) ERR;
-      if (nc_put_att(ncid, varid2, ATT_NAME2, NC_STRING, 0, empty_string)) ERR;
+      for (dim_combo = 0; dim_combo < NUM_DIM_COMBOS; dim_combo++)
+      {
+         char filename[NC_MAX_NAME + 1];
+         int dim_len = dim_combo ? NC_UNLIMITED : DHR_LEN;
+         int expected_unlimdimid = dim_combo ? 0 : -1;
+         char *default_fill = ((char *)"");
+         char **string_fillp = dim_combo == 3 ? my_string_fill : &default_fill;
+         char *data_in;
+
+         sprintf(filename, "%s_dim_combo_%d.nc", TEST_NAME, dim_combo);
+         if (nc_create(filename, NC_NETCDF4, &ncid)) ERR;
+
+         /* Create an array of strings for the Universal Declaraion of Human Rights. */
+         if (nc_def_dim(ncid, DIM_NAME1, dim_len, dimids)) ERR;
+         if (nc_def_var(ncid, VAR_NAME1, NC_STRING, NDIMS, dimids, &varid)) ERR;
+
+         /* Create a scalar variable for the empty string. */
+         if (nc_def_var(ncid, VAR_NAME2, NC_STRING, 0, NULL, &varid2)) ERR;
+         if (dim_combo == 3)
+            if (nc_put_att(ncid, varid, _FillValue, NC_STRING, 1, my_string_fill)) ERR;
+
+         /* Check some stuff. */
+         if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
+         if (ndims != NDIMS || nvars != 2 || natts != 0 || unlimdimid != expected_unlimdimid) ERR;
+         if (nc_inq_var(ncid, varid, var_name, &var_type, &var_ndims,
+                        var_dimids, &var_natts)) ERR;
+         if (var_type != NC_STRING || strcmp(var_name, VAR_NAME1) || var_ndims != NDIMS ||
+             var_dimids[0] != dimids[0]) ERR;
+
+         /* Write the universal declaraion of human rights. */
+         if (dim_combo)
+         {
+            size_t start[NDIMS], count[NDIMS] = {1};
+            int counter = 1;
+            
+            /* Write one record at a time. */
+            for (start[0] = 0; start[0] < DHR_LEN; start[0]++)
+            {
+               size_t new_start[NDIMS];
+               size_t *my_startp = start;
+
+               /* For dim_combo 2 or 3 skip every other record. */
+               new_start[0] = start[0] + counter++;
+               if (dim_combo >= 2)
+                  my_startp = new_start;
+
+               /* Write a record. */
+               nc_put_vara_string(ncid, varid, my_startp, count, (const char **)&data[start[0]]);
+            }
+         }
+         else
+         {
+            /* Write all records at once. */
+            if (nc_put_var(ncid, varid, data)) ERR;
+         }
+
+         /* Write an empty string with an empty attribute. */
+         if (nc_put_var(ncid, varid2, empty_string)) ERR;
+         if (nc_put_att(ncid, varid2, ATT_NAME2, NC_STRING, 0, empty_string)) ERR;
+
+         /* Close the file. */
+         if (nc_close(ncid)) ERR;
+
+         /* Check it out. */
+         if (nc_open(filename, NC_NOWRITE, &ncid)) ERR;
+         if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
+         if (ndims != NDIMS || nvars != 2 || natts != 0 || unlimdimid != expected_unlimdimid) ERR;
+
+         /* Check declaration. */
+         if (nc_inq_varid(ncid, VAR_NAME1, &varid)) ERR;
+         if (nc_inq_var(ncid, varid, var_name, &var_type, &var_ndims, var_dimids,
+                        &var_natts)) ERR;
+         if (var_type != NC_STRING || strcmp(var_name, VAR_NAME1) || var_ndims != NDIMS ||
+             var_dimids[0] != dimids[0]) ERR;
+
+         /* Check fill value stuff. */
+         {
+            int no_fill;
+            char *fill_value_in[1];
+            
+            if (nc_inq_var_fill(ncid, varid, &no_fill, (char **)fill_value_in)) ERR;
+            if (no_fill) ERR;
+            if (strcmp(fill_value_in[0], *string_fillp)) ERR;
+            if (nc_free_string(1, (char **)fill_value_in)) ERR;
+         }
+
+         if (dim_combo < 2)
+         {
+            char *data_in[DHR_LEN];
+            
+            /* Get the data in one read of the entire var. */
+            if (nc_get_var(ncid, varid, data_in)) ERR;
+            for (i = 0; i < DHR_LEN; i++)
+               if (strcmp(data_in[i], data[i])) ERR;
+            if (nc_free_string(DHR_LEN, data_in)) ERR;
+         }
+         else
+         {
+            char *data_in;
+            size_t start[NDIMS], count[NDIMS] = {1};
+            int my_count = 0;
+            
+            /* Get the data one record at a time. Every other record,
+             * starting with the first, is a fill value. */
+            for (start[0] = 0; start[0] < DHR_LEN; start[0]++)
+            {
+               if (nc_get_vara(ncid, varid, start, count, &data_in)) ERR;
+               if (start[0] % 2)
+               {
+                  if (strcmp(data_in, data[my_count++])) ERR;
+               }
+               else
+               {
+                  if (strcmp(data_in, *string_fillp)) ERR;
+               }
+               if (nc_free_string(1, &data_in)) ERR;
+            }
+         }
+
+         /* Check the empty var and att. */
+         if (nc_inq_varid(ncid, VAR_NAME2, &varid)) ERR;
+         if (nc_get_var(ncid, varid, &data_in)) ERR;
+         if (strcmp(data_in, empty_string[0])) ERR;
+         if (nc_free_string(1, &data_in)) ERR;
+         if (nc_get_att(ncid, varid, ATT_NAME2, NULL)) ERR;
+         if (nc_close(ncid)) ERR;
+      } /* next dim_combo */
+   }
+   SUMMARIZE_ERR;
 
-      /* Close the file. */
-      if (nc_close(ncid)) ERR;
+   printf("*** Testing a file that causes ncdump problems...");
+   {
+#define NUM_DIMS 2
+#define DIM_0_NAME "dim_0"
+#define DIM_1_NAME "dim_1"
+#define DIM_1_LEN 2
+#define FILE_NAME_NCDUMP "tst_strings_ncdump_problem.nc"
+#define VAR_NAME_NCDUMP "var_string"
+      int ncid, varid, dimid[NUM_DIMS];
+      char *string_data[] = {"x"};
+      int t;
+
+      /* Create a file. */
+      if (nc_create(FILE_NAME_NCDUMP, NC_NETCDF4, &ncid)) ERR;
+
+      /* Create dims. */
+      if (nc_def_dim(ncid, DIM_0_NAME, NC_UNLIMITED, &dimid[0])) ERR;
+      if (nc_def_dim(ncid, DIM_1_NAME, DIM_1_LEN, &dimid[1])) ERR;
+               
+      /* Create a var. */
+      if (nc_def_var(ncid, VAR_NAME_NCDUMP, NC_STRING, NUM_DIMS, dimid, &varid)) ERR;
+
+      /* Check that you can't turn off fill mode for NC_STRING variables. */
+      if (nc_def_var_fill(ncid, varid, NC_NOFILL, NULL) != NC_EINVAL) ERR;
+
+      /* End define mode. */
+      if (nc_enddef(ncid)) ERR;
+
+      /* Write to each var. */
+      for (t = 0; t < 1; t++)
+      {
+         size_t start[NUM_DIMS] = {1, 0};
+         size_t count[NUM_DIMS] = {1, 1};
 
-      /* Check it out. */
-      if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
-      if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
-      if (ndims != NDIMS || nvars != 2 || natts != 0 || unlimdimid != -1) ERR;
-
-      /* Check declaration. */
-      if (nc_inq_varid(ncid, VAR_NAME1, &varid)) ERR;
-      if (nc_inq_var(ncid, varid, var_name, &var_type, &var_ndims,
-		     var_dimids, &var_natts)) ERR;
-      if (var_type != NC_STRING || strcmp(var_name, VAR_NAME1) || var_ndims != NDIMS ||
-	  var_dimids[0] != dimids[0]) ERR;
-      if (nc_get_var(ncid, varid, data_in)) ERR;
-      for (i = 0; i < DHR_LEN; i++)
-	 if (strcmp(data_in[i], data[i])) ERR;
-      if (nc_free_string(DHR_LEN, data_in)) ERR;
-
-      /* Check the empty var and att. */
-      if (nc_inq_varid(ncid, VAR_NAME2, &varid)) ERR;
-      if (nc_get_var(ncid, varid, data_in)) ERR;
-      if (strcmp(data_in[0], empty_string[0])) ERR;
-      if (nc_free_string(1, data_in)) ERR;
-      if (nc_get_att(ncid, varid, ATT_NAME2, NULL)) ERR;
+         if (nc_put_vara_string(ncid, varid, start, count, (const char **)string_data)) ERR;
+      }
       if (nc_close(ncid)) ERR;
    }
    SUMMARIZE_ERR;
diff --git a/nc_test4/tst_types.c b/nc_test4/tst_types.c
index def4a04..03c5a8f 100644
--- a/nc_test4/tst_types.c
+++ b/nc_test4/tst_types.c
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
          /* Create a var... */
          sprintf(varname, "var_%d", type);
          if (nc_def_var(ncid1, varname, type + NC_UBYTE, 1, &dimid, &varid[type])) ERR;
-         if (nc_inq_type_equal(ncid1, type + NC_UBYTE, ncid2, type + NC_UBYTE, &equal));
+         if (nc_inq_type_equal(ncid1, type + NC_UBYTE, ncid2, type + NC_UBYTE, &equal)) ERR;
          if (!equal) ERR;
       }
       nc_close(ncid2);
diff --git a/nc_test4/tst_vars.c b/nc_test4/tst_vars.c
index 70883d4..7d2b8d1 100644
--- a/nc_test4/tst_vars.c
+++ b/nc_test4/tst_vars.c
@@ -81,8 +81,9 @@ create_4D_example(char *file_name, int cmode)
       write our data. */
    size_t start[NDIMS_EX], count[NDIMS_EX];
 
-   /* Program variables to hold the data we will write out. We will only
-      need enough space to hold one timestep of data; one record. */
+   /* Program variables to hold the data we will write out. We will
+      only need enough space to hold one timestep of data; one
+      record. */
    float pres_out[NLVL][NLAT][NLON];
    float temp_out[NLVL][NLAT][NLON];
 
@@ -1050,47 +1051,70 @@ main(int argc, char **argv)
 #define DIM7_LEN 2
 #define DIM7_NAME "dim_7_from_Indiana"
 #define VAR7_NAME "var_7_from_Idaho"
+#define VAR8_NAME "var_8_from_Outer_Space"
+#define VAR9_NAME "var_9_from_Inner_Space"
+#define VAR10_NAME "var_10_from_Im_Out_Of_Ideas"
 #define NDIMS 1
 
    printf("*** testing fill values...");
    {
       int dimids[NDIMS], dimids_in[NDIMS];
       size_t index[NDIMS];
-      int varid, ndims, natts;
+      int varid, varid2, varid3, varid4, ndims, natts;
       nc_type xtype_in;
       char name_in[NC_MAX_NAME + 1];
       int shuffle_in, deflate_in, deflate_level_in;
       int checksum_in, no_fill;
       unsigned short ushort_data = 42, ushort_data_in, fill_value_in;
+      unsigned short my_fill_value = 999;
+      unsigned short my_fill_value2 = 111;
 
-      /* Create a netcdf-4 file with one dim and 1 NC_USHORT var. */
+      /* Create a netcdf-4 file with one dim and some NC_USHORT vars. */
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM7_NAME, DIM7_LEN, &dimids[0])) ERR;
-      if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids,
-		     &varid)) ERR;
+      if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids, &varid)) ERR;
+      if (nc_def_var(ncid, VAR8_NAME, NC_USHORT, NDIMS, dimids, &varid2)) ERR;
+      if (nc_def_var(ncid, VAR9_NAME, NC_USHORT, NDIMS, dimids, &varid3)) ERR;
+      if (nc_put_att(ncid, varid3, _FillValue, NC_USHORT, 1, &my_fill_value2)) ERR;
+      if (nc_def_var(ncid, VAR10_NAME, NC_USHORT, NDIMS, dimids, &varid4)) ERR;
+      if (nc_put_att(ncid, varid4, _FillValue, NC_USHORT, 1, &my_fill_value2)) ERR;
 
       /* Check stuff. */
-      if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims,
-		     dimids_in, &natts)) ERR;
+      if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in,
+                     &natts)) ERR;
       if (strcmp(name_in, VAR7_NAME) || xtype_in != NC_USHORT ||
 	  ndims != 1 || natts != 0 || dimids_in[0] != 0) ERR;
       if (nc_inq_var_deflate(ncid, 0, &shuffle_in, &deflate_in,
-			     &deflate_level_in)) ERR;
+                             &deflate_level_in)) ERR;
       if (shuffle_in != NC_NOSHUFFLE || deflate_in) ERR;
       if (nc_inq_var_fletcher32(ncid, 0, &checksum_in)) ERR;
       if (checksum_in != NC_NOCHECKSUM) ERR;
       if (nc_inq_var_fill(ncid, 0, &no_fill, &fill_value_in)) ERR;
       if (no_fill || fill_value_in != NC_FILL_USHORT) ERR;
 
+      /* Set a fill value for the second and forth variable. This will
+       * overwrite the existing fill value attribute for varid4. */
+      if (nc_def_var_fill(ncid, varid2, 0, &my_fill_value)) ERR;
+      if (nc_def_var_fill(ncid, varid4, 0, &my_fill_value)) ERR;
+
       /* Write the second of two values. */
       index[0] = 1;
       if (nc_put_var1_ushort(ncid, 0, index, &ushort_data)) ERR;
+      if (nc_put_var1_ushort(ncid, varid2, index, &ushort_data)) ERR;
+      if (nc_put_var1_ushort(ncid, varid3, index, &ushort_data)) ERR;
+      if (nc_put_var1_ushort(ncid, varid4, index, &ushort_data)) ERR;
 
-      /* Get the first value, and make sure we get the default fill
-       * value for USHORT. */
+      /* Get the first value, and make sure we get the correct fill
+       * values. */
       index[0] = 0;
       if (nc_get_var1_ushort(ncid, 0, index, &ushort_data_in)) ERR;
       if (ushort_data_in != NC_FILL_USHORT) ERR;
+      if (nc_get_var1_ushort(ncid, varid2, index, &ushort_data_in)) ERR;
+      if (ushort_data_in != my_fill_value) ERR;
+      if (nc_get_var1_ushort(ncid, varid3, index, &ushort_data_in)) ERR;
+      if (ushort_data_in != my_fill_value2) ERR;
+      if (nc_get_var1_ushort(ncid, varid4, index, &ushort_data_in)) ERR;
+      if (ushort_data_in != my_fill_value) ERR;
 
       if (nc_close(ncid)) ERR;
 
@@ -1119,18 +1143,39 @@ main(int argc, char **argv)
       int varid;
       int no_fill;
       unsigned short ushort_data = 42, ushort_data_in, fill_value_in;
+      unsigned short my_fill_value = 999;
 
       /* Create a netcdf-4 file with one dim and 1 NC_USHORT var. */
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM7_NAME, DIM7_LEN, &dimids[0])) ERR;
       if (nc_def_var(ncid, VAR7_NAME, NC_USHORT, NDIMS, dimids,
 		     &varid)) ERR;
+
+      /* Turn off fill mode. */
       if (nc_def_var_fill(ncid, varid, 1, NULL)) ERR;
+      if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
+      if (!no_fill) ERR;
 
-      /* Check stuff. */
+      /* Turn on fill mode. */
+      if (nc_def_var_fill(ncid, varid, 0, NULL)) ERR;
+      if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
+      if (no_fill) ERR;
+      
+      /* Turn off fill mode. */
+      if (nc_def_var_fill(ncid, varid, 1, NULL)) ERR;
       if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
       if (!no_fill) ERR;
 
+      /* Try and set a fill value and fill mode off. It will be
+       * ignored because fill mode is off. */
+      if (nc_def_var_fill(ncid, varid, 1, &my_fill_value)) ERR;
+
+      /* Turn on fill mode. */
+      if (nc_def_var_fill(ncid, varid, 0, NULL)) ERR;
+      if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
+      if (fill_value_in != NC_FILL_USHORT) ERR;
+      if (no_fill) ERR;
+
       /* Write the second of two values. */
       index[0] = 1;
       if (nc_put_var1_ushort(ncid, varid, index, &ushort_data)) ERR;
@@ -1139,7 +1184,7 @@ main(int argc, char **argv)
        * value for USHORT. */
       index[0] = 0;
       if (nc_get_var1_ushort(ncid, varid, index, &ushort_data_in)) ERR;
-
+      if (ushort_data_in != NC_FILL_USHORT) ERR;
       if (nc_close(ncid)) ERR;
 
       /* Open the file and check the same stuff. */
@@ -1147,7 +1192,7 @@ main(int argc, char **argv)
 
       /* Check stuff. */
       if (nc_inq_var_fill(ncid, varid, &no_fill, &fill_value_in)) ERR;
-      if (!no_fill) ERR;
+      if (no_fill) ERR;
 
       if (nc_close(ncid)) ERR;
    }
diff --git a/nc_test4/tst_vars2.c b/nc_test4/tst_vars2.c
index 91769fe..514e78f 100644
--- a/nc_test4/tst_vars2.c
+++ b/nc_test4/tst_vars2.c
@@ -18,7 +18,7 @@
 #define DIM1_NAME "Hoplites_Engaged"
 #define VAR_NAME "Battle_of_Marathon"
 #define LOSSES_NAME "Miltiades_Losses"
-
+#define NDIMS1 1
 #define MAX_CNUM 4
 
 int
@@ -26,7 +26,7 @@ main(int argc, char **argv)
 {
    int ncid, dimids[NUM_DIMS];
    int varid;
-   int nvars_in, varids_in[NUM_VARS];
+   int nvars_in, varids_in[NUM_VARS] = {0};
    signed char fill_value = 42, fill_value_in;
    nc_type xtype_in;
    size_t len_in;
@@ -66,15 +66,22 @@ main(int argc, char **argv)
 	    return 1;
       }
 
+#define FILE_NAME2 "tst_vars2_latefill.nc"
       printf("**** testing simple fill value attribute creation...");
       {
          int status;
+         int schar_data = 0;
+         size_t index[1] = {0};
+         int dimid;
+
          /* Create a netcdf-4 file with one scalar var. Add fill
           * value. */
-         if (nc_create(FILE_NAME, cmode, &ncid)) ERR;
-         if (nc_def_var(ncid, VAR_NAME, NC_BYTE, 0, NULL, &varid)) ERR;
+         if (nc_create(FILE_NAME2, cmode, &ncid)) ERR;
+         if (nc_def_dim(ncid, VAR_NAME, TEST_VAL_42, &dimid)) ERR;
+         if (nc_def_var(ncid, VAR_NAME, NC_BYTE, 1, &dimid, &varid)) ERR;
          if (nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value)) ERR;
          if (nc_enddef(ncid)) ERR;
+         if (nc_put_var1(ncid, varid, index, &schar_data)) ERR;
          if (nc_redef(ncid)) ERR;
          status = nc_put_att_schar(ncid, varid, _FillValue, NC_BYTE, 1, &fill_value);
          if (status != NC_ELATEFILL)
@@ -82,7 +89,7 @@ main(int argc, char **argv)
          if (nc_close(ncid)) ERR;
 
          /* Open the file and check. */
-         if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR;
+         if (nc_open(FILE_NAME2, NC_WRITE, &ncid)) ERR;
          if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR;
          if (nvars_in != 1 || varids_in[0] != 0) ERR;
          if (nc_inq_varname(ncid, 0, name_in)) ERR;
@@ -507,6 +514,7 @@ main(int argc, char **argv)
       /* THese won't work due to bad params. */
       if (nc_rename_dim(ncid + MILLION, lon_dim, "longitude") != NC_EBADID) ERR;
       if (nc_rename_dim(ncid + TEST_VAL_42, lon_dim, "longitude") != NC_EBADID) ERR;
+      if (nc_rename_dim(ncid, lon_dim, NULL) != NC_EINVAL) ERR;
 
       /* rename dimension */
       if (nc_rename_dim(ncid, lon_dim, "longitude")) ERR;
@@ -533,13 +541,14 @@ main(int argc, char **argv)
       if (nc_rename_var(ncid, wind_id, too_long_name) != NC_EMAXNAME) ERR;
       if (nc_rename_var(ncid, wind_id, "temp2") != NC_ENAMEINUSE) ERR;
       if (nc_rename_var(ncid, wind_id, "windy") != NC_ENOTINDEFINE) ERR;
+      if (nc_rename_var(ncid, wind_id, NULL) != NC_EINVAL) ERR;
 
       /* rename variable */
       if (nc_rename_var(ncid, wind_id, "wind")) ERR;
 
       /* Enter define mode and rename it to something longer. */
       if (nc_redef(ncid)) ERR;
-      if (nc_rename_var(ncid, wind_id, "windy")) ERR;      
+      if (nc_rename_var(ncid, wind_id, "windy")) ERR;
       if (nc_inq_varid(ncid, "windy", &wind_id)) ERR;
       if (nc_close(ncid)) ERR;
 
@@ -553,12 +562,13 @@ main(int argc, char **argv)
       wind_dims[0] = lon_dim;
       if (nc_def_var(ncid, "temp", NC_FLOAT, RANK_wind, wind_dims, &wind_id)) ERR;
       if (nc_enddef(ncid)) ERR;
-      if (nc_rename_var(ncid, wind_id, "windy")) ERR;            
+      if (nc_rename_var(ncid, wind_id, "windy")) ERR;
       if (nc_close(ncid)) ERR;
-      
+
    }
    SUMMARIZE_ERR;
 
+#ifndef NO_NETCDF_2
 #define VAR_DIMS2 2
    printf("*** testing 2D array of NC_FLOAT with v2 API...");
    {
@@ -584,6 +594,7 @@ main(int argc, char **argv)
       ncclose(ncid);
    }
    SUMMARIZE_ERR;
+#endif /* NO_NETCDF_2 */
 
 #define NDIMS 3
 #define NNAMES 4
@@ -716,7 +727,7 @@ main(int argc, char **argv)
 
       /* This also works, uselessly. */
       if (nc_inq_var(ncid, 0, name_in, NULL, NULL, NULL, NULL)) ERR;
-      
+
       if (nc_close(ncid)) ERR;
 
       /* Open the file and check the same stuff. */
@@ -753,6 +764,8 @@ main(int argc, char **argv)
 #define VAR_NAME5 "V5"
 #define VAR_NAME5_1 "V5_1"
 #define VAR_NAME5_2 "V5_2"
+#define VAR_NAME5_3 "V5_3"
+#define VAR_NAME5_4 "V5_4"
 #define DIM5_LEN 1000
 #define CACHE_SIZE 32000000
 #define CACHE_NELEMS 1009
@@ -760,15 +773,18 @@ main(int argc, char **argv)
 #define CACHE_SIZE2 64000000
 #define CACHE_NELEMS2 2000
 #define CACHE_PREEMPTION2 .50
+#define NVAR4 5
 
       int dimids[NDIMS5], dimids_in[NDIMS5];
-      int varid, varid1, varid2;
+      int varid, varid1, varid2, varid3, varid4;
+      int varids_in4[NVAR4];
       int ndims, nvars, natts, unlimdimid;
       nc_type xtype_in;
       char name_in[NC_MAX_NAME + 1];
       int data[DIM5_LEN], data_in[DIM5_LEN];
       size_t chunksize[NDIMS5] = {5};
-      size_t bad_chunksize[NDIMS5] = {-5};
+      size_t bad_chunksize[NDIMS5] = {-5}; /* Converted to large pos number since size_t is unsigned. */
+      size_t large_chunksize[NDIMS5] = {(size_t)NC_MAX_INT + (size_t)1}; /* Too big for inq_var_chunking_ints(). */
       size_t chunksize_in[NDIMS5];
       int chunksize_int[NDIMS5];
       int chunksize_int_in[NDIMS5];
@@ -834,9 +850,9 @@ main(int argc, char **argv)
       if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
       if (ndims != NDIMS5 || nvars != 1 || natts != 0 ||
           unlimdimid != -1) ERR;
-      if (nc_inq_varids(ncid, &nvars, varids_in)) ERR;
+      if (nc_inq_varids(ncid, &nvars, varids_in4)) ERR;
       if (nvars != 1) ERR;
-      if (varids_in[0] != 0) ERR;
+      if (varids_in4[0] != 0) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
       if (strcmp(name_in, VAR_NAME5) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
 	  dimids_in[0] != 0) ERR;
@@ -860,13 +876,16 @@ main(int argc, char **argv)
                                    chunksize_int_in) != NC_ENOTVAR) ERR;
       if (nc_inq_var_chunking_ints(ncid, varid + TEST_VAL_42, &storage_in,
                                    chunksize_int_in) != NC_ENOTVAR) ERR;
-      
+
       /* Now check with the fortran versions of the var_chunking. */
       if (nc_inq_var_chunking_ints(ncid, 0, &storage_in, chunksize_int_in)) ERR;
+      if (storage_in != NC_CHUNKED) ERR;
       for (d = 0; d < NDIMS5; d++)
 	 if (chunksize_int_in[d] != chunksize[d]) ERR;
       for (d = 0; d < NDIMS5; d++)
          chunksize_int[d] = chunksize[d] * 2;
+      if (nc_inq_var_chunking_ints(ncid, 0, &storage_in, NULL)) ERR;
+      if (storage_in != NC_CHUNKED) ERR;
 
       /* Check that some bad parameter values are rejected properly. */
       if (nc_def_var_chunking_ints(ncid + MILLION, varid, NC_CHUNKED,
@@ -879,19 +898,29 @@ main(int argc, char **argv)
                                    chunksize_int) != NC_ENOTVAR) ERR;
       if (nc_def_var_chunking_ints(ncid, varid + TEST_VAL_42, NC_CHUNKED,
                                    chunksize_int) != NC_ENOTVAR) ERR;
-      
+
       if (nc_def_var_chunking_ints(ncid, varid, NC_CHUNKED, chunksize_int) != NC_ELATEDEF) ERR;
       if (nc_redef(ncid)) ERR;
       if (nc_def_var(ncid, VAR_NAME5_1, NC_INT, NDIMS5, dimids, &varid1)) ERR;
       if (nc_def_var(ncid, VAR_NAME5_2, NC_INT, 0, NULL, &varid2)) ERR;
+      if (nc_def_var(ncid, VAR_NAME5_3, NC_INT, 0, NULL, &varid3)) ERR;
+      if (nc_def_var(ncid, VAR_NAME5_4, NC_INT, NDIMS5, dimids, &varid4)) ERR;
       if (nc_def_var_chunking(ncid, varid2, NC_CHUNKED, chunksize)) ERR;
+      if (nc_def_var_chunking(ncid, varid3, NC_CONTIGUOUS, NULL)) ERR;
+      if (nc_def_var_chunking(ncid, varid4, NC_CHUNKED, large_chunksize) != NC_EBADCHUNK) ERR;
       if (nc_def_var_chunking_ints(ncid, varid2, NC_CHUNKED, chunksize_int)) ERR;
       if (nc_def_var_chunking_ints(ncid, varid1, NC_CHUNKED, chunksize_int)) ERR;
-      if (nc_inq_var_chunking_ints(ncid, varid2, NC_CHUNKED, chunksize_int_in)) ERR;      
+      if (nc_inq_var_chunking_ints(ncid, varid2, NULL, chunksize_int_in)) ERR;
       if (nc_inq_var_chunking_ints(ncid, varid1, NULL, chunksize_int_in)) ERR;
       for (d = 0; d < NDIMS5; d++)
 	 if (chunksize_int_in[d] != chunksize[d] * 2) ERR;
-      if (nc_inq_var_chunking_ints(ncid, varid1, NULL, NULL)) ERR;
+      if (nc_inq_var_chunking_ints(ncid, varid1, &storage_in, NULL)) ERR;
+      if (storage_in != NC_CHUNKED) ERR;
+      if (nc_inq_var_chunking_ints(ncid, varid2, NULL, chunksize_int_in)) ERR;
+      if (nc_inq_var_chunking_ints(ncid, varid3, &storage_in, NULL)) ERR;
+      if (storage_in != NC_CONTIGUOUS) ERR;
+      if (nc_inq_var_chunking_ints(ncid, varid3, &storage_in, chunksize_int_in)) ERR;
+      if (storage_in != NC_CONTIGUOUS) ERR;
 
       /* Check that some bad parameter values are rejected properly. */
       if (nc_get_var_chunk_cache(ncid + MILLION, varid, &cache_size_in, &cache_nelems_in,
@@ -900,7 +929,7 @@ main(int argc, char **argv)
 				 &cache_preemption_in) != NC_EBADID) ERR;
       if (nc_get_var_chunk_cache(ncid, varid + TEST_VAL_42, &cache_size_in, &cache_nelems_in,
 				 &cache_preemption_in) != NC_ENOTVAR) ERR;
-      if (nc_get_var_chunk_cache(ncid, varid2 + 1, &cache_size_in, &cache_nelems_in,
+      if (nc_get_var_chunk_cache(ncid, varid4 + 1, &cache_size_in, &cache_nelems_in,
 				 &cache_preemption_in) != NC_ENOTVAR) ERR;
       if (nc_get_var_chunk_cache(ncid, -TEST_VAL_42, &cache_size_in, &cache_nelems_in,
 				 &cache_preemption_in) != NC_ENOTVAR) ERR;
@@ -929,11 +958,11 @@ main(int argc, char **argv)
 
       /* Check stuff. */
       if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
-      if (ndims != NDIMS5 || nvars != NUM_VARS || natts != 0 ||
+      if (ndims != NDIMS5 || nvars != NVAR4 || natts != 0 ||
           unlimdimid != -1) ERR;
-      if (nc_inq_varids(ncid, &nvars, varids_in)) ERR;
-      if (nvars != NUM_VARS) ERR;
-      if (varids_in[0] != 0 || varids_in[1] != 1) ERR;
+      if (nc_inq_varids(ncid, &nvars, varids_in4)) ERR;
+      if (nvars != NVAR4) ERR;
+      if (varids_in4[0] != 0 || varids_in4[1] != 1) ERR;
       if (nc_inq_var(ncid, 0, name_in, &xtype_in, &ndims, dimids_in, &natts)) ERR;
       if (strcmp(name_in, VAR_NAME5) || xtype_in != NC_INT || ndims != 1 || natts != 0 ||
 	  dimids_in[0] != 0) ERR;
@@ -991,7 +1020,7 @@ main(int argc, char **argv)
                                       &cache_preemption_int_in)) ERR;
       if (cache_size_int_in != cache_size_int_default || cache_nelems_int_in != cache_nelems_int_default ||
           cache_preemption_int_in != (int)(CACHE_PREEMPTION2 * 100)) ERR;
-      
+
       if (nc_close(ncid)) ERR;
    }
 
@@ -1073,7 +1102,7 @@ main(int argc, char **argv)
 
       /* This call passes but does nothing. */
       if (nc_inq_var_chunking(ncid, 0, &storage_in, chunksize_in)) ERR;
-      
+
       if (nc_get_var_int(ncid, varid, data_in)) ERR;
       for (i = 0; i < DIM5_LEN; i++)
          if (data[i] != data_in[i])
@@ -1084,18 +1113,17 @@ main(int argc, char **argv)
    SUMMARIZE_ERR;
    printf("**** testing contiguous storage...");
    {
-#define NDIMS6 1
 #define DIM6_NAME "D5"
 #define VAR_NAME6 "V5"
 #define DIM6_LEN 100
 
-      int dimids[NDIMS6], dimids_in[NDIMS6];
+      int dimids[NDIMS1], dimids_in[NDIMS1];
       int varid;
       int ndims, nvars, natts, unlimdimid;
       nc_type xtype_in;
       char name_in[NC_MAX_NAME + 1];
       int data[DIM6_LEN], data_in[DIM6_LEN];
-      size_t chunksize_in[NDIMS6];
+      size_t chunksize_in[NDIMS1];
       int storage_in;
       int i;
 
@@ -1106,13 +1134,13 @@ main(int argc, char **argv)
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM6_NAME, DIM6_LEN, &dimids[0])) ERR;
       if (dimids[0] != 0) ERR;
-      if (nc_def_var(ncid, VAR_NAME6, NC_INT, NDIMS6, dimids, &varid)) ERR;
+      if (nc_def_var(ncid, VAR_NAME6, NC_INT, NDIMS1, dimids, &varid)) ERR;
       if (nc_def_var_chunking(ncid, varid, NC_CONTIGUOUS, NULL)) ERR;
       if (nc_put_var_int(ncid, varid, data)) ERR;
 
       /* Check stuff. */
       if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
-      if (ndims != NDIMS6 || nvars != 1 || natts != 0 ||
+      if (ndims != NDIMS1 || nvars != 1 || natts != 0 ||
           unlimdimid != -1) ERR;
       if (nc_inq_varids(ncid, &nvars, varids_in)) ERR;
       if (nvars != 1) ERR;
@@ -1133,7 +1161,7 @@ main(int argc, char **argv)
 
       /* Check stuff. */
       if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR;
-      if (ndims != NDIMS6 || nvars != 1 || natts != 0 ||
+      if (ndims != NDIMS1 || nvars != 1 || natts != 0 ||
           unlimdimid != -1) ERR;
       if (nc_inq_varids(ncid, &nvars, varids_in)) ERR;
       if (nvars != 1) ERR;
@@ -1347,26 +1375,34 @@ main(int argc, char **argv)
       if (nc_close(ncid)) ERR;
    }
    SUMMARIZE_ERR;
-#define NDIMS6 1
 #define DIM8_NAME "num_monkeys"
 #define DIM9_NAME "num_coconuts"
 #define DIM9_LEN 10
 #define VAR_NAME8 "John_Clayton"
 #define VAR_NAME9 "Lord_Greystoke"
+#define VAR_NAME10 "Jane_Porter"
    printf("**** testing that contiguous storage can't be turned on for vars with unlimited dims or filters...");
    {
       int ncid;
-      int dimids[NDIMS6];
+      int dimids[NDIMS1];
       int varid, varid2;
-      size_t chunksize_in[NDIMS6];
+      size_t chunksize_in[NDIMS1];
       int storage_in;
 
       /* Create a netcdf-4 file with one dim and some vars. */
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM8_NAME, NC_UNLIMITED, &dimids[0])) ERR;
-      if (nc_def_var(ncid, VAR_NAME8, NC_INT, NDIMS6, dimids, &varid)) ERR;
+      if (nc_def_var(ncid, VAR_NAME8, NC_INT, NDIMS1, dimids, &varid)) ERR;
       if (nc_def_dim(ncid, DIM9_NAME, DIM9_LEN, &dimids[0])) ERR;
-      if (nc_def_var(ncid, VAR_NAME9, NC_INT, NDIMS6, dimids, &varid2)) ERR;
+      if (nc_def_var(ncid, VAR_NAME9, NC_INT, NDIMS1, dimids, &varid2)) ERR;
+
+      /* These will fail due to bad paramters. */
+      if (nc_def_var_deflate(ncid, varid2, 0, 1,
+                             NC_MIN_DEFLATE_LEVEL - 1) != NC_EINVAL) ERR;
+      if (nc_def_var_deflate(ncid, varid2, 0, 1,
+                             NC_MAX_DEFLATE_LEVEL + 1) != NC_EINVAL) ERR;
+
+      /* This will work. */
       if (nc_def_var_deflate(ncid, varid2, 0, 1, 4)) ERR;
 
       /* This won't work because of the umlimited dimension. */
@@ -1388,8 +1424,10 @@ main(int argc, char **argv)
    printf("**** testing error conditions on nc_def_var functions...");
    {
       int ncid;
-      int dimids[NDIMS6];
+      int dimids[NDIMS1];
+      int bad_dimids[NDIMS1] = {42};
       int varid;
+      int varid_scalar;
       int num_models = 2;
       int m;
       int mode = NC_NETCDF4;
@@ -1397,26 +1435,71 @@ main(int argc, char **argv)
       /* Test without and with classic model. */
       for (m = 0; m < num_models; m++)
       {
+         int contiguous_in;
+         size_t chunksizes_in[NDIMS1];
+         int shuffle_in, deflate_in, deflate_level_in;
+
          if (m)
             mode |= NC_CLASSIC_MODEL;
 
          /* Create a netcdf-4 file. */
          if (nc_create(FILE_NAME, mode, &ncid)) ERR;
          if (nc_def_dim(ncid, DIM8_NAME, TEST_VAL_42, &dimids[0])) ERR;
-         if (nc_def_var(ncid, VAR_NAME8, NC_INT, NDIMS6, dimids, &varid)) ERR;
+
+         /* This won't work. */
+         if (nc_def_var(ncid, VAR_NAME8, NC_INT, NDIMS1, bad_dimids,
+                        &varid) != NC_EBADDIM) ERR;
+
+         /* This will work. */
+         if (nc_def_var(ncid, VAR_NAME8, NC_INT, NDIMS1, dimids, &varid)) ERR;
+         if (nc_def_var(ncid, VAR_NAME10, NC_INT, 0, NULL, &varid_scalar)) ERR;
 
          /* Set the var to contiguous. */
          if (nc_def_var_chunking(ncid, varid, NC_CONTIGUOUS, NULL)) ERR;
 
-         /* Now defalte can't be set. */
+         /* Now defalte will change the var to chunked. */
          if (nc_def_var_deflate(ncid, varid, 0, 1, 4)) ERR;
+         if (nc_inq_var_chunking(ncid, varid, &contiguous_in, chunksizes_in)) ERR;
+         if (contiguous_in) ERR;
+
+         /* Now I can't turn contiguous on, because deflate is on. */
+         if (nc_def_var_chunking(ncid, varid, NC_CONTIGUOUS, NULL) != NC_EINVAL) ERR;
+
+         /* Turn off deflation. */
+         if (nc_def_var_deflate(ncid, varid, 0, 0, 0)) ERR;
+         if (nc_inq_var_deflate(ncid, varid, &shuffle_in, &deflate_in, &deflate_level_in)) ERR;
+         if (shuffle_in || deflate_in) ERR;
+         if (nc_inq_var_deflate(ncid, varid, NULL, NULL, NULL)) ERR;
 
+         /* Deflate is ignored for scalar. */
+         if (nc_def_var_deflate(ncid, varid_scalar, 0, 1, 4)) ERR;
+         if (nc_inq_var_deflate(ncid, varid, &shuffle_in, &deflate_in, &deflate_level_in)) ERR;
+         if (shuffle_in || deflate_in) ERR;
+
+         /* Turn on shuffle. */
+         if (nc_def_var_deflate(ncid, varid, 1, 0, 0)) ERR;
+
+         /* Now I can't turn contiguous on, because shuffle is on. */
+         if (nc_def_var_chunking(ncid, varid, NC_CONTIGUOUS, NULL) != NC_EINVAL) ERR;
+
+         /* Turn off shuffle. */
+         if (nc_def_var_deflate(ncid, varid, 0, 0, 0)) ERR;
+
+         /* Turn on fletcher32. */
+         if (nc_def_var_fletcher32(ncid, varid, 1)) ERR;
+
+         /* Now I can't turn contiguous on, because fletcher32 is on. */
+         if (nc_def_var_chunking(ncid, varid, NC_CONTIGUOUS, NULL) != NC_EINVAL) ERR;
+
+         /* Turn off fletcher32. */
+         if (nc_def_var_fletcher32(ncid, varid, 0)) ERR;
+
+         /* Now I can make it contiguous again. */
+         if (nc_def_var_chunking(ncid, varid, NC_CONTIGUOUS, NULL)) ERR;
          if (nc_close(ncid)) ERR;
       }
-
    }
    SUMMARIZE_ERR;
-#define NDIMS6 1
 #define DIM8_NAME "num_monkeys"
 #define DIM9_NAME "num_coconuts"
 #define DIM9_LEN 10
@@ -1425,17 +1508,17 @@ main(int argc, char **argv)
    printf("**** testing that contiguous storage can't be turned on for vars with unlimited dims or filters...");
    {
       int ncid;
-      int dimids[NDIMS6];
+      int dimids[NDIMS1];
       int varid, varid2;
-      size_t chunksize_in[NDIMS6];
+      size_t chunksize_in[NDIMS1];
       int storage_in;
 
       /* Create a netcdf-4 file with one dim and some vars. */
       if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
       if (nc_def_dim(ncid, DIM8_NAME, NC_UNLIMITED, &dimids[0])) ERR;
-      if (nc_def_var(ncid, VAR_NAME8, NC_INT, NDIMS6, dimids, &varid)) ERR;
+      if (nc_def_var(ncid, VAR_NAME8, NC_INT, NDIMS1, dimids, &varid)) ERR;
       if (nc_def_dim(ncid, DIM9_NAME, DIM9_LEN, &dimids[0])) ERR;
-      if (nc_def_var(ncid, VAR_NAME9, NC_INT, NDIMS6, dimids, &varid2)) ERR;
+      if (nc_def_var(ncid, VAR_NAME9, NC_INT, NDIMS1, dimids, &varid2)) ERR;
       if (nc_def_var_deflate(ncid, varid2, 0, 1, 4)) ERR;
 
       /* This won't work because of the umlimited dimension. */
@@ -1454,5 +1537,39 @@ main(int argc, char **argv)
 
    }
    SUMMARIZE_ERR;
+#define DIM10_NAME "num_monkeys"
+#define DIM11_NAME "num_hats"
+#define VAR_NAME11 "Silly_Sally"
+#define NDIM2 2
+   printf("**** testing very large chunksizes...");
+   {
+      int ncid;
+      int dimid[NDIM2];
+      int varid;
+      size_t chunksize[NDIM2] = {1, (size_t)NC_MAX_INT + (size_t)1};
+      size_t chunksize_in[NDIM2];
+      int chunksize_int_in[NDIM2];
+      int storage_in;
+
+      /* Create a netcdf-4 file. */
+      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+      if (nc_def_dim(ncid, DIM10_NAME, NC_UNLIMITED, &dimid[0])) ERR;
+      if (nc_def_dim(ncid, DIM11_NAME, NC_UNLIMITED, &dimid[1])) ERR;
+      if (nc_def_var(ncid, VAR_NAME11, NC_BYTE, NDIM2, dimid, &varid)) ERR;
+      if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksize_in)) ERR;
+      if (storage_in != NC_CHUNKED) ERR;
+
+      /* Set a large chunksize. */
+      if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, chunksize)) ERR;
+      if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksize_in)) ERR;
+      if (storage_in != NC_CHUNKED) ERR;
+      if (chunksize_in[0] != chunksize[0] || chunksize_in[1] != chunksize[1]) ERR;
+      if (nc_inq_var_chunking_ints(ncid, varid, &storage_in, chunksize_int_in) != NC_ERANGE) ERR;
+
+      /* Close the file. */
+      if (nc_close(ncid)) ERR;
+
+   }
+   SUMMARIZE_ERR;
    FINAL_RESULTS;
 }
diff --git a/ncdap_test/Makefile.in b/ncdap_test/Makefile.in
index a33be60..0cb6051 100644
--- a/ncdap_test/Makefile.in
+++ b/ncdap_test/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -209,7 +209,12 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/findtestserver.Po \
+	./$(DEPDIR)/t_dap3a.Po ./$(DEPDIR)/t_misc.Po \
+	./$(DEPDIR)/t_ncf330.Po ./$(DEPDIR)/test_cvt.Po \
+	./$(DEPDIR)/test_nstride_cached.Po ./$(DEPDIR)/test_partvar.Po \
+	./$(DEPDIR)/test_vara.Po ./$(DEPDIR)/test_varm3.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -258,7 +263,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	check recheck distdir
+	check recheck distdir distdir-am
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -551,7 +556,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -560,6 +564,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -598,6 +603,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -752,8 +758,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -817,15 +823,21 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/findtestserver.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_dap3a.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_misc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_ncf330.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_cvt.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_nstride_cached.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_partvar.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_vara.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_varm3.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/findtestserver.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_dap3a.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_misc.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/t_ncf330.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_cvt.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_nstride_cached.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_partvar.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_vara.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_varm3.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1076,7 +1088,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1161,7 +1173,10 @@ t_misc.log: t_misc$(EXEEXT)
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1266,7 +1281,15 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
 	mostlyclean-am
 
 distclean: distclean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/findtestserver.Po
+	-rm -f ./$(DEPDIR)/t_dap3a.Po
+	-rm -f ./$(DEPDIR)/t_misc.Po
+	-rm -f ./$(DEPDIR)/t_ncf330.Po
+	-rm -f ./$(DEPDIR)/test_cvt.Po
+	-rm -f ./$(DEPDIR)/test_nstride_cached.Po
+	-rm -f ./$(DEPDIR)/test_partvar.Po
+	-rm -f ./$(DEPDIR)/test_vara.Po
+	-rm -f ./$(DEPDIR)/test_varm3.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1312,7 +1335,15 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/findtestserver.Po
+	-rm -f ./$(DEPDIR)/t_dap3a.Po
+	-rm -f ./$(DEPDIR)/t_misc.Po
+	-rm -f ./$(DEPDIR)/t_ncf330.Po
+	-rm -f ./$(DEPDIR)/test_cvt.Po
+	-rm -f ./$(DEPDIR)/test_nstride_cached.Po
+	-rm -f ./$(DEPDIR)/test_partvar.Po
+	-rm -f ./$(DEPDIR)/test_vara.Po
+	-rm -f ./$(DEPDIR)/test_varm3.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1334,20 +1365,21 @@ uninstall-am:
 .MAKE: $(am__recursive_targets) all check check-am install install-am \
 	install-strip
 
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-	check-TESTS check-am clean clean-checkPROGRAMS clean-generic \
-	clean-libtool clean-local cscopelist-am ctags ctags-am \
-	distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs installdirs-am maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	recheck tags tags-am uninstall uninstall-am
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--depfiles check check-TESTS check-am clean \
+	clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am recheck tags tags-am uninstall \
+	uninstall-am
 
 .PRECIOUS: Makefile
 
diff --git a/ncdap_test/expected3/Makefile.in b/ncdap_test/expected3/Makefile.in
index 9426cfc..165ac16 100644
--- a/ncdap_test/expected3/Makefile.in
+++ b/ncdap_test/expected3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -166,7 +166,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -175,6 +174,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -213,6 +213,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -363,8 +364,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -388,7 +389,10 @@ ctags CTAGS:
 cscope cscopelist:
 
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/ncdap_test/expectremote3/Makefile.in b/ncdap_test/expectremote3/Makefile.in
index d02d60e..2f5bd00 100644
--- a/ncdap_test/expectremote3/Makefile.in
+++ b/ncdap_test/expectremote3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -166,7 +166,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -175,6 +174,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -213,6 +213,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -357,8 +358,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -382,7 +383,10 @@ ctags CTAGS:
 cscope cscopelist:
 
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/ncdap_test/testdata3/Makefile.in b/ncdap_test/testdata3/Makefile.in
index 69e4bbc..1200821 100644
--- a/ncdap_test/testdata3/Makefile.in
+++ b/ncdap_test/testdata3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -166,7 +166,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -175,6 +174,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -213,6 +213,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -422,8 +423,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -447,7 +448,10 @@ ctags CTAGS:
 cscope cscopelist:
 
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am
index c827568..58673ee 100644
--- a/ncdump/Makefile.am
+++ b/ncdump/Makefile.am
@@ -4,6 +4,10 @@
 
 # Ed Hartnett, Dennis Heimbigner, Ward Fisher
 
+#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+#sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+
 # Put together AM_CPPFLAGS and AM_LDFLAGS.
 include $(top_srcdir)/lib_flags.am
 LDADD = ${top_builddir}/liblib/libnetcdf.la
diff --git a/ncdump/Makefile.in b/ncdump/Makefile.in
index 2e50b8a..feab532 100644
--- a/ncdump/Makefile.in
+++ b/ncdump/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -19,6 +19,10 @@
 
 # Ed Hartnett, Dennis Heimbigner, Ward Fisher
 
+#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+#sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
+
 # This is part of the netCDF package.
 # Copyright 2005 University Corporation for Atmospheric Research/Unidata
 # See COPYRIGHT file for conditions of use.
@@ -316,7 +320,25 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/bom.Po ./$(DEPDIR)/chunkspec.Po \
+	./$(DEPDIR)/dimmap.Po ./$(DEPDIR)/dumplib.Po \
+	./$(DEPDIR)/indent.Po ./$(DEPDIR)/nc4print.Po \
+	./$(DEPDIR)/nccopy.Po ./$(DEPDIR)/ncdump.Po \
+	./$(DEPDIR)/nciter.Po ./$(DEPDIR)/nctime0.Po \
+	./$(DEPDIR)/nctrunc.Po ./$(DEPDIR)/ocprint.Po \
+	./$(DEPDIR)/ref_ctest.Po ./$(DEPDIR)/ref_ctest64.Po \
+	./$(DEPDIR)/rewrite-scalar.Po ./$(DEPDIR)/tst_chunking.Po \
+	./$(DEPDIR)/tst_comp.Po ./$(DEPDIR)/tst_comp2.Po \
+	./$(DEPDIR)/tst_compress.Po ./$(DEPDIR)/tst_create_files.Po \
+	./$(DEPDIR)/tst_dimsizes.Po ./$(DEPDIR)/tst_enum_data.Po \
+	./$(DEPDIR)/tst_fileinfo.Po ./$(DEPDIR)/tst_fillbug.Po \
+	./$(DEPDIR)/tst_group_data.Po ./$(DEPDIR)/tst_h_rdc0.Po \
+	./$(DEPDIR)/tst_h_scalar.Po ./$(DEPDIR)/tst_nans.Po \
+	./$(DEPDIR)/tst_opaque_data.Po ./$(DEPDIR)/tst_special_atts.Po \
+	./$(DEPDIR)/tst_string_data.Po ./$(DEPDIR)/tst_unicode.Po \
+	./$(DEPDIR)/tst_utf8.Po ./$(DEPDIR)/tst_vlen_data.Po \
+	./$(DEPDIR)/utils.Po ./$(DEPDIR)/vardata.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -402,7 +424,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	check recheck distdir
+	check recheck distdir distdir-am
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -662,7 +684,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -671,6 +692,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -709,6 +731,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -917,8 +940,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -1116,42 +1139,48 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bom.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/chunkspec.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dimmap.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dumplib.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/indent.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nc4print.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccopy.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncdump.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nciter.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nctime0.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nctrunc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocprint.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_ctest.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_ctest64.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rewrite-scalar.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunking.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_comp.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_comp2.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compress.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_create_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dimsizes.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_enum_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fileinfo.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fillbug.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_group_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_rdc0.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_scalar.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nans.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_opaque_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_special_atts.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_string_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_unicode.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vlen_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/utils.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bom.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/chunkspec.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dimmap.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dumplib.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/indent.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nc4print.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccopy.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncdump.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nciter.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nctime0.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nctrunc.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ocprint.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_ctest.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_ctest64.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rewrite-scalar.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunking.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_comp.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_comp2.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_compress.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_create_files.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_dimsizes.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_enum_data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fileinfo.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_fillbug.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_group_data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_rdc0.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_h_scalar.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nans.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_opaque_data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_special_atts.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_string_data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_unicode.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_utf8.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vlen_data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/utils.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardata.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1445,7 +1474,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1495,7 +1524,10 @@ ref_ctest64.log: ref_ctest64$(EXEEXT)
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1600,7 +1632,42 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
 	clean-libtool clean-noinstPROGRAMS mostlyclean-am
 
 distclean: distclean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/bom.Po
+	-rm -f ./$(DEPDIR)/chunkspec.Po
+	-rm -f ./$(DEPDIR)/dimmap.Po
+	-rm -f ./$(DEPDIR)/dumplib.Po
+	-rm -f ./$(DEPDIR)/indent.Po
+	-rm -f ./$(DEPDIR)/nc4print.Po
+	-rm -f ./$(DEPDIR)/nccopy.Po
+	-rm -f ./$(DEPDIR)/ncdump.Po
+	-rm -f ./$(DEPDIR)/nciter.Po
+	-rm -f ./$(DEPDIR)/nctime0.Po
+	-rm -f ./$(DEPDIR)/nctrunc.Po
+	-rm -f ./$(DEPDIR)/ocprint.Po
+	-rm -f ./$(DEPDIR)/ref_ctest.Po
+	-rm -f ./$(DEPDIR)/ref_ctest64.Po
+	-rm -f ./$(DEPDIR)/rewrite-scalar.Po
+	-rm -f ./$(DEPDIR)/tst_chunking.Po
+	-rm -f ./$(DEPDIR)/tst_comp.Po
+	-rm -f ./$(DEPDIR)/tst_comp2.Po
+	-rm -f ./$(DEPDIR)/tst_compress.Po
+	-rm -f ./$(DEPDIR)/tst_create_files.Po
+	-rm -f ./$(DEPDIR)/tst_dimsizes.Po
+	-rm -f ./$(DEPDIR)/tst_enum_data.Po
+	-rm -f ./$(DEPDIR)/tst_fileinfo.Po
+	-rm -f ./$(DEPDIR)/tst_fillbug.Po
+	-rm -f ./$(DEPDIR)/tst_group_data.Po
+	-rm -f ./$(DEPDIR)/tst_h_rdc0.Po
+	-rm -f ./$(DEPDIR)/tst_h_scalar.Po
+	-rm -f ./$(DEPDIR)/tst_nans.Po
+	-rm -f ./$(DEPDIR)/tst_opaque_data.Po
+	-rm -f ./$(DEPDIR)/tst_special_atts.Po
+	-rm -f ./$(DEPDIR)/tst_string_data.Po
+	-rm -f ./$(DEPDIR)/tst_unicode.Po
+	-rm -f ./$(DEPDIR)/tst_utf8.Po
+	-rm -f ./$(DEPDIR)/tst_vlen_data.Po
+	-rm -f ./$(DEPDIR)/utils.Po
+	-rm -f ./$(DEPDIR)/vardata.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1646,7 +1713,42 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/bom.Po
+	-rm -f ./$(DEPDIR)/chunkspec.Po
+	-rm -f ./$(DEPDIR)/dimmap.Po
+	-rm -f ./$(DEPDIR)/dumplib.Po
+	-rm -f ./$(DEPDIR)/indent.Po
+	-rm -f ./$(DEPDIR)/nc4print.Po
+	-rm -f ./$(DEPDIR)/nccopy.Po
+	-rm -f ./$(DEPDIR)/ncdump.Po
+	-rm -f ./$(DEPDIR)/nciter.Po
+	-rm -f ./$(DEPDIR)/nctime0.Po
+	-rm -f ./$(DEPDIR)/nctrunc.Po
+	-rm -f ./$(DEPDIR)/ocprint.Po
+	-rm -f ./$(DEPDIR)/ref_ctest.Po
+	-rm -f ./$(DEPDIR)/ref_ctest64.Po
+	-rm -f ./$(DEPDIR)/rewrite-scalar.Po
+	-rm -f ./$(DEPDIR)/tst_chunking.Po
+	-rm -f ./$(DEPDIR)/tst_comp.Po
+	-rm -f ./$(DEPDIR)/tst_comp2.Po
+	-rm -f ./$(DEPDIR)/tst_compress.Po
+	-rm -f ./$(DEPDIR)/tst_create_files.Po
+	-rm -f ./$(DEPDIR)/tst_dimsizes.Po
+	-rm -f ./$(DEPDIR)/tst_enum_data.Po
+	-rm -f ./$(DEPDIR)/tst_fileinfo.Po
+	-rm -f ./$(DEPDIR)/tst_fillbug.Po
+	-rm -f ./$(DEPDIR)/tst_group_data.Po
+	-rm -f ./$(DEPDIR)/tst_h_rdc0.Po
+	-rm -f ./$(DEPDIR)/tst_h_scalar.Po
+	-rm -f ./$(DEPDIR)/tst_nans.Po
+	-rm -f ./$(DEPDIR)/tst_opaque_data.Po
+	-rm -f ./$(DEPDIR)/tst_special_atts.Po
+	-rm -f ./$(DEPDIR)/tst_string_data.Po
+	-rm -f ./$(DEPDIR)/tst_unicode.Po
+	-rm -f ./$(DEPDIR)/tst_utf8.Po
+	-rm -f ./$(DEPDIR)/tst_vlen_data.Po
+	-rm -f ./$(DEPDIR)/utils.Po
+	-rm -f ./$(DEPDIR)/vardata.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1669,22 +1771,22 @@ uninstall-man: uninstall-man1
 
 .MAKE: $(am__recursive_targets) check-am install-am install-strip
 
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-	check-TESTS check-am clean clean-binPROGRAMS \
-	clean-checkPROGRAMS clean-generic clean-libtool \
-	clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-binPROGRAMS install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-man1 install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs installdirs-am \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am recheck tags tags-am uninstall \
-	uninstall-am uninstall-binPROGRAMS uninstall-man \
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--depfiles check check-TESTS check-am clean \
+	clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
+	ctags-am distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-man1 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \
+	uninstall uninstall-am uninstall-binPROGRAMS uninstall-man \
 	uninstall-man1
 
 .PRECIOUS: Makefile
diff --git a/ncdump/cdl/Makefile.in b/ncdump/cdl/Makefile.in
index 98c5a67..4c290e9 100644
--- a/ncdump/cdl/Makefile.in
+++ b/ncdump/cdl/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -166,7 +166,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -175,6 +174,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -213,6 +213,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -353,8 +354,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -378,7 +379,10 @@ ctags CTAGS:
 cscope cscopelist:
 
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/ncdump/expected/Makefile.in b/ncdump/expected/Makefile.in
index f71db2c..2a27549 100644
--- a/ncdump/expected/Makefile.in
+++ b/ncdump/expected/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -164,7 +164,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -173,6 +172,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -211,6 +211,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -349,8 +350,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -374,7 +375,10 @@ ctags CTAGS:
 cscope cscopelist:
 
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
diff --git a/ncdump/nccopy.c b/ncdump/nccopy.c
index 2e50389..2ffd4ff 100644
--- a/ncdump/nccopy.c
+++ b/ncdump/nccopy.c
@@ -61,6 +61,7 @@ typedef struct VarID {
 
 struct FilterSpec {
     char* fqn;
+    int nofilter; /* 1=> do not apply any filters to this variable */
     unsigned int filterid;
     size_t nparams;
     unsigned int* params;
@@ -68,6 +69,7 @@ struct FilterSpec {
 
 static int nfilterspecs = 0; /* Number of defined filter specs */
 static struct FilterSpec filterspecs[MAX_FILTER_SPECS];
+static int suppressfilters = 0; /* 1 => do not apply any output filters unless specified */
 
 #endif
 
@@ -83,9 +85,11 @@ static size_t option_chunk_cache_size = CHUNK_CACHE_SIZE; /* default from config
 static size_t option_chunk_cache_nelems = CHUNK_CACHE_NELEMS; /* default from config.h */
 static int option_read_diskless = 0; /* default, don't read input into memory on open */
 static int option_write_diskless = 0; /* default, don't write output to diskless file */
+#ifdef USE_NETCDF4
 static int option_min_chunk_bytes = CHUNK_THRESHOLD; /* default, don't chunk variable if prod of
 						      * chunksizes of its dimensions is smaller
 						      * than this */
+#endif
 static int option_nlgrps = 0;		    /* Number of groups specified with -g
 					     * option on command line */
 static char** option_lgrps = 0;		    /* list of group names specified with -g
@@ -242,6 +246,9 @@ parsefilterspec(const char* optarg0, struct FilterSpec* spec)
     char* remainder = NULL;
 
     if(optarg0 == NULL || strlen(optarg0) == 0 || spec == NULL) return 0;
+
+    memset(spec,0,sizeof(struct FilterSpec));
+
     optarg = strdup(optarg0);
 
     /* Collect the fqn, taking escapes into account */
@@ -253,7 +260,8 @@ parsefilterspec(const char* optarg0, struct FilterSpec* spec)
 	else if(*p == '\0') {remainder = p; break;}
 	/* else continue */
     }
-    if(strlen(optarg) == 0) return 0; /* fqn does not exist */
+    if(strlen(optarg) == 0) {stat = NC_EINVAL; goto done;} /* fqn does not exist */
+
     /* Make sure leading '/' is in place */
     if(optarg[0]=='/')
 	spec->fqn = strdup(optarg);
@@ -263,6 +271,12 @@ parsefilterspec(const char* optarg0, struct FilterSpec* spec)
         strcat(spec->fqn,optarg);
     }
 
+    /* Check for special cases */
+    if(strcmp(remainder,"none") == 0) {
+	spec->nofilter = 1;
+	goto done;
+    }
+
     /* Collect the id+parameters */
     if((stat = NC_parsefilterspec(remainder,&id,&nparams,&params)) == NC_NOERR) {
         if(spec != NULL) {
@@ -271,6 +285,9 @@ parsefilterspec(const char* optarg0, struct FilterSpec* spec)
             spec->params = params;
 	}
     }
+
+done:
+    if(optarg) free(optarg);
     return stat;
 }
 
@@ -721,57 +738,101 @@ static int
 copy_var_filter(int igrp, int varid, int ogrp, int o_varid)
 {
     int stat = NC_NOERR;
-#ifdef USE_NETCDF4
     VarID vid = {igrp,varid};
     VarID ovid = {ogrp,o_varid};
     /* handle filter parameters, copying from input, overriding with command-line options */
-    struct FilterSpec spec;
-    int i, found;
+    struct FilterSpec inspec, ospec, actualspec;
+    int i;
     char* ofqn = NULL;
     int format, oformat;
+    int inputdefined, outputdefined, unfiltered;
 
     /* Get file format of the input and output */
     if((stat=nc_inq_format(vid.grpid,&format))) goto done;
     if((stat=nc_inq_format(ovid.grpid,&oformat))) goto done;
 
     if(oformat != NC_FORMAT_NETCDF4 && oformat != NC_FORMAT_NETCDF4_CLASSIC)
-	goto done; /* Can only use filter when output is netcdf4 */
+	goto done; /* Can only use filter when output is some netcdf4 variant */
 
     /* Compute the output vid's FQN */
     if((stat = computeFQN(ovid,&ofqn))) goto done;
-    /* See if any filter spec is defined for this output variable */
-    for(found=0,i=0;i<nfilterspecs;i++) {
-	if(strcmp(filterspecs[i].fqn,ofqn)==0) {spec = filterspecs[i]; found = 1; break;}
-    }
-    if(!found) {
-	spec.filterid = 0; /* marker to indicate not filter to apply */
-	if((oformat == NC_FORMAT_NETCDF4
-            || oformat != NC_FORMAT_NETCDF4_CLASSIC)
-	   && (format == NC_FORMAT_NETCDF4
-               || format != NC_FORMAT_NETCDF4_CLASSIC)
-	) {
-	    /* Only bother to look if both input and  output are netcdf-4 */
-	    if((stat=nc_inq_var_filter(vid.grpid,vid.varid,&spec.filterid,&spec.nparams,NULL)))
-	        goto done;
-	    if(spec.filterid > 0) {/* input has a filter */
-  	        spec.params = (unsigned int*)malloc(sizeof(unsigned int)*spec.nparams);
-	        if((stat=nc_inq_var_filter(vid.grpid,vid.varid,&spec.filterid,&spec.nparams,spec.params)))
-		    goto done;
+
+    /* Clear the in and out specs */
+    memset(&inspec,0,sizeof(inspec));
+    memset(&ospec,0,sizeof(ospec));
+    memset(&actualspec,0,sizeof(actualspec));
+
+    /* Is there a filter on the output variable */
+    outputdefined = 0; /* default is no filter defined */
+    /* Only bother to look if output is netcdf-4 variant */
+    if(oformat == NC_FORMAT_NETCDF4 || oformat == NC_FORMAT_NETCDF4_CLASSIC) {
+        /* See if any output filter spec is defined for this output variable */
+        for(i=0;i<nfilterspecs;i++) {
+	    if(strcmp(filterspecs[i].fqn,ofqn)==0) {
+	        ospec = filterspecs[i];
+	        outputdefined = 1;
+	        break;
 	    }
+        }
+    }
+
+    /* Is there a filter on the input variable */
+    inputdefined = 0; /* default is no filter defined */
+    /* Only bother to look if input is netcdf-4 variant */
+    if(format == NC_FORMAT_NETCDF4 || format == NC_FORMAT_NETCDF4_CLASSIC) {
+	stat=nc_inq_var_filter(vid.grpid,vid.varid,&inspec.filterid,&inspec.nparams,NULL);
+	if(stat && stat != NC_EFILTER)
+	    goto done; /* true error */
+	if(stat == NC_NOERR) {/* input has a filter */
+  	    inspec.params = (unsigned int*)malloc(sizeof(unsigned int)*inspec.nparams);
+	    if((stat=nc_inq_var_filter(vid.grpid,vid.varid,&inspec.filterid,&inspec.nparams,inspec.params)))
+	        goto done;
+	    inputdefined = 1;
 	}
     }
-    /* Apply filter spec if any */
-    if(spec.filterid > 0) {/* Apply filter */
-#ifdef USE_NETCDF4
-	if((stat=nc_def_var_filter(ovid.grpid,ovid.varid,spec.filterid,spec.nparams,spec.params)))
+
+    /* Rules for choosing output filter are as follows:
+
+	global		output		input	Actual Output
+	suppress	filter		filter	filter
+	-----------------------------------------------
+	true		undefined	NA	unfiltered
+	true		'none'		NA	unfiltered
+	true		defined		NA	use output filter
+	false		undefined	defined	use input filter
+	false		'none'		NA	unfiltered
+	false		defined		NA	use output filter
+    */
+
+    unfiltered = 0;
+
+    if(suppressfilters && !outputdefined) /* row 1 */
+	unfiltered = 1;		
+    else if(suppressfilters && outputdefined && ospec.nofilter) /* row 2 */
+	unfiltered = 1;		
+    else if(suppressfilters && outputdefined) /* row 3 */
+	actualspec = ospec;
+    else if(!suppressfilters && !outputdefined && inputdefined) /* row 4 */
+	actualspec = inspec;	
+    else if(!suppressfilters && outputdefined && ospec.nofilter) /* row 5 */
+	unfiltered = 1;
+    else if(!suppressfilters && outputdefined) /* row 6 */
+	actualspec = ospec;
+
+    /* Apply actual filter spec if any */
+    if(!unfiltered) {
+	if((stat=nc_def_var_filter(ovid.grpid,ovid.varid,
+				   actualspec.filterid,
+				   actualspec.nparams,
+				   actualspec.params)))
 	        goto done;
-#endif
     }
 done:
     /* Cleanup */
-    if(spec.filterid > 0 && spec.nparams > 0 && spec.params != NULL)
-	free(spec.params);
-#endif /*USE_NETCDF4*/
+    if(ofqn != NULL) free(ofqn);
+    if(inspec.fqn) free(inspec.fqn);
+    if(inspec.params) free(inspec.params);
+    /* Note we do not clean actualspec because it is a copy of in|out spec */
     return stat;
 }
 
@@ -1342,8 +1403,10 @@ copy_data(int igrp, int ogrp)
 /* Count total number of dimensions in ncid and all its descendant subgroups */
 int
 count_dims(int ncid) {
-    int numgrps;
     int ndims;
+#ifdef USE_NETCDF4
+    int numgrps;
+#endif
     NC_CHECK(nc_inq_ndims(ncid, &ndims));
 #ifdef USE_NETCDF4
     NC_CHECK(nc_inq_grps(ncid, &numgrps, NULL));
@@ -1784,10 +1847,12 @@ usage(void)
 int
 main(int argc, char**argv)
 {
+    int exitcode = EXIT_SUCCESS;
     char* inputfile = NULL;
     char* outputfile = NULL;
     int c;
 #ifdef USE_NETCDF4
+    int i;
     struct FilterSpec filterspec;
 #endif
 
@@ -1970,14 +2035,20 @@ main(int argc, char**argv)
       break;
 	case 'F': /* optional filter spec for a specified variable */
 #ifdef USE_NETCDF4
-	    if(parsefilterspec(optarg,&filterspec) != NC_NOERR)
-		usage();
-	    if(nfilterspecs >= (MAX_FILTER_SPECS-1))
-		error("too many -F filterspecs\n");
-	    filterspecs[nfilterspecs] = filterspec;
-	    nfilterspecs++;
-	    // Force output to be netcdf-4
-	    option_kind = NC_FORMAT_NETCDF4;
+	    /* If the arg is "none" then suppress all filters
+               on output unless explicit */
+	    if(strcmp(optarg,"none")==0) {
+		suppressfilters = 1;
+	    } else {
+		if(parsefilterspec(optarg,&filterspec) != NC_NOERR)
+		    usage();
+		if(nfilterspecs >= (MAX_FILTER_SPECS-1))
+		    error("too many -F filterspecs\n");
+		filterspecs[nfilterspecs] = filterspec;
+		nfilterspecs++;
+		// Force output to be netcdf-4
+		option_kind = NC_FORMAT_NETCDF4;
+	    }
 #else
 	    error("-F requires netcdf-4");
 #endif
@@ -2001,7 +2072,7 @@ main(int argc, char**argv)
 
 #ifdef USE_NETCDF4
 #ifdef DEBUGFILTER
-    { int i,j;
+    { int j;
         for(i=0;i<nfilterspecs;i++) {
 	    struct FilterSpec *spec = &filterspecs[i];
 	    fprintf(stderr,"filterspecs[%d]={fqn=|%s| filterid=%u nparams=%ld params=",
@@ -2018,6 +2089,16 @@ main(int argc, char**argv)
 #endif /*USE_NETCDF4*/
 
     if(copy(inputfile, outputfile) != NC_NOERR)
-        exit(EXIT_FAILURE);
-    exit(EXIT_SUCCESS);
+        exitcode = EXIT_FAILURE;
+
+#ifdef USE_NETCDF4
+    /* Clean up */
+    for(i=0;i<nfilterspecs;i++) {
+	struct FilterSpec* spec = &filterspecs[i];
+	if(spec->fqn) free(spec->fqn);
+        if(spec->params) free(spec->params);
+    }
+#endif /*USE_NETCDF4*/
+
+    exit(exitcode);
 }
diff --git a/ncgen/Makefile.in b/ncgen/Makefile.in
index c398c97..5b4fedf 100644
--- a/ncgen/Makefile.in
+++ b/ncgen/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -147,7 +147,19 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/bindata.Po ./$(DEPDIR)/bytebuffer.Po \
+	./$(DEPDIR)/cdata.Po ./$(DEPDIR)/cvt.Po ./$(DEPDIR)/data.Po \
+	./$(DEPDIR)/debug.Po ./$(DEPDIR)/dump.Po \
+	./$(DEPDIR)/escapes.Po ./$(DEPDIR)/f77data.Po \
+	./$(DEPDIR)/genbin.Po ./$(DEPDIR)/genc.Po \
+	./$(DEPDIR)/genchar.Po ./$(DEPDIR)/generate.Po \
+	./$(DEPDIR)/generr.Po ./$(DEPDIR)/genf77.Po \
+	./$(DEPDIR)/genj.Po ./$(DEPDIR)/genlib.Po \
+	./$(DEPDIR)/getfill.Po ./$(DEPDIR)/jdata.Po \
+	./$(DEPDIR)/list.Po ./$(DEPDIR)/main.Po ./$(DEPDIR)/nc_iter.Po \
+	./$(DEPDIR)/ncgeny.Po ./$(DEPDIR)/odom.Po \
+	./$(DEPDIR)/semantics.Po ./$(DEPDIR)/util.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -263,7 +275,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -272,6 +283,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -310,6 +322,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -469,8 +482,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -542,32 +555,38 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bindata.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bytebuffer.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdata.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvt.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/debug.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dump.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/escapes.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/f77data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genbin.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genchar.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/generate.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/generr.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genf77.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genj.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genlib.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getfill.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jdata.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/list.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nc_iter.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncgeny.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/odom.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/semantics.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/util.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bindata.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bytebuffer.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdata.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvt.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/debug.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dump.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/escapes.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/f77data.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genbin.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genc.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genchar.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/generate.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/generr.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genf77.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genj.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genlib.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getfill.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jdata.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/list.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nc_iter.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncgeny.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/odom.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/semantics.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/util.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -694,7 +713,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -767,7 +789,32 @@ clean: clean-am
 clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/bindata.Po
+	-rm -f ./$(DEPDIR)/bytebuffer.Po
+	-rm -f ./$(DEPDIR)/cdata.Po
+	-rm -f ./$(DEPDIR)/cvt.Po
+	-rm -f ./$(DEPDIR)/data.Po
+	-rm -f ./$(DEPDIR)/debug.Po
+	-rm -f ./$(DEPDIR)/dump.Po
+	-rm -f ./$(DEPDIR)/escapes.Po
+	-rm -f ./$(DEPDIR)/f77data.Po
+	-rm -f ./$(DEPDIR)/genbin.Po
+	-rm -f ./$(DEPDIR)/genc.Po
+	-rm -f ./$(DEPDIR)/genchar.Po
+	-rm -f ./$(DEPDIR)/generate.Po
+	-rm -f ./$(DEPDIR)/generr.Po
+	-rm -f ./$(DEPDIR)/genf77.Po
+	-rm -f ./$(DEPDIR)/genj.Po
+	-rm -f ./$(DEPDIR)/genlib.Po
+	-rm -f ./$(DEPDIR)/getfill.Po
+	-rm -f ./$(DEPDIR)/jdata.Po
+	-rm -f ./$(DEPDIR)/list.Po
+	-rm -f ./$(DEPDIR)/main.Po
+	-rm -f ./$(DEPDIR)/nc_iter.Po
+	-rm -f ./$(DEPDIR)/ncgeny.Po
+	-rm -f ./$(DEPDIR)/odom.Po
+	-rm -f ./$(DEPDIR)/semantics.Po
+	-rm -f ./$(DEPDIR)/util.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -813,7 +860,32 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/bindata.Po
+	-rm -f ./$(DEPDIR)/bytebuffer.Po
+	-rm -f ./$(DEPDIR)/cdata.Po
+	-rm -f ./$(DEPDIR)/cvt.Po
+	-rm -f ./$(DEPDIR)/data.Po
+	-rm -f ./$(DEPDIR)/debug.Po
+	-rm -f ./$(DEPDIR)/dump.Po
+	-rm -f ./$(DEPDIR)/escapes.Po
+	-rm -f ./$(DEPDIR)/f77data.Po
+	-rm -f ./$(DEPDIR)/genbin.Po
+	-rm -f ./$(DEPDIR)/genc.Po
+	-rm -f ./$(DEPDIR)/genchar.Po
+	-rm -f ./$(DEPDIR)/generate.Po
+	-rm -f ./$(DEPDIR)/generr.Po
+	-rm -f ./$(DEPDIR)/genf77.Po
+	-rm -f ./$(DEPDIR)/genj.Po
+	-rm -f ./$(DEPDIR)/genlib.Po
+	-rm -f ./$(DEPDIR)/getfill.Po
+	-rm -f ./$(DEPDIR)/jdata.Po
+	-rm -f ./$(DEPDIR)/list.Po
+	-rm -f ./$(DEPDIR)/main.Po
+	-rm -f ./$(DEPDIR)/nc_iter.Po
+	-rm -f ./$(DEPDIR)/ncgeny.Po
+	-rm -f ./$(DEPDIR)/odom.Po
+	-rm -f ./$(DEPDIR)/semantics.Po
+	-rm -f ./$(DEPDIR)/util.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -836,7 +908,7 @@ uninstall-man: uninstall-man1
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
 	clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
 	ctags ctags-am distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags distdir dvi dvi-am html \
diff --git a/ncgen/genbin.c b/ncgen/genbin.c
index e107a50..f24db12 100644
--- a/ncgen/genbin.c
+++ b/ncgen/genbin.c
@@ -249,13 +249,13 @@ genbin_definespecialattributes(Symbol* var)
 		level = 9; /* default */
 	    else
 		level = special->_FilterParams[0];
-	    if(level < 0 || level > 9)
+	    if(level > 9)
 		derror("Illegal deflate level");		
 	    else {
 	        stat = nc_def_var_deflate(var->container->ncid,
 	                var->ncid,
 	                (special->_Shuffle == 1?1:0),
-	                (level >= 0?1:0),
+	                (level > 0?1:0),
 			level);
 	    }
 	} else {
diff --git a/ncgen/genlib.c b/ncgen/genlib.c
index 98e845b..5571249 100644
--- a/ncgen/genlib.c
+++ b/ncgen/genlib.c
@@ -94,10 +94,12 @@ Caller must free.
 void
 topfqn(Symbol* sym)
 {
+#ifdef USE_NETCDF4
     char* fqn;
     char* fqnname;
     char* parentfqn;
     Symbol* parent;
+#endif
     
     if(sym->fqn != NULL)
 	return; /* already defined */
diff --git a/ncgen/ncgen.y b/ncgen/ncgen.y
index 0cfa03b..bfed119 100644
--- a/ncgen/ncgen.y
+++ b/ncgen/ncgen.y
@@ -16,6 +16,9 @@ static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
 #include        "ncoffsets.h"
 #include        "ncgeny.h"
 #include        "ncgen.h"
+#ifdef USE_NETCDF4
+#include        "ncfilter.h"
+#endif
 
 /* Following are in ncdump (for now)*/
 /* Need some (unused) definitions to get it to compile */
@@ -122,7 +125,9 @@ static int containsfills(Datalist* list);
 static void datalistextend(Datalist* dl, NCConstant* con);
 static void vercheck(int ncid);
 static long long extractint(NCConstant con);
+#ifdef USE_NETCDF4
 static int parsefilterflag(const char* sdata0, Specialdata* special);
+#endif
 
 int yylex(void);
 
@@ -1329,6 +1334,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
                 special->_Storage = NC_CHUNKED;
                 } break;
           case _FILTER_FLAG:
+#ifdef USE_NETCDF4
 		/* Parse the filter spec */
 		if(parsefilterflag(sdata,special) == NC_NOERR)
                     special->flags |= _FILTER_FLAG;
@@ -1336,6 +1342,9 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
 		    efree(special->_FilterParams);
 		    derror("_Filter: unparseable filter spec: %s",sdata);
 		}
+#else
+        derror("%s: the filter attribute requires netcdf-4 to be enabled",specialname(tag));
+#endif
                 break;
             default: PANIC1("makespecial: illegal token: %d",tag);
          }
@@ -1446,22 +1455,23 @@ specialname(int tag)
     return "<unknown>";
 }
 
+#ifdef USE_NETCDF4
 /*
 Parse a filter spec string and store it in special
 */
 static int
-parsefilterflag(const char* sdata0, Specialdata* special)
+parsefilterflag(const char* sdata, Specialdata* special)
 {
     int stat = NC_NOERR;
 
-    if(sdata0 == NULL || strlen(sdata0) == 0) goto fail;
-    sdata = strdup(sdata0);
+    if(sdata == NULL || strlen(sdata) == 0) return NC_EINVAL;
 
-    stat = NC_parsefilterspec(sdata0, &special->_FilterID, &special->nparams, &special->_FilterParams);
+    stat = NC_parsefilterspec(sdata, &special->_FilterID, &special->nparams, &special->_FilterParams);
     if(stat)
         derror("Malformed filter spec: %s",sdata);
     return stat;
 }
+#endif
 
 /*
 Since the arguments are all simple constants,
diff --git a/ncgen/ncgeny.c b/ncgen/ncgeny.c
index d39ae3d..1117048 100644
--- a/ncgen/ncgeny.c
+++ b/ncgen/ncgeny.c
@@ -79,6 +79,7 @@ static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
 #include        "ncoffsets.h"
 #include        "ncgeny.h"
 #include        "ncgen.h"
+#include        "ncfilter.h"
 
 /* Following are in ncdump (for now)*/
 /* Need some (unused) definitions to get it to compile */
@@ -185,7 +186,9 @@ static int containsfills(Datalist* list);
 static void datalistextend(Datalist* dl, NCConstant* con);
 static void vercheck(int ncid);
 static long long extractint(NCConstant con);
+#ifdef USE_NETCDF4
 static int parsefilterflag(const char* sdata0, Specialdata* special);
+#endif
 
 int yylex(void);
 
@@ -199,7 +202,7 @@ static void yyerror(fmt,va_alist) const char* fmt; va_dcl;
 extern int lex_init(void);
 
 
-#line 203 "ncgeny.c" /* yacc.c:339  */
+#line 206 "ncgeny.c" /* yacc.c:339  */
 
 # ifndef YY_NULLPTR
 #  if defined __cplusplus && 201103L <= __cplusplus
@@ -295,7 +298,7 @@ extern int ncgdebug;
 
 union YYSTYPE
 {
-#line 142 "ncgen.y" /* yacc.c:355  */
+#line 145 "ncgen.y" /* yacc.c:355  */
 
 Symbol* sym;
 unsigned long  size; /* allow for zero size to indicate e.g. UNLIMITED*/
@@ -304,7 +307,7 @@ int            nctype; /* for tracking attribute list type*/
 Datalist*      datalist;
 NCConstant     constant;
 
-#line 308 "ncgeny.c" /* yacc.c:355  */
+#line 311 "ncgeny.c" /* yacc.c:355  */
 };
 
 typedef union YYSTYPE YYSTYPE;
@@ -321,7 +324,7 @@ int ncgparse (void);
 
 /* Copy the second part of user declarations.  */
 
-#line 325 "ncgeny.c" /* yacc.c:358  */
+#line 328 "ncgeny.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -624,22 +627,22 @@ static const yytype_uint8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   224,   224,   230,   232,   239,   246,   246,   249,   258,
-     248,   263,   264,   265,   269,   269,   271,   281,   281,   284,
-     285,   286,   287,   290,   290,   293,   323,   325,   342,   351,
-     363,   377,   410,   411,   414,   428,   429,   430,   431,   432,
-     433,   434,   435,   436,   437,   438,   439,   442,   443,   444,
-     447,   448,   451,   451,   453,   454,   458,   465,   475,   487,
-     488,   489,   492,   493,   496,   496,   498,   520,   524,   528,
-     555,   556,   559,   560,   564,   578,   582,   587,   616,   617,
-     621,   622,   627,   637,   657,   668,   679,   698,   705,   705,
-     708,   710,   712,   714,   716,   725,   736,   738,   740,   742,
-     744,   746,   748,   750,   752,   754,   756,   761,   768,   777,
-     778,   779,   782,   783,   786,   790,   791,   795,   799,   800,
-     805,   806,   810,   811,   812,   813,   814,   815,   819,   823,
-     827,   829,   834,   835,   836,   837,   838,   839,   840,   841,
-     842,   843,   844,   845,   849,   850,   854,   856,   858,   860,
-     865,   869,   870,   876
+       0,   227,   227,   233,   235,   242,   249,   249,   252,   261,
+     251,   266,   267,   268,   272,   272,   274,   284,   284,   287,
+     288,   289,   290,   293,   293,   296,   326,   328,   345,   354,
+     366,   380,   413,   414,   417,   431,   432,   433,   434,   435,
+     436,   437,   438,   439,   440,   441,   442,   445,   446,   447,
+     450,   451,   454,   454,   456,   457,   461,   468,   478,   490,
+     491,   492,   495,   496,   499,   499,   501,   523,   527,   531,
+     558,   559,   562,   563,   567,   581,   585,   590,   619,   620,
+     624,   625,   630,   640,   660,   671,   682,   701,   708,   708,
+     711,   713,   715,   717,   719,   728,   739,   741,   743,   745,
+     747,   749,   751,   753,   755,   757,   759,   764,   771,   780,
+     781,   782,   785,   786,   789,   793,   794,   798,   802,   803,
+     808,   809,   813,   814,   815,   816,   817,   818,   822,   826,
+     830,   832,   837,   838,   839,   840,   841,   842,   843,   844,
+     845,   846,   847,   848,   852,   853,   857,   859,   861,   863,
+     868,   872,   873,   879
 };
 #endif
 
@@ -1631,19 +1634,19 @@ yyreduce:
   switch (yyn)
     {
         case 2:
-#line 227 "ncgen.y" /* yacc.c:1646  */
+#line 230 "ncgen.y" /* yacc.c:1646  */
     {if (error_count > 0) YYABORT;}
-#line 1637 "ncgeny.c" /* yacc.c:1646  */
+#line 1640 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 3:
-#line 230 "ncgen.y" /* yacc.c:1646  */
+#line 233 "ncgen.y" /* yacc.c:1646  */
     {createrootgroup(datasetname);}
-#line 1643 "ncgeny.c" /* yacc.c:1646  */
+#line 1646 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 8:
-#line 249 "ncgen.y" /* yacc.c:1646  */
+#line 252 "ncgen.y" /* yacc.c:1646  */
     {
 		Symbol* id = (yyvsp[-1].sym);
                 markcdf4("Group specification");
@@ -1651,29 +1654,29 @@ yyreduce:
                     yyerror("duplicate group declaration within parent group for %s",
                                 id->name);
             }
-#line 1655 "ncgeny.c" /* yacc.c:1646  */
+#line 1658 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 9:
-#line 258 "ncgen.y" /* yacc.c:1646  */
+#line 261 "ncgen.y" /* yacc.c:1646  */
     {listpop(groupstack);}
-#line 1661 "ncgeny.c" /* yacc.c:1646  */
+#line 1664 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 12:
-#line 264 "ncgen.y" /* yacc.c:1646  */
+#line 267 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1667 "ncgeny.c" /* yacc.c:1646  */
+#line 1670 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 13:
-#line 266 "ncgen.y" /* yacc.c:1646  */
+#line 269 "ncgen.y" /* yacc.c:1646  */
     {markcdf4("Type specification");}
-#line 1673 "ncgeny.c" /* yacc.c:1646  */
+#line 1676 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 16:
-#line 272 "ncgen.y" /* yacc.c:1646  */
+#line 275 "ncgen.y" /* yacc.c:1646  */
     { /* Use when defining a type */
               (yyvsp[0].sym)->objectclass = NC_TYPE;
               if(dupobjectcheck(NC_TYPE,(yyvsp[0].sym)))
@@ -1681,23 +1684,23 @@ yyreduce:
                             (yyvsp[0].sym)->name);
               listpush(typdefs,(void*)(yyvsp[0].sym));
 	    }
-#line 1685 "ncgeny.c" /* yacc.c:1646  */
+#line 1688 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 17:
-#line 281 "ncgen.y" /* yacc.c:1646  */
+#line 284 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1691 "ncgeny.c" /* yacc.c:1646  */
+#line 1694 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 18:
-#line 281 "ncgen.y" /* yacc.c:1646  */
+#line 284 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1697 "ncgeny.c" /* yacc.c:1646  */
+#line 1700 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 25:
-#line 295 "ncgen.y" /* yacc.c:1646  */
+#line 298 "ncgen.y" /* yacc.c:1646  */
     {
 		int i;
                 addtogroup((yyvsp[-3].sym)); /* sets prefix*/
@@ -1724,17 +1727,17 @@ yyreduce:
                 }
                 listsetlength(stack,stackbase);/* remove stack nodes*/
               }
-#line 1728 "ncgeny.c" /* yacc.c:1646  */
+#line 1731 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 26:
-#line 324 "ncgen.y" /* yacc.c:1646  */
+#line 327 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 1734 "ncgeny.c" /* yacc.c:1646  */
+#line 1737 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 27:
-#line 326 "ncgen.y" /* yacc.c:1646  */
+#line 329 "ncgen.y" /* yacc.c:1646  */
     {
 		    int i;
 		    (yyval.mark)=(yyvsp[-2].mark);
@@ -1749,22 +1752,22 @@ yyreduce:
 		    }
 		    listpush(stack,(void*)(yyvsp[0].sym));
 		}
-#line 1753 "ncgeny.c" /* yacc.c:1646  */
+#line 1756 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 28:
-#line 343 "ncgen.y" /* yacc.c:1646  */
+#line 346 "ncgen.y" /* yacc.c:1646  */
     {
             (yyvsp[-2].sym)->objectclass=NC_TYPE;
             (yyvsp[-2].sym)->subclass=NC_ECONST;
             (yyvsp[-2].sym)->typ.econst=(yyvsp[0].constant);
 	    (yyval.sym)=(yyvsp[-2].sym);
         }
-#line 1764 "ncgeny.c" /* yacc.c:1646  */
+#line 1767 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 29:
-#line 352 "ncgen.y" /* yacc.c:1646  */
+#line 355 "ncgen.y" /* yacc.c:1646  */
     {
 		    vercheck(NC_OPAQUE);
                     addtogroup((yyvsp[0].sym)); /*sets prefix*/
@@ -1774,11 +1777,11 @@ yyreduce:
                     (yyvsp[0].sym)->typ.size=int32_val;
                     (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_OPAQUE);
                 }
-#line 1778 "ncgeny.c" /* yacc.c:1646  */
+#line 1781 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 30:
-#line 364 "ncgen.y" /* yacc.c:1646  */
+#line 367 "ncgen.y" /* yacc.c:1646  */
     {
                     Symbol* basetype = (yyvsp[-4].sym);
 		    vercheck(NC_VLEN);
@@ -1790,11 +1793,11 @@ yyreduce:
                     (yyvsp[0].sym)->typ.size=VLENSIZE;
                     (yyvsp[0].sym)->typ.alignment=nctypealignment(NC_VLEN);
                 }
-#line 1794 "ncgeny.c" /* yacc.c:1646  */
+#line 1797 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 31:
-#line 378 "ncgen.y" /* yacc.c:1646  */
+#line 381 "ncgen.y" /* yacc.c:1646  */
     {
 	    int i,j;
 	    vercheck(NC_COMPOUND);
@@ -1824,23 +1827,23 @@ yyreduce:
 	    }
 	    listsetlength(stack,stackbase);/* remove stack nodes*/
           }
-#line 1828 "ncgeny.c" /* yacc.c:1646  */
+#line 1831 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 32:
-#line 410 "ncgen.y" /* yacc.c:1646  */
+#line 413 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-1].mark);}
-#line 1834 "ncgeny.c" /* yacc.c:1646  */
+#line 1837 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 33:
-#line 411 "ncgen.y" /* yacc.c:1646  */
+#line 414 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-2].mark);}
-#line 1840 "ncgeny.c" /* yacc.c:1646  */
+#line 1843 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 34:
-#line 415 "ncgen.y" /* yacc.c:1646  */
+#line 418 "ncgen.y" /* yacc.c:1646  */
     {
 	    int i;
 	    (yyval.mark)=(yyvsp[0].mark);
@@ -1852,118 +1855,118 @@ yyreduce:
 		f->typ.basetype = (yyvsp[-1].sym);
             }
         }
-#line 1856 "ncgeny.c" /* yacc.c:1646  */
+#line 1859 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 35:
-#line 428 "ncgen.y" /* yacc.c:1646  */
+#line 431 "ncgen.y" /* yacc.c:1646  */
     { (yyval.sym) = primsymbols[NC_CHAR]; }
-#line 1862 "ncgeny.c" /* yacc.c:1646  */
+#line 1865 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 36:
-#line 429 "ncgen.y" /* yacc.c:1646  */
+#line 432 "ncgen.y" /* yacc.c:1646  */
     { (yyval.sym) = primsymbols[NC_BYTE]; }
-#line 1868 "ncgeny.c" /* yacc.c:1646  */
+#line 1871 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 37:
-#line 430 "ncgen.y" /* yacc.c:1646  */
+#line 433 "ncgen.y" /* yacc.c:1646  */
     { (yyval.sym) = primsymbols[NC_SHORT]; }
-#line 1874 "ncgeny.c" /* yacc.c:1646  */
+#line 1877 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 38:
-#line 431 "ncgen.y" /* yacc.c:1646  */
+#line 434 "ncgen.y" /* yacc.c:1646  */
     { (yyval.sym) = primsymbols[NC_INT]; }
-#line 1880 "ncgeny.c" /* yacc.c:1646  */
+#line 1883 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 39:
-#line 432 "ncgen.y" /* yacc.c:1646  */
+#line 435 "ncgen.y" /* yacc.c:1646  */
     { (yyval.sym) = primsymbols[NC_FLOAT]; }
-#line 1886 "ncgeny.c" /* yacc.c:1646  */
+#line 1889 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 40:
-#line 433 "ncgen.y" /* yacc.c:1646  */
+#line 436 "ncgen.y" /* yacc.c:1646  */
     { (yyval.sym) = primsymbols[NC_DOUBLE]; }
-#line 1892 "ncgeny.c" /* yacc.c:1646  */
+#line 1895 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 41:
-#line 434 "ncgen.y" /* yacc.c:1646  */
+#line 437 "ncgen.y" /* yacc.c:1646  */
     { vercheck(NC_UBYTE); (yyval.sym) = primsymbols[NC_UBYTE]; }
-#line 1898 "ncgeny.c" /* yacc.c:1646  */
+#line 1901 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 435 "ncgen.y" /* yacc.c:1646  */
+#line 438 "ncgen.y" /* yacc.c:1646  */
     { vercheck(NC_USHORT); (yyval.sym) = primsymbols[NC_USHORT]; }
-#line 1904 "ncgeny.c" /* yacc.c:1646  */
+#line 1907 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 43:
-#line 436 "ncgen.y" /* yacc.c:1646  */
+#line 439 "ncgen.y" /* yacc.c:1646  */
     { vercheck(NC_UINT); (yyval.sym) = primsymbols[NC_UINT]; }
-#line 1910 "ncgeny.c" /* yacc.c:1646  */
+#line 1913 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 437 "ncgen.y" /* yacc.c:1646  */
+#line 440 "ncgen.y" /* yacc.c:1646  */
     { vercheck(NC_INT64); (yyval.sym) = primsymbols[NC_INT64]; }
-#line 1916 "ncgeny.c" /* yacc.c:1646  */
+#line 1919 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 438 "ncgen.y" /* yacc.c:1646  */
+#line 441 "ncgen.y" /* yacc.c:1646  */
     { vercheck(NC_UINT64); (yyval.sym) = primsymbols[NC_UINT64]; }
-#line 1922 "ncgeny.c" /* yacc.c:1646  */
+#line 1925 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 46:
-#line 439 "ncgen.y" /* yacc.c:1646  */
+#line 442 "ncgen.y" /* yacc.c:1646  */
     { vercheck(NC_STRING); (yyval.sym) = primsymbols[NC_STRING]; }
-#line 1928 "ncgeny.c" /* yacc.c:1646  */
+#line 1931 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 443 "ncgen.y" /* yacc.c:1646  */
+#line 446 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1934 "ncgeny.c" /* yacc.c:1646  */
+#line 1937 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 49:
-#line 444 "ncgen.y" /* yacc.c:1646  */
+#line 447 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1940 "ncgeny.c" /* yacc.c:1646  */
+#line 1943 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 52:
-#line 451 "ncgen.y" /* yacc.c:1646  */
+#line 454 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1946 "ncgeny.c" /* yacc.c:1646  */
+#line 1949 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 53:
-#line 451 "ncgen.y" /* yacc.c:1646  */
+#line 454 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1952 "ncgeny.c" /* yacc.c:1646  */
+#line 1955 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 56:
-#line 459 "ncgen.y" /* yacc.c:1646  */
+#line 462 "ncgen.y" /* yacc.c:1646  */
     {
 		(yyvsp[-2].sym)->dim.declsize = (size_t)extractint((yyvsp[0].constant));
 #ifdef GENDEBUG1
 fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long long)(yyvsp[-2].sym)->dim.declsize);
 #endif
 	      }
-#line 1963 "ncgeny.c" /* yacc.c:1646  */
+#line 1966 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 57:
-#line 466 "ncgen.y" /* yacc.c:1646  */
+#line 469 "ncgen.y" /* yacc.c:1646  */
     {
 		        (yyvsp[-2].sym)->dim.declsize = NC_UNLIMITED;
 		        (yyvsp[-2].sym)->dim.isunlimited = 1;
@@ -1971,11 +1974,11 @@ fprintf(stderr,"dimension: %s = %llu\n",(yyvsp[-2].sym)->name,(unsigned long lon
 fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 #endif
 		   }
-#line 1975 "ncgeny.c" /* yacc.c:1646  */
+#line 1978 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 58:
-#line 476 "ncgen.y" /* yacc.c:1646  */
+#line 479 "ncgen.y" /* yacc.c:1646  */
     {
                      (yyvsp[0].sym)->objectclass=NC_DIM;
                      if(dupobjectcheck(NC_DIM,(yyvsp[0].sym)))
@@ -1985,35 +1988,35 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		     (yyval.sym)=(yyvsp[0].sym);
 		     listpush(dimdefs,(void*)(yyvsp[0].sym));
                    }
-#line 1989 "ncgeny.c" /* yacc.c:1646  */
+#line 1992 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 60:
-#line 488 "ncgen.y" /* yacc.c:1646  */
+#line 491 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 1995 "ncgeny.c" /* yacc.c:1646  */
+#line 1998 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 61:
-#line 489 "ncgen.y" /* yacc.c:1646  */
+#line 492 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 2001 "ncgeny.c" /* yacc.c:1646  */
+#line 2004 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 496 "ncgen.y" /* yacc.c:1646  */
+#line 499 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 2007 "ncgeny.c" /* yacc.c:1646  */
+#line 2010 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 65:
-#line 496 "ncgen.y" /* yacc.c:1646  */
+#line 499 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 2013 "ncgeny.c" /* yacc.c:1646  */
+#line 2016 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 499 "ncgen.y" /* yacc.c:1646  */
+#line 502 "ncgen.y" /* yacc.c:1646  */
     {
 		    int i;
 		    stackbase=(yyvsp[0].mark);
@@ -2033,25 +2036,25 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		    }
 		    listsetlength(stack,stackbase);/* remove stack nodes*/
 		}
-#line 2037 "ncgeny.c" /* yacc.c:1646  */
+#line 2040 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 521 "ncgen.y" /* yacc.c:1646  */
+#line 524 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack);
                  listpush(stack,(void*)(yyvsp[0].sym));
 		}
-#line 2045 "ncgeny.c" /* yacc.c:1646  */
+#line 2048 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 525 "ncgen.y" /* yacc.c:1646  */
+#line 528 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2051 "ncgeny.c" /* yacc.c:1646  */
+#line 2054 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 529 "ncgen.y" /* yacc.c:1646  */
+#line 532 "ncgen.y" /* yacc.c:1646  */
     {
 		    int i;
 		    Dimset dimset;
@@ -2076,35 +2079,35 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
                     (yyvsp[-1].sym)->objectclass=NC_VAR;
 		    listsetlength(stack,stackbase);/* remove stack nodes*/
 		    }
-#line 2080 "ncgeny.c" /* yacc.c:1646  */
+#line 2083 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 555 "ncgen.y" /* yacc.c:1646  */
+#line 558 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack);}
-#line 2086 "ncgeny.c" /* yacc.c:1646  */
+#line 2089 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 556 "ncgen.y" /* yacc.c:1646  */
+#line 559 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-1].mark);}
-#line 2092 "ncgeny.c" /* yacc.c:1646  */
+#line 2095 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 559 "ncgen.y" /* yacc.c:1646  */
+#line 562 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2098 "ncgeny.c" /* yacc.c:1646  */
+#line 2101 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 561 "ncgen.y" /* yacc.c:1646  */
+#line 564 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2104 "ncgeny.c" /* yacc.c:1646  */
+#line 2107 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 565 "ncgen.y" /* yacc.c:1646  */
+#line 568 "ncgen.y" /* yacc.c:1646  */
     {Symbol* dimsym = (yyvsp[0].sym);
 		dimsym->objectclass = NC_DIM;
 		/* Find the actual dimension*/
@@ -2115,25 +2118,25 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		}
 		(yyval.sym)=dimsym;
 	    }
-#line 2119 "ncgeny.c" /* yacc.c:1646  */
+#line 2122 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 579 "ncgen.y" /* yacc.c:1646  */
+#line 582 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack);
              listpush(stack,(void*)(yyvsp[0].sym));
 	    }
-#line 2127 "ncgeny.c" /* yacc.c:1646  */
+#line 2130 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 583 "ncgen.y" /* yacc.c:1646  */
+#line 586 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2133 "ncgeny.c" /* yacc.c:1646  */
+#line 2136 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 588 "ncgen.y" /* yacc.c:1646  */
+#line 591 "ncgen.y" /* yacc.c:1646  */
     {
 		int i;
 		Dimset dimset;
@@ -2160,35 +2163,35 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		listsetlength(stack,stackbase);/* remove stack nodes*/
 		(yyval.sym) = (yyvsp[-1].sym);
 	    }
-#line 2164 "ncgeny.c" /* yacc.c:1646  */
+#line 2167 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 616 "ncgen.y" /* yacc.c:1646  */
+#line 619 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack);}
-#line 2170 "ncgeny.c" /* yacc.c:1646  */
+#line 2173 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 617 "ncgen.y" /* yacc.c:1646  */
+#line 620 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-1].mark);}
-#line 2176 "ncgeny.c" /* yacc.c:1646  */
+#line 2179 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 80:
-#line 621 "ncgen.y" /* yacc.c:1646  */
+#line 624 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=listlength(stack); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2182 "ncgeny.c" /* yacc.c:1646  */
+#line 2185 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 623 "ncgen.y" /* yacc.c:1646  */
+#line 626 "ncgen.y" /* yacc.c:1646  */
     {(yyval.mark)=(yyvsp[-2].mark); listpush(stack,(void*)(yyvsp[0].sym));}
-#line 2188 "ncgeny.c" /* yacc.c:1646  */
+#line 2191 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 628 "ncgen.y" /* yacc.c:1646  */
+#line 631 "ncgen.y" /* yacc.c:1646  */
     {  /* Anonymous integer dimension.
 	         Can only occur in type definitions*/
 	     char anon[32];
@@ -2198,11 +2201,11 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 	     (yyval.sym)->dim.isconstant = 1;
 	     (yyval.sym)->dim.declsize = uint32_val;
 	    }
-#line 2202 "ncgeny.c" /* yacc.c:1646  */
+#line 2205 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 638 "ncgen.y" /* yacc.c:1646  */
+#line 641 "ncgen.y" /* yacc.c:1646  */
     {  /* Anonymous integer dimension.
 	         Can only occur in type definitions*/
 	     char anon[32];
@@ -2216,11 +2219,11 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 	     (yyval.sym)->dim.isconstant = 1;
 	     (yyval.sym)->dim.declsize = int32_val;
 	    }
-#line 2220 "ncgeny.c" /* yacc.c:1646  */
+#line 2223 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 658 "ncgen.y" /* yacc.c:1646  */
+#line 661 "ncgen.y" /* yacc.c:1646  */
     {Symbol* vsym = (yyvsp[0].sym);
 		if(vsym->objectclass != NC_VAR) {
 		    derror("Undefined or forward referenced variable: %s",vsym->name);
@@ -2228,11 +2231,11 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		}
 		(yyval.sym)=vsym;
 	    }
-#line 2232 "ncgeny.c" /* yacc.c:1646  */
+#line 2235 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 669 "ncgen.y" /* yacc.c:1646  */
+#line 672 "ncgen.y" /* yacc.c:1646  */
     {Symbol* tsym = (yyvsp[0].sym);
 		if(tsym->objectclass != NC_TYPE) {
 		    derror("Undefined or forward referenced type: %s",tsym->name);
@@ -2240,11 +2243,11 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		}
 		(yyval.sym)=tsym;
 	    }
-#line 2244 "ncgeny.c" /* yacc.c:1646  */
+#line 2247 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 680 "ncgen.y" /* yacc.c:1646  */
+#line 683 "ncgen.y" /* yacc.c:1646  */
     {Symbol* tvsym = (yyvsp[0].sym); Symbol* sym;
 		/* disambiguate*/
 		tvsym->objectclass = NC_VAR;
@@ -2263,53 +2266,53 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		}
 		(yyval.sym)=tvsym;
 	    }
-#line 2267 "ncgeny.c" /* yacc.c:1646  */
+#line 2270 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 87:
-#line 698 "ncgen.y" /* yacc.c:1646  */
+#line 701 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym)=(yyvsp[0].sym);}
-#line 2273 "ncgeny.c" /* yacc.c:1646  */
+#line 2276 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 88:
-#line 705 "ncgen.y" /* yacc.c:1646  */
+#line 708 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 2279 "ncgeny.c" /* yacc.c:1646  */
+#line 2282 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 89:
-#line 705 "ncgen.y" /* yacc.c:1646  */
+#line 708 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 2285 "ncgeny.c" /* yacc.c:1646  */
+#line 2288 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 90:
-#line 709 "ncgen.y" /* yacc.c:1646  */
+#line 712 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_NCPROPS_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
-#line 2291 "ncgeny.c" /* yacc.c:1646  */
+#line 2294 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 711 "ncgen.y" /* yacc.c:1646  */
+#line 714 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_ISNETCDF4_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
-#line 2297 "ncgeny.c" /* yacc.c:1646  */
+#line 2300 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 713 "ncgen.y" /* yacc.c:1646  */
+#line 716 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_SUPERBLOCK_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),ATTRGLOBAL);}
-#line 2303 "ncgeny.c" /* yacc.c:1646  */
+#line 2306 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 715 "ncgen.y" /* yacc.c:1646  */
+#line 718 "ncgen.y" /* yacc.c:1646  */
     { (yyval.sym)=makeattribute((yyvsp[-2].sym),NULL,NULL,(yyvsp[0].datalist),ATTRGLOBAL);}
-#line 2309 "ncgeny.c" /* yacc.c:1646  */
+#line 2312 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 717 "ncgen.y" /* yacc.c:1646  */
+#line 720 "ncgen.y" /* yacc.c:1646  */
     {Symbol* tsym = (yyvsp[-5].sym); Symbol* vsym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym);
 		if(vsym->objectclass == NC_VAR) {
 		    (yyval.sym)=makeattribute(asym,vsym,tsym,(yyvsp[0].datalist),ATTRVAR);
@@ -2318,11 +2321,11 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		    YYABORT;
 		}
 	    }
-#line 2322 "ncgeny.c" /* yacc.c:1646  */
+#line 2325 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 726 "ncgen.y" /* yacc.c:1646  */
+#line 729 "ncgen.y" /* yacc.c:1646  */
     {Symbol* sym = (yyvsp[-4].sym); Symbol* asym = (yyvsp[-2].sym);
 		if(sym->objectclass == NC_VAR) {
 		    (yyval.sym)=makeattribute(asym,sym,NULL,(yyvsp[0].datalist),ATTRVAR);
@@ -2333,345 +2336,345 @@ fprintf(stderr,"dimension: %s = UNLIMITED\n",(yyvsp[-2].sym)->name);
 		    YYABORT;
 		}
 	    }
-#line 2337 "ncgeny.c" /* yacc.c:1646  */
+#line 2340 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 737 "ncgen.y" /* yacc.c:1646  */
+#line 740 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
-#line 2343 "ncgeny.c" /* yacc.c:1646  */
+#line 2346 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 739 "ncgen.y" /* yacc.c:1646  */
+#line 742 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_FILLVALUE_FLAG,(yyvsp[-4].sym),(yyvsp[-5].sym),(void*)(yyvsp[0].datalist),0);}
-#line 2349 "ncgeny.c" /* yacc.c:1646  */
+#line 2352 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 98:
-#line 741 "ncgen.y" /* yacc.c:1646  */
+#line 744 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_STORAGE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2355 "ncgeny.c" /* yacc.c:1646  */
+#line 2358 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 99:
-#line 743 "ncgen.y" /* yacc.c:1646  */
+#line 746 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_CHUNKSIZES_FLAG,(yyvsp[-4].sym),NULL,(void*)(yyvsp[0].datalist),0);}
-#line 2361 "ncgeny.c" /* yacc.c:1646  */
+#line 2364 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 100:
-#line 745 "ncgen.y" /* yacc.c:1646  */
+#line 748 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_FLETCHER32_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2367 "ncgeny.c" /* yacc.c:1646  */
+#line 2370 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 101:
-#line 747 "ncgen.y" /* yacc.c:1646  */
+#line 750 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_DEFLATE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2373 "ncgeny.c" /* yacc.c:1646  */
+#line 2376 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 102:
-#line 749 "ncgen.y" /* yacc.c:1646  */
+#line 752 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_SHUFFLE_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2379 "ncgeny.c" /* yacc.c:1646  */
+#line 2382 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 103:
-#line 751 "ncgen.y" /* yacc.c:1646  */
+#line 754 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_ENDIAN_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2385 "ncgeny.c" /* yacc.c:1646  */
+#line 2388 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 104:
-#line 753 "ncgen.y" /* yacc.c:1646  */
+#line 756 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_FILTER_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2391 "ncgeny.c" /* yacc.c:1646  */
+#line 2394 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 105:
-#line 755 "ncgen.y" /* yacc.c:1646  */
+#line 758 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_NOFILL_FLAG,(yyvsp[-4].sym),NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2397 "ncgeny.c" /* yacc.c:1646  */
+#line 2400 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 106:
-#line 757 "ncgen.y" /* yacc.c:1646  */
+#line 760 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym) = makespecial(_FORMAT_FLAG,NULL,NULL,(void*)&(yyvsp[0].constant),1);}
-#line 2403 "ncgeny.c" /* yacc.c:1646  */
+#line 2406 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 107:
-#line 762 "ncgen.y" /* yacc.c:1646  */
+#line 765 "ncgen.y" /* yacc.c:1646  */
     {
 	        (yyval.sym)=(yyvsp[0].sym);
                 (yyvsp[0].sym)->ref.is_ref=1;
                 (yyvsp[0].sym)->is_prefixed=0;
                 setpathcurrent((yyvsp[0].sym));
 	    }
-#line 2414 "ncgeny.c" /* yacc.c:1646  */
+#line 2417 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 108:
-#line 769 "ncgen.y" /* yacc.c:1646  */
+#line 772 "ncgen.y" /* yacc.c:1646  */
     {
 	        (yyval.sym)=(yyvsp[0].sym);
                 (yyvsp[0].sym)->ref.is_ref=1;
                 (yyvsp[0].sym)->is_prefixed=1;
 	        /* path is set in ncgen.l*/
 	    }
-#line 2425 "ncgeny.c" /* yacc.c:1646  */
+#line 2428 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 110:
-#line 778 "ncgen.y" /* yacc.c:1646  */
+#line 781 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 2431 "ncgeny.c" /* yacc.c:1646  */
+#line 2434 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 111:
-#line 779 "ncgen.y" /* yacc.c:1646  */
+#line 782 "ncgen.y" /* yacc.c:1646  */
     {}
-#line 2437 "ncgeny.c" /* yacc.c:1646  */
+#line 2440 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 114:
-#line 787 "ncgen.y" /* yacc.c:1646  */
+#line 790 "ncgen.y" /* yacc.c:1646  */
     {(yyvsp[-2].sym)->data = (yyvsp[0].datalist);}
-#line 2443 "ncgeny.c" /* yacc.c:1646  */
+#line 2446 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 115:
-#line 790 "ncgen.y" /* yacc.c:1646  */
+#line 793 "ncgen.y" /* yacc.c:1646  */
     {(yyval.datalist) = (yyvsp[0].datalist);}
-#line 2449 "ncgeny.c" /* yacc.c:1646  */
+#line 2452 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 116:
-#line 791 "ncgen.y" /* yacc.c:1646  */
+#line 794 "ncgen.y" /* yacc.c:1646  */
     {(yyval.datalist) = (yyvsp[0].datalist);}
-#line 2455 "ncgeny.c" /* yacc.c:1646  */
+#line 2458 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 117:
-#line 795 "ncgen.y" /* yacc.c:1646  */
+#line 798 "ncgen.y" /* yacc.c:1646  */
     {(yyval.datalist) = builddatalist(0);}
-#line 2461 "ncgeny.c" /* yacc.c:1646  */
+#line 2464 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 118:
-#line 799 "ncgen.y" /* yacc.c:1646  */
+#line 802 "ncgen.y" /* yacc.c:1646  */
     {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
-#line 2467 "ncgeny.c" /* yacc.c:1646  */
+#line 2470 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 119:
-#line 801 "ncgen.y" /* yacc.c:1646  */
+#line 804 "ncgen.y" /* yacc.c:1646  */
     {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
-#line 2473 "ncgeny.c" /* yacc.c:1646  */
+#line 2476 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 120:
-#line 805 "ncgen.y" /* yacc.c:1646  */
+#line 808 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=(yyvsp[0].constant);}
-#line 2479 "ncgeny.c" /* yacc.c:1646  */
+#line 2482 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 121:
-#line 806 "ncgen.y" /* yacc.c:1646  */
+#line 809 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=builddatasublist((yyvsp[-1].datalist));}
-#line 2485 "ncgeny.c" /* yacc.c:1646  */
+#line 2488 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 122:
-#line 810 "ncgen.y" /* yacc.c:1646  */
+#line 813 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=(yyvsp[0].constant);}
-#line 2491 "ncgeny.c" /* yacc.c:1646  */
+#line 2494 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 123:
-#line 811 "ncgen.y" /* yacc.c:1646  */
+#line 814 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_OPAQUE);}
-#line 2497 "ncgeny.c" /* yacc.c:1646  */
+#line 2500 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 124:
-#line 812 "ncgen.y" /* yacc.c:1646  */
+#line 815 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_FILLVALUE);}
-#line 2503 "ncgeny.c" /* yacc.c:1646  */
+#line 2506 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 125:
-#line 813 "ncgen.y" /* yacc.c:1646  */
+#line 816 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_NIL);}
-#line 2509 "ncgeny.c" /* yacc.c:1646  */
+#line 2512 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 126:
-#line 814 "ncgen.y" /* yacc.c:1646  */
+#line 817 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=(yyvsp[0].constant);}
-#line 2515 "ncgeny.c" /* yacc.c:1646  */
+#line 2518 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 128:
-#line 819 "ncgen.y" /* yacc.c:1646  */
+#line 822 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant) = makeenumconstref((yyvsp[0].sym));}
-#line 2521 "ncgeny.c" /* yacc.c:1646  */
+#line 2524 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 129:
-#line 823 "ncgen.y" /* yacc.c:1646  */
+#line 826 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=evaluate((yyvsp[-3].sym),(yyvsp[-1].datalist));}
-#line 2527 "ncgeny.c" /* yacc.c:1646  */
+#line 2530 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 130:
-#line 828 "ncgen.y" /* yacc.c:1646  */
+#line 831 "ncgen.y" /* yacc.c:1646  */
     {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
-#line 2533 "ncgeny.c" /* yacc.c:1646  */
+#line 2536 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 131:
-#line 830 "ncgen.y" /* yacc.c:1646  */
+#line 833 "ncgen.y" /* yacc.c:1646  */
     {datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant))); (yyval.datalist)=(yyvsp[-2].datalist);}
-#line 2539 "ncgeny.c" /* yacc.c:1646  */
+#line 2542 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 132:
-#line 834 "ncgen.y" /* yacc.c:1646  */
+#line 837 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_CHAR);}
-#line 2545 "ncgeny.c" /* yacc.c:1646  */
+#line 2548 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 133:
-#line 835 "ncgen.y" /* yacc.c:1646  */
+#line 838 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_BYTE);}
-#line 2551 "ncgeny.c" /* yacc.c:1646  */
+#line 2554 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 134:
-#line 836 "ncgen.y" /* yacc.c:1646  */
+#line 839 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_SHORT);}
-#line 2557 "ncgeny.c" /* yacc.c:1646  */
+#line 2560 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 135:
-#line 837 "ncgen.y" /* yacc.c:1646  */
+#line 840 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_INT);}
-#line 2563 "ncgeny.c" /* yacc.c:1646  */
+#line 2566 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 136:
-#line 838 "ncgen.y" /* yacc.c:1646  */
+#line 841 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_INT64);}
-#line 2569 "ncgeny.c" /* yacc.c:1646  */
+#line 2572 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 137:
-#line 839 "ncgen.y" /* yacc.c:1646  */
+#line 842 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_UBYTE);}
-#line 2575 "ncgeny.c" /* yacc.c:1646  */
+#line 2578 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 138:
-#line 840 "ncgen.y" /* yacc.c:1646  */
+#line 843 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_USHORT);}
-#line 2581 "ncgeny.c" /* yacc.c:1646  */
+#line 2584 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 139:
-#line 841 "ncgen.y" /* yacc.c:1646  */
+#line 844 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_UINT);}
-#line 2587 "ncgeny.c" /* yacc.c:1646  */
+#line 2590 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 140:
-#line 842 "ncgen.y" /* yacc.c:1646  */
+#line 845 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_UINT64);}
-#line 2593 "ncgeny.c" /* yacc.c:1646  */
+#line 2596 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 141:
-#line 843 "ncgen.y" /* yacc.c:1646  */
+#line 846 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_FLOAT);}
-#line 2599 "ncgeny.c" /* yacc.c:1646  */
+#line 2602 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 142:
-#line 844 "ncgen.y" /* yacc.c:1646  */
+#line 847 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_DOUBLE);}
-#line 2605 "ncgeny.c" /* yacc.c:1646  */
+#line 2608 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 143:
-#line 845 "ncgen.y" /* yacc.c:1646  */
+#line 848 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_STRING);}
-#line 2611 "ncgeny.c" /* yacc.c:1646  */
+#line 2614 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 144:
-#line 849 "ncgen.y" /* yacc.c:1646  */
+#line 852 "ncgen.y" /* yacc.c:1646  */
     {(yyval.datalist) = builddatalist(0); datalistextend((yyval.datalist),&((yyvsp[0].constant)));}
-#line 2617 "ncgeny.c" /* yacc.c:1646  */
+#line 2620 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 145:
-#line 850 "ncgen.y" /* yacc.c:1646  */
+#line 853 "ncgen.y" /* yacc.c:1646  */
     {(yyval.datalist)=(yyvsp[-2].datalist); datalistextend((yyvsp[-2].datalist),&((yyvsp[0].constant)));}
-#line 2623 "ncgeny.c" /* yacc.c:1646  */
+#line 2626 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 146:
-#line 855 "ncgen.y" /* yacc.c:1646  */
+#line 858 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_INT);}
-#line 2629 "ncgeny.c" /* yacc.c:1646  */
+#line 2632 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 147:
-#line 857 "ncgen.y" /* yacc.c:1646  */
+#line 860 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_UINT);}
-#line 2635 "ncgeny.c" /* yacc.c:1646  */
+#line 2638 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 148:
-#line 859 "ncgen.y" /* yacc.c:1646  */
+#line 862 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_INT64);}
-#line 2641 "ncgeny.c" /* yacc.c:1646  */
+#line 2644 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 149:
-#line 861 "ncgen.y" /* yacc.c:1646  */
+#line 864 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_UINT64);}
-#line 2647 "ncgeny.c" /* yacc.c:1646  */
+#line 2650 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 150:
-#line 865 "ncgen.y" /* yacc.c:1646  */
+#line 868 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=makeconstdata(NC_STRING);}
-#line 2653 "ncgeny.c" /* yacc.c:1646  */
+#line 2656 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 151:
-#line 869 "ncgen.y" /* yacc.c:1646  */
+#line 872 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=(yyvsp[0].constant);}
-#line 2659 "ncgeny.c" /* yacc.c:1646  */
+#line 2662 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 152:
-#line 870 "ncgen.y" /* yacc.c:1646  */
+#line 873 "ncgen.y" /* yacc.c:1646  */
     {(yyval.constant)=(yyvsp[0].constant);}
-#line 2665 "ncgeny.c" /* yacc.c:1646  */
+#line 2668 "ncgeny.c" /* yacc.c:1646  */
     break;
 
   case 153:
-#line 876 "ncgen.y" /* yacc.c:1646  */
+#line 879 "ncgen.y" /* yacc.c:1646  */
     {(yyval.sym)=(yyvsp[0].sym);}
-#line 2671 "ncgeny.c" /* yacc.c:1646  */
+#line 2674 "ncgeny.c" /* yacc.c:1646  */
     break;
 
 
-#line 2675 "ncgeny.c" /* yacc.c:1646  */
+#line 2678 "ncgeny.c" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -2899,7 +2902,7 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 879 "ncgen.y" /* yacc.c:1906  */
+#line 882 "ncgen.y" /* yacc.c:1906  */
 
 
 #ifndef NO_STDARG
@@ -3353,9 +3356,17 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
                 special->_Storage = NC_CHUNKED;
                 } break;
           case _FILTER_FLAG:
+#ifdef USE_NETCDF4
 		/* Parse the filter spec */
-		if(parsefilterflag(sdata,special))
+		if(parsefilterflag(sdata,special) == NC_NOERR)
                     special->flags |= _FILTER_FLAG;
+		else {
+		    efree(special->_FilterParams);
+		    derror("_Filter: unparseable filter spec: %s",sdata);
+		}
+#else
+        derror("%s: the filter attribute requires netcdf-4 to be enabled",specialname(tag));
+#endif
                 break;
             default: PANIC1("makespecial: illegal token: %d",tag);
          }
@@ -3466,62 +3477,23 @@ specialname(int tag)
     return "<unknown>";
 }
 
+#ifdef USE_NETCDF4
 /*
 Parse a filter spec string and store it in special
 */
 static int
-parsefilterflag(const char* sdata0, Specialdata* special)
+parsefilterflag(const char* sdata, Specialdata* special)
 {
-    char* p;
-    char* sdata = NULL;
-    int stat;
-    size_t count;
-    unsigned int* ulist = NULL;
-
-    if(sdata0 == NULL || strlen(sdata0) == 0) goto fail;
-    sdata = strdup(sdata0);
-
-    /* Count number of unsigned integers and delimit */
-    p=sdata;
-    for(count=0;;count++) {
-        char* q = strchr(p,',');
-	if(q == NULL) break;
-	*q++ = '\0'; /* delimit */
-	p = q;
-    }
-    count++; /* for final piece */
-
-    /* Start by collecting the filter id */
-    p = sdata;
-    stat = sscanf(p,"%u",&special->_FilterID);
-    if(stat != 1) goto fail;
-    count--;  /* actual param count minus the id */
-
-    ulist = (unsigned int*)malloc(sizeof(unsigned int)*(count));
-    if(ulist == NULL) goto fail;
-
-    special->nparams = count;
-    for(count=0;count < special->nparams ;) {
-        unsigned int uval;
-        p = p + strlen(p) + 1; /* move to next param */
-	stat = sscanf(p,"%u",&uval);
-	if(stat != 1) goto fail;
-	ulist[count++] = uval;
-    }
-    special->_FilterParams = ulist;
-    ulist = NULL; /* avoid duplicate free */
+    int stat = NC_NOERR;
 
-    if(sdata) free(sdata);
-    if(ulist) free(ulist);
-    return 1;
-fail:
-    if(sdata) free(sdata);
-    if(ulist) free(ulist);
-    if(special) special->_FilterID = 0;
-    derror("Malformed filter spec: %s",sdata);
+    if(sdata == NULL || strlen(sdata) == 0) return NC_EINVAL;
 
-    return 0;
+    stat = NC_parsefilterspec(sdata, &special->_FilterID, &special->nparams, &special->_FilterParams);
+    if(stat)
+        derror("Malformed filter spec: %s",sdata);
+    return stat;
 }
+#endif
 
 /*
 Since the arguments are all simple constants,
diff --git a/ncgen/ncgeny.h b/ncgen/ncgeny.h
index 3c59b97..dab86a4 100644
--- a/ncgen/ncgeny.h
+++ b/ncgen/ncgeny.h
@@ -106,7 +106,7 @@ extern int ncgdebug;
 
 union YYSTYPE
 {
-#line 142 "ncgen.y" /* yacc.c:1909  */
+#line 145 "ncgen.y" /* yacc.c:1909  */
 
 Symbol* sym;
 unsigned long  size; /* allow for zero size to indicate e.g. UNLIMITED*/
diff --git a/ncgen3/Makefile.in b/ncgen3/Makefile.in
index e1725a5..9e12f10 100644
--- a/ncgen3/Makefile.in
+++ b/ncgen3/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -144,7 +144,10 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/escapes.Po ./$(DEPDIR)/genlib.Po \
+	./$(DEPDIR)/getfill.Po ./$(DEPDIR)/init.Po ./$(DEPDIR)/load.Po \
+	./$(DEPDIR)/main.Po ./$(DEPDIR)/ncgentab.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -437,7 +440,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -446,6 +448,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -484,6 +487,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -625,8 +629,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -698,13 +702,19 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/escapes.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genlib.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getfill.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/init.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/load.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncgentab.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/escapes.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genlib.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getfill.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/init.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/load.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncgentab.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -951,7 +961,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: 
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1001,7 +1011,10 @@ run_nc4_tests.sh.log: run_nc4_tests.sh
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1078,7 +1091,13 @@ clean: clean-am
 clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/escapes.Po
+	-rm -f ./$(DEPDIR)/genlib.Po
+	-rm -f ./$(DEPDIR)/getfill.Po
+	-rm -f ./$(DEPDIR)/init.Po
+	-rm -f ./$(DEPDIR)/load.Po
+	-rm -f ./$(DEPDIR)/main.Po
+	-rm -f ./$(DEPDIR)/ncgentab.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1124,7 +1143,13 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/escapes.Po
+	-rm -f ./$(DEPDIR)/genlib.Po
+	-rm -f ./$(DEPDIR)/getfill.Po
+	-rm -f ./$(DEPDIR)/init.Po
+	-rm -f ./$(DEPDIR)/load.Po
+	-rm -f ./$(DEPDIR)/main.Po
+	-rm -f ./$(DEPDIR)/ncgentab.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1147,20 +1172,20 @@ uninstall-man: uninstall-man1
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-binPROGRAMS \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-man1 \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am recheck tags tags-am uninstall \
-	uninstall-am uninstall-binPROGRAMS uninstall-man \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+	check-am clean clean-binPROGRAMS clean-generic clean-libtool \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-man1 install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \
+	uninstall uninstall-am uninstall-binPROGRAMS uninstall-man \
 	uninstall-man1
 
 .PRECIOUS: Makefile
diff --git a/nctest/Makefile.am b/nctest/Makefile.am
index 9c8c05a..348472e 100644
--- a/nctest/Makefile.am
+++ b/nctest/Makefile.am
@@ -16,7 +16,7 @@ AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
 # generated in a pressurized chamber that exactly simulated the
 # atmosphere on the surface of Mars.
 EXTRA_DIST = ref_nctest_classic.nc ref_nctest_64bit_offset.nc	\
-compare_test_files.sh run_valgrind_tests.sh CMakeLists.txt
+compare_test_files.sh CMakeLists.txt
 
 CLEANFILES = nctest_*.nc test2.nc temp.tmp tst_*.nc	\
 nctest_classic.cdl ref_nctest_classic.cdl
@@ -33,12 +33,6 @@ TEST_EXTENSIONS = .sh
 # compare_test_files depends on nctest executing first.
 compare_test_files.log: nctest.log 
 
-# This will the test program with valgrind, the memory checking
-# tool. (Valgrind must be present for this to work.)
-if USE_VALGRIND_TESTS
-TESTS += run_valgrind_tests.sh
-endif # USE_VALGRIND_TESTS
-
 # These are the source files for the nctest program.
 nctest_SOURCES = add.c add.h atttests.c cdftests.c dimtests.c driver.c	\
 emalloc.c emalloc.h error.c error.h misctest.c rec.c slabs.c testcdf.h	\
diff --git a/nctest/Makefile.in b/nctest/Makefile.in
index 38e84d7..dd32a00 100644
--- a/nctest/Makefile.in
+++ b/nctest/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -103,11 +103,7 @@ host_triplet = @host@
 target_triplet = @target@
 @USE_DAP_TRUE at am__append_1 = -I${top_srcdir}/oc2
 check_PROGRAMS = $(am__EXEEXT_1)
-TESTS = $(am__EXEEXT_1) compare_test_files.sh $(am__append_2)
-
-# This will the test program with valgrind, the memory checking
-# tool. (Valgrind must be present for this to work.)
- at USE_VALGRIND_TESTS_TRUE@am__append_2 = run_valgrind_tests.sh
+TESTS = $(am__EXEEXT_1) compare_test_files.sh
 subdir = nctest
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -152,7 +148,17 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/add.Po ./$(DEPDIR)/atttests.Po \
+	./$(DEPDIR)/cdftests.Po ./$(DEPDIR)/dimtests.Po \
+	./$(DEPDIR)/driver.Po ./$(DEPDIR)/emalloc.Po \
+	./$(DEPDIR)/error.Po ./$(DEPDIR)/misctest.Po \
+	./$(DEPDIR)/rec.Po ./$(DEPDIR)/slabs.Po \
+	./$(DEPDIR)/tst_rename.Po ./$(DEPDIR)/val.Po \
+	./$(DEPDIR)/vardef.Po ./$(DEPDIR)/varget.Po \
+	./$(DEPDIR)/vargetg.Po ./$(DEPDIR)/varput.Po \
+	./$(DEPDIR)/varputg.Po ./$(DEPDIR)/vartests.Po \
+	./$(DEPDIR)/vputget.Po ./$(DEPDIR)/vputgetg.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -442,7 +448,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -451,6 +456,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -489,6 +495,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -596,7 +603,7 @@ AM_TESTS_ENVIRONMENT = export TOPSRCDIR=${abs_top_srcdir}; export TOPBUILDDIR=${
 # generated in a pressurized chamber that exactly simulated the
 # atmosphere on the surface of Mars.
 EXTRA_DIST = ref_nctest_classic.nc ref_nctest_64bit_offset.nc	\
-compare_test_files.sh run_valgrind_tests.sh CMakeLists.txt
+compare_test_files.sh CMakeLists.txt
 
 CLEANFILES = nctest_*.nc test2.nc temp.tmp tst_*.nc	\
 nctest_classic.cdl ref_nctest_classic.cdl
@@ -636,8 +643,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 $(top_srcdir)/lib_flags.am $(am__empty):
 
@@ -673,26 +680,32 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/atttests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdftests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dimtests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/driver.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/emalloc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misctest.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rec.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slabs.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rename.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/val.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardef.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varget.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vargetg.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varput.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varputg.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vartests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputget.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputgetg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/atttests.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdftests.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dimtests.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/driver.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/emalloc.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misctest.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rec.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slabs.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rename.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/val.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardef.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varget.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vargetg.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varput.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varputg.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vartests.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputget.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputgetg.Po at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -896,7 +909,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	fi;								\
 	$$success || exit 1
 
-check-TESTS:
+check-TESTS: $(check_PROGRAMS)
 	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
 	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -946,7 +959,10 @@ tst_rename.log: tst_rename$(EXEEXT)
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -1022,7 +1038,26 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/add.Po
+	-rm -f ./$(DEPDIR)/atttests.Po
+	-rm -f ./$(DEPDIR)/cdftests.Po
+	-rm -f ./$(DEPDIR)/dimtests.Po
+	-rm -f ./$(DEPDIR)/driver.Po
+	-rm -f ./$(DEPDIR)/emalloc.Po
+	-rm -f ./$(DEPDIR)/error.Po
+	-rm -f ./$(DEPDIR)/misctest.Po
+	-rm -f ./$(DEPDIR)/rec.Po
+	-rm -f ./$(DEPDIR)/slabs.Po
+	-rm -f ./$(DEPDIR)/tst_rename.Po
+	-rm -f ./$(DEPDIR)/val.Po
+	-rm -f ./$(DEPDIR)/vardef.Po
+	-rm -f ./$(DEPDIR)/varget.Po
+	-rm -f ./$(DEPDIR)/vargetg.Po
+	-rm -f ./$(DEPDIR)/varput.Po
+	-rm -f ./$(DEPDIR)/varputg.Po
+	-rm -f ./$(DEPDIR)/vartests.Po
+	-rm -f ./$(DEPDIR)/vputget.Po
+	-rm -f ./$(DEPDIR)/vputgetg.Po
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -1068,7 +1103,26 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/add.Po
+	-rm -f ./$(DEPDIR)/atttests.Po
+	-rm -f ./$(DEPDIR)/cdftests.Po
+	-rm -f ./$(DEPDIR)/dimtests.Po
+	-rm -f ./$(DEPDIR)/driver.Po
+	-rm -f ./$(DEPDIR)/emalloc.Po
+	-rm -f ./$(DEPDIR)/error.Po
+	-rm -f ./$(DEPDIR)/misctest.Po
+	-rm -f ./$(DEPDIR)/rec.Po
+	-rm -f ./$(DEPDIR)/slabs.Po
+	-rm -f ./$(DEPDIR)/tst_rename.Po
+	-rm -f ./$(DEPDIR)/val.Po
+	-rm -f ./$(DEPDIR)/vardef.Po
+	-rm -f ./$(DEPDIR)/varget.Po
+	-rm -f ./$(DEPDIR)/vargetg.Po
+	-rm -f ./$(DEPDIR)/varput.Po
+	-rm -f ./$(DEPDIR)/varputg.Po
+	-rm -f ./$(DEPDIR)/vartests.Po
+	-rm -f ./$(DEPDIR)/vputget.Po
+	-rm -f ./$(DEPDIR)/vputgetg.Po
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1089,16 +1143,16 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
-	ctags ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
+	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	recheck tags tags-am uninstall uninstall-am
diff --git a/nctest/run_valgrind_tests.sh b/nctest/run_valgrind_tests.sh
deleted file mode 100755
index 29cbcb8..0000000
--- a/nctest/run_valgrind_tests.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-if test "x$srcdir" = x ; then srcdir=`pwd`; fi
-. ../test_common.sh
-
-# This shell runs the tests with valgrind.
-
-# $Id: run_valgrind_tests.sh,v 1.9 2010/01/26 20:24:18 ed Exp $
-
-set -e
-echo ""
-echo "Testing programs with valgrind..."
-
-# These are my test programs.
-list='nctest tst_rename'
-
-# These don't work yet: tst_fills tst_xplatform2 tst_interops6 tst_strings 
-
-for tst in $list; do
-    echo ""
-    cmd1="valgrind -q --error-exitcode=2 --leak-check=full ./$tst"
-    echo "$cmd1:"
-    $cmd1
-done
-
-echo "SUCCESS!!!"
-
-exit 0
diff --git a/oc2/Makefile.in b/oc2/Makefile.in
index fd1a45a..09a17a0 100644
--- a/oc2/Makefile.in
+++ b/oc2/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -139,7 +139,21 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/liboc_la-daplex.Plo \
+	./$(DEPDIR)/liboc_la-dapparse.Plo \
+	./$(DEPDIR)/liboc_la-dapy.Plo ./$(DEPDIR)/liboc_la-oc.Plo \
+	./$(DEPDIR)/liboc_la-occompile.Plo \
+	./$(DEPDIR)/liboc_la-occurlflags.Plo \
+	./$(DEPDIR)/liboc_la-occurlfunctions.Plo \
+	./$(DEPDIR)/liboc_la-ocdata.Plo \
+	./$(DEPDIR)/liboc_la-ocdebug.Plo \
+	./$(DEPDIR)/liboc_la-ocdump.Plo \
+	./$(DEPDIR)/liboc_la-ochttp.Plo \
+	./$(DEPDIR)/liboc_la-ocinternal.Plo \
+	./$(DEPDIR)/liboc_la-ocnode.Plo \
+	./$(DEPDIR)/liboc_la-ocread.Plo \
+	./$(DEPDIR)/liboc_la-ocutil.Plo ./$(DEPDIR)/liboc_la-xxdr.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -226,7 +240,6 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
-ENABLE_ERANGE_FILL = @ENABLE_ERANGE_FILL@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
 GREP = @GREP@
@@ -235,6 +248,7 @@ HAS_DAP = @HAS_DAP@
 HAS_DAP2 = @HAS_DAP2@
 HAS_DAP4 = @HAS_DAP4@
 HAS_DISKLESS = @HAS_DISKLESS@
+HAS_ERANGE_FILL = @HAS_ERANGE_FILL@
 HAS_HDF4 = @HAS_HDF4@
 HAS_HDF5 = @HAS_HDF5@
 HAS_JNA = @HAS_JNA@
@@ -273,6 +287,7 @@ NC_HAS_CDF5 = @NC_HAS_CDF5@
 NC_HAS_DAP2 = @NC_HAS_DAP2@
 NC_HAS_DAP4 = @NC_HAS_DAP4@
 NC_HAS_DISKLESS = @NC_HAS_DISKLESS@
+NC_HAS_ERANGE_FILL = @NC_HAS_ERANGE_FILL@
 NC_HAS_HDF4 = @NC_HAS_HDF4@
 NC_HAS_HDF5 = @NC_HAS_HDF5@
 NC_HAS_JNA = @NC_HAS_JNA@
@@ -416,8 +431,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	  *config.status*) \
 	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -449,22 +464,28 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-daplex.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-dapparse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-dapy.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-oc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-occompile.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-occurlflags.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-occurlfunctions.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocdata.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocdebug.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocdump.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ochttp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocinternal.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocnode.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocread.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocutil.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-xxdr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-daplex.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-dapparse.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-dapy.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-oc.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-occompile.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-occurlflags.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-occurlfunctions.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocdata.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocdebug.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocdump.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ochttp.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocinternal.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocnode.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocread.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-ocutil.Plo at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/liboc_la-xxdr.Plo at am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+	@$(MKDIR_P) $(@D)
+	@echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -660,7 +681,10 @@ cscopelist-am: $(am__tagged_files)
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -730,7 +754,22 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
 	mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/liboc_la-daplex.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-dapparse.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-dapy.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-oc.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-occompile.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-occurlflags.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-occurlfunctions.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocdata.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocdebug.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocdump.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ochttp.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocinternal.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocnode.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocread.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocutil.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-xxdr.Plo
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-tags
@@ -776,7 +815,22 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
+		-rm -f ./$(DEPDIR)/liboc_la-daplex.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-dapparse.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-dapy.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-oc.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-occompile.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-occurlflags.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-occurlfunctions.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocdata.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocdebug.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocdump.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ochttp.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocinternal.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocnode.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocread.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-ocutil.Plo
+	-rm -f ./$(DEPDIR)/liboc_la-xxdr.Plo
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -797,16 +851,16 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+	clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	cscopelist-am ctags ctags-am distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
diff --git a/test-driver b/test-driver
index 0218a01..b8521a4 100755
--- a/test-driver
+++ b/test-driver
@@ -1,9 +1,9 @@
 #! /bin/sh
 # test-driver - basic testsuite driver script.
 
-scriptversion=2016-01-11.22; # UTC
+scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 2011-2017 Free Software Foundation, Inc.
+# Copyright (C) 2011-2018 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -140,7 +140,7 @@ echo ":copy-in-global-log: $gcopy" >> $trs_file
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
diff --git a/test_common.in b/test_common.in
index 8e3c8a9..b8af518 100644
--- a/test_common.in
+++ b/test_common.in
@@ -1,5 +1,5 @@
-TOPSRCDIR=@abs_top_srcdir@
-TOPBUILDDIR=@abs_top_builddir@
+TOPSRCDIR='@abs_top_srcdir@'
+TOPBUILDDIR='@abs_top_builddir@'
 
 set -e
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/netcdf.git



More information about the Pkg-grass-devel mailing list