summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack/h5repack_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src/h5repack/h5repack_main.c')
-rw-r--r--tools/src/h5repack/h5repack_main.c79
1 files changed, 35 insertions, 44 deletions
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 0822b16..793c689 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -633,7 +633,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'q':
if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(opt_arg))) {
- error_msg(" failed to set sort by form <%s>\n", opt_arg);
+ error_msg("failed to set sort by form <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -642,7 +642,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'z':
if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(opt_arg))) {
- error_msg(" failed to set sort order form <%s>\n", opt_arg);
+ error_msg("failed to set sort order form <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -660,30 +660,30 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* If neither -i nor -o given, get in and out files positionally */
if (0 == (has_i + has_o)) {
- if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
- infile = argv[opt_ind];
- outfile = argv[opt_ind + 1];
-
- if (!HDstrcmp(infile, outfile)) {
- error_msg("file names cannot be the same\n");
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- }
- }
- else {
- error_msg("file names missing\n");
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- }
- }
- else if (has_i != 1 || has_o != 1) {
- error_msg("filenames must be either both -i -o or both positional\n");
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- }
+ if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
+ infile = argv[opt_ind];
+ outfile = argv[opt_ind + 1];
+
+ if (!HDstrcmp(infile, outfile)) {
+ error_msg("file names cannot be the same\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
+ }
+ else {
+ error_msg("file names missing\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
+ }
+ else if (has_i != 1 || has_o != 1) {
+ error_msg("filenames must be either both -i -o or both positional\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
done:
return ret_value;
@@ -702,27 +702,15 @@ done:
int main(int argc, const char **argv)
{
pack_opt_t options; /*the global options */
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- void *edata;
- void *tools_edata;
int parse_ret;
HDmemset(&options, 0, sizeof(pack_opt_t));
- h5tools_setprogname(PROGRAMNAME);
- h5tools_setstatus(EXIT_SUCCESS);
-
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
- /* Disable tools error reporting */
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
/* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */
if (h5tools_getenv_update_hyperslab_bufsize() < 0) {
@@ -753,10 +741,8 @@ int main(int argc, const char **argv)
goto done;
}
- if (enable_error_stack > 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
- }
+ /* enable error reporting if command line option */
+ h5tools_error_report();
/* pack it */
if (h5repack(infile, outfile, &options) < 0) {
@@ -768,6 +754,11 @@ int main(int argc, const char **argv)
h5tools_setstatus(EXIT_SUCCESS);
done:
+ if (options.fin_fapl >= 0 && options.fin_fapl != H5P_DEFAULT)
+ H5Pclose(options.fin_fapl);
+ if (options.fout_fapl >= 0 && options.fout_fapl != H5P_DEFAULT)
+ H5Pclose(options.fout_fapl);
+
/* free tables */
h5repack_end(&options);