diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2022-04-13 21:17:29 (GMT) |
commit | cabc39c3e197e2591449d2604bfee26465fb60e1 (patch) | |
tree | d5f39f5f5965584bf9bf49646a2af617adfd3e4e /test/tcheck_version.c | |
parent | 7355f4c505092a7a85474b47f18d5206028e2c95 (diff) | |
parent | ab69f5df770ee3cc6cd6c81d905a5317b894a002 (diff) | |
download | hdf5-feature/coding_standards.zip hdf5-feature/coding_standards.tar.gz hdf5-feature/coding_standards.tar.bz2 |
Merge branch 'develop' into feature/coding_standardsfeature/coding_standards
Diffstat (limited to 'test/tcheck_version.c')
-rw-r--r-- | test/tcheck_version.c | 95 |
1 files changed, 59 insertions, 36 deletions
diff --git a/test/tcheck_version.c b/test/tcheck_version.c index 2611178..bfc8daf 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -29,17 +29,21 @@ #include "h5test.h" -#define progname "tcheck_version" +#ifdef H5_HAVE_WIN32_API +#include <crtdbg.h> +#endif + +#define progname "tcheck_version" /* prototypes */ void showhelp(void); void parse(int ac, char **av); -void abort_intercept (int H5_ATTR_UNUSED sig); +void abort_intercept(int H5_ATTR_UNUSED sig); /* global variables */ -unsigned major = H5_VERS_MAJOR; -unsigned minor = H5_VERS_MINOR; -unsigned release = H5_VERS_RELEASE; +unsigned major = H5_VERS_MAJOR; +unsigned minor = H5_VERS_MINOR; +unsigned release = H5_VERS_RELEASE; void showhelp(void) @@ -53,43 +57,43 @@ showhelp(void) HDprintf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); } - void parse(int ac, char **av) { char *pt; - while (--ac > 0){ - pt = *(++av); - if (*pt != '-') { - HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av); - HDexit(EXIT_FAILURE); - }else{ - switch(*(++pt)) { - case 't': /* option -t */ - switch(*(++pt)) { - case 'M': - major++; - break; - case 'm': - minor++; - break; - case 'r': - release++; - break; - default: - HDfprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); - HDexit(EXIT_FAILURE); - } - break; - case 'h': /* help page */ - showhelp(); - HDexit(EXIT_SUCCESS); - default: + while (--ac > 0) { + pt = *(++av); + if (*pt != '-') { HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av); HDexit(EXIT_FAILURE); } - } + else { + switch (*(++pt)) { + case 't': /* option -t */ + switch (*(++pt)) { + case 'M': + major++; + break; + case 'm': + minor++; + break; + case 'r': + release++; + break; + default: + HDfprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + } + break; + case 'h': /* help page */ + showhelp(); + HDexit(EXIT_SUCCESS); + default: + HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + } + } } } @@ -103,17 +107,36 @@ parse(int ac, char **av) * This tries to eliminate those side effects. */ H5_ATTR_NORETURN void -abort_intercept (int H5_ATTR_UNUSED sig) +abort_intercept(int H5_ATTR_UNUSED sig) { HDexit(6); } +#ifdef H5_HAVE_WIN32_API +/* Turns off the modal dialog that is raised when the Windows CRT calls abort(). + * + * Returning TRUE here lets Windows know that we've handled the abort() and that there + * is no need to alert the user with a modal dialog box. + */ +int +handle_crt_abort(int reportType, char *message, int *returnValue) +{ + return TRUE; +} +#endif + int main(int ac, char **av) { +#ifdef H5_HAVE_WIN32_API + (void)_CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, handle_crt_abort); +#endif parse(ac, av); HDsignal(SIGABRT, &abort_intercept); H5check_version(major, minor, release); HDsignal(SIGABRT, SIG_DFL); +#ifdef H5_HAVE_WIN32_API + (void)_CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, handle_crt_abort); +#endif return 0; } |