summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-11-16 16:10:07 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-24 09:20:03 -0800
commit357f6376eca66aa9d1257b4cbda75890701c5813 (patch)
treef330b5ec21bb55f05c521917ed9f128b0724368f
parentd3588ef0bbcf5de29d1563b98f948535f674d685 (diff)
downloadsubsurface-357f6376eca66aa9d1257b4cbda75890701c5813.tar.gz
Interpret - as STDOUT on writing xml files
This prepares for the smartrack converter webservice. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--subsurface-core/save-xml.c11
1 files 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);