summaryrefslogtreecommitdiffstats
path: root/test/h5test.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-10-06 19:09:59 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-10-06 19:09:59 (GMT)
commit8e9b142d9cd347432d400b4f9b3b88a3f047c06d (patch)
tree47f400406beacaac0a987619ee17a7f4ef0bb44d /test/h5test.c
parent8d131aca15bca2d042ef175af5cf5a642d4c1152 (diff)
parent58db7babe40a10916a1c3b7667eaaeb5d48c2fb8 (diff)
downloadhdf5-8e9b142d9cd347432d400b4f9b3b88a3f047c06d.zip
hdf5-8e9b142d9cd347432d400b4f9b3b88a3f047c06d.tar.gz
hdf5-8e9b142d9cd347432d400b4f9b3b88a3f047c06d.tar.bz2
[svn-r27976] merge from trunk.
Diffstat (limited to 'test/h5test.c')
-rw-r--r--test/h5test.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/test/h5test.c b/test/h5test.c
index f936605..843ec35 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -96,7 +96,7 @@ static H5E_auto2_t err_func = NULL;
static herr_t h5_errors(hid_t estack, void *client_data);
static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix,
- char *fullname, size_t size);
+ char *fullname, size_t size, hbool_t nest_printf);
/*-------------------------------------------------------------------------
@@ -327,7 +327,7 @@ h5_reset(void)
char *
h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
- return (h5_fixname_real(base_name, fapl, ".h5", fullname, size));
+ return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE));
}
@@ -347,7 +347,33 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
char *
h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
- return (h5_fixname_real(base_name, fapl, NULL, fullname, size));
+ return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE));
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_fixname_printf
+ *
+ * Purpose: Same as h5_fixname but returns a filename that can be passed
+ * through a printf-style function once before being passed to the file
+ * driver. Basically, replaces all % characters used by the file
+ * driver with %%.
+ *
+ * Return: Success: The FULLNAME pointer.
+ *
+ * Failure: NULL if BASENAME or FULLNAME is the null
+ * pointer or if FULLNAME isn't large enough for
+ * the result.
+ *
+ * Programmer: Neil Fortner
+ * Wednesday, July 15, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+char *
+h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size)
+{
+ return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE));
}
@@ -375,7 +401,7 @@ h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t s
*/
static char *
h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
- char *fullname, size_t size)
+ char *fullname, size_t size, hbool_t nest_printf)
{
const char *prefix = NULL;
char *ptr, last = '\0';
@@ -396,7 +422,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
if(suffix) {
if(H5FD_FAMILY == driver)
- suffix = "%05d.h5";
+ suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
else if (H5FD_MULTI == driver)
suffix = NULL;
}