From 10be4f46ca1a16353cedbd4b709bcc2332d69a78 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Mon, 16 Nov 2015 16:10:07 +0100 Subject: [PATCH 1/2] Interpret - as STDOUT on writing xml files This prepares for the smartrack converter webservice. Signed-off-by: Robert C. Helling --- subsurface-core/save-xml.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/subsurface-core/save-xml.c b/subsurface-core/save-xml.c index 1668858..eabcf4f 100644 --- a/subsurface-core/save-xml.c +++ b/subsurface-core/save-xml.c @@ -666,12 +666,15 @@ int save_dives_logic(const char *filename, const bool select_only) if (git) return git_save_dives(git, branch, remote, select_only); - try_to_backup(filename); - save_dives_buffer(&buf, select_only); - error = -1; - f = subsurface_fopen(filename, "w"); + if (same_string(filename, "-")) { + f = stdout; + } else { + try_to_backup(filename); + error = -1; + f = subsurface_fopen(filename, "w"); + } if (f) { flush_buffer(&buf, f); error = fclose(f); -- 2.4.9 (Apple Git-60)