-/* Wrapper to successive call of fclose() from function called "f" on "file",
- * then unlink() on file at path "p2" if it exists, then rename() from path "p1"
- * to "p2". Used for handling atomic saving of files via temp files.
- */
-extern void try_fclose_unlink_rename(FILE * file, char * p1, char * p2,
- char * f);
+/* Return "path" + suffix "_tmp". Value is malloc'd, must be freed externally.*/
+extern char * build_temp_path(char * path);
+
+/* Write to "path_tmp" "path" + "_tmp" and return a new file at that "path_tmp"
+ * open for writing. "path_tmp" is malloc()'d, must be freed externally.
+*/
+extern FILE * atomic_write_start(char * path, char ** path_tmp);