summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_main.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-08-22 15:53:07 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-08-22 15:53:07 (GMT)
commita72dc6c92c78650589a9f13d7221318dd1032efe (patch)
tree761d5b07a4814de36d88adc5bfebc161e29adabe /tools/h5repack/h5repack_main.c
parente9f3b20b64d3c2ffe2e134a5c4bf974c916472b8 (diff)
downloadhdf5-a72dc6c92c78650589a9f13d7221318dd1032efe.zip
hdf5-a72dc6c92c78650589a9f13d7221318dd1032efe.tar.gz
hdf5-a72dc6c92c78650589a9f13d7221318dd1032efe.tar.bz2
[svn-r15521] #1184
Add a userblock to an HDF5 file during the repack. The user gives give a filename and userblock size as command line parameters to h5repack and the contents of that file are stored in the userblock for the HDF5 file created by h5repack. New flags to handle this -u and -b Tested : windows, linux
Diffstat (limited to 'tools/h5repack/h5repack_main.c')
-rw-r--r--tools/h5repack/h5repack_main.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index d512923..db0a87b 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -37,7 +37,7 @@ static int has_i_o = 0;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLc:d:s:";
+static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -51,6 +51,8 @@ static struct long_options l_opts[] = {
{ "compact", require_arg, 'c' },
{ "indexed", require_arg, 'd' },
{ "ssize", require_arg, 's' },
+ { "ublock", require_arg, 'u' },
+ { "block", require_arg, 'b' },
{ NULL, 0, '\0' }
};
@@ -84,14 +86,16 @@ static struct long_options l_opts[] = {
* added support for multiple global filters
* PVN, May 16, 2008
* added backward compatibility for -i infile -o outfile
- *-------------------------------------------------------------------------
+ * PVN, August 20, 2008
+ * add a user block to file if requested (new switches -u -b)
+ *-------------------------------------------------------------------------
*/
int main(int argc, char **argv)
{
char *infile = NULL;
char *outfile = NULL;
pack_opt_t options; /*the global options */
- int ret;
+ int ret=-1;
int i;
/* initialize options */
@@ -284,7 +288,8 @@ int main(int argc, char **argv)
}
-
+
+
/* pack it */
ret=h5repack(infile,outfile,&options);
@@ -324,6 +329,8 @@ static void usage(const char *prog)
printf(" -s S[:F], --ssize=S[:F] Shared object header message minimum size\n");
printf(" -m T, --threshold=T Do not apply the filter to datasets smaller than T\n");
printf(" -e M, --file=M Name of file M with the -f and -l options\n");
+ printf(" -u U, --ublock=U Name of file U with user block data to be added\n");
+ printf(" -b D, --block=D Size of user block to be added\n");
printf(" -f FILT, --filter=FILT Filter type\n");
printf(" -l LAYT, --layout=LAYT Layout type\n");
@@ -331,7 +338,9 @@ static void usage(const char *prog)
printf(" T - is an integer greater than 1, size of dataset in bytes \n");
printf(" M - is a filename.\n");
+ printf(" U - is a filename.\n");
printf(" S - is an integer\n");
+ printf(" D - is the user block size (any power of 2 equal to 512 or greater)\n");
printf(" F - is the shared object header message type, any of <dspace|dtype|fill|\n");
printf(" pline|attr>. If F is not specified, S applies to all messages\n");
@@ -530,6 +539,17 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options
break;
+
+ case 'u':
+
+ options->ublock_filename = opt_arg;
+ break;
+
+ case 'b':
+
+ options->ublock_size = atoi( opt_arg );
+ break;
+
} /* switch */