summaryrefslogtreecommitdiffstats
path: root/test/links.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-14 16:44:46 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-14 16:44:46 (GMT)
commitb6fc6ede10fee24e9ef0a21df81cc181f6d7fec0 (patch)
tree66321165e4bd58a9fe3722a1a3baee2f835d0544 /test/links.c
parent3f571b6b4499e09aa6db29cb389e1121624a081d (diff)
downloadhdf5-b6fc6ede10fee24e9ef0a21df81cc181f6d7fec0.zip
hdf5-b6fc6ede10fee24e9ef0a21df81cc181f6d7fec0.tar.gz
hdf5-b6fc6ede10fee24e9ef0a21df81cc181f6d7fec0.tar.bz2
[svn-r346] Changes since 19980410
---------------------- ./html/H5.format.html ./src/H5E.c ./src/H5Epublic.h ./src/H5F.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gprivate.h ./src/h5ls.c ./test/Makefile.in Symbolic links are now supported. The ./test/links program will create a `links.h5' file that demonstrates hard links, soft links, dangling links, and recursive links. A symbolic link is a symbol table entity and doesn't have an object header. It's format is described in H5.format.hml. ./src/H5G.c ./src/H5Gpublic.h ./src/h5ls.c Implemented H5Gstat() and H5Gget_linkval() as documented by Quincey. The `H5G_type_t type' field of `H5G_stat_t' was changed to `int type' because H5G_type_t was already used and the `type' data type should be open-ended. ./src/H5Ffamily.c Removed an incorrect diagnostic message. ./test/big.c Added read/write calls to test partial I/O to big contiguous datasets. With no arguments it writes to a dataset and prints the list of points written which should be redirected to a file. With an argument (the name of a file containing the stdout of a run with no arguments) values are read from the dataset. One would typically say `big >x && big x'.
Diffstat (limited to 'test/links.c')
-rw-r--r--test/links.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/links.c b/test/links.c
new file mode 100644
index 0000000..ac4a3e1
--- /dev/null
+++ b/test/links.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 1998 NCSA
+ * All rights reserved.
+ *
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Friday, April 10, 1998
+ *
+ * Purpose: Tests hard and soft (symbolic) links.
+ */
+#include <hdf5.h>
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests links.
+ *
+ * Return: Success: 0
+ *
+ * Failure: non-zero
+ *
+ * Programmer: Robb Matzke
+ * Friday, April 10, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (void)
+{
+ hid_t file, scalar, grp, d1;
+ hsize_t size[1] = {1};
+
+ /* Create a file */
+ file = H5Fcreate ("links.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ scalar = H5Screate_simple (1, size, size);
+
+ /* Create a group */
+ grp = H5Gcreate (file, "grp1", 0);
+ H5Gclose (grp);
+
+ /* Create a dataset */
+ d1 = H5Dcreate (file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT);
+ H5Dclose (d1);
+
+ /* Create a hard link */
+ H5Glink (file, H5G_LINK_HARD, "d1", "grp1/hard");
+
+ /* Create a symbolic link */
+ H5Glink (file, H5G_LINK_SOFT, "/d1", "grp1/soft");
+
+ /* Create a symbolic link to something that doesn't exist */
+ H5Glink (file, H5G_LINK_SOFT, "foobar", "grp1/dangle");
+
+ /* Create a recursive symbolic link */
+ H5Glink (file, H5G_LINK_SOFT, "/grp1/recursive", "/grp1/recursive");
+
+ /* Close */
+ H5Sclose (scalar);
+ H5Fclose (file);
+ return 0;
+}