From 357f6376eca66aa9d1257b4cbda75890701c5813 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Mon, 16 Nov 2015 16:10:07 +0100 Subject: Interpret - as STDOUT on writing xml files This prepares for the smartrack converter webservice. Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- 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 166885861..eabcf4f26 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); -- cgit v1.2.3-70-g09d2