/*------------------------------------------------------------------------- * Function: main * * Purpose: h5repack main program * * Return: Success: EXIT_SUCCESS(0) * * Failure: EXIT_FAILURE(1) * * Programmer: Pedro Vicente, [email protected] * * Date: May 9, 2003 * * Comments: * *------------------------------------------------------------------------- */ int main(int argc, const char **argv) { pack_opt_t options; /*the global options */ h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); /* Initialize h5tools lib */ h5tools_init(); /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ if (h5tools_getenv_update_hyperslab_bufsize() < 0) { h5tools_setstatus(EXIT_FAILURE); goto done; } /* initialize options */ h5repack_init(&options, 0); if (parse_command_line(argc, argv, &options) < 0) goto done; /* get file names if they were not yet got */ if (has_i_o == 0) { if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) { infile = argv[opt_ind]; outfile = argv[opt_ind + 1]; if ( HDstrcmp( infile, outfile ) == 0) { error_msg("file names cannot be the same\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto done; } } else { error_msg("file names missing\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto done; } } /* pack it */ h5tools_setstatus(h5repack(infile, outfile, &options)); done: /* free tables */ h5repack_end(&options); leave(h5tools_getstatus()); return 0; }
/*------------------------------------------------------------------------- * Function: main * * Purpose: h5repack main program * * Return: Success: EXIT_SUCCESS(0) * * Failure: EXIT_FAILURE(1) * * Programmer: Pedro Vicente, [email protected] * * Date: May 9, 2003 * * Comments: * *------------------------------------------------------------------------- */ 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 h5tools lib */ h5tools_init(); /* initialize options */ h5repack_init(&options,0); parse_command_line(argc, argv, &options); /* get file names if they were not yet got */ if ( has_i_o == 0 ) { if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) { infile = argv[ opt_ind ]; outfile = argv[ opt_ind + 1 ]; if ( HDstrcmp( infile, outfile ) == 0 ) { error_msg("file names cannot be the same\n"); usage(h5tools_getprogname()); HDexit(EXIT_FAILURE); } } else { error_msg("file names missing\n"); usage(h5tools_getprogname()); HDexit(EXIT_FAILURE); } } /* pack it */ ret=h5repack(infile,outfile,&options); /* free tables */ h5repack_end(&options); if (ret==-1) return 1; else return 0; }
/*------------------------------------------------------------------------- * Function: main * * Purpose: h5repack main program * * Return: 1, error, 0, no error * * Programmer: Pedro Vicente, [email protected] * * Date: May 9, 2003 * * Comments: * * Modifications: * July 2004: Introduced the extra EC or NN option for SZIP * October 2006: Added a new switch -n, that allows to write the dataset * using a native type. The default to write is the file type. * * Modification: * Peter Cao, June 13, 2007 * Add "-L, --latest" option to pack a file with the latest file format * PVN, November 19, 2007 * adopted the syntax h5repack [OPTIONS] file1 file2 * PVN, November 28, 2007 * 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 repacked file (switches -u -b) * PVN, August 28, 2008 * add options to set alignment (H5Pset_alignment) (switches -t -a) *------------------------------------------------------------------------- */ int main(int argc, const char **argv) { pack_opt_t options; /*the global options */ int ret=-1; /* initialize options */ h5repack_init (&options,0); parse_command_line(argc, argv, &options); /* get file names if they were not yet got */ if ( has_i_o == 0 ) { if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) { infile = argv[ opt_ind ]; outfile = argv[ opt_ind + 1 ]; if ( strcmp( infile, outfile ) == 0 ) { error_msg(progname, "file names cannot be the same\n"); usage(progname); exit(EXIT_FAILURE); } } else { error_msg(progname, "file names missing\n"); usage(progname); exit(EXIT_FAILURE); } } /* pack it */ ret=h5repack(infile,outfile,&options); /* free tables */ h5repack_end(&options); if (ret==-1) return 1; else return 0; }