Index: trunk/FACT++/src/showlog.cc
===================================================================
--- trunk/FACT++/src/showlog.cc	(revision 16821)
+++ trunk/FACT++/src/showlog.cc	(revision 16822)
@@ -2,4 +2,5 @@
 
 #include "Time.h"
+#include "tools.h"
 #include "WindowLog.h"
 #include "Configuration.h"
@@ -17,5 +18,4 @@
         ("begin,b",   var<string>(), "Start time to be displayed (e.g. 20:00:12)")
         ("end,e",     var<string>(), "End time to be displayed (e.g. 21:00:13)")
-        ("day,d",     var<int16_t>()->implicit_value(true)->default_value(-1), "Index of block between start and end time to be displayed.")
         ("verbose,v", var<int16_t>()->implicit_value(true)->default_value(8), "Verbosity level (0:only fatal errors, 8:everything)")
         ("color,c",   po_bool(false), "Process a file which already contains color codes")
@@ -41,7 +41,10 @@
         "Use -c or --color to process color coded files.\n"
         "\n"
-        "The default is to read from stdin.\n"
-        "\n"
-        "Usage: showlog [-c] [-vN] [-b start] [-e end] [-d day] [file1 ...]\n";
+        "The default is to read from stdin if no filoename as given. If, as "
+        "a filename, just a number between 2000000 and 21000000 is given, "
+        "e.g. 20111016 a log with the name /fact/aux/2011/10/16/20111016.log "
+        "is read.\n"
+        "\n"
+        "Usage: showlog [-c] [-vN] [-b start] [-e end] [file1 ...]\n";
     cout << endl;
 }
@@ -61,5 +64,5 @@
 
 
-void showlog(const string &fname, const Time &tbeg, const Time &tend, int16_t day, int16_t severity, bool color)
+void showlog(string fname, const Time &tbeg, const Time &tend, int16_t severity, bool color)
 {
     // Alternatives
@@ -69,5 +72,15 @@
     const boost::regex reg("\x1B\[[0-9;]*[a-zA-Z]");
 
+    const uint32_t night = atoi(fname.c_str());
+    if (night>20000000 && night<21000000 &&to_string(night)==fname)
+        fname = Tools::Form("/fact/aux/%04d/%02d/%02d/%d.log",
+                            night/10000, (night/100)%100, night%100, night);
+
+    if (!fname.empty())
+        cerr << "Reading " << fname << endl;
+
     ifstream fin(fname.empty() ? "/dev/stdin" : fname.c_str());
+    if (!fin)
+        throw runtime_error(strerror(errno));
 
     string buffer;
@@ -93,20 +106,27 @@
             const Time t("1970-01-01 "+tm);
 
-            if (day>=0)
+            if (tbeg.IsValid() && !tend.IsValid() && t<tbeg)
+                continue;
+
+            if (tend.IsValid() && !tbeg.IsValid() && t>tend)
+                continue;
+
+            if (tbeg.IsValid() && tend.IsValid())
             {
-                if (tprev<tbeg && t>tbeg)
-                    counter++;
-
-                tprev = t;
-
-                if (day!=counter)
-                    continue;
+                if (tend>tbeg)
+                {
+                    if (t<tbeg)
+                        continue;
+                    if (t>tend)
+                        continue;
+                }
+                else
+                {
+                    if (t>tbeg)
+                        continue;
+                    if (t<tend)
+                        continue;
+                }
             }
-
-            if (tbeg.IsValid() && t<tbeg)
-                continue;
-
-            if (tend.IsValid() && t>tend)
-                continue;
         }
 
@@ -175,8 +195,8 @@
 
     if (files.size()==0)
-        showlog("", tbeg, tend, conf.Get<int16_t>("day"), conf.Get<int16_t>("verbose"), conf.Get<bool>("color"));
+        showlog("", tbeg, tend, conf.Get<int16_t>("verbose"), conf.Get<bool>("color"));
 
     for (auto it=files.begin(); it!=files.end(); it++)
-        showlog(*it, tbeg, tend, conf.Get<int16_t>("day"), conf.Get<int16_t>("verbose"), conf.Get<bool>("color"));
+        showlog(*it, tbeg, tend, conf.Get<int16_t>("verbose"), conf.Get<bool>("color"));
 
     return 0;
