diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-05-11 17:49:41 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-05-11 17:49:41 (GMT) |
commit | 05d75af8b88cc13232eda2b1660c1bb9ae0bb831 (patch) | |
tree | 6f103b56a01c45a3b98bd914f4cccb996bbc931e /tools/h5repack/h5repack_main.c | |
parent | 9e595dec197d2812b13c4b86cf3389549c54fbb5 (diff) | |
download | hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.zip hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.tar.gz hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.tar.bz2 |
[svn-r18757] Enable tools lib to be built as a dll on windows. Added two get/set functions for progname and d_status.
Also add windows import/export declarations to functions.
Updated windows - H5pubconf.h for packed bits function
Tested:
Windows, linux
Diffstat (limited to 'tools/h5repack/h5repack_main.c')
-rw-r--r-- | tools/h5repack/h5repack_main.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index f52aa5a..aaabeac 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -20,6 +20,8 @@ #include "h5tools_utils.h" #include "h5repack.h" +/* Name of tool */ +#define PROGRAMNAME "h5repack" static void usage(const char *prog); static void parse_command_line(int argc, const char **argv, pack_opt_t* options); @@ -27,8 +29,6 @@ static void read_info(const char *filename,pack_opt_t *options); /* module-scoped variables */ -const char *progname = "h5repack"; -int d_status = EXIT_SUCCESS; static int has_i_o = 0; const char *infile = NULL; const char *outfile = NULL; @@ -105,6 +105,9 @@ int main(int argc, const char **argv) pack_opt_t options; /*the global options */ int ret=-1; + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + /* initialize options */ h5repack_init(&options,0); @@ -121,8 +124,8 @@ int main(int argc, const char **argv) if ( strcmp( infile, outfile ) == 0 ) { - error_msg(progname, "file names cannot be the same\n"); - usage(progname); + error_msg(h5tools_getprogname(), "file names cannot be the same\n"); + usage(h5tools_getprogname()); exit(EXIT_FAILURE); } @@ -130,8 +133,8 @@ int main(int argc, const char **argv) else { - error_msg(progname, "file names missing\n"); - usage(progname); + error_msg(h5tools_getprogname(), "file names missing\n"); + usage(h5tools_getprogname()); exit(EXIT_FAILURE); } } @@ -304,10 +307,10 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'h': - usage(progname); + usage(h5tools_getprogname()); exit(EXIT_SUCCESS); case 'V': - print_version(progname); + print_version(h5tools_getprogname()); exit(EXIT_SUCCESS); case 'v': options->verbose = 1; @@ -317,7 +320,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) /* parse the -f filter option */ if (h5repack_addfilter( opt_arg, options)<0) { - error_msg(progname, "in parsing filter\n"); + error_msg(h5tools_getprogname(), "in parsing filter\n"); exit(EXIT_FAILURE); } break; @@ -326,7 +329,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) /* parse the -l layout option */ if (h5repack_addlayout( opt_arg, options)<0) { - error_msg(progname, "in parsing layout\n"); + error_msg(h5tools_getprogname(), "in parsing layout\n"); exit(EXIT_FAILURE); } break; @@ -337,7 +340,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) options->min_comp = atoi( opt_arg ); if ((int)options->min_comp<=0) { - error_msg(progname, "invalid minimum compress size <%s>\n", opt_arg ); + error_msg(h5tools_getprogname(), "invalid minimum compress size <%s>\n", opt_arg ); exit(EXIT_FAILURE); } break; @@ -430,7 +433,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) options->alignment = atol( opt_arg ); if ( options->alignment < 1 ) { - error_msg(progname, "invalid alignment size\n", opt_arg ); + error_msg(h5tools_getprogname(), "invalid alignment size\n", opt_arg ); exit(EXIT_FAILURE); } break; @@ -445,8 +448,8 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) /* check for file names to be processed */ if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) { - error_msg(progname, "missing file names\n"); - usage(progname); + error_msg(h5tools_getprogname(), "missing file names\n"); + usage(h5tools_getprogname()); exit(EXIT_FAILURE); } } @@ -489,7 +492,7 @@ void read_info(const char *filename, if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { - error_msg(progname, "cannot open options file %s\n", filename); + error_msg(h5tools_getprogname(), "cannot open options file %s\n", filename); exit(EXIT_FAILURE); } @@ -526,7 +529,7 @@ void read_info(const char *filename, comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addfilter(comp_info,options)==-1){ - error_msg(progname, "could not add compression option\n"); + error_msg(h5tools_getprogname(), "could not add compression option\n"); exit(EXIT_FAILURE); } } @@ -556,7 +559,7 @@ void read_info(const char *filename, comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addlayout(comp_info,options)==-1){ - error_msg(progname, "could not add chunck option\n"); + error_msg(h5tools_getprogname(), "could not add chunck option\n"); exit(EXIT_FAILURE); } } @@ -565,7 +568,7 @@ void read_info(const char *filename, *------------------------------------------------------------------------- */ else { - error_msg(progname, "bad file format for %s", filename); + error_msg(h5tools_getprogname(), "bad file format for %s", filename); exit(EXIT_FAILURE); } } |