diff --git a/src/engine/io-gncxml-v2.c b/src/engine/io-gncxml-v2.c index 5295555a3e..25cab9a12a 100644 --- a/src/engine/io-gncxml-v2.c +++ b/src/engine/io-gncxml-v2.c @@ -595,11 +595,9 @@ write_schedXactions( FILE *out, GNCBook *book ) } gboolean -gnc_book_write_to_xml_file_v2(GNCBook *book, const char *filename) +gnc_book_write_to_xml_filehandle_v2(GNCBook *book, FILE *out) { - FILE *out; - - out = fopen(filename, "w"); + if (!out) return FALSE; fprintf(out, "\n"); fprintf(out, "<" GNC_V2_STRING ">\n"); @@ -629,6 +627,18 @@ gnc_book_write_to_xml_file_v2(GNCBook *book, const char *filename) write_schedXactions(out, book); fprintf(out, "\n\n"); + + return TRUE; +} + +gboolean +gnc_book_write_to_xml_file_v2(GNCBook *book, const char *filename) +{ + FILE *out; + + out = fopen(filename, "w"); + gnc_book_write_to_xml_filehandle_v2 (book, out); + write_emacs_trailer(out); if(fclose(out) != 0) diff --git a/src/engine/io-gncxml-v2.h b/src/engine/io-gncxml-v2.h index 1e4922f4db..3facb51cf6 100644 --- a/src/engine/io-gncxml-v2.h +++ b/src/engine/io-gncxml-v2.h @@ -87,6 +87,7 @@ gboolean gnc_book_load_from_xml_file_v2( void (*countcallback)(const char *type, load_counter count)); /* write all account info to a file */ +gboolean gnc_book_write_to_xml_filehandle_v2(GNCBook *book, FILE *fh); gboolean gnc_book_write_to_xml_file_v2(GNCBook *book, const char *filename); /* The is_gncxml_file() routine checks to see if the first few