diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-08-02 21:44:04 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-08-02 21:44:04 +0100 |
commit | 780d7c53a8479b62fe8d90e16a3045187e347cc7 (patch) | |
tree | 7d1766aea3d80fdfa21e0779acb520ff05a80dcb /src/utils.h | |
parent | cf89528fc6668e6d07b6e99db0069c9fe1f6e05d (diff) | |
download | nsgenbind-780d7c53a8479b62fe8d90e16a3045187e347cc7.tar.gz nsgenbind-780d7c53a8479b62fe8d90e16a3045187e347cc7.tar.bz2 |
generates files with temporary name and only overwites on change
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h index b37d755..508d1c1 100644 --- a/src/utils.h +++ b/src/utils.h @@ -22,6 +22,20 @@ char *genb_fpath(const char *fname); */ FILE *genb_fopen(const char *fname, const char *mode); +/** + * Open file allowing for output path prefix + * + * file is opened for reading/writing with a temporary suffix allowing for the + * matching close call to check the output is different before touching the + * target file. + */ +FILE *genb_fopen_tmp(const char *fname); + +/** + * Close file opened with genb_fopen + */ +int genb_fclose_tmp(FILE *filef, const char *fname); + #ifdef _WIN32 #define NEED_STRNDUP 1 char *strndup(const char *s, size_t n); |