From f30439d5920626e9527817f9168d72ae1594208e Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 10 Dec 1999 15:44:04 -0500 Subject: [svn-r1870] h5dump.c: Added -V option for displaying version information. h5tools.c: Added print_version routine to display version information. h5tools.h: Added print_version prototype. --- tools/h5dump.c | 31 +++++++++++++++++++------------ tools/h5tools.c | 9 +++++++++ tools/h5tools.h | 5 +++++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/tools/h5dump.c b/tools/h5dump.c index 08bb2c5..b80ecb8 100644 --- a/tools/h5dump.c +++ b/tools/h5dump.c @@ -41,10 +41,11 @@ fprintf(stderr, "\nUsage of HDF5 Dumper:\n\n \ h5dump [-h] [-bb] [-header] [-a ] [-d ] [-g ]\n \ [-l ] [-t ] [-w ] \n\n\ - -h Print information on this command.\n\ + -h Print information on this command and exit.\n\ -bb Display the conent of the boot block. The default is not to display.\n\ -header Display header only; no data is displayed.\n\ - -v Display the object ids\n\ + -v Display the object ids\n\ + -V Display version information and exit.\n\ -a Display the specified attribute(s).\n\ -d Display the specified dataset(s).\n\ -g Display the specified group(s) and all the members.\n\ @@ -1082,8 +1083,14 @@ main(int argc, char *argv[]) usage(); free(opts); exit(0); + } + else if (!strcmp(argv[curr_arg],"-V")){ + print_version("h5dump"); + free(opts); + exit(0); + } - } else if (!strcmp(argv[curr_arg],"-bb")) + else if (!strcmp(argv[curr_arg],"-bb")) display_bb = 1; @@ -1091,17 +1098,17 @@ main(int argc, char *argv[]) display_data=0; - else if (!strcmp(argv[curr_arg],"-v")) + else if (!strcmp(argv[curr_arg],"-v")) - display_oid = 1; + display_oid = 1; - else if (!strcmp(argv[curr_arg],"-w")){ - /* - this way we know which arg was the -w - we know it won't be 0 since curr_arg starts at 1 - */ - newwidth = curr_arg; - } + else if (!strcmp(argv[curr_arg],"-w")){ + /* + this way we know which arg was the -w + we know it won't be 0 since curr_arg starts at 1 + */ + newwidth = curr_arg; + } else if (strcmp(argv[curr_arg],"-a") && strcmp(argv[curr_arg],"-d") && strcmp(argv[curr_arg],"-g") && diff --git a/tools/h5tools.c b/tools/h5tools.c index a1048ed..61a6459 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -2509,3 +2509,12 @@ int h5dump_attr(hid_t oid, hid_t p_type){ return (status); } +/* Print the program name and the version information which is */ +/* defined the same as the HDF5 library version. */ +void print_version(char *program_name) +{ + printf("%s: Version %u.%u.%u%s\n", + program_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, + H5_VERS_SUBRELEASE); +} + diff --git a/tools/h5tools.h b/tools/h5tools.h index 31b58be..8d806f2 100644 --- a/tools/h5tools.h +++ b/tools/h5tools.h @@ -353,3 +353,8 @@ extern ProgType programtype; #define BEGIN "{" #define END "}" #endif + + +/* Definitions of useful routines */ +void print_version(char *program_name); + -- cgit v0.12