diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-06-29 20:06:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 20:06:48 (GMT) |
commit | 2090a527c13a13c0ea5b59b319b3402d2ef8f578 (patch) | |
tree | b9d6a7744894956cba1e99630f1803c42d2298e4 /tools/src/misc/h5clear.c | |
parent | 4ff544f9977da3bd54eac03cc124961eea7c4daf (diff) | |
download | hdf5-2090a527c13a13c0ea5b59b319b3402d2ef8f578.zip hdf5-2090a527c13a13c0ea5b59b319b3402d2ef8f578.tar.gz hdf5-2090a527c13a13c0ea5b59b319b3402d2ef8f578.tar.bz2 |
Brings the tools getopt(3) replacement into the main library (#803)
* Moves get_option from the tools library to the C library
* Adds H5 prefix to get_option call and variables
* Renames the H5_get_option long options struct and enum
Diffstat (limited to 'tools/src/misc/h5clear.c')
-rw-r--r-- | tools/src/misc/h5clear.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index ac7c0ca..524ad03 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -44,40 +44,40 @@ static hsize_t increment = DEFAULT_INCREMENT; /* * Command-line options: only publicize long options */ -static const char * s_opts = "hVsmzi*"; -static struct long_options l_opts[] = {{"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"version", no_arg, 'V'}, - {"version", no_arg, 'V'}, - {"versio", no_arg, 'V'}, - {"versi", no_arg, 'V'}, - {"vers", no_arg, 'V'}, - {"status", no_arg, 's'}, - {"statu", no_arg, 's'}, - {"stat", no_arg, 's'}, - {"sta", no_arg, 's'}, - {"st", no_arg, 's'}, - {"image", no_arg, 'm'}, - {"imag", no_arg, 'm'}, - {"ima", no_arg, 'm'}, - {"im", no_arg, 'm'}, - {"filesize", no_arg, 'z'}, - {"filesiz", no_arg, 'z'}, - {"filesi", no_arg, 'z'}, - {"files", no_arg, 'z'}, - {"file", no_arg, 'z'}, - {"fil", no_arg, 'z'}, - {"fi", no_arg, 'z'}, - {"increment", optional_arg, 'i'}, - {"incremen", optional_arg, 'i'}, - {"increme", optional_arg, 'i'}, - {"increm", optional_arg, 'i'}, - {"incre", optional_arg, 'i'}, - {"incr", optional_arg, 'i'}, - {"inc", optional_arg, 'i'}, - {"in", optional_arg, 'i'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "hVsmzi*"; +static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"version", no_arg, 'V'}, + {"version", no_arg, 'V'}, + {"versio", no_arg, 'V'}, + {"versi", no_arg, 'V'}, + {"vers", no_arg, 'V'}, + {"status", no_arg, 's'}, + {"statu", no_arg, 's'}, + {"stat", no_arg, 's'}, + {"sta", no_arg, 's'}, + {"st", no_arg, 's'}, + {"image", no_arg, 'm'}, + {"imag", no_arg, 'm'}, + {"ima", no_arg, 'm'}, + {"im", no_arg, 'm'}, + {"filesize", no_arg, 'z'}, + {"filesiz", no_arg, 'z'}, + {"filesi", no_arg, 'z'}, + {"files", no_arg, 'z'}, + {"file", no_arg, 'z'}, + {"fil", no_arg, 'z'}, + {"fi", no_arg, 'z'}, + {"increment", optional_arg, 'i'}, + {"incremen", optional_arg, 'i'}, + {"increme", optional_arg, 'i'}, + {"increm", optional_arg, 'i'}, + {"incre", optional_arg, 'i'}, + {"incr", optional_arg, 'i'}, + {"inc", optional_arg, 'i'}, + {"in", optional_arg, 'i'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -150,7 +150,7 @@ parse_command_line(int argc, const char **argv) } /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -176,12 +176,12 @@ parse_command_line(int argc, const char **argv) case 'i': increment_eoa_eof = TRUE; - if (opt_arg != NULL) { - if (HDatoi(opt_arg) < 0) { + if (H5_optarg != NULL) { + if (HDatoi(H5_optarg) < 0) { usage(h5tools_getprogname()); goto done; } - increment = (hsize_t)HDatoi(opt_arg); + increment = (hsize_t)HDatoi(H5_optarg); } break; @@ -193,14 +193,14 @@ parse_command_line(int argc, const char **argv) } /* end while */ /* check for file name to be processed */ - if (argc <= opt_ind) { + if (argc <= H5_optind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto error; } /* end if */ - fname_g = HDstrdup(argv[opt_ind]); + fname_g = HDstrdup(argv[H5_optind]); done: return (0); |