diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-07-06 18:21:42 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2021-07-06 18:21:42 (GMT) |
commit | 820695a78e3a277daea1bdcbb8ad54b8ee6650a5 (patch) | |
tree | fe7545305c0a77db3b9671e5a82fdffc4b2cc82e /tools/src/misc | |
parent | 9f13ecfa2e93840d1cc45dbf0bfcf8b955814931 (diff) | |
parent | 18bbd3f0a7f14adeebf8f342ed242ff191f9b7c5 (diff) | |
download | hdf5-hdf5-1_12_1.zip hdf5-hdf5-1_12_1.tar.gz hdf5-hdf5-1_12_1.tar.bz2 |
Merge remote-tracking branch 'origin/hdf5_1_12_1' into 1.12/master forhdf5-1_12_1
HDF5 1.12.1 release.
Diffstat (limited to 'tools/src/misc')
-rw-r--r-- | tools/src/misc/CMakeLists.txt | 43 | ||||
-rw-r--r-- | tools/src/misc/Makefile.am | 2 | ||||
-rw-r--r-- | tools/src/misc/Makefile.in | 83 | ||||
-rw-r--r-- | tools/src/misc/h5clear.c | 26 | ||||
-rw-r--r-- | tools/src/misc/h5debug.c | 256 | ||||
-rw-r--r-- | tools/src/misc/h5mkgrp.c | 249 | ||||
-rw-r--r-- | tools/src/misc/h5repart.c | 12 |
7 files changed, 423 insertions, 248 deletions
diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 16e4555..8b6b9bb 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -7,28 +7,32 @@ project (HDF5_TOOLS_SRC_MISC C) #-- Misc Executables if (NOT ONLY_SHARED_LIBS) add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) - target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5debug PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5debug STATIC) target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5debug PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) - target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5repart PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repart STATIC) target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repart PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) - target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5mkgrp PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5mkgrp STATIC) target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5mkgrp PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) - target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5clear PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5clear STATIC) target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5clear PROPERTIES FOLDER tools) @@ -38,33 +42,37 @@ if (NOT ONLY_SHARED_LIBS) h5debug h5repart h5mkgrp - h5clear + h5clear ) endif () if (BUILD_SHARED_LIBS) add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) - target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5debug-shared SHARED) + target_compile_options(h5debug-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5debug-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared") add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) - target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5repart-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repart-shared SHARED) target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repart-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart-shared") add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) - target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5mkgrp-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5mkgrp-shared SHARED) target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5mkgrp-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp-shared") add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) - target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5clear-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5clear-shared SHARED) target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5clear-shared PROPERTIES FOLDER tools) @@ -78,6 +86,23 @@ if (BUILD_SHARED_LIBS) ) endif () +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (NOT ONLY_SHARED_LIBS) + clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug) + clang_format (HDF5_H5REPART_SRC_FORMAT h5repart) + clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp) + clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear) + else () + clang_format (HDF5_H5DEBUG_SRC_FORMAT h5debug-shared) + clang_format (HDF5_H5REPART_SRC_FORMAT h5repart-shared) + clang_format (HDF5_H5MKGRP_SRC_FORMAT h5mkgrp-shared) + clang_format (HDF5_H5CLEAR_SRC_FORMAT h5clear-shared) + endif () +endif () + ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/src/misc/Makefile.am b/tools/src/misc/Makefile.am index f1d2aaf..e8ee947 100644 --- a/tools/src/misc/Makefile.am +++ b/tools/src/misc/Makefile.am @@ -6,7 +6,7 @@ # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in # the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. ## diff --git a/tools/src/misc/Makefile.in b/tools/src/misc/Makefile.in index 955a87d..df110b0 100644 --- a/tools/src/misc/Makefile.in +++ b/tools/src/misc/Makefile.in @@ -22,7 +22,7 @@ # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in # the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # @@ -116,6 +116,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ $(top_srcdir)/m4/ax_check_junit.m4 \ $(top_srcdir)/m4/ax_java_options.m4 \ $(top_srcdir)/m4/ax_jni_include_dir.m4 \ + $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_prog_jar.m4 \ $(top_srcdir)/m4/ax_prog_java.m4 \ $(top_srcdir)/m4/ax_prog_java_works.m4 \ @@ -438,7 +439,7 @@ AMTAR = @AMTAR@ # H5_CFLAGS holds flags that should be used when building hdf5, # but which should not be exported to h5cc for building other programs. -# AM_CFLAGS is an automake construct which should be used by Makefiles +# AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @@ -466,6 +467,7 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CC_VERSION = @CC_VERSION@ CFLAGS = @CFLAGS@ +CLANG_SANITIZE_CHECKS = @CLANG_SANITIZE_CHECKS@ CODESTACK = @CODESTACK@ CONFIG_DATE = @CONFIG_DATE@ CONFIG_MODE = @CONFIG_MODE@ @@ -482,11 +484,54 @@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ -DEV_WARNINGS = @DEV_WARNINGS@ +DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@ +DIAGS = @DIAGS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ +DOXYGEN_EXAMPLES_DIRECTORY = @DOXYGEN_EXAMPLES_DIRECTORY@ +DOXYGEN_EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@ +DOXYGEN_HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@ +DOXYGEN_HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@ +DOXYGEN_HTML_FOOTER = @DOXYGEN_HTML_FOOTER@ +DOXYGEN_HTML_HEADER = @DOXYGEN_HTML_HEADER@ +DOXYGEN_INCLUDE_ALIASES = @DOXYGEN_INCLUDE_ALIASES@ +DOXYGEN_INPUT_DIRECTORY = @DOXYGEN_INPUT_DIRECTORY@ +DOXYGEN_LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@ +DOXYGEN_MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@ +DOXYGEN_OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@ +DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@ +DOXYGEN_PACKAGE = @DOXYGEN_PACKAGE@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DOXYGEN_PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@ +DOXYGEN_PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@ +DOXYGEN_SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@ +DOXYGEN_SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@ +DOXYGEN_VERSION_STRING = @DOXYGEN_VERSION_STRING@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -520,6 +565,7 @@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ +H5_IS_DARWIN = @H5_IS_DARWIN@ H5_JAVACFLAGS = @H5_JAVACFLAGS@ H5_JAVAFLAGS = @H5_JAVAFLAGS@ H5_JNIFLAGS = @H5_JNIFLAGS@ @@ -530,6 +576,7 @@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_LIBHDFS = @HAVE_LIBHDFS@ HAVE_PTHREAD = @HAVE_PTHREAD@ +HDF5_DOXYGEN = @HDF5_DOXYGEN@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF5_TESTS = @HDF5_TESTS@ @@ -542,6 +589,7 @@ HL = @HL@ HL_FOR = @HL_FOR@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ +IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -579,6 +627,7 @@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MAP_API = @MAP_API@ MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@ +MIRROR_VFD = @MIRROR_VFD@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ NM = @NM@ @@ -615,6 +664,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PREADWRITE = @PREADWRITE@ PROFILING = @PROFILING@ RANLIB = @RANLIB@ +RECURSIVE_RW_LOCKS = @RECURSIVE_RW_LOCKS@ ROOT = @ROOT@ ROS3_VFD = @ROS3_VFD@ RUNPARALLEL = @RUNPARALLEL@ @@ -638,6 +688,7 @@ TIME = @TIME@ TR = @TR@ TRACE_API = @TRACE_API@ UNAME_INFO = @UNAME_INFO@ +USE_FILE_LOCKING = @USE_FILE_LOCKING@ USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ USE_FILTER_SZIP = @USE_FILTER_SZIP@ USINGMEMCHECKER = @USINGMEMCHECKER@ @@ -730,15 +781,15 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la -# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at -# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is -# prepended to the normal and complete install path that it precedes for the -# purpose of installing in a temporary directory which is useful for building -# rpms and other packages. The '/' after ${DESTDIR} will be followed by another -# '/' at the beginning of the normal install path. When DESTDIR is empty the -# path then begins with '//', which is incorrect and causes problems at least for -# Cygwin. +# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below +# has been removed. According to the official description of DESTDIR by Gnu at +# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is +# prepended to the normal and complete install path that it precedes for the +# purpose of installing in a temporary directory which is useful for building +# rpms and other packages. The '/' after ${DESTDIR} will be followed by another +# '/' at the beginning of the normal install path. When DESTDIR is empty the +# path then begins with '//', which is incorrect and causes problems at least for +# Cygwin. # Scripts used to build examples # If only shared libraries have been installed, have h5cc build examples with @@ -779,7 +830,7 @@ LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ $(EXTRA_PROG) -chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) +chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) TEST_EXTENSIONS = .sh SH_LOG_COMPILER = $(SHELL) AM_SH_LOG_FLAGS = @@ -1292,9 +1343,9 @@ uninstall-am: uninstall-binPROGRAMS # commands that should be executed even if a file with the same name already # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ - build-tests check-clean check-install check-p check-s check-vfd \ - check-passthrough-vol install-doc lib progs tests uninstall-doc \ - _exec_check-s _test help + build-tests check-clean check-install check-p check-s check-vfd \ + check-passthrough-vol install-doc lib progs tests uninstall-doc \ + _exec_check-s _test help trace doxygen help: @$(top_srcdir)/bin/makehelp diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 40f17a5..ac7c0ca 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -98,10 +98,18 @@ usage(const char *prog) HDfprintf(stdout, " -s, --status Clear the status_flags field in the file's superblock\n"); HDfprintf(stdout, " -m, --image Remove the metadata cache image from the file\n"); HDfprintf(stdout, " --filesize Print the file's EOA and EOF\n"); - HDfprintf(stdout, " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for " - "the file <file_name>\n"); HDfprintf(stdout, - " C is >= 0; C is optional and will default to 1M when not set"); + " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for\n"); + HDfprintf(stdout, " the file <file_name>.\n"); + HDfprintf(stdout, + " C is >= 0; C is optional and will default to 1M when not set.\n"); + HDfprintf( + stdout, + " This option helps to repair a crashed file where the stored EOA\n"); + HDfprintf(stdout, " in the superblock is different from the actual EOF.\n"); + HDfprintf(stdout, + " The file’s EOA and EOF will be the same after applying\n"); + HDfprintf(stdout, " this option to the file.\n"); HDfprintf(stdout, "\n"); HDfprintf(stdout, "Examples of use:\n"); HDfprintf(stdout, "\n"); @@ -257,9 +265,6 @@ main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable the HDF5 library's error reporting */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* initialize h5tools lib */ h5tools_init(); @@ -270,6 +275,9 @@ main(int argc, const char *argv[]) if (fname_g == NULL) goto done; + /* enable error reporting if command line option */ + h5tools_error_report(); + /* Print usage/exit if not using at least one of the options */ if (!clear_status_flags && !remove_cache_image && !increment_eoa_eof && !print_filesize) { usage(h5tools_getprogname()); @@ -333,7 +341,7 @@ main(int argc, const char *argv[]) } /* Open the file */ - if ((fid = h5tools_fopen(fname, flags, fapl, NULL, NULL, (size_t)0)) < 0) { + if ((fid = h5tools_fopen(fname, flags, fapl, FALSE, NULL, (size_t)0)) < 0) { error_msg("h5tools_fopen\n"); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -350,7 +358,7 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_FAILURE); goto done; } - HDfprintf(stdout, "EOA is %a; EOF is %a \n", eoa, st.st_size); + HDfprintf(stdout, "EOA is %" PRIuHADDR "; EOF is %" PRIuHADDR " \n", eoa, (haddr_t)st.st_size); } /* --increment option */ diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 87ca78f..0f1f4fe 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -15,7 +15,7 @@ * * Created: debug.c * Jul 18 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Debugs an existing HDF5 file at a low level. * @@ -67,7 +67,6 @@ * Return: Non-NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -76,7 +75,7 @@ static const H5B2_class_t * get_H5B2_class(const uint8_t *sig) { H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1]; - const H5B2_class_t *cls; + const H5B2_class_t *cls = NULL; switch (subtype) { case H5B2_TEST_ID: @@ -134,7 +133,6 @@ get_H5B2_class(const uint8_t *sig) case H5B2_NUM_BTREE_ID: default: HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype)); - HDexit(4); } /* end switch */ return (cls); @@ -150,7 +148,6 @@ get_H5B2_class(const uint8_t *sig) * Return: Non-NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -159,7 +156,7 @@ static const H5EA_class_t * get_H5EA_class(const uint8_t *sig) { H5EA_cls_id_t clsid = (H5EA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1]; - const H5EA_class_t *cls; + const H5EA_class_t *cls = NULL; switch (clsid) { case H5EA_CLS_TEST_ID: @@ -177,7 +174,6 @@ get_H5EA_class(const uint8_t *sig) case H5EA_NUM_CLS_ID: default: HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid)); - HDexit(4); } /* end switch */ return (cls); @@ -193,7 +189,6 @@ get_H5EA_class(const uint8_t *sig) * Return: Non-NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -202,7 +197,7 @@ static const H5FA_class_t * get_H5FA_class(const uint8_t *sig) { H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1]; - const H5FA_class_t *cls; + const H5FA_class_t *cls = NULL; switch (clsid) { case H5FA_CLS_TEST_ID: @@ -220,7 +215,6 @@ get_H5FA_class(const uint8_t *sig) case H5FA_NUM_CLS_ID: default: HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid)); - HDexit(4); } /* end switch */ return (cls); @@ -236,7 +230,6 @@ get_H5FA_class(const uint8_t *sig) * Failure: exit (non-zero) * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -244,26 +237,32 @@ get_H5FA_class(const uint8_t *sig) int main(int argc, char *argv[]) { - hid_t fid, fapl; + hid_t fid = H5I_INVALID_HID; + hid_t fapl = H5I_INVALID_HID; H5VL_object_t *vol_obj; H5F_t * f; - haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; + haddr_t addr = 0; + int extra_count = 0; /* Number of extra arguments */ + haddr_t extra[10]; uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; - H5E_auto2_t func; - void * edata; + H5E_auto2_t func = NULL; + void * edata = NULL; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t status = SUCCEED; + int exit_value = 0; if (argc == 1) { - HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); - HDexit(1); + HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]*]\n", argv[0]); + exit_value = 1; + goto done; } /* end if */ /* Initialize the library */ if (H5open() < 0) { HDfprintf(stderr, "cannot initialize the library\n"); - HDexit(1); + exit_value = 1; + goto done; } /* end if */ /* Disable error reporting */ @@ -275,62 +274,81 @@ main(int argc, char *argv[]) */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { HDfprintf(stderr, "cannot create file access property list\n"); - HDexit(1); + exit_value = 1; + goto done; } /* end if */ if (HDstrchr(argv[1], '%')) if (H5Pset_fapl_family(fapl, (hsize_t)0, H5P_DEFAULT) < 0) { HDfprintf(stderr, "cannot set file access property list\n"); - HDexit(1); + exit_value = 1; + goto done; } if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) { HDfprintf(stderr, "cannot open file\n"); - HDexit(1); + exit_value = 1; + goto done; } /* end if */ /* Push API context */ if (H5CX_push() < 0) { HDfprintf(stderr, "cannot set API context\n"); - HDexit(1); + exit_value = 1; + goto done; } api_ctx_pushed = TRUE; if (NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(fid))) { HDfprintf(stderr, "cannot obtain vol_obj pointer\n"); - HDexit(2); + exit_value = 2; + goto done; } /* end if */ if (NULL == (f = (H5F_t *)H5VL_object_data(vol_obj))) { HDfprintf(stderr, "cannot obtain H5F_t pointer\n"); - HDexit(2); + exit_value = 2; + goto done; } /* end if */ /* Ignore metadata tags while using h5debug */ if (H5AC_ignore_tags(f) < 0) { HDfprintf(stderr, "cannot ignore metadata tags\n"); - HDexit(1); + exit_value = 1; + goto done; } /* * Parse command arguments. */ + + /* Primary data structure to dump */ if (argc > 2) addr = (haddr_t)HDstrtoll(argv[2], NULL, 0); - if (argc > 3) - extra = (haddr_t)HDstrtoll(argv[3], NULL, 0); - if (argc > 4) - extra2 = (haddr_t)HDstrtoll(argv[4], NULL, 0); - if (argc > 5) - extra3 = (haddr_t)HDstrtoll(argv[5], NULL, 0); - if (argc > 6) - extra4 = (haddr_t)HDstrtoll(argv[6], NULL, 0); + + /* Extra arguments for primary data structure */ + HDmemset(extra, 0, sizeof(extra)); + if (argc > 3) { + /* Number of extra arguments */ + extra_count = argc - 3; + + /* Range check against 'extra' array size */ + if (extra_count > (int)(sizeof(extra) / sizeof(haddr_t))) { + HDfprintf(stderr, "\nWARNING: Only using first %d extra parameters\n\n", + (int)(sizeof(extra) / sizeof(haddr_t))); + extra_count = (int)(sizeof(extra) / sizeof(haddr_t)); + } /* end if */ + + for (u = 0; u < (size_t)extra_count; u++) + extra[u] = (haddr_t)HDstrtoll(argv[u + 3], NULL, 0); + } /* end if */ /* * Read the signature at the specified file position. */ - HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr); + HDfprintf(stdout, "Reading signature at address %" PRIuHADDR " (rel)\n", addr); if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) { HDfprintf(stderr, "cannot read signature\n"); - HDexit(3); + exit_value = 3; + goto done; } if (!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) { /* @@ -356,14 +374,14 @@ main(int argc, char *argv[]) */ /* Check for extra parameters */ - if (extra == 0) { + if (extra_count == 0 || extra[0] == 0) { HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); HDfprintf(stderr, "Symbol table node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <Symbol table node address> <address of local heap>\n\n"); } /* end if */ - status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]); } else if (!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -378,54 +396,59 @@ main(int argc, char *argv[]) switch (subtype) { case H5B_SNODE_ID: /* Check for extra parameters */ - if (extra == 0) { + if (extra_count == 0 || extra[0] == 0) { HDfprintf( stderr, "\nWarning: Providing the group's local heap address will give more information\n"); HDfprintf(stderr, "B-tree symbol table node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <address of local heap>\n\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]); break; case H5B_CHUNK_ID: /* Check for extra parameters */ - if (extra == 0) { + if (extra_count == 0 || extra[0] == 0) { HDfprintf( stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n"); HDfprintf(stderr, "B-tree chunked storage node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest " "chunk dim>...<fastest chunk dim>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - /* Build array of chunk dimensions */ - ndims = (unsigned)extra; - dim[0] = (uint32_t)extra2; - if (ndims > 1) - dim[1] = (uint32_t)extra3; - if (ndims > 2) - dim[2] = (uint32_t)extra4; + /* Set # of dimensions */ + ndims = (unsigned)extra[0]; /* Check for dimension error */ - if (ndims > 3) { - HDfprintf(stderr, "ERROR: Only 3 dimensions support currently (fix h5debug)\n"); + if (ndims > 9) { + HDfprintf(stderr, "ERROR: Only 9 dimensions support currently (fix h5debug)\n"); HDfprintf(stderr, "B-tree chunked storage node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest " "chunk dim>...<fastest chunk dim>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end for */ + + /* Build array of chunk dimensions */ + for (u = 0; u < ndims; u++) + dim[u] = (uint32_t)extra[u + 1]; + + /* Check for dimension error */ for (u = 0; u < ndims; u++) if (0 == dim[u]) { HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n"); HDfprintf(stderr, "B-tree chunked storage node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> " "<slowest chunk dim>...<fastest chunk dim>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ /* Set the last dimension (the element size) to zero */ @@ -437,7 +460,8 @@ main(int argc, char *argv[]) case H5B_NUM_BTREE_ID: default: HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype)); - HDexit(4); + exit_value = 4; + goto done; } } else if (!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { @@ -447,15 +471,16 @@ main(int argc, char *argv[]) const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); - if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) && extra == 0) { + if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0)) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the " "layout message in order to dump header\n"); HDfprintf(stderr, "v2 B-tree hdr usage:\n"); HDfprintf(stderr, "\th5debug <filename> <v2 B-tree header address> <object header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5B2__hdr_debug(f, addr, stdout, 0, VCOL, cls, (haddr_t)extra); + status = H5B2__hdr_debug(f, addr, stdout, 0, VCOL, cls, (haddr_t)extra[0]); } else if (!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -466,7 +491,7 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) && - (extra == 0 || extra2 == 0 || extra3 == 0 || extra4 == 0)) { + (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0 || extra[3] == 0)) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object " "header address containing the layout message in order to dump internal node\n"); @@ -475,9 +500,10 @@ main(int argc, char *argv[]) HDfprintf(stderr, "v2 B-tree internal node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> " "<number of records> <depth> <object header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } - else if (extra == 0 || extra2 == 0 || extra3 == 0) { + else if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and " "depth in order to dump internal node\n"); HDfprintf(stderr, @@ -485,11 +511,12 @@ main(int argc, char *argv[]) HDfprintf(stderr, "v2 B-tree internal node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> " "<number of records> <depth>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, - (haddr_t)extra4); + status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], + (unsigned)extra[2], (haddr_t)extra[3]); } else if (!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -499,16 +526,18 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra == 0 || extra2 == 0 || extra3 == 0)) { + if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) && + (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0)) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header " "address containing the layout message in order to dump leaf node\n"); HDfprintf(stderr, "v2 B-tree leaf node usage:\n"); HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number " "of records> <object header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } - else if (extra == 0 || extra2 == 0) { + else if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) { HDfprintf( stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n"); @@ -516,10 +545,12 @@ main(int argc, char *argv[]) HDfprintf( stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); + status = + H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], (haddr_t)extra[2]); } else if (!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -533,17 +564,18 @@ main(int argc, char *argv[]) */ /* Check for enough valid parameters */ - if (extra == 0 || extra2 == 0) { + if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) { HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to " "dump direct block\n"); HDfprintf(stderr, "Fractal heap direct block usage:\n"); HDfprintf( stderr, "\th5debug <filename> <direct block address> <heap header address> <size of direct block>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5HF_dblock_debug(f, addr, stdout, 0, VCOL, extra, (size_t)extra2); + status = H5HF_dblock_debug(f, addr, stdout, 0, VCOL, extra[0], (size_t)extra[1]); } else if (!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -551,17 +583,18 @@ main(int argc, char *argv[]) */ /* Check for enough valid parameters */ - if (extra == 0 || extra2 == 0) { + if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) { HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump " "indirect block\n"); HDfprintf(stderr, "Fractal heap indirect block usage:\n"); HDfprintf( stderr, "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5HF_iblock_debug(f, addr, stdout, 0, VCOL, extra, (unsigned)extra2); + status = H5HF_iblock_debug(f, addr, stdout, 0, VCOL, extra[0], (unsigned)extra[1]); } else if (!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -576,23 +609,24 @@ main(int argc, char *argv[]) */ /* Check for enough valid parameters */ - if (extra == 0 || extra2 == 0) { + if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) { HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump " "serialized sections\n"); HDfprintf(stderr, "Free space serialized sections usage:\n"); HDfprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header " "address> <client address>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5FS_sects_debug(f, addr, stdout, 0, VCOL, extra, extra2); + status = H5FS_sects_debug(f, addr, stdout, 0, VCOL, extra[0], extra[1]); } else if (!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug shared message master table. */ - status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned)UFAIL, (unsigned)UFAIL); + status = H5SM_table_debug(f, addr, stdout, 0, VCOL, UINT_MAX, UINT_MAX); } else if (!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -600,15 +634,16 @@ main(int argc, char *argv[]) */ /* Check for enough valid parameters */ - if (extra == 0) { + if (extra_count == 0 || extra[0] == 0) { HDfprintf(stderr, "ERROR: Need shared message header address in order to shared message list\n"); HDfprintf(stderr, "Shared message list usage:\n"); HDfprintf(stderr, "\th5debug <filename> <shared message list address> <shared message header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5SM_list_debug(f, addr, stdout, 0, VCOL, (haddr_t)extra); + status = H5SM_list_debug(f, addr, stdout, 0, VCOL, (haddr_t)extra[0]); } else if (!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -618,17 +653,18 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if (extra == 0) { + if (extra_count == 0 || extra[0] == 0) { HDfprintf( stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); HDfprintf(stderr, "Extensible array header block usage:\n"); HDfprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5EA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra); + status = H5EA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra[0]); } else if (!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -638,17 +674,18 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if (extra == 0 || extra2 == 0) { + if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) { HDfprintf(stderr, "ERROR: Need extensible array header address and object header address " "containing the layout message in order to dump index block\n"); HDfprintf(stderr, "Extensible array index block usage:\n"); HDfprintf( stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5EA__iblock_debug(f, addr, stdout, 0, VCOL, cls, extra, extra2); + status = H5EA__iblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], extra[1]); } else if (!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -658,16 +695,17 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if (extra == 0 || extra2 == 0 || extra3 == 0) { + if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) { HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object " "header address containing the layout message in order to dump super block\n"); HDfprintf(stderr, "Extensible array super block usage:\n"); HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super " "block index> <object header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5EA__sblock_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3); + status = H5EA__sblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], extra[2]); } else if (!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -677,17 +715,18 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if (extra == 0 || extra2 == 0 || extra3 == 0) { + if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) { HDfprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object " "header address containing the layout message in order to dump data block\n"); HDfprintf(stderr, "Extensible array data block usage:\n"); HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of " "elements in data block> <object header address\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5EA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3); + status = H5EA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (size_t)extra[1], extra[2]); } else if (!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -697,16 +736,17 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if (extra == 0) { + if (extra_count == 0 || extra[0] == 0) { HDfprintf( stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); HDfprintf(stderr, "Fixed array header block usage:\n"); HDfprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5FA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra); + status = H5FA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra[0]); } else if (!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -716,17 +756,18 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if (extra == 0 || extra2 == 0) { + if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) { HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing " "the layout message in order to dump data block\n"); HDfprintf(stderr, "fixed array data block usage:\n"); HDfprintf( stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end if */ - status = H5FA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra, extra2); + status = H5FA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], extra[1]); } else if (!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -760,18 +801,23 @@ main(int argc, char *argv[]) HDputchar('\n'); HDfprintf(stderr, "unknown signature\n"); - HDexit(4); + exit_value = 4; + goto done; } /* end else */ /* Check for an error when dumping information */ if (status < 0) { HDfprintf(stderr, "An error occurred!\n"); H5Eprint2(H5E_DEFAULT, stderr); - HDexit(5); + exit_value = 5; + goto done; } /* end if */ - H5Pclose(fapl); - H5Fclose(fid); +done: + if (fapl > 0) + H5Pclose(fapl); + if (fid > 0) + H5Fclose(fid); /* Pop API context */ if (api_ctx_pushed) @@ -779,5 +825,5 @@ main(int argc, char *argv[]) H5Eset_auto2(H5E_DEFAULT, func, edata); - return 0; + return exit_value; } /* main() */ diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index 671b8ae..516191c 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -23,20 +23,23 @@ int d_status = EXIT_SUCCESS; /* command-line options: short and long-named parameters */ static const char * s_opts = "hlpvV"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"latest", no_arg, 'l'}, - {"parents", no_arg, 'p'}, {"verbose", no_arg, 'v'}, - {"version", no_arg, 'V'}, {NULL, 0, '\0'}}; +static struct long_options l_opts[] = { + {"help", no_arg, 'h'}, {"latest", no_arg, 'l'}, {"parents", no_arg, 'p'}, + {"verbose", no_arg, 'v'}, {"version", no_arg, 'V'}, {"vol-value", require_arg, '1'}, + {"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, {NULL, 0, '\0'}}; /* Command line parameter settings */ -typedef struct { +typedef struct mkgrp_opt_t { char * fname; /* File name to operate on */ hbool_t latest; /* Whether file should use latest format versions */ hbool_t verbose; /* Whether output should be verbose */ hbool_t parents; /* Whether to create intermediate groups */ size_t ngroups; /* Number of groups to create */ char ** groups; /* Pointer to array of group names */ -} param_t; -param_t params; /* Command line parameter settings */ + hid_t fapl_id; /* fapl to use when opening the file */ +} mkgrp_opt_t; + +mkgrp_opt_t params_g; /* Command line parameter settings */ /*------------------------------------------------------------------------- * Function: leave @@ -54,13 +57,17 @@ leave(int ret) { size_t curr_group; - if (params.fname) - HDfree(params.fname); - if (params.ngroups) { - for (curr_group = 0; curr_group < params.ngroups; curr_group++) - HDfree(params.groups[curr_group]); - HDfree(params.groups); + if (params_g.fname) + HDfree(params_g.fname); + if (params_g.ngroups) { + for (curr_group = 0; curr_group < params_g.ngroups; curr_group++) + HDfree(params_g.groups[curr_group]); + HDfree(params_g.groups); } + if (H5I_INVALID_HID != params_g.fapl_id && H5P_DEFAULT != params_g.fapl_id) + if (H5Pclose(params_g.fapl_id) < 0) + error_msg("Could not close file access property list\n"); + h5tools_close(); HDexit(ret); } /* end leave() */ @@ -77,64 +84,83 @@ leave(int ret) *------------------------------------------------------------------------- */ static void -usage(void) +usage(const char *prog) { - HDfprintf(stdout, "\ -usage: h5mkgrp [OPTIONS] FILE GROUP...\n\ - OPTIONS\n\ - -h, --help Print a usage message and exit\n\ - -l, --latest Use latest version of file format to create groups\n\ - -p, --parents No error if existing, make parent groups as needed\n\ - -v, --verbose Print information about OBJECTS and OPTIONS\n\ - -V, --version Print version number and exit\n"); + FLUSHSTREAM(rawoutstream); + PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] FILE GROUP...\n", prog); + PRINTVALSTREAM(rawoutstream, " OPTIONS\n"); + PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n"); + PRINTVALSTREAM(rawoutstream, + " -l, --latest Use latest version of file format to create groups\n"); + PRINTVALSTREAM(rawoutstream, + " -p, --parents No error if existing, make parent groups as needed\n"); + PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n"); + PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n"); + PRINTVALSTREAM(rawoutstream, + " --vol-value Value (ID) of the VOL connector to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vol-name Name of the VOL connector to use for opening the\n"); + PRINTVALSTREAM(rawoutstream, " HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, + " --vol-info VOL-specific info to pass to the VOL connector used for\n"); + PRINTVALSTREAM(rawoutstream, " opening the HDF5 file specified\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } /* end usage() */ /*------------------------------------------------------------------------- - * Function: parse_command_line + * Function: parse_command_line * - * Purpose: Parses command line and sets up global variable to control output + * Purpose: Parses command line and sets up global variable to control + * output * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * * Programmer: Quincey Koziol, 2/13/2007 * *------------------------------------------------------------------------- */ static int -parse_command_line(int argc, const char *argv[], param_t *parms) +parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options) { - int opt; /* Option from command line */ - size_t curr_group; /* Current group name to copy */ + int opt; /* Option from command line */ + size_t curr_group; /* Current group name to copy */ + hbool_t custom_fapl = FALSE; + h5tools_vol_info_t vol_info; + hid_t tmp_fapl_id = H5I_INVALID_HID; /* Check for empty command line */ if (argc == 1) { - usage(); + usage(h5tools_getprogname()); leave(EXIT_SUCCESS); - } /* end if */ + } + + /* Initialize fapl info struct */ + HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t)); /* Parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { /* Display 'help' */ case 'h': - usage(); + usage(h5tools_getprogname()); leave(EXIT_SUCCESS); break; /* Create objects with the latest version of the format */ case 'l': - parms->latest = TRUE; + options->latest = TRUE; break; /* Create parent groups */ case 'p': - parms->parents = TRUE; + options->parents = TRUE; break; /* Verbose output */ case 'v': - parms->verbose = TRUE; + options->verbose = TRUE; break; /* Display version */ @@ -143,9 +169,25 @@ parse_command_line(int argc, const char *argv[], param_t *parms) leave(EXIT_SUCCESS); break; + case '1': + vol_info.type = VOL_BY_VALUE; + vol_info.u.value = (H5VL_class_value_t)HDatoi(opt_arg); + custom_fapl = TRUE; + break; + + case '2': + vol_info.type = VOL_BY_NAME; + vol_info.u.name = opt_arg; + custom_fapl = TRUE; + break; + + case '3': + vol_info.info_string = opt_arg; + break; + /* Bad command line argument */ default: - usage(); + usage(h5tools_getprogname()); leave(EXIT_FAILURE); } /* end switch */ } /* end while */ @@ -153,43 +195,51 @@ parse_command_line(int argc, const char *argv[], param_t *parms) /* Check for file name to be processed */ if (argc <= opt_ind) { error_msg("missing file name\n"); - usage(); + usage(h5tools_getprogname()); leave(EXIT_FAILURE); - } /* end if */ + } /* Retrieve file name */ - parms->fname = HDstrdup(argv[opt_ind]); + options->fname = HDstrdup(argv[opt_ind]); opt_ind++; /* Check for group(s) to be created */ if (argc <= opt_ind) { error_msg("missing group name(s)\n"); - usage(); + usage(h5tools_getprogname()); leave(EXIT_FAILURE); - } /* end if */ + } /* Allocate space for the group name pointers */ - parms->ngroups = (size_t)(argc - opt_ind); - parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *)); + options->ngroups = (size_t)(argc - opt_ind); + options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *)); /* Retrieve the group names */ curr_group = 0; while (opt_ind < argc) { - parms->groups[curr_group] = HDstrdup(argv[opt_ind]); + options->groups[curr_group] = HDstrdup(argv[opt_ind]); curr_group++; opt_ind++; - } /* end while */ - -#ifdef QAK - HDfprintf(stderr, "parms->parents = %t\n", parms->parents); - HDfprintf(stderr, "parms->verbose = %t\n", parms->verbose); - HDfprintf(stderr, "parms->fname = '%s'\n", parms->fname); - HDfprintf(stderr, "parms->ngroups = %Zu\n", parms->ngroups); - for (curr_group = 0; curr_group < parms->ngroups; curr_group++) - HDfprintf(stderr, "parms->group[%Zu] = '%s'\n", curr_group, parms->groups[curr_group]); -#endif /* QAK */ - - return (0); + } + + /* Setup a custom fapl for file accesses */ + if (custom_fapl) { + if ((tmp_fapl_id = h5tools_get_fapl(options->fapl_id, &vol_info, NULL)) < 0) { + error_msg("failed to setup file access property list (fapl) for file\n"); + leave(EXIT_FAILURE); + } + + /* Close the old fapl */ + if (options->fapl_id != H5P_DEFAULT) + if (H5Pclose(options->fapl_id) < 0) { + error_msg("failed to close file access property list (fapl)\n"); + leave(EXIT_FAILURE); + } + + options->fapl_id = tmp_fapl_id; + } + + return 0; } /* parse_command_line() */ /*------------------------------------------------------------------------- @@ -204,117 +254,112 @@ parse_command_line(int argc, const char *argv[], param_t *parms) int main(int argc, const char *argv[]) { - hid_t fid; /* HDF5 file ID */ - hid_t fapl_id; /* File access property list ID */ - hid_t lcpl_id; /* Link creation property list ID */ - size_t curr_group; /* Current group to create */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list ID */ + size_t curr_group; /* Current group to create */ h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable the HDF5 library's error reporting */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); - /* Parse command line */ - HDmemset(¶ms, 0, sizeof(params)); - if (parse_command_line(argc, argv, ¶ms) < 0) { - error_msg("unable to parse command line arguments\n"); - leave(EXIT_FAILURE); - } /* end if */ + /* Initialize the parameters */ + HDmemset(¶ms_g, 0, sizeof(params_g)); /* Create file access property list */ - if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + if ((params_g.fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg("Could not create file access property list\n"); leave(EXIT_FAILURE); - } /* end if */ + } + + /* Parse command line */ + if (parse_command_line(argc, argv, ¶ms_g) < 0) { + error_msg("unable to parse command line arguments\n"); + leave(EXIT_FAILURE); + } + + /* enable error reporting if command line option */ + h5tools_error_report(); /* Check for creating groups with new format version */ - if (params.latest) { + if (params_g.latest) { /* Set the "use the latest version of the format" bounds */ - if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + if (H5Pset_libver_bounds(params_g.fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { error_msg("Could not set property for using latest version of the format\n"); leave(EXIT_FAILURE); - } /* end if */ + } /* Display some output if requested */ - if (params.verbose) + if (params_g.verbose) HDprintf("%s: Creating groups with latest version of the format\n", h5tools_getprogname()); - } /* end if */ + } /* Attempt to open an existing HDF5 file first */ - fid = h5tools_fopen(params.fname, H5F_ACC_RDWR, fapl_id, NULL, NULL, 0); + fid = h5tools_fopen(params_g.fname, H5F_ACC_RDWR, params_g.fapl_id, FALSE, NULL, 0); /* If we couldn't open an existing file, try creating file */ /* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */ if (fid < 0) - fid = H5Fcreate(params.fname, H5F_ACC_EXCL, H5P_DEFAULT, fapl_id); + fid = H5Fcreate(params_g.fname, H5F_ACC_EXCL, H5P_DEFAULT, params_g.fapl_id); /* Test for error in opening file */ if (fid < 0) { - error_msg("Could not open output file '%s'\n", params.fname); + error_msg("Could not open output file '%s'\n", params_g.fname); leave(EXIT_FAILURE); - } /* end if */ + } /* Create link creation property list */ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { error_msg("Could not create link creation property list\n"); leave(EXIT_FAILURE); - } /* end if */ + } /* Check for creating intermediate groups */ - if (params.parents) { + if (params_g.parents) { /* Set the intermediate group creation property */ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) { error_msg("Could not set property for creating parent groups\n"); leave(EXIT_FAILURE); - } /* end if */ + } /* Display some output if requested */ - if (params.verbose) + if (params_g.verbose) HDprintf("%s: Creating parent groups\n", h5tools_getprogname()); - } /* end if */ + } /* Loop over creating requested groups */ - for (curr_group = 0; curr_group < params.ngroups; curr_group++) { + for (curr_group = 0; curr_group < params_g.ngroups; curr_group++) { hid_t gid; /* Group ID */ /* Attempt to create a group */ - if ((gid = H5Gcreate2(fid, params.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - error_msg("Could not create group '%s'\n", params.groups[curr_group]); + if ((gid = H5Gcreate2(fid, params_g.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + error_msg("Could not create group '%s'\n", params_g.groups[curr_group]); leave(EXIT_FAILURE); - } /* end if */ + } /* Close the group */ if (H5Gclose(gid) < 0) { - error_msg("Could not close group '%s'??\n", params.groups[curr_group]); + error_msg("Could not close group '%s'??\n", params_g.groups[curr_group]); leave(EXIT_FAILURE); - } /* end if */ + } /* Display some output if requested */ - if (params.verbose) - HDprintf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]); + if (params_g.verbose) + HDprintf("%s: created group '%s'\n", h5tools_getprogname(), params_g.groups[curr_group]); } /* end for */ /* Close link creation property list */ if (H5Pclose(lcpl_id) < 0) { error_msg("Could not close link creation property list\n"); leave(EXIT_FAILURE); - } /* end if */ + } /* Close file */ if (H5Fclose(fid) < 0) { - error_msg("Could not close output file '%s'??\n", params.fname); - leave(EXIT_FAILURE); - } /* end if */ - - /* Close file access property list */ - if (H5Pclose(fapl_id) < 0) { - error_msg("Could not close file access property list\n"); + error_msg("Could not close output file '%s'??\n", params_g.fname); leave(EXIT_FAILURE); - } /* end if */ + } leave(EXIT_SUCCESS); } /* end main() */ diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index 10e9f23..f4cef6a 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -6,13 +6,13 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> + * Programmer: Robb Matzke * Wednesday, May 13, 1998 * * Purpose: Repartitions a file family. This program can be used to @@ -64,10 +64,10 @@ usage(const char *progname) "(windows or sec2)\n"); HDfprintf(stderr, " SRC The name of the source file\n"); HDfprintf(stderr, " DST The name of the destination files\n"); - HDfprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or " - "`k' for kB.\n"); + HDfprintf(stderr, "Sizes may be suffixed with 'g' for GB, 'm' for MB or " + "'k' for kB.\n"); HDfprintf(stderr, "File family names include an integer printf " - "format such as `%%d'\n"); + "format such as '%%d'\n"); HDexit(EXIT_FAILURE); } @@ -97,7 +97,7 @@ static off_t get_size(const char *progname, int *argno, int argc, char *argv[]) { off_t retval = -1; - char *suffix; + char *suffix = NULL; if (isdigit((int)(argv[*argno][2]))) { retval = HDstrtol(argv[*argno] + 2, &suffix, 10); |