Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4590)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4591)
@@ -27,4 +27,5 @@
 
 
+
   2004/08/12: Thomas Bretz
 
@@ -35,4 +36,10 @@
    * mbase/MStatusDisplay.cc:
      - small modification to postscript output
+
+   * showlog.cc:
+     - added
+
+   * Makefile:
+     - added showlog
 
 
Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 4590)
+++ trunk/MagicSoft/Mars/Makefile	(revision 4591)
@@ -21,5 +21,5 @@
 
 #PROGRAMS = readraw merpp mars test mona status
-PROGRAMS = readdaq readraw merpp star status mars mona
+PROGRAMS = readdaq readraw merpp star status mars mona showlog
 SOLIB    = libmars.so
 CINT     = M
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 4590)
+++ trunk/MagicSoft/Mars/NEWS	(revision 4591)
@@ -3,4 +3,8 @@
 
    - new macros for database interaction: filldotrun.C, filldotrbk.C
+
+   - added new program which can convert colored output which was redirected
+     into a file back into colored text (for example to display it with
+     more): showlog
 
 
Index: trunk/MagicSoft/Mars/showlog.cc
===================================================================
--- trunk/MagicSoft/Mars/showlog.cc	(revision 4591)
+++ trunk/MagicSoft/Mars/showlog.cc	(revision 4591)
@@ -0,0 +1,52 @@
+#include <errno.h>
+#include <fstream>
+
+#include "MLog.h"
+
+using namespace std;
+
+static void Usage()
+{
+    gLog << endl;
+    gLog << "Sorry the usage is:" << endl;
+    gLog << "   showlog filename" << endl;
+    gLog << " or" << endl;
+    gLog << "   showlog < filename" << endl << endl;
+    gLog << " This program converts colored output made with ansi codes" << endl;
+    gLog << " (like it is done by MLog) and redirected into a file back" << endl;
+    gLog << " into colored output." << endl << endl;
+}
+
+// FIXME: Enhance this tool with a converter to HTMl, etc.
+//        Add option for 'no-colors'
+int main(int argc, char **argv)
+{
+    if (argc>2)
+    {
+        Usage();
+        return -1;
+    }
+
+    istream *in = argc==2 ? new ifstream(argv[1]) : &cin;
+    if (!*in)
+    {
+        gLog << "Cannot open file " << argv[1] << ": " << strerror(errno) << endl;
+        return -1;
+    }
+
+    TString s;
+    while (1)
+    {
+        s.ReadLine(*in);
+        if (!*in)
+            break;
+
+        s.ReplaceAll("", "\033");
+        gLog << s << endl;
+    }
+
+    if (in!=&cin)
+        delete in;
+
+    return 0;
+}
