diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-02-14 22:14:48 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-02-14 22:14:48 (GMT) |
commit | a77a08b02fb31e87f451a39640e4376e49878097 (patch) | |
tree | ad0cb9089dcad158b20131ccf566a122cdb92ee2 /tools/src/h5dump | |
parent | 9adb74e41b0e6870991267a2beac9bba3c8de7f8 (diff) | |
download | hdf5-a77a08b02fb31e87f451a39640e4376e49878097.zip hdf5-a77a08b02fb31e87f451a39640e4376e49878097.tar.gz hdf5-a77a08b02fb31e87f451a39640e4376e49878097.tar.bz2 |
HDFFV-10384 Add optional arg to enable-error-stack
Diffstat (limited to 'tools/src/h5dump')
-rw-r--r-- | tools/src/h5dump/h5dump.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index b90d60f..62f0ed0 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -67,7 +67,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -181,7 +181,7 @@ static struct long_options l_opts[] = { { "sort_order", require_arg, 'z' }, { "format", require_arg, 'm' }, { "region", no_arg, 'R' }, - { "enable-error-stack", no_arg, 'E' }, + { "enable-error-stack", optional_arg, 'E' }, { "packed-bits", require_arg, 'M' }, { "no-compact-subset", no_arg, 'C' }, { "ddl", optional_arg, 'O' }, @@ -191,7 +191,7 @@ static struct long_options l_opts[] = { { NULL, 0, '\0' } }; - + /*------------------------------------------------------------------------- * Function: leave * @@ -214,7 +214,7 @@ leave(int ret) HDexit(ret); } - + /*------------------------------------------------------------------------- * Function: usage * @@ -366,7 +366,7 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, "\n"); } - + /*------------------------------------------------------------------------- * Function: table_list_add * @@ -419,7 +419,7 @@ table_list_add(hid_t oid, unsigned long file_no) return((ssize_t) idx); } /* end table_list_add() */ - + /*------------------------------------------------------------------------- * Function: table_list_visited * @@ -449,7 +449,7 @@ table_list_visited(unsigned long file_no) return(-1); } /* end table_list_visited() */ - + /*------------------------------------------------------------------------- * Function: table_list_free * @@ -817,7 +817,7 @@ parse_mask_list(const char *h_list) } } - + /*------------------------------------------------------------------------- * Function: free_handler * @@ -865,7 +865,7 @@ free_handler(struct handler_t *hand, int len) } } - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -920,9 +920,8 @@ parse_start: case 'n': display_fi = TRUE; last_was_dset = FALSE; - if ( opt_arg != NULL) { + if (opt_arg != NULL) h5trav_set_verbose(HDatoi(opt_arg)); - } break; case 'p': display_dcpl = TRUE; @@ -939,8 +938,9 @@ parse_start: last_was_dset = FALSE; break; case 'A': - if ( opt_arg != NULL) { - if(0 == HDatoi(opt_arg)) include_attrs = FALSE; + if (opt_arg != NULL) { + if(0 == HDatoi(opt_arg)) + include_attrs = FALSE; } else { display_data = FALSE; @@ -1059,7 +1059,7 @@ parse_start: break; case 'o': - if ( bin_output ) { + if (bin_output) { if (h5tools_set_data_output_file(opt_arg, 1) < 0) { usage(h5tools_getprogname()); goto error; @@ -1086,8 +1086,8 @@ parse_start: break; case 'b': - if ( opt_arg != NULL) { - if ( ( bin_form = set_binary_form(opt_arg)) < 0) { + if (opt_arg != NULL) { + if ((bin_form = set_binary_form(opt_arg)) < 0) { /* failed to set binary form */ usage(h5tools_getprogname()); goto error; @@ -1106,7 +1106,7 @@ parse_start: break; case 'q': - if ( ( sort_by = set_sort_by(opt_arg)) < 0) { + if ((sort_by = set_sort_by(opt_arg)) < 0) { /* failed to set "sort by" form */ usage(h5tools_getprogname()); goto error; @@ -1114,7 +1114,7 @@ parse_start: break; case 'z': - if ( ( sort_order = set_sort_order(opt_arg)) < 0) { + if ((sort_order = set_sort_order(opt_arg)) < 0) { /* failed to set "sort order" form */ usage(h5tools_getprogname()); goto error; @@ -1268,7 +1268,10 @@ end_collect: /** end subsetting parameters **/ case 'E': - enable_error_stack = TRUE; + if (opt_arg != NULL) + enable_error_stack = HDatoi(opt_arg); + else + enable_error_stack = 1; break; case 'C': disable_compact_subset = TRUE; @@ -1306,7 +1309,7 @@ error: return hand; } - + /*------------------------------------------------------------------------- * Function: main * @@ -1388,7 +1391,7 @@ main(int argc, const char *argv[]) goto done; } - if (enable_error_stack) { + if (enable_error_stack > 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); } @@ -1764,7 +1767,7 @@ h5_fileaccess(void) return fapl; } - + /*------------------------------------------------------------------------- * Function: init_prefix * @@ -1785,7 +1788,7 @@ init_prefix(char **prfx, size_t prfx_len) error_msg("unable to allocate prefix buffer\n"); } - + /*------------------------------------------------------------------------- * Function: add_prefix * |