From 442f1e06f9afc70445e971bbc9e7e4a11f871471 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Tue, 26 Jun 2001 04:41:41 +0000 Subject: [PATCH] add file handle interface to docs git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4800 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/io-gncxml-v2.c | 18 ++++++++++++++---- src/engine/io-gncxml-v2.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) 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