[svn-r21994] Add tools_init to main

This commit is contained in:
Allen Byrne 2012-02-27 15:10:18 -05:00
parent 3a713f8075
commit 009522483e
3 changed files with 34 additions and 23 deletions

View File

@ -32,9 +32,9 @@ void parse_command_line (int argc, const char *argv[]);
#define PROGRAMNAME "getub"
char *nbytes = NULL;
static const char *s_opts = "c:"; /* add more later ? */
static const char *s_opts = "c:"; /* add more later ? */
static struct long_options l_opts[] = {
{"c", require_arg, 'c'}, /* input file */
{"c", require_arg, 'c'}, /* input file */
{NULL, 0, '\0'}
};
@ -84,15 +84,15 @@ parse_command_line (int argc, const char *argv[])
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
{
case 'c':
nbytes = HDstrdup (opt_arg);
break;
case '?':
default:
usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
{
case 'c':
nbytes = HDstrdup (opt_arg);
break;
case '?':
default:
usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
}
if (argc <= opt_ind)
@ -115,6 +115,9 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
/* Initialize h5tools lib */
h5tools_init();
parse_command_line (argc, argv);
if (nbytes == NULL)
@ -161,7 +164,7 @@ main (int argc, const char *argv[])
if (res < (long)size)
{
if (buf)
free (buf);
free (buf);
HDclose (fd);
exit (EXIT_FAILURE);
}

View File

@ -60,7 +60,7 @@ usage (const char *prog)
fflush (stdout);
fprintf (stdout, "usage: %s h5_file\n", prog);
fprintf (stdout,
" Check that h5_fil is HDF5 file and print size of user block \n");
" Check that h5_fil is HDF5 file and print size of user block \n");
fprintf (stdout, " %s -h\n", prog);
fprintf (stdout, " Print a usage message and exit\n");
}
@ -90,15 +90,15 @@ parse_command_line (int argc, const char *argv[])
while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
{
case 'h':
usage (h5tools_getprogname());
exit (EXIT_SUCCESS);
case '?':
default:
usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
{
case 'h':
usage (h5tools_getprogname());
exit (EXIT_SUCCESS);
case '?':
default:
usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
}
/* check for file name to be processed */
@ -139,6 +139,9 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
/* Initialize h5tools lib */
h5tools_init();
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@ -174,7 +177,7 @@ main (int argc, const char *argv[])
if (plist < 0)
{
error_msg("Can't get file creation plist for file \"%s\"\n",
ifname);
ifname);
return (EXIT_FAILURE);
}

View File

@ -168,6 +168,11 @@ static int make_complex_attr_references(hid_t loc_id);
int main (void)
{
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
/* Initialize h5tools lib */
h5tools_init();
pack_opt_t pack_options;
diff_opt_t diff_options;
hsize_t fs_size = 0; /* free space section threshold */