diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2011-08-19 16:02:57 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2011-08-19 16:02:57 (GMT) |
commit | 00cdf98d005604d4ebf243c58ecacfc1c904f1fd (patch) | |
tree | 457b68eca73df1e00cc7a299d8038fedf9ab99b6 /tools/h5jam/h5unjam.c | |
parent | 85eabb54fe67701bec6165f67f57e5aae1f155a1 (diff) | |
download | hdf5-00cdf98d005604d4ebf243c58ecacfc1c904f1fd.zip hdf5-00cdf98d005604d4ebf243c58ecacfc1c904f1fd.tar.gz hdf5-00cdf98d005604d4ebf243c58ecacfc1c904f1fd.tar.bz2 |
[svn-r21264] Purpose:
Work for:
HDFFV-7515 - GMQS: h5unjam - incorrect help page and should display when
no file is given.
and
HDFFV-5941 - h5jam: specifying a user block file with a proper HDF5 magic
number will result in a corrupted HDF5 file.
Description:
- Merged from HDF5 trunk r21236,
- Revised command help pages of h5jam and h5unjam. The descriptions
were not up to date and some were missing. (HDFFV-7515)
- Fixed h5jam not to allow specifying an HDF5 formatted file as input
file for -u (user block file) option, because the original HDF5 file
will not be accessible if allows. (HDFFV-5941)
Tested:
jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), cmake (jam, win)
Diffstat (limited to 'tools/h5jam/h5unjam.c')
-rw-r--r-- | tools/h5jam/h5unjam.c | 69 |
1 files changed, 59 insertions, 10 deletions
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index d3b36a9..14ed651 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -69,15 +69,56 @@ static struct long_options l_opts[] = { static void usage(const char *prog) { - fflush(stdout); - fprintf(stdout, "usage: %s -i h5_file -o user_block_file_out -o h5_file_out [-d | --delete]\n", prog); - fprintf(stdout, " Extract user block from 'h5_file' into 'user_block_file'\n"); - fprintf(stdout, " and HDF5 file into 'h5_file_out'\n"); - - fprintf(stdout, " %s -h\n",prog); - fprintf(stdout, " Print a usage message and exit\n"); - fprintf(stdout, " %s -V \n", prog); - fprintf(stdout, " Print HDF5 library version and exit\n"); + HDfflush(stdout); + HDfprintf(stdout, + "usage: %s -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]\n", prog); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, + "Splits user file and HDF5 file into two files: user block data and HDF5 data.\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, + "OPTIONS\n"); + HDfprintf(stdout, + " -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file\n"); + HDfprintf(stdout, + " contains no user block, exit with an error message.\n"); + HDfprintf(stdout, + " -o out_file.h5 Specifies output HDF5 file without a user block.\n"); + HDfprintf(stdout, + " If not specified, the user block will be removed from the\n"); + HDfprintf(stdout, + " input HDF5 file.\n"); + HDfprintf(stdout, + " -u out_user_file\n"); + HDfprintf(stdout, + " Specifies the output file containing the data from the\n"); + HDfprintf(stdout, + " user block.\n"); + HDfprintf(stdout, + " Cannot be used with --delete option.\n"); + HDfprintf(stdout, + " --delete Remove the user block from the input HDF5 file. The content\n"); + HDfprintf(stdout, + " of the user block is discarded.\n"); + HDfprintf(stdout, + " Cannot be used with the -u option.\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, + " -h Prints a usage message and exits.\n"); + HDfprintf(stdout, + " -V Prints the HDF5 library version and exits.\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, + " If neither --delete nor -u is specified, the user block from the input file\n"); + HDfprintf(stdout, + " will be displayed to stdout.\n"); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, + "Exit Status:\n"); + HDfprintf(stdout, + " 0 Succeeded.\n"); + HDfprintf(stdout, + " >0 An error occurred.\n"); } /*------------------------------------------------------------------------- @@ -203,10 +244,18 @@ main(int argc, const char *argv[]) parse_command_line(argc, argv); + if (input_file == NULL) { + /* no user block */ + error_msg("missing arguemnt for HDF5 file input.\n"); + help_ref_msg(stderr); + leave (EXIT_FAILURE); + } + testval = H5Fis_hdf5(input_file); if (testval <= 0) { - error_msg("Input HDF5 file is not HDF \"%s\"\n", input_file); + error_msg("Input HDF5 file \"%s\" is not HDF\n", input_file); + help_ref_msg (stderr); h5tools_setstatus(EXIT_FAILURE); goto done; } |