diff options
Diffstat (limited to 'test/h5test.c')
-rw-r--r-- | test/h5test.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/test/h5test.c b/test/h5test.c index dc13a27..aa99c1f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -93,7 +93,7 @@ static const char *multi_letters = "msbrglo"; 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); /*------------------------------------------------------------------------- @@ -295,7 +295,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)); } @@ -315,7 +315,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)); } @@ -343,7 +369,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'; @@ -364,7 +390,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; } |