Index: /trunk/FACT++/src/fadctrl.cc
===================================================================
--- /trunk/FACT++/src/fadctrl.cc	(revision 10858)
+++ /trunk/FACT++/src/fadctrl.cc	(revision 10859)
@@ -812,7 +812,7 @@
             switch (fStatus2[i->first])
             {
-            case 0: str << "1-7:not connected)"; break;
-            case 1: str << "1-7:connecting [" << GetNumConnected(i->first) << "])";   break;
-            case 2: str << "1-7:connected)";    break;
+            case 0:  str << "1-7:not connected)"; break;
+            case 7:  str << "1-7:connected)";    break;
+            default: str << "1-7:connecting [" << fStatus2[i->first] << "])";   break;
             }
 
@@ -882,5 +882,6 @@
     {
         vector<string> addr;
-        for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++)
+
+        for (BoardList::const_iterator i=fBoards.begin(); i!=fBoards.end(); i++)
             addr.push_back(i->second.first);
 
@@ -959,34 +960,30 @@
         vector<char> stat1(40);
         vector<char> stat2(40);
+
+        int cnt = 0;
         for (BoardList::const_iterator i=fBoards.begin(); i!=fBoards.end(); i++)
         {
             const ConnectionFAD &c = *i->second.second;
-
-            const int &idx = i->first;
 
             // ----- Command socket -----
             if (c.IsConnecting())
             {
-                stat1[idx] = 1;
+                stat1[i->first] = 1;
                 nconnecting1++;
             }
             if (c.IsConnected())
             {
-                stat1[idx] = 2;
+                stat1[i->first] = 2;
                 nconnected1++;
             }
 
             // ----- Event builder -----
-            if (!IsConnected(idx) && !IsDisconnected(idx))
-            {
-                stat2[idx] = 1;
+            stat2[i->first] = GetNumConnected(cnt);
+
+            if (!IsConnected(cnt) && !IsDisconnected(cnt))
                 nconnecting2++;
-            }
-
-            if (IsConnected(idx))
-            {
-                stat2[idx] = 2;
+
+            if (IsConnected(cnt))
                 nconnected2++;
-            }
         }
 
@@ -1195,4 +1192,20 @@
         SetMaxMemory(conf.Get<unsigned int>("max-mem"));
 
+        // vvvvv for debugging vvvvv
+        if (conf.Has("debug-port"))
+        {
+            const int port = conf.Get<unsigned int>("debug-port");
+            const int num  = conf.Get<unsigned int>("debug-num");
+            for (int i=0; i<num; i++)
+            {
+                ostringstream str;
+                str << "localhost:" << port+8*i;
+                AddEndpoint(str.str());
+            }
+            Connect();
+            return true;
+        }
+        // ^^^^^ for debugging ^^^^^
+
         if (!(conf.Has("base-addr") ^ conf.Has("addr")))
         {
@@ -1355,11 +1368,20 @@
     po::options_description control("FAD control options");
     control.add_options()
-//        ("addr,a",        var<string>("localhost:5000"),  "Network address of FTM")
         ("quiet,q",    po_bool(),  "Disable printing contents of all received messages in clear text.")
         ("hex-out",    po_bool(),  "Enable printing contents of all printed messages also as hex data.")
         ("data-out",   po_bool(),  "Enable printing received event data.")
+        ;
+
+    po::options_description builder("Event builder options");
+    builder.add_options()
+        ("max-mem,m",  var<unsigned int>(100), "Maximum memory the event builder thread is allowed to consume for its event buffer")
+        ;
+
+    po::options_description connect("FAD connection options");
+    connect.add_options()
         ("addr",       vars<string>(),     "Network address of FAD")
         ("base-addr",  var<string>(),      "Base address of all FAD")
-        ("max-mem,m",  var<unsigned int>(100), "Maximum memory the event builder thread is allowed to consume for its event buffer")
+        ("debug-num,n",  var<unsigned int>(40),  "Sets the number of fake boards to be connected locally")
+        ("debug-port,p", var<unsigned int>(),    "Sets <debug-num> addresses to 'localhost:<debug-port>' in steps of 8")
         ;
 
@@ -1368,4 +1390,6 @@
     conf.AddOptions(config);
     conf.AddOptions(control);
+    conf.AddOptions(builder);
+    conf.AddOptions(connect);
 }
 
