2016-12-12 03:25:08 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Copyright by The HDF Group. *
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
2017-04-18 03:32:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
|
|
|
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
|
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2016-12-12 03:25:08 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
#include "hdf5.h"
|
|
|
|
#include "H5private.h"
|
|
|
|
#include "h5tools.h"
|
|
|
|
|
|
|
|
static void usage(void);
|
|
|
|
|
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
|
|
|
HDfprintf(stdout, "\n");
|
|
|
|
HDfprintf(stdout, "Usage error!\n");
|
|
|
|
HDfprintf(stdout, "Usage: clear_open_chk filename\n");
|
|
|
|
} /* usage() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2017-01-05 22:58:58 +08:00
|
|
|
* Function: main
|
2016-12-12 03:25:08 +08:00
|
|
|
*
|
2017-01-05 22:58:58 +08:00
|
|
|
* Purpose: To open the file which has zero or nonzero status_flags in
|
|
|
|
* the superblock.
|
2016-12-12 03:25:08 +08:00
|
|
|
*
|
2017-01-05 22:58:58 +08:00
|
|
|
* Return: 0 on success
|
|
|
|
* 1 on failure
|
2016-12-12 03:25:08 +08:00
|
|
|
*
|
2017-01-05 22:58:58 +08:00
|
|
|
* Programmer: Vailin Choi; July 2013
|
2016-12-12 03:25:08 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2017-01-05 22:58:58 +08:00
|
|
|
char *fname; /* The HDF5 file name */
|
|
|
|
hid_t fid; /* File ID */
|
2016-12-12 03:25:08 +08:00
|
|
|
|
|
|
|
/* Check the # of arguments */
|
|
|
|
if(argc != 2) {
|
2017-01-05 22:58:58 +08:00
|
|
|
usage();
|
2017-01-06 02:01:45 +08:00
|
|
|
HDexit(EXIT_FAILURE);
|
2016-12-12 03:25:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the file name */
|
|
|
|
fname = HDstrdup(argv[1]);
|
|
|
|
|
|
|
|
/* Try opening the file */
|
2020-02-12 07:57:19 +08:00
|
|
|
if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
|
2017-01-05 22:58:58 +08:00
|
|
|
HDfprintf(stderr, "clear_open_chk: unable to open the file\n");
|
|
|
|
HDfree(fname);
|
2017-01-06 02:01:45 +08:00
|
|
|
HDexit(EXIT_FAILURE);
|
2016-12-12 03:25:08 +08:00
|
|
|
}
|
2017-01-05 22:58:58 +08:00
|
|
|
HDfree(fname);
|
2016-12-12 03:25:08 +08:00
|
|
|
|
|
|
|
/* Close the file */
|
|
|
|
if(H5Fclose(fid) < 0) {
|
2017-01-05 22:58:58 +08:00
|
|
|
HDfprintf(stderr, "clear_open_chk: cannot close the file\n");
|
2017-01-06 02:01:45 +08:00
|
|
|
HDexit(EXIT_FAILURE);
|
2016-12-12 03:25:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Return success */
|
2017-01-06 02:01:45 +08:00
|
|
|
HDexit(EXIT_SUCCESS);
|
2016-12-12 03:25:08 +08:00
|
|
|
} /* main() */
|