diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-02-21 16:37:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 16:37:04 (GMT) |
commit | c7d800e5e526e2dcc2fd19cd0c75d2ef92f184bc (patch) | |
tree | aa6df876c2d6da6f35f531fd025589e60f9e2b8d /tools/lib/h5tools_utils.h | |
parent | 1c9f219463e236487a27cee6cb839379d670cda4 (diff) | |
download | hdf5-c7d800e5e526e2dcc2fd19cd0c75d2ef92f184bc.zip hdf5-c7d800e5e526e2dcc2fd19cd0c75d2ef92f184bc.tar.gz hdf5-c7d800e5e526e2dcc2fd19cd0c75d2ef92f184bc.tar.bz2 |
1.12 Fix tools incompatibility (#1448)
* fix tools incompatibility with get_option #1443
* Fix get_option function
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools/lib/h5tools_utils.h')
-rw-r--r-- | tools/lib/h5tools_utils.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 095ad6c..f955d2b 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -40,6 +40,53 @@ H5TOOLS_DLLVAR FILE *overflow_file; H5TOOLS_DLLVAR hsize_t H5TOOLS_MALLOCSIZE; /* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ H5TOOLS_DLLVAR hsize_t H5TOOLS_BUFSIZE; +/* + * begin get_option section + */ +H5TOOLS_DLLVAR int opt_err; /* getoption prints errors if this is on */ +H5TOOLS_DLLVAR int opt_ind; /* token pointer */ +H5TOOLS_DLLVAR const char *opt_arg; /* flag argument (or value) */ + +/* + * get_option determines which options are specified on the command line and + * returns a pointer to any arguments possibly associated with the option in + * the ``opt_arg'' variable. get_option returns the shortname equivalent of + * the option. The long options are specified in the following way: + * + * struct long_options foo[] = { + * { "filename", require_arg, 'f' }, + * { "append", no_arg, 'a' }, + * { "width", require_arg, 'w' }, + * { NULL, 0, 0 } + * }; + * + * Long named options can have arguments specified as either: + * + * ``--param=arg'' or ``--param arg'' + * + * Short named options can have arguments specified as either: + * + * ``-w80'' or ``-w 80'' + * + * and can have more than one short named option specified at one time: + * + * -aw80 + * + * in which case those options which expect an argument need to come at the + * end. + */ +typedef struct long_options { + const char *name; /* name of the long option */ + int has_arg; /* whether we should look for an arg */ + char shortval; /* the shortname equivalent of long arg + * this gets returned from get_option */ +} long_options; + +H5TOOLS_DLL int get_option(int argc, const char *const *argv, const char *opt, + const struct long_options *l_opt); +/* + * end get_option section + */ /*struct taken from the dumper. needed in table struct*/ typedef struct obj_t { |