From 84af961d2500e75e18a8e994c163c655f36aa9ff Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de>
Date: Thu, 10 Aug 2017 20:08:26 +0200
Subject: [PATCH] errors in fe2; react to allow_overwrite.

---
 pub/lib/commands.cpp |  4 ++--
 pub/lib/file_out.cpp | 10 +++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/pub/lib/commands.cpp b/pub/lib/commands.cpp
index 7c6c4373..a6c047ee 100644
--- a/pub/lib/commands.cpp
+++ b/pub/lib/commands.cpp
@@ -279,9 +279,9 @@ bool frida_command(string cmd)
     } else if (cmd == "fs") {
         NFileOut::save("yda", SMem::instance()->overwrite);
     } else if (cmd == "fe1") {
-        NFileOut::save("csv");
+        NFileOut::save("csv", SMem::instance()->overwrite);
     } else if (cmd == "fe2") {
-        NFileOut::save("tab");
+        NFileOut::save("tab", SMem::instance()->overwrite);
     } else if (cmd == "fc") {
         SMem::instance()->mem_copy();
     } else if (cmd == "fx") {
diff --git a/pub/lib/file_out.cpp b/pub/lib/file_out.cpp
index 8055b0b7..fc2c06be 100644
--- a/pub/lib/file_out.cpp
+++ b/pub/lib/file_out.cpp
@@ -183,14 +183,18 @@ void NFileOut::save_tab(FILE* file, const COlo* f)
     if (!fd)
         throw S("tab save not implemented for non-data files");
     for (int j = 0; j < f->nJ(); j++) {
+        const CSpec* s = fd->VS(j);
         for (int iz = 0; iz < f->ZCo.size(); ++iz) {
             if (iz > 0)
                 fprintf(file, "\t");
-            fprintf(file, "%g", PCAST<const CObjNum>(fd->VS(j)->z[iz])->to_r());
+            fprintf(file, "%g", PCAST<const CObjNum>(s->z[iz])->to_r());
         }
         fprintf(file, "\n");
-        for (int i = 0; i < fd->VS(j)->size(); ++i) {
-            fprintf(file, "%g\t%g\n", fd->VS(j)->x[i], fd->VS(j)->y[i]);
+        for (int i = 0; i < s->size(); ++i) {
+            if (s->has_dy())
+                fprintf(file, "%g\t%g\t%g\n", s->x[i], s->y[i], s->dy[i]);
+            else
+                fprintf(file, "%g\t%g\n", s->x[i], s->y[i]);
         }
         fprintf(file, "\n");
     }
-- 
GitLab