powerguru-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Powerguru-commit] [SCM] powerguru branch, master, updated. 48283db0c8ea


From: Rob Savoye
Subject: [Powerguru-commit] [SCM] powerguru branch, master, updated. 48283db0c8ea6a1ec1ad76b8680ee5b4524c4920
Date: Sat, 10 Dec 2011 00:05:06 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "powerguru".

The branch, master has been updated
       via  48283db0c8ea6a1ec1ad76b8680ee5b4524c4920 (commit)
      from  885b34f389c1338dfb95f57df57f60bae8b3231f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/powerguru.git/commit/?id=48283db0c8ea6a1ec1ad76b8680ee5b4524c4920


commit 48283db0c8ea6a1ec1ad76b8680ee5b4524c4920
Author: Rob Savoye <address@hidden>
Date:   Fri Dec 9 17:04:55 2011 -0700

    minor reformatting for code style. Update copyright date. Add emacs block

diff --git a/Makefile.am b/Makefile.am
index 98585ba..95365b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 # 
-#   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008,
-#              2009, 2010 Free Software Foundation, Inc.
+#  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+#      Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/client/Makefile.am b/client/Makefile.am
index bc9e457..c148bf1 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,5 +1,6 @@
 # 
-# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010 Free Software 
Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010, 2011
+#      Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/client/cmd.cc b/client/cmd.cc
index 5f98f43..c5ab7f9 100644
--- a/client/cmd.cc
+++ b/client/cmd.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -65,59 +66,59 @@ main(int argc, char *argv[])
 
     // scan for the two main standard GNU options
     for (c=0; c<argc; c++) {
-      if (strcmp("--help", argv[c]) == 0) {
-        usage(argv[0]);
-        exit(0);
-      }
-      if (strcmp("--version", argv[c]) == 0) {
-        cerr << "PowerGuru version: " << VERSION << endl;
-        exit(0);
-      }
+        if (strcmp("--help", argv[c]) == 0) {
+            usage(argv[0]);
+            exit(0);
+        }
+        if (strcmp("--version", argv[c]) == 0) {
+            cerr << "PowerGuru version: " << VERSION << endl;
+            exit(0);
+        }
     }
     
     while ((c = getopt (argc, argv, "hvdcm:u:p:V")) != -1) {
-      switch (c) {
-      case 'h':
-        usage (argv[0]);
-        break;
+        switch (c) {
+          case 'h':
+              usage (argv[0]);
+              break;
         
-      case 'v':
-        dbglogfile.set_verbosity();
-        break;
+          case 'v':
+              dbglogfile.set_verbosity();
+              break;
         
-      case 'm':
-        hostname = strdup(optarg);
-        break;
+          case 'm':
+              hostname = strdup(optarg);
+              break;
         
-        // Specify database user name.
-      case 'u': 
-        user = strdup(optarg);
-        break;
+              // Specify database user name.
+          case 'u': 
+              user = strdup(optarg);
+              break;
         
-        // Specify database user password.
-      case 'p':
-        passwd = strdup(optarg);
-        break;   
+              // Specify database user password.
+          case 'p':
+              passwd = strdup(optarg);
+              break;   
         
-      case 'c':
-        client = true;
-        daemon = false;
-        break;   
+          case 'c':
+              client = true;
+              daemon = false;
+              break;   
         
-      case 'V':
-        cerr << "PowerGuru version " << VERSION << endl;
-        exit (0);
-        break;   
+          case 'V':
+              cerr << "PowerGuru version " << VERSION << endl;
+              exit (0);
+              break;   
         
-      case 'd':
-        client = false;
-        daemon = true;
-        break;   
+          case 'd':
+              client = false;
+              daemon = true;
+              break;   
         
-      default:
-        usage (argv[0]);
-        break;
-      }
+          default:
+              usage (argv[0]);
+              break;
+        }
     }
     
     // get the file name from the command line
@@ -151,128 +152,128 @@ main(int argc, char *argv[])
 
     // Make a client connection
     if (client == true) {
-      msg.init(hostname);
-      msg.checkConsole();
+        msg.init(hostname);
+        msg.checkConsole();
     }
 
     // Start as a daemon
     if (daemon == true) {
-      msg.init(true);
+        msg.init(true);
     }
     //msg.methodsDump();          // FIXME: debugging crap
     
     //msg.print_msg(msg.status((meter_data_t *)0));
 
     if (client) {
-      msg.writeNet(msg.metersRequestCreate(Msgs::BATTERY_VOLTS));
+        msg.writeNet(msg.metersRequestCreate(Msgs::BATTERY_VOLTS));
     }
 
     // msg.cacheDump();
     
     while ((ch = con.Getc()) != 'q') {
-      if (ch > 0){                // If we have something, process it
-        //con.Putc (ch);          // echo inputted character to screen
+        if (ch > 0){                // If we have something, process it
+            //con.Putc (ch);          // echo inputted character to screen
         
-        switch (ch) {
-          // Toggle the DTR state, which is as close as we get to
-          // flow control.
-        case 's':
-          if (client) {
+            switch (ch) {
+                // Toggle the DTR state, which is as close as we get to
+                // flow control.
+              case 's':
+                  if (client) {
 #if 0
-            //sleep(1);
-            msg.writeNet(msg.metersRequestCreate(Msgs::AC1_VOLTS_IN));
-            //sleep(1);
-            msg.writeNet(msg.metersRequestCreate(Msgs::CHARGE_AMPS));
-            //sleep(1);
-            msg.writeNet(msg.metersRequestCreate(Msgs::AC_LOAD_AMPS));
-            //sleep(1);
-            msg.writeNet(msg.metersRequestCreate(Msgs::PV_AMPS_IN));
-            //sleep(1);
-            msg.writeNet(msg.metersRequestCreate(Msgs::SELL_AMPS));
-            //            msg.writeNet(msg.requestCreate(""));
+                      //sleep(1);
+                      
msg.writeNet(msg.metersRequestCreate(Msgs::AC1_VOLTS_IN));
+                      //sleep(1);
+                      msg.writeNet(msg.metersRequestCreate(Msgs::CHARGE_AMPS));
+                      //sleep(1);
+                      
msg.writeNet(msg.metersRequestCreate(Msgs::AC_LOAD_AMPS));
+                      //sleep(1);
+                      msg.writeNet(msg.metersRequestCreate(Msgs::PV_AMPS_IN));
+                      //sleep(1);
+                      msg.writeNet(msg.metersRequestCreate(Msgs::SELL_AMPS));
+                      //            msg.writeNet(msg.requestCreate(""));
 #else            
-            msg.writeNet(msg.requestCreate(Msgs::REVISION));
-            msg.writeNet(msg.requestCreate(Msgs::SYSVERSION));
-            msg.writeNet(msg.requestCreate(Msgs::OPMODE));
-            msg.writeNet(msg.requestCreate(Msgs::WARNINGMODE));
-            msg.writeNet(msg.requestCreate(Msgs::ERRORMODE));
+                      msg.writeNet(msg.requestCreate(Msgs::REVISION));
+                      msg.writeNet(msg.requestCreate(Msgs::SYSVERSION));
+                      msg.writeNet(msg.requestCreate(Msgs::OPMODE));
+                      msg.writeNet(msg.requestCreate(Msgs::WARNINGMODE));
+                      msg.writeNet(msg.requestCreate(Msgs::ERRORMODE));
 #endif
-          }
-          break;
-        case 'Q':
-        case 'q':
-          con.Puts("Qutting PowerGuru due to user input!\n");
-          msg.writeNet("quit");
-          exit(0);
-          break;
-        case '?':
-          con.Puts("PowerGuru client\n");
-          con.Puts("\t? - help\r\n");
-          con.Puts("\tq - Quit\r\n");
-          con.Puts("\tQ - Quit\r\n");
-          sleep(2);
-        default:
-          break;
-        };
-      }
+                  }
+                  break;
+              case 'Q':
+              case 'q':
+                  con.Puts("Qutting PowerGuru due to user input!\n");
+                  msg.writeNet("quit");
+                  exit(0);
+                  break;
+              case '?':
+                  con.Puts("PowerGuru client\n");
+                  con.Puts("\t? - help\r\n");
+                  con.Puts("\tq - Quit\r\n");
+                  con.Puts("\tQ - Quit\r\n");
+                  sleep(2);
+              default:
+                  break;
+            };
+        }
 
-      XML xml;
-      unsigned int i;
-      memset(buffer, 0, INBUFSIZE);
+        XML xml;
+        unsigned int i;
+        memset(buffer, 0, INBUFSIZE);
 #if 1
-      vector<const xmlChar *> messages;
-      //const xmlChar *messages[200];
-      ret = msg.anydata(messages);
+        vector<const xmlChar *> messages;
+        //const xmlChar *messages[200];
+        ret = msg.anydata(messages);
 
-      if (ret == ERROR) {
-        dbglogfile << "ERROR: Got error from socket " << endl;
-        // Start as a daemon
-        if (daemon == true) {
-          msg.closeNet();
-          // wait for the next connection
-          if (msg.newNetConnection(true)) {
-            dbglogfile << "New connection started for remote client." << endl;
-          }
-        } else {
-          if (errno != EAGAIN) {
-            dbglogfile << "ERROR: " << errno << ":\t"<< strerror(errno) << 
endl;
-            msg.closeNet();
-            exit (-1);
-          }
+        if (ret == ERROR) {
+            dbglogfile << "ERROR: Got error from socket " << endl;
+            // Start as a daemon
+            if (daemon == true) {
+                msg.closeNet();
+                // wait for the next connection
+                if (msg.newNetConnection(true)) {
+                    dbglogfile << "New connection started for remote client." 
<< endl;
+                }
+            } else {
+                if (errno != EAGAIN) {
+                    dbglogfile << "ERROR: " << errno << ":\t"<< 
strerror(errno) << endl;
+                    msg.closeNet();
+                    exit (-1);
+                }
+            }
         }
-      }
-      for (i=0; i < messages.size(); i++) {
-        cerr << "Got message " << messages[i] << endl;
-        string str = (const char *)messages[i];
-        delete messages[i];
-        if (xml.parseXML(str) == ERROR) {
-          continue;
+        for (i=0; i < messages.size(); i++) {
+            cerr << "Got message " << messages[i] << endl;
+            string str = (const char *)messages[i];
+            delete messages[i];
+            if (xml.parseXML(str) == ERROR) {
+                continue;
+            }
         }
-      }
-      messages.clear();
-      msg.cacheDump();
+        messages.clear();
+        msg.cacheDump();
 
 #else
-      ptr = buffer;
-      int bytes = msg.readNet(buffer, INBUFSIZE, 0);      
-      if (bytes > 0) {
-        while (ptr != NULL) {
-          if (ptr != buffer) {
-            ptr++;
-          }
-          // We're at the end of the messages
-          if (strlen(ptr) == 0) {
-            break;
-          }
-          if (xml.parseXML(ptr) == false) {
-            break;
-          }
-          if (strncmp(buffer, "quit", 4) == 0) {
-            exit(0);
-          }
-          ptr = strchr(ptr, '\0');
+        ptr = buffer;
+        int bytes = msg.readNet(buffer, INBUFSIZE, 0);      
+        if (bytes > 0) {
+            while (ptr != NULL) {
+                if (ptr != buffer) {
+                    ptr++;
+                }
+                // We're at the end of the messages
+                if (strlen(ptr) == 0) {
+                    break;
+                }
+                if (xml.parseXML(ptr) == false) {
+                    break;
+                }
+                if (strncmp(buffer, "quit", 4) == 0) {
+                    exit(0);
+                }
+                ptr = strchr(ptr, '\0');
+            }
         }
-      }
 #endif
     }
     //con.Close();
@@ -293,3 +294,8 @@ usage (const char *prog)
     cerr << "-p\tRemote Machine password" << endl;
     exit (-1);
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/configure.ac b/configure.ac
index 422781f..3227585 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
-dnl  Copyright (C) 2005 Free Software Foundation, Inc.
+dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+dnl    Free Software Foundation, Inc.
 dnl
 dnl  This program is free software; you can redistribute it and/or modify
 dnl  it under the terms of the GNU General Public License as published by
@@ -139,7 +140,7 @@ AM_PATH_SNMP
 AM_CONDITIONAL(BUILD_SNMP, test x$snmp = xtrue)
 
 sim=false
-AC_ARG_ENABLE(sim, [  --enable-sim           enable support for Sim 
(default=yes)],
+AC_ARG_ENABLE(sim, [  --enable-sim           enable support for Sim 
(default=no)],
 [case "${enableval}" in
   yes) sim=true ;;
   no)  sim=false ;;
@@ -148,6 +149,16 @@ esac])
 
 AM_CONDITIONAL(BUILD_SIM, test x${sim} = xtrue)
 
+client=false
+AC_ARG_ENABLE(client, [  --enable-client           enable support for Client 
(default=no)],
+[case "${enableval}" in
+  yes) client=true ;;
+  no)  client=false ;;
+  *)   AC_MSG_ERROR([bad value ${enableval} for enable-malloc option]) ;;
+esac])
+
+AM_CONDITIONAL(BUILD_CLIENT, test x${client} = xtrue)
+
 dnl link to the images so we can browse the HTML output before
 dnl installing it.
 AC_LINK_FILES(doc/C/images,doc/C/images)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 8320213..e45c4ae 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -1,5 +1,6 @@
 # 
-# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010 Free Software 
Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010, 2011
+#      Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/daemon/main.cc b/daemon/main.cc
index a09d5e0..1b8f97f 100644
--- a/daemon/main.cc
+++ b/daemon/main.cc
@@ -70,7 +70,8 @@ alarm_handler2 (int sig);
 int curses = 0;
 
 int
-main(int argc, char *argv[]) {
+main(int argc, char *argv[])
+{
     int c, i;
     ErrCond Err;
     string item, str;
@@ -97,19 +98,19 @@ main(int argc, char *argv[]) {
     //    Console con;
 
     if (argc == 1) {
-      //usage(argv[0]);
+        //usage(argv[0]);
     }
 
     // scan for the two main standard GNU options
     for (c=0; c<argc; c++) {
-      if (strcmp("--help", argv[c]) == 0) {
-        usage(argv[0]);
-        exit(0);
-      }
-      if (strcmp("--version", argv[c]) == 0) {
-        cerr << "PowerGuru version: " << VERSION << endl;
-        exit(0);
-      }
+        if (strcmp("--help", argv[c]) == 0) {
+            usage(argv[0]);
+            exit(0);
+        }
+        if (strcmp("--version", argv[c]) == 0) {
+            cerr << "PowerGuru version: " << VERSION << endl;
+            exit(0);
+        }
     }
 
     // Set the option flags to default values. We do it this way to
@@ -134,134 +135,134 @@ main(int argc, char *argv[]) {
     RCinitFile config;
     config.load_files();
     if (config.dbhostGet().size() > 0) {
-      pdb.dbHostSet(config.dbhostGet());
+        pdb.dbHostSet(config.dbhostGet());
     }
     if (config.dbnameGet().size() > 0) {    
-      pdb.dbNameSet(config.dbnameGet());
+        pdb.dbNameSet(config.dbnameGet());
     }
     if (config.dbuserGet().size() > 0) {    
-      pdb.dbUserSet(config.dbuserGet());
+        pdb.dbUserSet(config.dbuserGet());
     }
     if (config.dbpasswdGet().size() > 0) {    
-      pdb.dbPasswdSet(config.dbpasswdGet());
+        pdb.dbPasswdSet(config.dbpasswdGet());
     }
 
     if (config.deviceGet().size() > 0) {    
-      filespec = (char *)config.deviceGet().c_str();
+        filespec = (char *)config.deviceGet().c_str();
     }
     
     filespec = DEFAULT_UART;
     // Process the command line arguments.
     while ((c = getopt (argc, argv, "d:ahvm:cexnob:pu:w:rj")) != -1) {
-      switch (c) {
-      case 'p':
-        poll = true;
-        xantrexmode = true;     // FIXME: force xantrex mode for now
-       break;
+        switch (c) {
+          case 'p':
+              poll = true;
+              xantrexmode = true;     // FIXME: force xantrex mode for now
+              break;
 
 #if 0
-      case 'i':
-        ui.Dump();
-        exit(0);
-       break;
-
-      case 'a':
-        ui.DumpAliases();
-        exit(0);
-        break;
-
-      case 'i':
-       item = strdup(optarg);
-        monitor = true;
-       break;
+          case 'i':
+              ui.Dump();
+              exit(0);
+              break;
+
+          case 'a':
+              ui.DumpAliases();
+              exit(0);
+              break;
+
+          case 'i':
+              item = strdup(optarg);
+              monitor = true;
+              break;
 #endif
         
-      case 'd':
-       filespec = strdup(optarg);
-       break;
+          case 'd':
+              filespec = strdup(optarg);
+              break;
 
-      case 'h':
-       usage (argv[0]);
-       break;
+          case 'h':
+              usage (argv[0]);
+              break;
 
-      case 'x':
-        //console = true;
-        xantrexmode = true;
-       break;
+          case 'x':
+              //console = true;
+              xantrexmode = true;
+              break;
 
-      case 'o':
-        outbackmode = true;
-       break;
+          case 'o':
+              outbackmode = true;
+              break;
 
-      case 'r':
-        background = true;
-       break;
+          case 'r':
+              background = true;
+              break;
 
 #ifdef USE_SNMP
-      case 'j':
-        snmp = true;
-        daemon = false;
-        client = false;
-       break;
+          case 'j':
+              snmp = true;
+              daemon = false;
+              client = false;
+              break;
 #endif
-      case 'e':
-        echo = true;
-       break;
+          case 'e':
+              echo = true;
+              break;
         
-        // Don't use the database. The default is to use the database.
-      case 'n':
-        use_db = false;
-        break;
-
-        // Specify database host machine.
-      case 'm':
-        pdb.dbHostSet(optarg);
-        break;
-        // Specify database name.
-      case 'b':
-        pdb.dbNameSet(optarg);
-        break;
+              // Don't use the database. The default is to use the database.
+          case 'n':
+              use_db = false;
+              break;
+
+              // Specify database host machine.
+          case 'm':
+              pdb.dbHostSet(optarg);
+              break;
+              // Specify database name.
+          case 'b':
+              pdb.dbNameSet(optarg);
+              break;
         
-        // Specify database user name.
-      case 'u':
-        pdb.dbUserSet(optarg);
-        break;
+              // Specify database user name.
+          case 'u':
+              pdb.dbUserSet(optarg);
+              break;
         
-        // Specify database user password.
-      case 'w':
-        pdb.dbPasswdSet(optarg);
-        break;
-
-      case 'c':
-        client = true;
-        daemon = false;
-        break;
-
-      case 'v':
-        // verbosity++;
-       dbglogfile.set_verbosity();
-       dbglogfile << "Verbose output turned on" << endl;
-       break;
+              // Specify database user password.
+          case 'w':
+              pdb.dbPasswdSet(optarg);
+              break;
+
+          case 'c':
+              client = true;
+              daemon = false;
+              break;
+
+          case 'v':
+              // verbosity++;
+              dbglogfile.set_verbosity();
+              dbglogfile << "Verbose output turned on" << endl;
+              break;
        
-      default:
-       usage (argv[0]);
-        break;
-      }
+          default:
+              usage (argv[0]);
+              break;
+        }
     }
 
     // Open the network connection to the database.
     if (use_db) {
-      if (!pdb.openDB()) {
-        dbglogfile << "ERROR: Couldn't open database!" << endl;
-        exit(1);
-      }
+        if (!pdb.openDB()) {
+            dbglogfile << "ERROR: Couldn't open database!" << endl;
+            exit(1);
+        }
     }
 
     // Start the SNMP daemon support.
 #ifdef USE_SNMP
     if (snmp) {
-      SnmpDaemon agent;
-      agent.master(false);
+        SnmpDaemon agent;
+        agent.master(false);
     }
 #endif
 
@@ -270,96 +271,96 @@ main(int argc, char *argv[]) {
         
     // Talk to an Outback Power Systems device
     if (outbackmode) {
-      Console con;
-      // Open a console for user input
-      con.Open();
+        Console con;
+        // Open a console for user input
+        con.Open();
     
-      con.Puts("PowerGuru - Outback Mode\r\n");
-      //outback outdev("/dev/pts/7");
-      outback outdev(filespec);
-      if (poll) {
-        // outdev.poll();
-      } else {
-        if (outdev.main(con, pdb) == ERROR) {
-          dbglogfile << "ERROR: Main Loop exited with an error!" << endl;
-        }
+        con.Puts("PowerGuru - Outback Mode\r\n");
+        //outback outdev("/dev/pts/7");
+        outback outdev(filespec);
+        if (poll) {
+            // outdev.poll();
+        } else {
+            if (outdev.main(con, pdb) == ERROR) {
+                dbglogfile << "ERROR: Main Loop exited with an error!" << endl;
+            }
         
-      }
-      con.Reset();
-      con.Close();
-      exit(0);
+        }
+        con.Reset();
+        con.Close();
+        exit(0);
     }
 
     if (xantrexmode) {
-      XantrexUI ui;
-      Console con;
-      // Open a console for user input
-      con.Open();
-      if (poll) {
-        // Open the serial port
-        try {
-          ui.Open(filespec);
-        }
-        catch (ErrCond catch_err) {
-          cerr << catch_err << endl;
-          exit(1);
-        }
-        //
-        for (i=0; i<1000; i++) {        
-          //display = ui.MenuHeadingPlus();
+        XantrexUI ui;
+        Console con;
+        // Open a console for user input
+        con.Open();
+        if (poll) {
+            // Open the serial port
+            try {
+                ui.Open(filespec);
+            }
+            catch (ErrCond catch_err) {
+                cerr << catch_err << endl;
+                exit(1);
+            }
+            //
+            for (i=0; i<1000; i++) {        
+                //display = ui.MenuHeadingPlus();
 #if 0
-          ch = con.Getc();
-          switch (ch) {
-            // Toggle the DTR state, which is as close as we get to
-            // flow control.
-          case 'Q':
-          case 'q':
-            return SUCCESS;
-            break;
-          case '?':
-            con.Puts("PowerGuru - Outback Mode\r\n");
-            con.Puts("\t? - help\r\n");
-            con.Puts("\tq - Quit\r\n");
-            con.Puts("\tQ - Quit\r\n");
-            sleep(2);
-          default:
-            break;
-          };
+                ch = con.Getc();
+                switch (ch) {
+                    // Toggle the DTR state, which is as close as we get to
+                    // flow control.
+                  case 'Q':
+                  case 'q':
+                      return SUCCESS;
+                      break;
+                  case '?':
+                      con.Puts("PowerGuru - Outback Mode\r\n");
+                      con.Puts("\t? - help\r\n");
+                      con.Puts("\tq - Quit\r\n");
+                      con.Puts("\tQ - Quit\r\n");
+                      sleep(2);
+                  default:
+                      break;
+                };
 #endif
           
-          vector<meter_data_t *> data = ui.PollMeters(1);
+                vector<meter_data_t *> data = ui.PollMeters(1);
 //           ui.MenuHeadingPlus();
 //           ui.MenuHeadingMinus();          
-          pdb.queryInsert(data);
+                pdb.queryInsert(data);
 #if 0
-          for (i=0; i<data->size(); i++) {
-            //cout << "Inverter/Charger amps: " << data[i]->inverter_amps << 
endl;
-            cout << "Input amps AC: " << data[i]->input_amps << endl;
-            cout << "Load  amps AC: " << data[i]->load_amps << endl;
-            cout << "Battery actual volts DC: " << data[i]->actual_volts << 
endl;
-            cout << "Battery TempComp volts DC: " << data[i]->tempcomp_volts 
<< endl;
-            cout << "Inverter volts AC: " << data[i]->inverter_volts << endl;
-            cout << "Grid (AC1) volts AC: " << data[i]->ac1 << endl;
-            cout << "Generator (AC2) volts AC: " << data[i]->ac2 << endl;
-            cout << "Read Frequency Hertz: " << data[i]->hertz << endl;
-            //pdb.queryInsert(data[i]);
-            //delete data[i];
-          }
+                for (i=0; i<data->size(); i++) {
+                    //cout << "Inverter/Charger amps: " << 
data[i]->inverter_amps << endl;
+                    cout << "Input amps AC: " << data[i]->input_amps << endl;
+                    cout << "Load  amps AC: " << data[i]->load_amps << endl;
+                    cout << "Battery actual volts DC: " << 
data[i]->actual_volts << endl;
+                    cout << "Battery TempComp volts DC: " << 
data[i]->tempcomp_volts << endl;
+                    cout << "Inverter volts AC: " << data[i]->inverter_volts 
<< endl;
+                    cout << "Grid (AC1) volts AC: " << data[i]->ac1 << endl;
+                    cout << "Generator (AC2) volts AC: " << data[i]->ac2 << 
endl;
+                    cout << "Read Frequency Hertz: " << data[i]->hertz << endl;
+                    //pdb.queryInsert(data[i]);
+                    //delete data[i];
+                }
 #endif
-          //sleep(1);
-          cout << endl;
+                //sleep(1);
+                cout << endl;
+            }
         }
-      }
-      con.Reset();
-      con.Close();
-      exit(0);
+        con.Reset();
+        con.Close();
+        exit(0);
     }
 
     if (use_db) {
-      if (!pdb.closeDB()) {
-        dbglogfile << "ERROR: Couldn't open database!" << endl;
-        exit(1);
-      }
+        if (!pdb.closeDB()) {
+            dbglogfile << "ERROR: Couldn't open database!" << endl;
+            exit(1);
+        }
     }
     
     // Network daemon/client mode. Normally we're a network daemon that
@@ -369,65 +370,65 @@ main(int argc, char *argv[]) {
     // other direction.
     if (daemon || client) {
       
-      Msgs msg;
-      msg.toggleDebug(true);
+        Msgs msg;
+        msg.toggleDebug(true);
       
-      // Make a client connection
-      if (client == true) {
-        msg.init(hostname);
-      }
+        // Make a client connection
+        if (client == true) {
+            msg.init(hostname);
+        }
       
-      // Start as a daemon
-      if (daemon == true) {
-        msg.init(true);
-      }
-      //msg.methodsDump();          // FIXME: debugging crap
+        // Start as a daemon
+        if (daemon == true) {
+            msg.init(true);
+        }
+        //msg.methodsDump();          // FIXME: debugging crap
       
-      //msg.print_msg(msg.status((meter_data_t *)0));
+        //msg.print_msg(msg.status((meter_data_t *)0));
       
-      if (client) {
-        msg.writeNet(msg.metersRequestCreate(Msgs::BATTERY_VOLTS));
-      }
+        if (client) {
+            msg.writeNet(msg.metersRequestCreate(Msgs::BATTERY_VOLTS));
+        }
       
-      //      msg.cacheDump();
+        //      msg.cacheDump();
       
-      XML xml;
-      unsigned int i;
+        XML xml;
+        unsigned int i;
 
-      vector<const xmlChar *> messages;
-      //const xmlChar *messages[200];
+        vector<const xmlChar *> messages;
+        //const xmlChar *messages[200];
         
-      bool loop = true;
-      while (loop) {
-        ret = msg.anydata(messages);
-        if (ret == ERROR) {
-          dbglogfile << "ERROR: Got error from socket " << endl;
-          msg.closeNet();
-          // wait for the next connection
-          if ((ret = msg.newNetConnection(true))) {
-            dbglogfile << "New connection started for remote client."
-                       << msg.remoteIP().c_str()
-                       << msg.remoteName().c_str() << endl;
-            ret = SUCCESS;        // the error has been handled
-            continue;
-          }
-        }
-        if (messages.size() == 0) {
-          dbglogfile << "ERROR: client socket shutdown! " << endl;
+        bool loop = true;
+        while (loop) {
+            ret = msg.anydata(messages);
+            if (ret == ERROR) {
+                dbglogfile << "ERROR: Got error from socket " << endl;
+                msg.closeNet();
+                // wait for the next connection
+                if ((ret = msg.newNetConnection(true))) {
+                    dbglogfile << "New connection started for remote client."
+                               << msg.remoteIP().c_str()
+                               << msg.remoteName().c_str() << endl;
+                    ret = SUCCESS;        // the error has been handled
+                    continue;
+                }
+            }
+            if (messages.size() == 0) {
+                dbglogfile << "ERROR: client socket shutdown! " << endl;
+            }
+            for (i=0; i < messages.size(); i++) {
+                cerr << "Got (" << messages.size() << ") messages " << 
messages[i] << endl;
+                string str = (const char *)messages[i];
+                delete messages[i];
+                if (msg.findTag("command")) {
+                    cerr << "Got command message!" << endl;
+                }
+                if (xml.parseXML(str) == ERROR) {
+                    continue;
+                }
+            }
+            messages.clear();
         }
-        for (i=0; i < messages.size(); i++) {
-          cerr << "Got (" << messages.size() << ") messages " << messages[i] 
<< endl;
-          string str = (const char *)messages[i];
-          delete messages[i];
-          if (msg.findTag("command")) {
-            cerr << "Got command message!" << endl;
-          }
-          if (xml.parseXML(str) == ERROR) {
-            continue;
-          }
-        }
-        messages.clear();
-      }
     }
 }
 
@@ -436,78 +437,82 @@ main(int argc, char *argv[]) {
 void
 alarm_handler2 (int sig)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  ostringstream oss;
-  struct sigaction  act;
+    DEBUGLOG_REPORT_FUNCTION;
+    ostringstream oss;
+    struct sigaction  act;
 #if 0
-  int ch;
-  struct errcond Err;
+    int ch;
+    struct errcond Err;
   
 #if 1
-  // If there is keyboard input, stop looking for the old
-  // output.
-  ch = con.Getc();
-  if (ch > 0) {
-    alarm(0);
-    con.Ungetc(ch);
-    return;
-  }
+    // If there is keyboard input, stop looking for the old
+    // output.
+    ch = con.Getc();
+    if (ch > 0) {
+        alarm(0);
+        con.Ungetc(ch);
+        return;
+    }
 #else
-  datasrc.RecvPacket((unsigned char *)&ch, 1, Err);
-  dbglogfile << " CH is " << ch << endl;
+    datasrc.RecvPacket((unsigned char *)&ch, 1, Err);
+    dbglogfile << " CH is " << ch << endl;
   
-  if (ch > 0) {
-    alarm(0);
-    con.Ungetc(ch);
-    return;
-  }
+    if (ch > 0) {
+        alarm(0);
+        con.Ungetc(ch);
+        return;
+    }
 #endif
 #endif
   
-  act.sa_handler = alarm_handler2;
-  sigaction (SIGALRM, &act, NULL);
+    act.sa_handler = alarm_handler2;
+    sigaction (SIGALRM, &act, NULL);
   
-  alarm(1);
+    alarm(1);
 }
 
 static void
 usage (const char *prog)
 {
-  cerr <<"This program implements a command line interface" << endl; 
-  cerr << "for an inverter or charge controller" << endl;
-  cerr << "Usage: " << prog << " [sglvphmdcx]" << endl;
-
-  // enable SNMP daemon mode
-  cerr << "SNMP Mode:" << endl;
-  cerr << "\t-j\t\t\t\tEnable SNMP agent mode" << endl;
-  cerr << "\t-r\t\t\t\trun in the background as a daemon." << endl;
-
-  // Display the End User options
-  cerr << "User Options:" << endl;
-  // cerr << "\t-s [heading:item or name]\tSet Item value" << endl;
-  // cerr << "\t-g [heading:item or name]\tGet Item value" << endl;
-  cerr << "\t-p\t\t\t\tPoll the Meters" << endl;
-  cerr << "\t-l\t\t\t\tLogfile name" << endl;
-  cerr << "\t-v\t\t\t\tVerbose mode" << endl;
-  cerr << "\t-d [filespec]\t\t\tSpecify Serial Port" << endl;
-  cerr << "\t-h\t\t\t\tHelp (this display)" << endl;
-  cerr << "\t-a\t\t\t\tDisplay Command names" << endl;
-
-  // Display the Maintainer options
-  cerr << "Maintainer Options:" << endl;
-  cerr << "\t-m head:item\t\t\tMenu Item index" << endl;
-  cerr << "\t-d\t\t\t\tDump internal data" << endl;
-  cerr << "\t-x\t\t\t\tXantrex Console mode" << endl;
-  cerr << "\t-o\t\t\t\tOutback Console mode" << endl;
-  cerr << "\t-e\t\t\t\tEcho Input Mode" << endl;
+    cerr <<"This program implements a command line interface" << endl; 
+    cerr << "for an inverter or charge controller" << endl;
+    cerr << "Usage: " << prog << " [sglvphmdcx]" << endl;
+
+    // enable SNMP daemon mode
+    cerr << "SNMP Mode:" << endl;
+    cerr << "\t-j\t\t\t\tEnable SNMP agent mode" << endl;
+    cerr << "\t-r\t\t\t\trun in the background as a daemon." << endl;
+
+    // Display the End User options
+    cerr << "User Options:" << endl;
+    // cerr << "\t-s [heading:item or name]\tSet Item value" << endl;
+    // cerr << "\t-g [heading:item or name]\tGet Item value" << endl;
+    cerr << "\t-p\t\t\t\tPoll the Meters" << endl;
+    cerr << "\t-l\t\t\t\tLogfile name" << endl;
+    cerr << "\t-v\t\t\t\tVerbose mode" << endl;
+    cerr << "\t-d [filespec]\t\t\tSpecify Serial Port" << endl;
+    cerr << "\t-h\t\t\t\tHelp (this display)" << endl;
+    cerr << "\t-a\t\t\t\tDisplay Command names" << endl;
+
+    // Display the Maintainer options
+    cerr << "Maintainer Options:" << endl;
+    cerr << "\t-m head:item\t\t\tMenu Item index" << endl;
+    cerr << "\t-d\t\t\t\tDump internal data" << endl;
+    cerr << "\t-x\t\t\t\tXantrex Console mode" << endl;
+    cerr << "\t-o\t\t\t\tOutback Console mode" << endl;
+    cerr << "\t-e\t\t\t\tEcho Input Mode" << endl;
   
-  // Display the Database options
-  cerr << "Database Options:" << endl;
-  cerr << "\t-m hostname\t\t\tSpecify Database hostname or IP" << endl;
-  cerr << "\t-u username\t\t\tSpecify User Name" << endl;
-  cerr << "\t-b dbname\t\t\tSpecify the Database" << endl;
-  cerr << "\t-w password\t\t\tSpecify the password" << endl;
-
-  exit (-1);
+    // Display the Database options
+    cerr << "Database Options:" << endl;
+    cerr << "\t-m hostname\t\t\tSpecify Database hostname or IP" << endl;
+    cerr << "\t-u username\t\t\tSpecify User Name" << endl;
+    cerr << "\t-b dbname\t\t\tSpecify the Database" << endl;
+    cerr << "\t-w password\t\t\tSpecify the password" << endl;
+
+    exit (-1);
 }
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 616476e..819c953 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,5 +1,6 @@
 # 
-# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010 Free Software 
Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010, 2011
+#      Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/lib/console.cc b/lib/console.cc
index 5175bd0..c69ca26 100644
--- a/lib/console.cc
+++ b/lib/console.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -42,136 +43,141 @@ Console::Console (void) {
 }
 
 Console::~Console (void) {
-  Close();
-  inchannel.filespec.erase();
-  outchannel.filespec.erase();
-  state = Console::UNSET;
+    Close();
+    inchannel.filespec.erase();
+    outchannel.filespec.erase();
+    state = Console::UNSET;
 }
 
 void
 Console::Open (void) {
-  // Open a console for the end user to type at. We default to stdio (cin)
-  //  string str = "stdin";
+    // Open a console for the end user to type at. We default to stdio (cin)
+    //  string str = "stdin";
   
-  OpenInChannel();
+    OpenInChannel();
   
-  //  str = "stdout";
+    //  str = "stdout";
 
-  // Open a the output channel for the console. We default to stdio (cout)
-  OpenOutChannel();
+    // Open a the output channel for the console. We default to stdio (cout)
+    OpenOutChannel();
 }
 
 void
 Console::OpenInChannel (string channel) {
-  if (channel == "stdin") {
-    inchannel.fhandle = stdin;
-    inchannel.filespec = "stdin";
-    state = Console::OPEN;
-  }
+    if (channel == "stdin") {
+        inchannel.fhandle = stdin;
+        inchannel.filespec = "stdin";
+        state = Console::OPEN;
+    }
 
 #if 1
-  signal (SIGINT, signal_handler);
-  signal (SIGQUIT, signal_handler);
+    signal (SIGINT, signal_handler);
+    signal (SIGQUIT, signal_handler);
 #else
-  struct sigaction saio;
+    struct sigaction saio;
 
-  // FIXME: we want to trap ^C on the console, but this doesn't seem to work
-  saio.sa_handler = signal_handler;
-  saio.sa_mask = 0;
-  saio.sa_flags = 0;
-  saio.sa_restorer = 0;
+    // FIXME: we want to trap ^C on the console, but this doesn't seem to work
+    saio.sa_handler = signal_handler;
+    saio.sa_mask = 0;
+    saio.sa_flags = 0;
+    saio.sa_restorer = 0;
 
-  sigaction(SIGIO, &saio, 0);
+    sigaction(SIGIO, &saio, 0);
 #endif
 
-  fcntl(fileno(inchannel.fhandle), F_SETOWN, getpid());
+    fcntl(fileno(inchannel.fhandle), F_SETOWN, getpid());
 
-  //  MakeRaw(fileno(inchannel.fhandle));
+    //  MakeRaw(fileno(inchannel.fhandle));
 }
 
 void
 Console::OpenInChannel (void) {
-  inchannel.fhandle = stdin;
-  inchannel.filespec = "stdin";
-  state = Console::OPEN;
+    inchannel.fhandle = stdin;
+    inchannel.filespec = "stdin";
+    state = Console::OPEN;
 
 #if 1
-  signal (SIGINT, signal_handler);
-  signal (SIGQUIT, signal_handler);
+    signal (SIGINT, signal_handler);
+    signal (SIGQUIT, signal_handler);
 #else
-  struct sigaction saio;
+    struct sigaction saio;
 
-  // FIXME: we want to trap ^C on the console, but this doesn't seem to work
-  saio.sa_handler = signal_handler;
-  saio.sa_mask = 0;
-  saio.sa_flags = 0;
-  saio.sa_restorer = 0;
+    // FIXME: we want to trap ^C on the console, but this doesn't seem to work
+    saio.sa_handler = signal_handler;
+    saio.sa_mask = 0;
+    saio.sa_flags = 0;
+    saio.sa_restorer = 0;
 
-  sigaction(SIGIO, &saio, 0);
+    sigaction(SIGIO, &saio, 0);
 #endif
 
-  fcntl(fileno(inchannel.fhandle), F_SETOWN, getpid());
-  fcntl(fileno(inchannel.fhandle), F_SETFL, O_NONBLOCK);
+    fcntl(fileno(inchannel.fhandle), F_SETOWN, getpid());
+    fcntl(fileno(inchannel.fhandle), F_SETFL, O_NONBLOCK);
 
-  // MakeRaw(fileno(inchannel.fhandle));
+    // MakeRaw(fileno(inchannel.fhandle));
 }
 
 void
 Console::OpenOutChannel (string channel) {
-  if (channel == "stdout") {
-    outchannel.fhandle = stdout;
-    outchannel.filespec = "stdout";
-    state = Console::OPEN;
-  }
-  // MakeRaw(fileno(outchannel.fhandle));
+    if (channel == "stdout") {
+        outchannel.fhandle = stdout;
+        outchannel.filespec = "stdout";
+        state = Console::OPEN;
+    }
+    // MakeRaw(fileno(outchannel.fhandle));
 }
 
 void
 Console::OpenOutChannel (void) {
-  outchannel.fhandle = stdout;
-  outchannel.filespec = "stdout";
-  state = Console::OPEN;
+    outchannel.fhandle = stdout;
+    outchannel.filespec = "stdout";
+    state = Console::OPEN;
 }
 
 // Reset the input channel to be where it was when we started
 void
 Console::Close (void) {
-  state = Console::CLOSED;
-  Reset();
+    state = Console::CLOSED;
+    Reset();
 }
 
 void
 Console::Reset (void) {
-  tcsetattr(fileno(inchannel.fhandle), TCSANOW, &oldtty);
+    tcsetattr(fileno(inchannel.fhandle), TCSANOW, &oldtty);
 }
 
 void
 Console::MakeRaw (int x) {
-  termios newtty;
-  int flag;
-
-  tcgetattr(x, &oldtty);
-  newtty = oldtty;
-  newtty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
-  newtty.c_oflag &= ~OPOST;
-  newtty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
-  newtty.c_cflag &= ~(CSIZE|PARENB);
-  newtty.c_cflag |= CS8;
-  tcsetattr(x, TCSANOW, &newtty);
+    termios newtty;
+    int flag;
+
+    tcgetattr(x, &oldtty);
+    newtty = oldtty;
+    newtty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    newtty.c_oflag &= ~OPOST;
+    newtty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    newtty.c_cflag &= ~(CSIZE|PARENB);
+    newtty.c_cflag |= CS8;
+    tcsetattr(x, TCSANOW, &newtty);
   
-  flag = fcntl(x, F_GETFL, 0);
-  fcntl(x, F_SETFL, flag | O_NDELAY);
+    flag = fcntl(x, F_GETFL, 0);
+    fcntl(x, F_SETFL, flag | O_NDELAY);
 }
 
 void
 Console::SendEOL (void) {
-  Putc('\r');
-  Putc('\n'); 
+    Putc('\r');
+    Putc('\n'); 
 }
 
 void
 signal_handler (int sig)
 {
-  dbglogfile << "Got a " << sig << " from the console" << endl;
-  exit(sig);
+    dbglogfile << "Got a " << sig << " from the console" << endl;
+    exit(sig);
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/console.h b/lib/console.h
index 5bd442c..f5ad8aa 100644
--- a/lib/console.h
+++ b/lib/console.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -29,62 +30,67 @@
 
 class Console {
 public:
-  Console (void);
-  ~Console (void);
+    Console (void);
+    ~Console (void);
 
-  enum state_e { UNSET, OPEN, RAW, CLOSED };
+    enum state_e { UNSET, OPEN, RAW, CLOSED };
 
-  void Open (void);
-  void OpenInChannel (std::string channel);
-  void OpenInChannel (void);
-  void OpenOutChannel (std::string channel);
-  void OpenOutChannel (void);
-  void Close (void);
-  void Reset (void);
+    void Open (void);
+    void OpenInChannel (std::string channel);
+    void OpenInChannel (void);
+    void OpenOutChannel (std::string channel);
+    void OpenOutChannel (void);
+    void Close (void);
+    void Reset (void);
   
-  void SendEOL (void);
+    void SendEOL (void);
   
-  void MakeRaw (int);
-  void MakeRaw (void) { MakeRaw (fileno(inchannel.fhandle)); }
-  void MakeRaw (FILE * x) { MakeRaw (fileno(x)); }
+    void MakeRaw (int);
+    void MakeRaw (void) { MakeRaw (fileno(inchannel.fhandle)); }
+    void MakeRaw (FILE * x) { MakeRaw (fileno(x)); }
 
-  // get a byte from the console
-  int Getc (void) { return Getc (inchannel.fhandle); }
-  int Getc (FILE *x) { return getc(x); }
+    // get a byte from the console
+    int Getc (void) { return Getc (inchannel.fhandle); }
+    int Getc (FILE *x) { return getc(x); }
 
-  // write a byte to the console
-  int Putc (int x) { return Putc (x, outchannel.fhandle); }
-  int Putc (int x, FILE *y)  { return putc(x, y); }
+    // write a byte to the console
+    int Putc (int x) { return Putc (x, outchannel.fhandle); }
+    int Putc (int x, FILE *y)  { return putc(x, y); }
 
-   // write a string to the console
-  int Puts (std::string out) { return Puts (out.c_str(), outchannel.fhandle); }
-  int Puts (std::string out, FILE *y)  { return fputs(out.c_str(), y); }
-  int Puts (ErrCond &Err)  { return fputs(Err.GetMsg().c_str(), 
outchannel.fhandle); }
+    // write a string to the console
+    int Puts (std::string out) { return Puts (out.c_str(), 
outchannel.fhandle); }
+    int Puts (std::string out, FILE *y)  { return fputs(out.c_str(), y); }
+    int Puts (ErrCond &Err)  { return fputs(Err.GetMsg().c_str(), 
outchannel.fhandle); }
  
-  // Accessors
+    // Accessors
 
-  // Set/Get the name of the device we are using for the console
-  std::string GetFileSpec (void) { return inchannel.filespec; }
-  void SetFileSpec (std::string x) { inchannel.filespec = x; }
+    // Set/Get the name of the device we are using for the console
+    std::string GetFileSpec (void) { return inchannel.filespec; }
+    void SetFileSpec (std::string x) { inchannel.filespec = x; }
 
-  // Set/Get the FILE pointer
-  FILE *GetFileHandle(void) { return inchannel.fhandle; }
-  void SetFileHandle (FILE *x) { inchannel.fhandle = x; }
+    // Set/Get the FILE pointer
+    FILE *GetFileHandle(void) { return inchannel.fhandle; }
+    void SetFileHandle (FILE *x) { inchannel.fhandle = x; }
 
-  // Set/Get the state of the console
-  state_e GetState (void) { return state; }
-  void SetState (state_e x) { state = x; }
+    // Set/Get the state of the console
+    state_e GetState (void) { return state; }
+    void SetState (state_e x) { state = x; }
 
- private:
-  struct channel {
-          FILE *fhandle;
-          std::string filespec;
-  };
-  struct channel inchannel;
-  struct channel outchannel;
-  state_e state;
-  termios oldtty;
+private:
+    struct channel {
+        FILE *fhandle;
+        std::string filespec;
+    };
+    struct channel inchannel;
+    struct channel outchannel;
+    state_e state;
+    termios oldtty;
 };
 
 // __CONSOLE_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/database.h b/lib/database.h
index e6e59bb..45d9864 100644
--- a/lib/database.h
+++ b/lib/database.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -53,63 +54,67 @@ typedef enum { NO_DEVICE, MX_OUTBACK, FX_OUTBACK, 
SW_XANTREX } device_t;
 
 typedef struct
 {
-  int   unit;                   // The unit number for the device
-  device_t type;                // The type of the device
-  int   charge_amps;            // The amperage being put into the batteries
-  int   ac_load_amps;           // The load in amps
-  float battery_volts;          // Actual Battery Voltage
-  float ac_volts_out;           // The voltage the inverter is producing
-  float ac1_volts_in;           // Grid AC input
-  float ac2_volts_in;           // Generator AC input. Xantrex only
-  int   pv_amps_in;             // The current coming from the PV panels.
-  float pv_volts_in;            // The DC voltage coming from the PV panels.
-  float buy_amps;               // The AC current taken from the Grid
-                                // and used to charge the batteries; 
-  float sell_amps;              // The AC current the batteries are
-                                // putting into the grid.
-  float daily_kwh;              // The daily kilowatts put into the
-                                // batteries from the PV
-                                // source. Outback only.
-  int   hertz;                  // Frequency in Hertz. Xantrex only
-  float tempcomp_volts;         // Battery Voltage temperate
-                                // compensated. Xantrex Only.
+    int   unit;                   // The unit number for the device
+    device_t type;                // The type of the device
+    int   charge_amps;            // The amperage being put into the batteries
+    int   ac_load_amps;           // The load in amps
+    float battery_volts;          // Actual Battery Voltage
+    float ac_volts_out;           // The voltage the inverter is producing
+    float ac1_volts_in;           // Grid AC input
+    float ac2_volts_in;           // Generator AC input. Xantrex only
+    int   pv_amps_in;             // The current coming from the PV panels.
+    float pv_volts_in;            // The DC voltage coming from the PV panels.
+    float buy_amps;               // The AC current taken from the Grid
+    // and used to charge the batteries; 
+    float sell_amps;              // The AC current the batteries are
+    // putting into the grid.
+    float daily_kwh;              // The daily kilowatts put into the
+    // batteries from the PV
+    // source. Outback only.
+    int   hertz;                  // Frequency in Hertz. Xantrex only
+    float tempcomp_volts;         // Battery Voltage temperate
+    // compensated. Xantrex Only.
   
 }  meter_data_t ;
 
 class Database
 {
- public:
-  Database();
-  ~Database();
+public:
+    Database();
+    ~Database();
   
-  bool openDB ();
-  bool closeDB ();
-  bool queryInsert(std::vector<meter_data_t *> data);
-  bool queryInsert(meter_data_t *data);
-  bool queryInsert(const char *query);
-  void *queryResults(const char *query);
-  //bool deleteDB(etamsg_t *data);
-  //bool insertDB(etamsg_t *data);
-  char *gettime();
+    bool openDB ();
+    bool closeDB ();
+    bool queryInsert(std::vector<meter_data_t *> data);
+    bool queryInsert(meter_data_t *data);
+    bool queryInsert(const char *query);
+    void *queryResults(const char *query);
+    //bool deleteDB(etamsg_t *data);
+    //bool insertDB(etamsg_t *data);
+    char *gettime();
 
-  // Accessors
-  void dbUserSet(std::string user);
-  void dbPasswdSet(std::string passwd);
-  void dbNameSet(std::string name);
-  void dbHostSet(std::string host);
- private:
-  enum {CLOSED, OPENED} state;
-  dbtype          _dbtype;
-  int             _dbport;
-  std::string     _dbuser;
-  std::string     _dbpasswd;
-  std::string     _dbhost;
-  std::string     _dbname;
-  std::string     _tblname;
-  MYSQL           *_connection;
-  MYSQL           _mysql;
+    // Accessors
+    void dbUserSet(std::string user);
+    void dbPasswdSet(std::string passwd);
+    void dbNameSet(std::string name);
+    void dbHostSet(std::string host);
+private:
+    enum {CLOSED, OPENED} state;
+    dbtype          _dbtype;
+    int             _dbport;
+    std::string     _dbuser;
+    std::string     _dbpasswd;
+    std::string     _dbhost;
+    std::string     _dbname;
+    std::string     _tblname;
+    MYSQL           *_connection;
+    MYSQL           _mysql;
 };
 
 // __DATABASE_H__
 #endif
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/err.cc b/lib/err.cc
index db0d991..f6c4fb9 100644
--- a/lib/err.cc
+++ b/lib/err.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -83,12 +84,12 @@ ErrCond::SetMsg (const char *filein, int linein, const char 
*funcin, int codein,
 
 void
 ErrCond::SetMsg (string &s) {
-  emsg = s;
+    emsg = s;
 }
 
 void
 ErrCond::SetMsg (const char *s) {
-  emsg = s;
+    emsg = s;
 }
  
 void
@@ -101,69 +102,74 @@ ErrCond::SetMsg (int x, const char *s) {
 // formatting the string. We currently don't do anything with this.
 ostream&
 ErrCond::operator << (ostream & (&)(ostream &)) {
-  //  ClearErr();
-  cerr << __PRETTY_FUNCTION__ << ": not implemented!" << endl;
-  // FIXME: This return value is tottaly bogus, and exists only to
-  // shut up GCC until this actually gets implemented.
-  return cout;
+    //  ClearErr();
+    cerr << __PRETTY_FUNCTION__ << ": not implemented!" << endl;
+    // FIXME: This return value is tottaly bogus, and exists only to
+    // shut up GCC until this actually gets implemented.
+    return cout;
 }
 
 ErrCond& 
 ErrCond::operator << (const char *x)
 {
-  emsg += x;
-  return *this;
+    emsg += x;
+    return *this;
 }
 
 ErrCond& 
 ErrCond::operator << (string &x)
 {
-  emsg += x;
-  return *this;
+    emsg += x;
+    return *this;
 }
 
 ErrCond& 
 ErrCond::operator << (void *x)
 {
-  char buf[10];
-  sprintf ((char *)&buf, "%p", x);
-  emsg += buf;
-  return *this;
+    char buf[10];
+    sprintf ((char *)&buf, "%p", x);
+    emsg += buf;
+    return *this;
 }
 
 ErrCond& 
 ErrCond::operator << (int x)
 {
-  char buf[10];
-  sprintf ((char *)&buf, "%d", x);
-  emsg += buf;
-  return *this;
+    char buf[10];
+    sprintf ((char *)&buf, "%d", x);
+    emsg += buf;
+    return *this;
 }
 
 ostream& 
 operator << (ostream &os, ErrCond& e) {
-  string msg;
+    string msg;
   
-  if (e.GetCode() > EMEDIUMTYPE) {
-    msg = "WARNING: ";
-  } else {
-    msg = "ERROR: ";
-  }
+    if (e.GetCode() > EMEDIUMTYPE) {
+        msg = "WARNING: ";
+    } else {
+        msg = "ERROR: ";
+    }
   
-  if (e.GetFunc().size() > 0)
-    msg += e.GetFunc();
+    if (e.GetFunc().size() > 0)
+        msg += e.GetFunc();
 
-  if (e.GetLine() > 0)
-    msg += e.GetFunc();
+    if (e.GetLine() > 0)
+        msg += e.GetFunc();
   
-  if (e.GetMsg().size() > 0)
-    msg += e.GetMsg();
-
-  if (errno) {
-    msg += " (";
-    msg += strerror(errno);
-    msg += ") ";
-  }
+    if (e.GetMsg().size() > 0)
+        msg += e.GetMsg();
+
+    if (errno) {
+        msg += " (";
+        msg += strerror(errno);
+        msg += ") ";
+    }
   
-  return os << msg;
+    return os << msg;
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/err.h b/lib/err.h
index d744038..732b87a 100644
--- a/lib/err.h
+++ b/lib/err.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -73,45 +74,45 @@ typedef enum retcode {
 
 // Clear the error code and message
 static inline void CLEARERR (struct errcond *x) {
-  x->code=0;
-  x->msg[0] = STRTERM;
+    x->code=0;
+    x->msg[0] = STRTERM;
 };
 
 // Set an error message based on just an error message
 static inline void SETERRMSG (struct errcond *x, const char *y) {
-  x->code=-1;
-  strncpy (x->msg, y, ERRMSGSIZE);
-  x->msg[ERRMSGSIZE] = STRTERM;
+    x->code=-1;
+    strncpy (x->msg, y, ERRMSGSIZE);
+    x->msg[ERRMSGSIZE] = STRTERM;
 };
 
 // Get the error message
 static inline char *GETERRMSG (struct errcond *x) {
-  return x->msg;
+    return x->msg;
 };
 
 // Set an error message based on an error code
 static inline void SETERRCODE (struct errcond *x, int y) {
-  x->code=y;
-  x->msg[0] = STRTERM;
+    x->code=y;
+    x->msg[0] = STRTERM;
 };
 
 // Get the error code
 static inline int GETERRCODE (struct errcond *x) {
-  return x->code;
+    return x->code;
 };
 
 // Get the error code
 static inline int ERRCOND (struct errcond *x) {
-       return ((x->code > 0 || x->msg[0] > 'a') ? x->code : 0);
+    return ((x->code > 0 || x->msg[0] > 'a') ? x->code : 0);
 };
 
 // Set an error message based on the message and an error code
 static inline void SETERR(struct errcond *x, const char *y, int z) {
-  x->code=z;
-  if (y!=NULL) {
-    strncpy (x->msg, y, ERRMSGSIZE);
-    x->msg[ERRMSGSIZE] = STRTERM;
-  }
+    x->code=z;
+    if (y!=NULL) {
+        strncpy (x->msg, y, ERRMSGSIZE);
+        x->msg[ERRMSGSIZE] = STRTERM;
+    }
 };
 
 #ifdef __cplusplus
@@ -126,62 +127,65 @@ static inline void SETERR(struct errcond *x, const char 
*y, int z) {
 // Do this in C++ instead
 class ErrCond {
 public:
-  ErrCond(void) {
-    ecode = 0;
-    line = 0;
-  }
-  ErrCond(int x) {
-    ecode = x;
-  }
-
-  ~ErrCond(void);
-  ErrCond(const char *filein, int linein, const char *funcin, int codein, 
std::string &s);
-  // methods
-  void ClearErr(void);
+    ErrCond(void) {
+        ecode = 0;
+        line = 0;
+    }
+    ErrCond(int x) {
+        ecode = x;
+    }
+
+    ~ErrCond(void);
+    ErrCond(const char *filein, int linein, const char *funcin, int codein, 
std::string &s);
+    // methods
+    void ClearErr(void);
   
-  ErrCond &SetMsg (const char *filein, int linein, const char *funcin, int 
codein, std::string s);
-
-  void SetMsg (std::string &s);
-  void SetMsg (const char *s);
-  void SetMsg (int x, const char *s);
-  void SetCode(int x) { 
-    ecode = x;
-  }
-  int GetCode(void) { 
-    return ecode;
-  }
-  int GetLine(void) { 
-    return line;
-  }
-  std::string &GetFile(void) { 
-    return file;
-  }
+    ErrCond &SetMsg (const char *filein, int linein, const char *funcin, int 
codein, std::string s);
+
+    void SetMsg (std::string &s);
+    void SetMsg (const char *s);
+    void SetMsg (int x, const char *s);
+    void SetCode(int x) { 
+        ecode = x;
+    }
+    int GetCode(void) { 
+        return ecode;
+    }
+    int GetLine(void) { 
+        return line;
+    }
+    std::string &GetFile(void) { 
+        return file;
+    }
   
-  std::string &GetFunc(void) { 
-    return func;
-  }
+    std::string &GetFunc(void) { 
+        return func;
+    }
   
-  std::string &GetMsg(void) { 
-    return emsg;
-  }
-
-  ErrCond& operator << (ErrCond&);
-  ErrCond& operator << (int x);
-  ErrCond& operator << (char const *str);
-  ErrCond& operator << (std::string &str);
-  ErrCond& operator << (void *addr);
-
-  friend std::ostream & operator << (std::ostream &os, ErrCond& e);
-  std::ostream& operator << (std::ostream & (&)(std::ostream &));
+    std::string &GetMsg(void) { 
+        return emsg;
+    }
+
+    ErrCond& operator << (ErrCond&);
+    ErrCond& operator << (int x);
+    ErrCond& operator << (char const *str);
+    ErrCond& operator << (std::string &str);
+    ErrCond& operator << (void *addr);
+
+    friend std::ostream & operator << (std::ostream &os, ErrCond& e);
+    std::ostream& operator << (std::ostream & (&)(std::ostream &));
 private:
-  std::string file;
-  std::string func;
-  int line;
-  int ecode;
-  std::string emsg;
+    std::string file;
+    std::string func;
+    int line;
+    int ecode;
+    std::string emsg;
 };
 
 #endif
 #endif         // __ERR_H__
 
-
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/gdb.h b/lib/gdb.h
index 9dcba3d..2994390 100644
--- a/lib/gdb.h
+++ b/lib/gdb.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,3 +23,8 @@ public:
   
 private:
 };
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/log.cc b/lib/log.cc
index 581318b..d6f4b95 100644
--- a/lib/log.cc
+++ b/lib/log.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -76,8 +77,8 @@ extern "C" int hex2digit (int);
 
 
 ostream& operator<<(ostream& os, Verbose& b) {
-  // dbglogfile.verbosity(b);
-  return os;
+    // dbglogfile.verbosity(b);
+    return os;
 }
 
 #if 0
@@ -93,38 +94,38 @@ ostream& stampoff(ostream& x) {
 #endif
 
 ostream& timestamp(ostream& x) {
-  time_t t;
-  char buf[10];
+    time_t t;
+    char buf[10];
 
-  memset (buf, '0', 10);       // this terminates the string
-  time (&t);                   // get the current time
-  strftime (buf, sizeof(buf), "%H:%M:%S", localtime (&t));
+    memset (buf, '0', 10);     // this terminates the string
+    time (&t);                 // get the current time
+    strftime (buf, sizeof(buf), "%H:%M:%S", localtime (&t));
 
-  return x << buf << ": ";
+    return x << buf << ": ";
 }
 
 string timestamp() {
-  time_t t;
-  string sbuf;
-  char buf[10];
+    time_t t;
+    string sbuf;
+    char buf[10];
 
-  memset (buf, '0', 10);       // this terminates the string
-  time (&t);                   // get the current time
-  strftime (buf, sizeof(buf), "%H:%M:%S", localtime (&t));
-  sbuf = buf;
+    memset (buf, '0', 10);     // this terminates the string
+    time (&t);                 // get the current time
+    strftime (buf, sizeof(buf), "%H:%M:%S", localtime (&t));
+    sbuf = buf;
 
-  return sbuf;
+    return sbuf;
 }
 
 ostream& datetimestamp(ostream& x) {
-  time_t t;
-  char buf[20];
+    time_t t;
+    char buf[20];
 
-  memset (buf, '0', 20);       // this terminates the string
-  time (&t);                   // get the current time
-  strftime (buf, sizeof(buf), "%Y-%m-%d %H:%M:%S ", localtime (&t));
+    memset (buf, '0', 20);     // this terminates the string
+    time (&t);                 // get the current time
+    strftime (buf, sizeof(buf), "%Y-%m-%d %H:%M:%S ", localtime (&t));
 
-  return x << buf;
+    return x << buf;
 }
 
 // FIXME: This controls the entire output stream
@@ -159,21 +160,21 @@ LogFile::LogFile (const char *filespec) {
     verbose = 0;
     stamp = true;
     if (state == OPEN)
-      LogFile::outstream.close ();
+        LogFile::outstream.close ();
     LogFile::outstream.open (filespec, ios::out);
     state = OPEN;
 }
 
 retcode_t
 LogFile::Open (const char *filespec) {
-  if (state == OPEN)
-    LogFile::outstream.close ();
-  LogFile::outstream.open (filespec, ios::out);
-  state = OPEN;
+    if (state == OPEN)
+        LogFile::outstream.close ();
+    LogFile::outstream.open (filespec, ios::out);
+    state = OPEN;
   
-  // LogFile::outstream << "Opened " << filespec << endl;
+    // LogFile::outstream << "Opened " << filespec << endl;
   
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
@@ -191,7 +192,7 @@ LogFile::Close (void) {
 LogFile&
 LogFile::operator << (ErrCond& e) {
     if (verbose > 0)
-      cout << e << endl;
+        cout << e << endl;
     LogFile::outstream << e;
     state = INPROGRESS;
 
@@ -201,48 +202,48 @@ LogFile::operator << (ErrCond& e) {
 LogFile&
 LogFile::operator << (long x)
 {
-  if (verbose > 0)
-    cout << x;
-  LogFile::outstream << x;
-  state = INPROGRESS;
+    if (verbose > 0)
+        cout << x;
+    LogFile::outstream << x;
+    state = INPROGRESS;
   
-  return *this;
+    return *this;
 }
 
 LogFile&
 LogFile::operator << (unsigned int x)
 {
-  if (verbose > 0)
-    cout << x;
-  LogFile::outstream << x;
-  state = INPROGRESS;
+    if (verbose > 0)
+        cout << x;
+    LogFile::outstream << x;
+    state = INPROGRESS;
   
-  return *this;
+    return *this;
 }
 
 LogFile&
 LogFile::operator << (float x)
 { 
-  LogFile::outstream << x;
-  if (verbose > 0) {
-    cout << x;
-  }
-  state = INPROGRESS;
+    LogFile::outstream << x;
+    if (verbose > 0) {
+        cout << x;
+    }
+    state = INPROGRESS;
 
-  return *this;
+    return *this;
 }
 
 LogFile&
 LogFile::operator << (double &x)
 {
-  LogFile::outstream << x; 
-  if (verbose > 0) {
-    cout << x;
-  }
+    LogFile::outstream << x; 
+    if (verbose > 0) {
+        cout << x;
+    }
   
-  state = INPROGRESS;
+    state = INPROGRESS;
 
-  return *this;
+    return *this;
 }
 
 LogFile&
@@ -269,8 +270,8 @@ LogFile::operator << (void *ptr) {
 
 LogFile& 
 LogFile::operator << (string s) {
-  outstream << s;
-  return *this;
+    outstream << s;
+    return *this;
 }
 
 LogFile& 
@@ -279,7 +280,7 @@ LogFile::operator << (const char *c) {
     logentry += ": ";
 
     if (stamp == true && (state == IDLE || state == OPEN)) {
-      LogFile::state = INPROGRESS;
+        LogFile::state = INPROGRESS;
        if (verbose > 0)
            cout << logentry  << c;
         outstream << logentry << c;
@@ -299,11 +300,11 @@ LogFile::operator << (const xmlChar *c) {
     logentry += ": ";
 
     if (c == -0) {
-      return *this;
+        return *this;
     }
     
     if (stamp == true && (state == IDLE || state == OPEN)) {
-      LogFile::state = INPROGRESS;
+        LogFile::state = INPROGRESS;
        if (verbose > 0)
            cout << logentry  << c;
         outstream << logentry << c;
@@ -321,7 +322,7 @@ LogFile::operator << (const xmlChar *c) {
 ostream&
 LogFile::operator << (ostream & (&)(ostream &)) {
     if (verbose > 0)
-      cout << "\r" << endl;
+        cout << "\r" << endl;
     LogFile::outstream << endl;;
     LogFile::outstream.flush();
     LogFile::state = IDLE;
@@ -343,7 +344,7 @@ LogFile::note (int level, const char *fmt, ...) {
 #ifdef _WIN32
     SYSTEMTIME system_time, local_time;
 #else
-     time_t t;
+    time_t t;
 #endif // _WIN32
     const char *errmsg;
 
@@ -356,7 +357,7 @@ LogFile::note (int level, const char *fmt, ...) {
     SystemTimeToTzSpecificLocalTime (NULL, &system_time, &local_time);
     sprintf (buf, "%02u:%02u:%02u.%03u", local_time.wHour,
 
-        local_time.wMinute, local_time.wSecond, local_time.wMilliseconds);
+             local_time.wMinute, local_time.wSecond, local_time.wMilliseconds);
 #else
     time (&t);                 // get the current time
     strftime (buf, sizeof(buf), "%H:%M:%S", localtime (&t));
@@ -370,8 +371,8 @@ LogFile::note (int level, const char *fmt, ...) {
     // don't ever print log messages to the screen.
 #if 0
     if (verbose >= level) {
-      cout << tmp;       ;
-      cout.flush();
+        cout << tmp;       ;
+        cout.flush();
     }
 #endif
 
@@ -399,8 +400,8 @@ LogFile::printf (int level, const char *fmt, ...) {
     // don't ever print log messages to the screen.
 #if 0
     if (verbose >= level) {
-      cout << tmp;
-      cout.flush();
+        cout << tmp;
+        cout.flush();
     }
 #endif    
 
@@ -545,26 +546,26 @@ ascify_buffer (unsigned char *p, const unsigned char *s, 
int x) {
     for (i=0 ; i<x; i++) {
 //        dbglogfile.note (3, "\tascify 0x%x", s[i]);
         switch (s[i]) {
-        case '\012':           // newlines
-            *p++ = '\\';
-            *p++ = 'n';
-            continue;
-        case '\015':           // carriage returns
-            *p++ = '\\';
-            *p++ = 'r';
-            continue;
-        case '\033':           // escape
-            *p++ = '\\';
-            *p++ = 'e';
-            continue;
-        case '\011':           // tab
-            *p++ = '\\';
-            *p++ = 't';
-            continue;
-        case '\010':           // backspace
-            *p++ = '\\';
-            *p++ = 'b';
-            continue;
+          case '\012':         // newlines
+              *p++ = '\\';
+              *p++ = 'n';
+              continue;
+          case '\015':         // carriage returns
+              *p++ = '\\';
+              *p++ = 'r';
+              continue;
+          case '\033':         // escape
+              *p++ = '\\';
+              *p++ = 'e';
+              continue;
+          case '\011':         // tab
+              *p++ = '\\';
+              *p++ = 't';
+              continue;
+          case '\010':         // backspace
+              *p++ = '\\';
+              *p++ = 'b';
+              continue;
         }
         
         if (s[i] < 26) {       // modify control characters
@@ -602,7 +603,7 @@ hexify_buffer (unsigned char *p, const unsigned char *s, 
int x) {
         *p++ = hexchars[s[i] & 0xf];
         *p++ = ' ';
 //        dbglogfile.note (3, "\thexify s[%d] = 0x%02x", i, s[i]);
-        }
+    }
 
     *p = '\0';                                  // terminate the string
 
@@ -614,10 +615,10 @@ hexify_buffer (unsigned char *p, const unsigned char *s, 
int x) {
 //      returns a hex digit.
 extern "C" char
 digit2hex(int digit) {
-  if (digit < 10)
-    return '0' + digit;
-  else
-    return 'a' + digit - 10;
+    if (digit < 10)
+        return '0' + digit;
+    else
+        return 'a' + digit - 10;
 }
 
 // convert an ascii hex digit to a number.
@@ -626,18 +627,23 @@ digit2hex(int digit) {
 extern "C" int
 hex2digit (int digit)
 {
-if (digit == 0)
-  return 0;
+    if (digit == 0)
+        return 0;
 
-  if (digit >= '0' && digit <= '9')
-    return digit - '0';
-  if (digit >= 'a' && digit <= 'f')
-    return digit - 'a' + 10;
-  if (digit >= 'A' && digit <= 'F')
-    return digit - 'A' + 10;
+    if (digit >= '0' && digit <= '9')
+        return digit - '0';
+    if (digit >= 'a' && digit <= 'f')
+        return digit - 'a' + 10;
+    if (digit >= 'A' && digit <= 'F')
+        return digit - 'A' + 10;
 
-  /* shouldn't ever get this far */
-  return -1;
+    /* shouldn't ever get this far */
+    return -1;
 }
 
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/log.h b/lib/log.h
index f129990..1dbbe28 100644
--- a/lib/log.h
+++ b/lib/log.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -46,10 +47,10 @@ extern std::ostream& datetimestamp(std::ostream& x);
 
 // Print a number in binary:
 class Verbose {
-  int level;
+    int level;
 public:
-  Verbose(int l) { level = l; }
-  friend std::ostream& operator<<(std::ostream&, Verbose&);
+    Verbose(int l) { level = l; }
+    friend std::ostream& operator<<(std::ostream&, Verbose&);
 };
 
 // Get the current timestamp
@@ -58,67 +59,67 @@ std::string timestamp();
 // This is a basic file logging class
 class LogFile { // public std::ofstream {
 public:
-  LogFile (void);
-  LogFile (const char *);
-  ~LogFile(void) {
-    if (state == OPEN) {
-      //      flush();
-      //      state = CLOSED;
-      Close();
+    LogFile (void);
+    LogFile (const char *);
+    ~LogFile(void) {
+        if (state == OPEN) {
+            //      flush();
+            //      state = CLOSED;
+            Close();
+        }
     }
-  }
-  enum file_state {
-    CLOSED,
-    OPEN,
-    INPROGRESS,
-    IDLE
-  } state;
+    enum file_state {
+        CLOSED,
+        OPEN,
+        INPROGRESS,
+        IDLE
+    } state;
   
-  file_state GetState (void) { return state; }
-  LogFile& operator << (ErrCond&);
-  LogFile& operator << (int x);
-  LogFile& operator << (long x);
-  LogFile& operator << (unsigned int x);
-  // These both resolve to an unsigned int.
-  // LogFile& operator << (size_t x);
-  // LogFile& operator << (time_t x);
-  LogFile& operator << (float x);
-  LogFile& operator << (double &x);
-  LogFile& operator << (bool x);
-  LogFile& operator << (void *);
-  LogFile& operator << (const char *);
-  LogFile& operator << (const xmlChar *);
-  LogFile& operator << (std::string );
-  std::ostream& operator << (std::ostream & (&)(std::ostream &));
-  const char *GetEntry(void);
+    file_state GetState (void) { return state; }
+    LogFile& operator << (ErrCond&);
+    LogFile& operator << (int x);
+    LogFile& operator << (long x);
+    LogFile& operator << (unsigned int x);
+    // These both resolve to an unsigned int.
+    // LogFile& operator << (size_t x);
+    // LogFile& operator << (time_t x);
+    LogFile& operator << (float x);
+    LogFile& operator << (double &x);
+    LogFile& operator << (bool x);
+    LogFile& operator << (void *);
+    LogFile& operator << (const char *);
+    LogFile& operator << (const xmlChar *);
+    LogFile& operator << (std::string );
+    std::ostream& operator << (std::ostream & (&)(std::ostream &));
+    const char *GetEntry(void);
   
-  retcode_t Open(const char *);
-  retcode_t Close(void);
-  // accessors for the verbose level
-  void set_verbosity (void) {
-    verbose++;
-    //        note (3, "Verbosity now set to %d", verbose);
-  }
-  void set_verbosity (int x) {
-    verbose = x;
-    //        note (3, "Verbosity now set to %d", verbose);
-  }
-
-  void SetStamp (bool b) {
-    stamp = b;
-  }
-  bool GetStamp (void) {
-    return stamp;
-  }
-  //std::string gettimestamp();
+    retcode_t Open(const char *);
+    retcode_t Close(void);
+    // accessors for the verbose level
+    void set_verbosity (void) {
+        verbose++;
+        //        note (3, "Verbosity now set to %d", verbose);
+    }
+    void set_verbosity (int x) {
+        verbose = x;
+        //        note (3, "Verbosity now set to %d", verbose);
+    }
+
+    void SetStamp (bool b) {
+        stamp = b;
+    }
+    bool GetStamp (void) {
+        return stamp;
+    }
+    //std::string gettimestamp();
   
 private:
-  static std::ofstream console;
-  std::ofstream outstream;
-  static int verbose;
-  bool stamp;
-  std::string logentry;
-  friend std::ostream & operator << (std::ostream &os, LogFile& e);
+    static std::ofstream console;
+    std::ofstream outstream;
+    static int verbose;
+    bool stamp;
+    std::string logentry;
+    friend std::ostream & operator << (std::ostream &os, LogFile& e);
 };
 
 extern LogFile dbglogfile;
@@ -127,8 +128,8 @@ struct __Host_Function_Report__ {
     const char *func;
 
     __Host_Function_Report__(void) {
-      if (dbglogfile.GetState() == LogFile::OPEN)
-       dbglogfile  << "enter" << std::endl;
+        if (dbglogfile.GetState() == LogFile::OPEN)
+            dbglogfile  << "enter" << std::endl;
     }
 
     __Host_Function_Report__(char *_func) {
@@ -146,7 +147,7 @@ struct __Host_Function_Report__ {
     }
 };
 
-#define DEBUGLOG_REPORT_FUNCTION       \
+#define DEBUGLOG_REPORT_FUNCTION                                        \
     __Host_Function_Report__ __host_function_report__( __PRETTY_FUNCTION__)
 
 #define DEBUGLOG_REPORT_RETURN
@@ -164,4 +165,7 @@ ascify_buffer (unsigned char *p, const unsigned char *s, 
int x);
 // __LOG_H__
 #endif
 
-
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/menuitem.cc b/lib/menuitem.cc
index 5e4c6d8..0269706 100644
--- a/lib/menuitem.cc
+++ b/lib/menuitem.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -44,386 +45,389 @@ const char *prefix = "\r\n  ";
 // pointer.
 MenuItem::MenuItem()
 {
-  headidx = 0;
-  itemidx = 0;
-  type = NONE;
+    headidx = 0;
+    itemidx = 0;
+    type = NONE;
 }
 
 // Constructors for the MenuItem class.
 MenuItem::MenuItem(string lab, int x)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.intval = 0;
-  SetItem(lab, x, 0, zz, MENUHEAD);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.intval = 0;
+    SetItem(lab, x, 0, zz, MENUHEAD);
 }
 
 MenuItem::MenuItem(string lab, int x, int y, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.intval = 0;
-  SetItem(lab, x, y, zz, MENUITEM);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.intval = 0;
+    SetItem(lab, x, y, zz, MENUITEM);
 }
 
 MenuItem::MenuItem(string lab, int x, int y, bool z, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.boolval = z;
-  SetItem(lab, x, y, zz, BOOL);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.boolval = z;
+    SetItem(lab, x, y, zz, BOOL);
 }
 
 MenuItem::MenuItem(string lab, int x, int y, int z, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.intval = z;
-  SetItem(lab, x, y, zz, INT);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.intval = z;
+    SetItem(lab, x, y, zz, INT);
 }
 
 MenuItem::MenuItem(string lab, int x, int y, float z, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
-  union mval zz;
-  zz.floatval = z;
-  SetItem(lab, x, y, zz, FLOAT);
+    union mval zz;
+    zz.floatval = z;
+    SetItem(lab, x, y, zz, FLOAT);
 }
 
 MenuItem::MenuItem(string lab, int x, int y, time_t z, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
-  union mval zz;
-  zz.timeval = z;
-  SetItem(lab, x, y, zz, TIME);
+    union mval zz;
+    zz.timeval = z;
+    SetItem(lab, x, y, zz, TIME);
 }
 
 // Set the item's data
 void
 MenuItem::SetRange(int x, int y)
 {
-  minrange.intval = x;
-  maxrange.intval = y;
+    minrange.intval = x;
+    maxrange.intval = y;
 }
 
 void
 MenuItem::SetRange(float x, float y)
 {
-  minrange.floatval = x;
-  maxrange.floatval = y;
+    minrange.floatval = x;
+    maxrange.floatval = y;
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, union mval z, enum datatype dtype)
 {
-  SetItem(lab, x, 0, z, dtype, "");
+    SetItem(lab, x, 0, z, dtype, "");
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, union mval z, enum datatype dtype, 
string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-
-  label = lab;
-  headidx = x;
-  itemidx = y;
-  value = z;
-  cmdname = abbrev;
-  type = dtype;
+    //  DEBUGLOG_REPORT_FUNCTION;
+
+    label = lab;
+    headidx = x;
+    itemidx = y;
+    value = z;
+    cmdname = abbrev;
+    type = dtype;
 }
 
 // This sets a menu header
 void
 MenuItem::SetItem(string lab, int x)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.intval = 0;
-  SetItem(lab, x, 0, zz, MENUHEAD);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.intval = 0;
+    SetItem(lab, x, 0, zz, MENUHEAD);
 }
 
 // These all set a menu item
 void
 MenuItem::SetItem(string lab, int x, int y)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.intval = 0;
-  SetItem(lab, x, y, zz, INFO);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.intval = 0;
+    SetItem(lab, x, y, zz, INFO);
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.intval = 0;
-  SetItem(lab, x, y, zz, MENUITEM, abbrev);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.intval = 0;
+    SetItem(lab, x, y, zz, MENUITEM, abbrev);
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, bool z)
 {
-  SetItem(lab, x, y, z, "");
+    SetItem(lab, x, y, z, "");
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, bool z, std::string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.boolval = z;
-  SetItem(lab, x, y, zz, BOOL, abbrev);  
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.boolval = z;
+    SetItem(lab, x, y, zz, BOOL, abbrev);  
 }
 
 
 void
 MenuItem::SetItem(string lab, int x, int y, int z)
 {
-  union mval zz;
-  zz.intval = z;
-  SetItem(lab, x, y, zz, INT, "");
+    union mval zz;
+    zz.intval = z;
+    SetItem(lab, x, y, zz, INT, "");
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, int z, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  union mval zz;
-  zz.intval = z;
-  SetItem(lab, x, y, zz, INT, abbrev);
+    //  DEBUGLOG_REPORT_FUNCTION;
+    union mval zz;
+    zz.intval = z;
+    SetItem(lab, x, y, zz, INT, abbrev);
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, float z)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
-  union mval zz;
-  zz.floatval = z;
-  SetItem(lab, x, y, zz, FLOAT, "");
+    union mval zz;
+    zz.floatval = z;
+    SetItem(lab, x, y, zz, FLOAT, "");
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, float z, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
-  union mval zz;
-  zz.floatval = z;
-  SetItem(lab, x, y, zz, FLOAT, abbrev);
+    union mval zz;
+    zz.floatval = z;
+    SetItem(lab, x, y, zz, FLOAT, abbrev);
 }
 
 void
 MenuItem::SetItem(string lab, int x, int y, time_t z, string abbrev)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
-  union mval zz;
-  zz.timeval = z;
-  SetItem(lab, x, y, zz, TIME, abbrev);
+    union mval zz;
+    zz.timeval = z;
+    SetItem(lab, x, y, zz, TIME, abbrev);
 }
 
 void
 MenuItem::Dump(void)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
 #if 0
-  string str0[] = {
-    "NONE",
-    "MENUHEAD",
-    "MENUITEM",
-    "TIME",
-    "DATE",
-    "FLOAT",
-    "INT",
-    "EOL",
-    "BOOL",
-    "CLOCK",
-    "ENUM"
-  };
+    string str0[] = {
+        "NONE",
+        "MENUHEAD",
+        "MENUITEM",
+        "TIME",
+        "DATE",
+        "FLOAT",
+        "INT",
+        "EOL",
+        "BOOL",
+        "CLOCK",
+        "ENUM"
+    };
 #endif
 
-  if (type <= ENUM) {
-    dbglogfile << " Label is: \"" << label << "\"" << endl;
-  }
-  dbglogfile << "\tHeader Index: "   << headidx;
-  dbglogfile << ", Item Index: " << itemidx;
+    if (type <= ENUM) {
+        dbglogfile << " Label is: \"" << label << "\"" << endl;
+    }
+    dbglogfile << "\tHeader Index: "   << headidx;
+    dbglogfile << ", Item Index: " << itemidx;
 
-  if (cmdname.size() > 0)
-    dbglogfile << ", Alias is: \"" << cmdname << "\"";
-  dbglogfile << endl;
-  
-  switch (type) {
-  case NONE:
-    dbglogfile << "\tUnitialized data type." << endl;
-    break;
-  case INFO:
-    dbglogfile << "\tInformational Message." << endl;
-    break;
-  case MENUHEAD:
-    dbglogfile << "\tMenu Heading" << endl;
-    break;
-  case MENUITEM:
-    dbglogfile << "\tMenu Item: "<< endl;
-    break;
-  case BOOL:
-    if (value.boolval == false)
-      dbglogfile << "\tBoolean value is: " << "OFF" ;
-    else
-      dbglogfile << "\tBoolean value is: " << "ON" ;      
+    if (cmdname.size() > 0)
+        dbglogfile << ", Alias is: \"" << cmdname << "\"";
     dbglogfile << endl;
-    break;
-  case INT:
-    dbglogfile << "\tInteger value is: " << value.intval << endl;
-    break;
-  case FLOAT:
-    dbglogfile << "\tFIXME: Float value is: " << (int)value.floatval << endl;
-    break;
-  case TIME:
-    dbglogfile << "\tFIXME: Time value is: " << (int)value.timeval << endl;
-    break;
-  case EOL:
-  case CLOCK:
-  case ENUM:
-  case DATE:
-    dbglogfile << "\tERROR: unsupported type! " << value.intval << endl;
-    break;
-  default:
-    dbglogfile << "Data Type out of range";
-    break;
-  };
+  
+    switch (type) {
+      case NONE:
+          dbglogfile << "\tUnitialized data type." << endl;
+          break;
+      case INFO:
+          dbglogfile << "\tInformational Message." << endl;
+          break;
+      case MENUHEAD:
+          dbglogfile << "\tMenu Heading" << endl;
+          break;
+      case MENUITEM:
+          dbglogfile << "\tMenu Item: "<< endl;
+          break;
+      case BOOL:
+          if (value.boolval == false)
+              dbglogfile << "\tBoolean value is: " << "OFF" ;
+          else
+              dbglogfile << "\tBoolean value is: " << "ON" ;      
+          dbglogfile << endl;
+          break;
+      case INT:
+          dbglogfile << "\tInteger value is: " << value.intval << endl;
+          break;
+      case FLOAT:
+          dbglogfile << "\tFIXME: Float value is: " << (int)value.floatval << 
endl;
+          break;
+      case TIME:
+          dbglogfile << "\tFIXME: Time value is: " << (int)value.timeval << 
endl;
+          break;
+      case EOL:
+      case CLOCK:
+      case ENUM:
+      case DATE:
+          dbglogfile << "\tERROR: unsupported type! " << value.intval << endl;
+          break;
+      default:
+          dbglogfile << "Data Type out of range";
+          break;
+    };
   
   
 #if 0
-  if (type == BOOL)
-    dbglogfile << "\tBoolean Value is: " << value.intval << " and is: " << 
str0[type] << "\r" << endl;
-  else
-    dbglogfile << "BOOL shit!\r\n";
+    if (type == BOOL)
+        dbglogfile << "\tBoolean Value is: " << value.intval << " and is: " << 
str0[type] << "\r" << endl;
+    else
+        dbglogfile << "BOOL shit!\r\n";
 #endif
 }
 
 std::string &
 MenuItem::SetDisplay(std::string &label)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  ostringstream oss;
+    ostringstream oss;
   
-  oss << prefix;
-  oss << label;
-  oss.fill(FILLCHAR);
-  oss.width(HEADIDX - label.size());
+    oss << prefix;
+    oss << label;
+    oss.fill(FILLCHAR);
+    oss.width(HEADIDX - label.size());
   
-  display = oss.str();
+    display = oss.str();
 
-  return display;
+    return display;
 }
 
 std::string &
 MenuItem::SetDisplay(std::string &label, int x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  ostringstream oss;
+    DEBUGLOG_REPORT_FUNCTION;
+    ostringstream oss;
 
-  oss.clear();
+    oss.clear();
   
-  oss << prefix;
-  oss << label;
-  oss.fill(FILLCHAR);
-  oss.width(INTIDX - label.size() - 1);
-  oss << FILLCHAR;
-  oss.fill('0');
-  oss.width(2);
-  oss << x;
-  display = oss.str();
-
-  pollout = *this;
+    oss << prefix;
+    oss << label;
+    oss.fill(FILLCHAR);
+    oss.width(INTIDX - label.size() - 1);
+    oss << FILLCHAR;
+    oss.fill('0');
+    oss.width(2);
+    oss << x;
+    display = oss.str();
+
+    pollout = *this;
   
-  return display;
+    return display;
 }
 
 std::string &
 MenuItem::SetDisplay(int x)
 {
-  return SetDisplay(label, x);
+    return SetDisplay(label, x);
 }
 
 std::string &
 MenuItem::SetDisplay(std::string &label, bool x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  ostringstream oss;
+    DEBUGLOG_REPORT_FUNCTION;
+    ostringstream oss;
   
-  oss.clear();
-  oss << prefix;
-  oss << label;
-  oss.fill(FILLCHAR);
-  oss.width(BOOLIDX - label.size());
-
-  pollout = *this;
-
-  if (x)
-    oss << "YES";
-  else
-    oss << "NO";
+    oss.clear();
+    oss << prefix;
+    oss << label;
+    oss.fill(FILLCHAR);
+    oss.width(BOOLIDX - label.size());
+
+    pollout = *this;
+
+    if (x)
+        oss << "YES";
+    else
+        oss << "NO";
   
-  display = oss.str();
+    display = oss.str();
   
-  return display;
+    return display;
 }
 
 std::string &
 MenuItem::SetDisplay(std::string &label, float x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  ostringstream oss;
+    DEBUGLOG_REPORT_FUNCTION;
+    ostringstream oss;
   
-  oss.clear();
-  oss << prefix;
-  oss << label;
-  oss.fill(FILLCHAR);
-  oss.precision(3);
-  oss.width(FLTIDX - label.size());
-  oss << x;
-  display = oss.str();
+    oss.clear();
+    oss << prefix;
+    oss << label;
+    oss.fill(FILLCHAR);
+    oss.precision(3);
+    oss.width(FLTIDX - label.size());
+    oss << x;
+    display = oss.str();
   
-  pollout = *this;
+    pollout = *this;
 
-  return display;
+    return display;
 }
 
 std::string &
 MenuItem::SetDisplay(float x)
 {
-  return SetDisplay(label, x);
+    return SetDisplay(label, x);
 }
 
 std::string &
 MenuItem::SetDisplay(time_t x)
 {
-  return SetDisplay(label, x);
+    return SetDisplay(label, x);
 }
 
 std::string
 &MenuItem::SetDisplay(std::string &label, time_t x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  ostringstream oss;
+    ostringstream oss;
   
-  oss.clear();
-  oss << prefix;
-  oss << label;
-  oss.fill(' ');
-  oss.width(TIMEIDX - label.size());
-  oss << x;
-  display = oss.str();
-
-  return display;
+    oss.clear();
+    oss << prefix;
+    oss << label;
+    oss.fill(' ');
+    oss.width(TIMEIDX - label.size());
+    oss << x;
+    display = oss.str();
+
+    return display;
 }
 
-
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/menuitem.h b/lib/menuitem.h
index e9cc080..9cdb712 100644
--- a/lib/menuitem.h
+++ b/lib/menuitem.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -41,96 +42,101 @@ const char FILLCHAR = ' ';
 // Each menu item has associated data, and it's location indexes into which
 // item number of which header this is.
 union mval {
-  float  floatval;
-  int    intval;
-  bool   boolval;
-  time_t timeval;
+    float  floatval;
+    int    intval;
+    bool   boolval;
+    time_t timeval;
 };
 
 class MenuItem 
 {
 public:
-  MenuItem();
-  ~MenuItem() { };
+    MenuItem();
+    ~MenuItem() { };
 
-  enum datatype
+    enum datatype
     { NONE, INFO, MENUHEAD, MENUITEM, TIME, DATE, FLOAT, INT, EOL, BOOL, 
CLOCK, ENUM };
-  MenuItem(std::string label, int x); // make a menuheader label
-  // make a menuitem label
-  MenuItem(std::string label, int x, int y, std::string abbrev);
-  MenuItem(std::string label, int x, int y, bool z, std::string abbrev);
-  //  MenuItem(std::string label, int x, int y, enum datatype z);
-  MenuItem(std::string label, int x, int y, int z, std::string abbrev);
-  MenuItem(std::string label, int x, int y, float z, std::string abbrev);
-  MenuItem(std::string label, int x, int y, time_t z, std::string abbrev);
+    MenuItem(std::string label, int x); // make a menuheader label
+    // make a menuitem label
+    MenuItem(std::string label, int x, int y, std::string abbrev);
+    MenuItem(std::string label, int x, int y, bool z, std::string abbrev);
+    //  MenuItem(std::string label, int x, int y, enum datatype z);
+    MenuItem(std::string label, int x, int y, int z, std::string abbrev);
+    MenuItem(std::string label, int x, int y, float z, std::string abbrev);
+    MenuItem(std::string label, int x, int y, time_t z, std::string abbrev);
 
-  // Set the data
-  void SetItem(std::string label, int x, int y, union mval val, enum datatype 
dtype);
-  void SetItem(std::string label, int x, int y, union mval val, enum datatype 
dtype, std::string);
+    // Set the data
+    void SetItem(std::string label, int x, int y, union mval val, enum 
datatype dtype);
+    void SetItem(std::string label, int x, int y, union mval val, enum 
datatype dtype, std::string);
 
-  void SetRange(int x, int y);
-  void SetRange(float x, float y);
-  void SetItem(std::string label, int x); // make a menuheader label
-  // make a menuitem label
-  void SetItem(std::string label, int x, int y);
-  void SetItem(std::string label, int x, int y, std::string abbrev);
-  void SetItem(std::string label, int x, int y, bool z);
-  void SetItem(std::string label, int x, int y, bool z, std::string abbrev);
-  //  void SetItem(std::string label, int x, int y, enum datatype z);
-  void SetItem(std::string label, int x, int y, int z);
-  void SetItem(std::string label, int x, int y, int z, std::string abbrev);
-  void SetItem(std::string label, int x, int y, float z);
-  void SetItem(std::string label, int x, int y, float z, std::string abbrev);
-  void SetItem(std::string label, int x, int y, time_t z, std::string abbrev);
+    void SetRange(int x, int y);
+    void SetRange(float x, float y);
+    void SetItem(std::string label, int x); // make a menuheader label
+    // make a menuitem label
+    void SetItem(std::string label, int x, int y);
+    void SetItem(std::string label, int x, int y, std::string abbrev);
+    void SetItem(std::string label, int x, int y, bool z);
+    void SetItem(std::string label, int x, int y, bool z, std::string abbrev);
+    //  void SetItem(std::string label, int x, int y, enum datatype z);
+    void SetItem(std::string label, int x, int y, int z);
+    void SetItem(std::string label, int x, int y, int z, std::string abbrev);
+    void SetItem(std::string label, int x, int y, float z);
+    void SetItem(std::string label, int x, int y, float z, std::string abbrev);
+    void SetItem(std::string label, int x, int y, time_t z, std::string 
abbrev);
   
-  std::string &GetLabel(void)   { return label; }
-  std::string &GetAlias(void)   { return cmdname; }
-  int GetHeaderIndex(void)      { return headidx; }
-  int GetItemIndex(void)        { return itemidx; }
+    std::string &GetLabel(void)   { return label; }
+    std::string &GetAlias(void)   { return cmdname; }
+    int GetHeaderIndex(void)      { return headidx; }
+    int GetItemIndex(void)        { return itemidx; }
   
 
-  // Overload so we can extract the various data types
-  union mval GetValue(union mval *x) { return (*x = value); }
-  int GetInt(void)             { return value.intval; }
-  float GetFloat(void)         { return value.floatval; }
-  bool GetBool(void)           { return value.boolval; }      
-  bool GetValue(bool *x)       { return (*x = value.boolval); }
-  int GetValue(int *x)         { return (*x = value.intval); }
-  float GetValue(float *x)     { return (*x = value.floatval); }
-  time_t GetValue(time_t *x)   { return (*x = value.timeval); }
-  void SetValue(int x)         { value.intval = x; }
-  void SetValue(float x)       { value.floatval = x; }
-  void SetValue(time_t x)      { value.timeval = x; }
-  enum datatype GetType(void)  { return type; }
-  int GetIntMin (void)         { return minrange.intval; }
-  int GetIntMax (void)         { return maxrange.intval; }
-  float GetFloatMin (void)       { return minrange.floatval; }
-  float GetFloatMax (void)       { return maxrange.floatval; }
-  void Dump(void);
+    // Overload so we can extract the various data types
+    union mval GetValue(union mval *x) { return (*x = value); }
+    int GetInt(void)             { return value.intval; }
+    float GetFloat(void)         { return value.floatval; }
+    bool GetBool(void)           { return value.boolval; }      
+    bool GetValue(bool *x)       { return (*x = value.boolval); }
+    int GetValue(int *x)         { return (*x = value.intval); }
+    float GetValue(float *x)     { return (*x = value.floatval); }
+    time_t GetValue(time_t *x)   { return (*x = value.timeval); }
+    void SetValue(int x)         { value.intval = x; }
+    void SetValue(float x)       { value.floatval = x; }
+    void SetValue(time_t x)      { value.timeval = x; }
+    enum datatype GetType(void)  { return type; }
+    int GetIntMin (void)         { return minrange.intval; }
+    int GetIntMax (void)         { return maxrange.intval; }
+    float GetFloatMin (void)       { return minrange.floatval; }
+    float GetFloatMax (void)       { return maxrange.floatval; }
+    void Dump(void);
   
-  std::string &SetDisplay(std::string &label);
-  std::string &SetDisplay(std::string &label, int x);
-  std::string &SetDisplay(int x);
-  std::string &SetDisplay(std::string &label, float x);
-  std::string &SetDisplay(float x);
-  std::string &SetDisplay(std::string &label, bool x);
-  std::string &SetDisplay(bool x);
-  std::string &SetDisplay(time_t x);
-  std::string &SetDisplay(std::string &label, time_t x);
-  std::string &GetDisplay(void)   { return display; }
+    std::string &SetDisplay(std::string &label);
+    std::string &SetDisplay(std::string &label, int x);
+    std::string &SetDisplay(int x);
+    std::string &SetDisplay(std::string &label, float x);
+    std::string &SetDisplay(float x);
+    std::string &SetDisplay(std::string &label, bool x);
+    std::string &SetDisplay(bool x);
+    std::string &SetDisplay(time_t x);
+    std::string &SetDisplay(std::string &label, time_t x);
+    std::string &GetDisplay(void)   { return display; }
 
- private:
-  std::string cmdname;          // this is an abbreviation used for
-                                // the command line interface
-  std::string label;
-  std::string display;
-  int headidx;
-  int itemidx;
-  enum datatype type;
-  union mval value;
-  union mval minrange;
-  union mval maxrange;
+private:
+    std::string cmdname;          // this is an abbreviation used for
+    // the command line interface
+    std::string label;
+    std::string display;
+    int headidx;
+    int itemidx;
+    enum datatype type;
+    union mval value;
+    union mval minrange;
+    union mval maxrange;
 };
 
 // end of __MENUITEM_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/msgs.cc b/lib/msgs.cc
index 230ecc2..034c763 100644
--- a/lib/msgs.cc
+++ b/lib/msgs.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -50,79 +51,79 @@ std::map<const xmlChar *, std::string> Msgs::_cache;
 
 Msgs::Msgs()
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  Tcputil tu;
-  tu.hostDataGet();
+    // DEBUGLOG_REPORT_FUNCTION;
+    Tcputil tu;
+    tu.hostDataGet();
   
-  _thisip = tu.hostIPNameGet();
-  _thishost = tu.hostNameGet();
+    _thisip = tu.hostIPNameGet();
+    _thishost = tu.hostNameGet();
 
-  _version = atof(VERSION);
+    _version = atof(VERSION);
 }
 
 Msgs::Msgs(std::string host, std::string ip) // : _net_mode(NONET)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  Tcputil tu;
-  tu.hostDataGet();
+    // DEBUGLOG_REPORT_FUNCTION;
+    Tcputil tu;
+    tu.hostDataGet();
   
-  _thisip = tu.hostIPNameGet();
-  _thishost = tu.hostNameGet();
+    _thisip = tu.hostIPNameGet();
+    _thishost = tu.hostNameGet();
   
-  _remoteip = ip;
-  _remotehost = host;
+    _remoteip = ip;
+    _remotehost = host;
 
-  _version = atof(VERSION);
+    _version = atof(VERSION);
 }
 
 Msgs::Msgs(Tcpip *tcpip)//  : _net_mode(NONET)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  Tcputil tu;
-  tu.hostDataGet();
+    // DEBUGLOG_REPORT_FUNCTION;
+    Tcputil tu;
+    tu.hostDataGet();
   
-  _thisip = tu.hostIPNameGet();
-  _thishost = tu.hostNameGet();
+    _thisip = tu.hostIPNameGet();
+    _thishost = tu.hostNameGet();
   
-  //  _remoteip = ip;
-  //  _remotehost = host;
+    //  _remoteip = ip;
+    //  _remotehost = host;
   
-  _version = atof(VERSION);
+    _version = atof(VERSION);
 }
 
 retcode_t
 Msgs::init(net_mode_e mode)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string hostname = "localhost";
-  bool block = true;
-  
-  if (mode == CLIENT) {
-    _net_mode = CLIENT;
-    if (createNetClient(hostname)) {
-      dbglogfile << "Connected to server at " << hostname.c_str() << endl;
-      init();                     // initialize the table of pointers
-      return SUCCESS;
+    DEBUGLOG_REPORT_FUNCTION;
+    string hostname = "localhost";
+    bool block = true;
+  
+    if (mode == CLIENT) {
+        _net_mode = CLIENT;
+        if (createNetClient(hostname)) {
+            dbglogfile << "Connected to server at " << hostname.c_str() << 
endl;
+            init();                     // initialize the table of pointers
+            return SUCCESS;
+        } else {
+            dbglogfile << "ERROR: Couldn't create connection to server" << 
hostname.c_str()  << endl;
+        }
+    } else if (mode == DAEMON) {
+        _net_mode = DAEMON;
+        init(DAEMON, block);
+        dbglogfile << "WARNING: ignoring hostname, starting as daemon" << endl;
     } else {
-      dbglogfile << "ERROR: Couldn't create connection to server" << 
hostname.c_str()  << endl;
+        dbglogfile << "ERROR: no mode specified! " << endl;
+        _net_mode = NONET;
     }
-  } else if (mode == DAEMON) {
-    _net_mode = DAEMON;
-    init(DAEMON, block);
-    dbglogfile << "WARNING: ignoring hostname, starting as daemon" << endl;
-  } else {
-    dbglogfile << "ERROR: no mode specified! " << endl;
-    _net_mode = NONET;
-  }
-  return ERROR;  
+    return ERROR;  
 }
 
 // If a hostname is specifed, we force client mode.
 retcode_t
 Msgs::init(net_mode_e mode, std::string hostname)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  return init(hostname);
+    DEBUGLOG_REPORT_FUNCTION;
+    return init(hostname);
 }
 
 // By default, if just a hostname is supplied, we assume it's to establish
@@ -130,191 +131,191 @@ Msgs::init(net_mode_e mode, std::string hostname)
 retcode_t
 Msgs::init(std::string hostname)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  if (createNetClient(hostname)) {
-    dbglogfile << "Connected to server at " << hostname.c_str() << endl;
-    init();                     // initialize the table of pointers
-    _net_mode = CLIENT;
-    writeNet(heloCreate(_version));
-    return SUCCESS;
-  } else {
-    dbglogfile << "ERROR: Couldn't create connection to server" << hostname  
<< endl;
-  }
-  return ERROR;
+    if (createNetClient(hostname)) {
+        dbglogfile << "Connected to server at " << hostname.c_str() << endl;
+        init();                     // initialize the table of pointers
+        _net_mode = CLIENT;
+        writeNet(heloCreate(_version));
+        return SUCCESS;
+    } else {
+        dbglogfile << "ERROR: Couldn't create connection to server" << 
hostname  << endl;
+    }
+    return ERROR;
 }
 
 retcode_t
 Msgs::init(net_mode_e mode, bool block)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string hostname = "localhost";
-  if (mode == CLIENT) {
-    _net_mode = CLIENT;
-    if (createNetClient(hostname)) {
-      dbglogfile << "Connected to server at " << hostname.c_str() << endl;
-      init();                     // initialize the table of pointers
-      return SUCCESS;
+    DEBUGLOG_REPORT_FUNCTION;
+    string hostname = "localhost";
+    if (mode == CLIENT) {
+        _net_mode = CLIENT;
+        if (createNetClient(hostname)) {
+            dbglogfile << "Connected to server at " << hostname.c_str() << 
endl;
+            init();                     // initialize the table of pointers
+            return SUCCESS;
+        } else {
+            dbglogfile << "ERROR: Couldn't create connection to server" << 
hostname.c_str()  << endl;
+        }
+    } else if (mode == DAEMON) {
+        _net_mode = DAEMON;
+        init(true);
+        dbglogfile << "WARNING: ignoring hostname, starting as daemon" << endl;
     } else {
-      dbglogfile << "ERROR: Couldn't create connection to server" << 
hostname.c_str()  << endl;
+        dbglogfile << "ERROR: no mode specified! " << endl;
+        _net_mode = NONET;
     }
-  } else if (mode == DAEMON) {
-    _net_mode = DAEMON;
-    init(true);
-    dbglogfile << "WARNING: ignoring hostname, starting as daemon" << endl;
-  } else {
-    dbglogfile << "ERROR: no mode specified! " << endl;
-    _net_mode = NONET;
-  }
-  return ERROR;
+    return ERROR;
 }
                
 retcode_t
 Msgs::init(bool block)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  _net_mode = DAEMON;
-  
-  if (createNetServer()) {
-    dbglogfile << "New server started for remote client." << endl;
-    init();                     // initialize the table of pointers
-  } else {
-    dbglogfile << "ERROR: Couldn't create a new server" << endl;
-  }      
-  
-  if (newNetConnection(block)) {
-    dbglogfile << "New connection started for remote client." << endl;
+    DEBUGLOG_REPORT_FUNCTION;
     _net_mode = DAEMON;
-    writeNet(heloCreate(_version));
-    return SUCCESS;
-  } else {
-    dbglogfile << "ERROR: Couldn't create a new connection!" << endl;
-  }
-  return ERROR;
+  
+    if (createNetServer()) {
+        dbglogfile << "New server started for remote client." << endl;
+        init();                     // initialize the table of pointers
+    } else {
+        dbglogfile << "ERROR: Couldn't create a new server" << endl;
+    }      
+  
+    if (newNetConnection(block)) {
+        dbglogfile << "New connection started for remote client." << endl;
+        _net_mode = DAEMON;
+        writeNet(heloCreate(_version));
+        return SUCCESS;
+    } else {
+        dbglogfile << "ERROR: Couldn't create a new connection!" << endl;
+    }
+    return ERROR;
 }
 
   
 retcode_t
 Msgs::init(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  // Top level node of the message
-  _methods[BAD_CAST "powerguru"] =      &Msgs::powerguruProcess;
+    // Top level node of the message
+    _methods[BAD_CAST "powerguru"] =      &Msgs::powerguruProcess;
   
     // initialization message
-  _methods[BAD_CAST "helo"] =           &Msgs::heloProcess;
-  _methods[BAD_CAST "client"] =         &Msgs::clientProcess;
-  _methods[BAD_CAST "server"] =         &Msgs::serverProcess;
-  
-  // Meter readings
-  _methods[BAD_CAST "meters"] =         &Msgs::metersProcess;
-  _methods[BAD_CAST "charge-mps"] =     &Msgs::chargeAmpsProcess;
-  _methods[BAD_CAST "load-amps"] =      &Msgs::loadAmpsProcess;
-  _methods[BAD_CAST "pv-amps"] =        &Msgs::pvAmpsProcess;
-  _methods[BAD_CAST "pv-volts"] =       &Msgs::pvVoltsProcess;
-  _methods[BAD_CAST "daily-kwh"] =      &Msgs::dailyKwhProcess;
-  _methods[BAD_CAST "hertz"] =          &Msgs::hertzProcess;
-  _methods[BAD_CAST "battery-volts"] =  &Msgs::batteryVoltsProcess;
-  _methods[BAD_CAST "buy-amps"] =       &Msgs::buyAmpsProcess;
-  _methods[BAD_CAST "sell-amps"] =      &Msgs::sellAmpsProcess;
-  _methods[BAD_CAST "ac-volts-out"] =   &Msgs::acVoltsOutProcess;
-  _methods[BAD_CAST "ac1-volts-in"] =   &Msgs::ac1InProcess;
-  _methods[BAD_CAST "ac2-volts-in"] =   &Msgs::ac2InProcess;
-  
-  // Status messages on the system
-  _methods[BAD_CAST "status"] = &Msgs::statusProcess;
-  _methods[BAD_CAST "version"] = &Msgs::statusProcess;
-  _methods[BAD_CAST "revision"] = &Msgs::statusProcess;
-  _methods[BAD_CAST "opmode"] = &Msgs::statusProcess;
-  _methods[BAD_CAST "errormode"] = &Msgs::statusProcess;
-  _methods[BAD_CAST "warningmode"] = &Msgs::statusProcess;
-
-  // Configuration settings
-  _methods[BAD_CAST "config"] = &Msgs::configProcess;
-  _methods[BAD_CAST "generator"] = &Msgs::configProcess;
-  _methods[BAD_CAST "grid"] = &Msgs::configProcess;
-  _methods[BAD_CAST "buy"] = &Msgs::configProcess;
-  _methods[BAD_CAST "sell"] = &Msgs::configProcess;
-  _methods[BAD_CAST "start"] = &Msgs::configProcess;
-  _methods[BAD_CAST "end"] = &Msgs::configProcess;
-
-  // Command messages
-  _methods[BAD_CAST "command"] = &Msgs::commandProcess;
+    _methods[BAD_CAST "helo"] =           &Msgs::heloProcess;
+    _methods[BAD_CAST "client"] =         &Msgs::clientProcess;
+    _methods[BAD_CAST "server"] =         &Msgs::serverProcess;
+  
+    // Meter readings
+    _methods[BAD_CAST "meters"] =         &Msgs::metersProcess;
+    _methods[BAD_CAST "charge-mps"] =     &Msgs::chargeAmpsProcess;
+    _methods[BAD_CAST "load-amps"] =      &Msgs::loadAmpsProcess;
+    _methods[BAD_CAST "pv-amps"] =        &Msgs::pvAmpsProcess;
+    _methods[BAD_CAST "pv-volts"] =       &Msgs::pvVoltsProcess;
+    _methods[BAD_CAST "daily-kwh"] =      &Msgs::dailyKwhProcess;
+    _methods[BAD_CAST "hertz"] =          &Msgs::hertzProcess;
+    _methods[BAD_CAST "battery-volts"] =  &Msgs::batteryVoltsProcess;
+    _methods[BAD_CAST "buy-amps"] =       &Msgs::buyAmpsProcess;
+    _methods[BAD_CAST "sell-amps"] =      &Msgs::sellAmpsProcess;
+    _methods[BAD_CAST "ac-volts-out"] =   &Msgs::acVoltsOutProcess;
+    _methods[BAD_CAST "ac1-volts-in"] =   &Msgs::ac1InProcess;
+    _methods[BAD_CAST "ac2-volts-in"] =   &Msgs::ac2InProcess;
+  
+    // Status messages on the system
+    _methods[BAD_CAST "status"] = &Msgs::statusProcess;
+    _methods[BAD_CAST "version"] = &Msgs::statusProcess;
+    _methods[BAD_CAST "revision"] = &Msgs::statusProcess;
+    _methods[BAD_CAST "opmode"] = &Msgs::statusProcess;
+    _methods[BAD_CAST "errormode"] = &Msgs::statusProcess;
+    _methods[BAD_CAST "warningmode"] = &Msgs::statusProcess;
+
+    // Configuration settings
+    _methods[BAD_CAST "config"] = &Msgs::configProcess;
+    _methods[BAD_CAST "generator"] = &Msgs::configProcess;
+    _methods[BAD_CAST "grid"] = &Msgs::configProcess;
+    _methods[BAD_CAST "buy"] = &Msgs::configProcess;
+    _methods[BAD_CAST "sell"] = &Msgs::configProcess;
+    _methods[BAD_CAST "start"] = &Msgs::configProcess;
+    _methods[BAD_CAST "end"] = &Msgs::configProcess;
+
+    // Command messages
+    _methods[BAD_CAST "command"] = &Msgs::commandProcess;
 //   _methods[BAD_CAST "auxilary"] = &Msgs::commandAuxilaryProcess;
 //   _methods[BAD_CAST "relay"] = &Msgs::commandRelayProcess;
 //   _methods[BAD_CAST "poll"] = &Msgs::commandPollProcess;;
 //   _methods[BAD_CAST "inverter"] = &Msgs::commandInverterProcess;;
 //   _methods[BAD_CAST "charger"] = &Msgs::commandChargerProcess;;
-  // _methods[BAD_CAST "restart"] = &Msgs::commandRestartProcess;;
-  _methods[BAD_CAST "auxilary"] = &Msgs::commandProcess;
+    // _methods[BAD_CAST "restart"] = &Msgs::commandRestartProcess;;
+    _methods[BAD_CAST "auxilary"] = &Msgs::commandProcess;
     _methods[BAD_CAST "relay"] = &Msgs::commandProcess;
-  _methods[BAD_CAST "poll"] = &Msgs::commandProcess;
-  _methods[BAD_CAST "inverter"] = &Msgs::commandProcess;
-  _methods[BAD_CAST "charger"] = &Msgs::commandProcess;
+    _methods[BAD_CAST "poll"] = &Msgs::commandProcess;
+    _methods[BAD_CAST "inverter"] = &Msgs::commandProcess;
+    _methods[BAD_CAST "charger"] = &Msgs::commandProcess;
   
-  //  _methods[""] = &Msgs::unimplementedProcess;
+    //  _methods[""] = &Msgs::unimplementedProcess;
 
-  // preload a few values
-  if (_net_mode == DAEMON) {
-    _cache[BAD_CAST "version"] = VERSION;
-    _cache[BAD_CAST "revision"] = VERSION;
+    // preload a few values
+    if (_net_mode == DAEMON) {
+        _cache[BAD_CAST "version"] = VERSION;
+        _cache[BAD_CAST "revision"] = VERSION;
 //     _cache[BAD_CAST "opmode"] = "unknown";
 //     _cache[BAD_CAST "errormode"] = "unknown";
 //     _cache[BAD_CAST "warningmode"] = "unknown";
 
-    // FIXME: fake meter values!
-    // Meters
-    _cache[BAD_CAST "battery-volts"] = "88888888";
-    _cache[BAD_CAST "charge-amps"] = "777777777";
-    _cache[BAD_CAST "load-amps"] = "66666666";
-    _cache[BAD_CAST "pv-amps"] = "55555555";
-    _cache[BAD_CAST "sell-amps"] = "444444444444";
-  }
+        // FIXME: fake meter values!
+        // Meters
+        _cache[BAD_CAST "battery-volts"] = "88888888";
+        _cache[BAD_CAST "charge-amps"] = "777777777";
+        _cache[BAD_CAST "load-amps"] = "66666666";
+        _cache[BAD_CAST "pv-amps"] = "55555555";
+        _cache[BAD_CAST "sell-amps"] = "444444444444";
+    }
   
-  return SUCCESS;
+    return SUCCESS;
 }
 
 std::string
 Msgs::cacheGet(const xmlChar * name) {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 #if 1
-  const xmlChar         *tag;
-  string                str;
-  
-  _body.str("");
-  std::map<const xmlChar *, string>::const_iterator it;
-  for (it = _cache.begin(); it != _cache.end(); it++) {
-    //entry = it->second;
-    tag = it->first;
-    str  = it->second;
+    const xmlChar         *tag;
+    string                str;
+  
     _body.str("");
-    if (xmlStrcmp(tag, name) == 0) {
-      if (str.size() != 0) {
-        _body << " Has data: " << str;
-      } else {
-        dbglogfile << " doesn't have data";
-        return _body.str();
-      }
-      return str;
+    std::map<const xmlChar *, string>::const_iterator it;
+    for (it = _cache.begin(); it != _cache.end(); it++) {
+        //entry = it->second;
+        tag = it->first;
+        str  = it->second;
+        _body.str("");
+        if (xmlStrcmp(tag, name) == 0) {
+            if (str.size() != 0) {
+                _body << " Has data: " << str;
+            } else {
+                dbglogfile << " doesn't have data";
+                return _body.str();
+            }
+            return str;
+        }
+        dbglogfile << "Looking for cache value for XML Tag \"" << tag
+                   << "\" has " << _body.str().c_str() << endl;
     }
-    dbglogfile << "Looking for cache value for XML Tag \"" << tag
-               << "\" has " << _body.str().c_str() << endl;
-  }
-  return _body.str();
+    return _body.str();
 #else
-  return _cache[name];
+    return _cache[name];
 #endif
 }
 
 retcode_t
 Msgs::cacheAdd(const xmlChar * name, string str)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _cache[name] = str;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _cache[name] = str;
 
-  // FIXME: we should make sure this actually worked.
-  return SUCCESS;
+    // FIXME: we should make sure this actually worked.
+    return SUCCESS;
 }
 
 
@@ -322,36 +323,36 @@ Msgs::cacheAdd(const xmlChar * name, string str)
 void
 Msgs::methodSet(const xmlChar * name, methodPtr_t func)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _methods[name] = func;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _methods[name] = func;
 }
 
 // Get the function for an XML tag from the list.
 Msgs::methodPtr_t
 Msgs::methodGet(const xmlChar * name)
 {
-  //DEBUGLOG_REPORT_FUNCTION;
+    //DEBUGLOG_REPORT_FUNCTION;
 #if 1
-  const xmlChar         *str;
-  Msgs::methodPtr_t     ptr;
-  
-  std::map<const xmlChar *, Msgs::methodPtr_t>::const_iterator it;
-  for (it = _methods.begin(); it != _methods.end(); it++) {
-    //entry = it->second;
-    str = it->first;
-    ptr  = it->second;
-    _body.str("");
-    if (ptr != 0) {
-      _body << " a function pointer";
-    } else {
-      _body << " doesn't have a function pointer";
-    }
-    //     dbglogfile << "Looking for method for XML Tag \"" << name.c_str()
-    //                << "\" has " << _body.str().c_str() << endl;
-    if (xmlStrcmp(str, name) == 0) {
-      return ptr;
+    const xmlChar         *str;
+    Msgs::methodPtr_t     ptr;
+  
+    std::map<const xmlChar *, Msgs::methodPtr_t>::const_iterator it;
+    for (it = _methods.begin(); it != _methods.end(); it++) {
+        //entry = it->second;
+        str = it->first;
+        ptr  = it->second;
+        _body.str("");
+        if (ptr != 0) {
+            _body << " a function pointer";
+        } else {
+            _body << " doesn't have a function pointer";
+        }
+        //     dbglogfile << "Looking for method for XML Tag \"" << 
name.c_str()
+        //                << "\" has " << _body.str().c_str() << endl;
+        if (xmlStrcmp(str, name) == 0) {
+            return ptr;
+        }
     }
-  }
 #else
     dbglogfile << "\"" << name << "\" method we want" << endl;
     return _methods[name];
@@ -363,243 +364,243 @@ Msgs::methodGet(const xmlChar * name)
 retcode_t
 Msgs::methodProcess(const xmlChar *name, XMLNode *node)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  //(this->*_methods.find(name)(node); 
-  return (this->*_methods[name])(node);
+    // DEBUGLOG_REPORT_FUNCTION;
+    //(this->*_methods.find(name)(node); 
+    return (this->*_methods[name])(node);
 }
 
 // Dump all the pointer to methods for each XML Tag
 void
 Msgs::methodsDump(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  const xmlChar         *name;
-  Msgs::methodPtr_t     ptr;
-  
-  dbglogfile << "We have " << (int)_methods.size() << " in function table" << 
endl;
-  
-  std::map<const xmlChar *, Msgs::methodPtr_t>::const_iterator it;
-  for (it = _methods.begin(); it != _methods.end(); it++) {
-    name = it->first;
-    ptr  = it->second;
-    _body.str("");
-    if (ptr != 0) {
-      _body << "a method pointer";
-    } else {
-      _body << "no pointer to method";
+    DEBUGLOG_REPORT_FUNCTION;
+    const xmlChar         *name;
+    Msgs::methodPtr_t     ptr;
+  
+    dbglogfile << "We have " << (int)_methods.size() << " in function table" 
<< endl;
+  
+    std::map<const xmlChar *, Msgs::methodPtr_t>::const_iterator it;
+    for (it = _methods.begin(); it != _methods.end(); it++) {
+        name = it->first;
+        ptr  = it->second;
+        _body.str("");
+        if (ptr != 0) {
+            _body << "a method pointer";
+        } else {
+            _body << "no pointer to method";
+        }
+        dbglogfile << "XML Tag \"" << name
+                   << "\" has " << _body.str().c_str() << endl;
     }
-    dbglogfile << "XML Tag \"" << name
-               << "\" has " << _body.str().c_str() << endl;
-  }
 }
 
 // Dump all the pointer to methods for each XML Tag
 void
 Msgs::cacheDump(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  const xmlChar         *name;
-  string                data;
-  
-  dbglogfile << "We have " << (int)_cache.size() << " items in the cache" << 
endl;
-  
-  std::map<const xmlChar *, string>::const_iterator it;
-  for (it = _cache.begin(); it != _cache.end(); it++) {
-    name = it->first;
-    data  = it->second;
-    _body.str("");
-    if (data.size() != 0) {
-      _body << "data is " << data;
-    } else {
-      _body << "no data";
+    DEBUGLOG_REPORT_FUNCTION;
+    const xmlChar         *name;
+    string                data;
+  
+    dbglogfile << "We have " << (int)_cache.size() << " items in the cache" << 
endl;
+  
+    std::map<const xmlChar *, string>::const_iterator it;
+    for (it = _cache.begin(); it != _cache.end(); it++) {
+        name = it->first;
+        data  = it->second;
+        _body.str("");
+        if (data.size() != 0) {
+            _body << "data is " << data;
+        } else {
+            _body << "no data";
+        }
+        dbglogfile << "XML Tag \"" << name
+                   << "\" has " << _body.str().c_str() << endl;
     }
-    dbglogfile << "XML Tag \"" << name
-               << "\" has " << _body.str().c_str() << endl;
-  }
 }
 
 Msgs::~Msgs()
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
   
 }
 
 retcode_t
 Msgs::unimplementedProcess(XMLNode *xml)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  dbglogfile << "XML tag \"" << xml->nameGet() << "\" doesn't exist." << endl;
+    dbglogfile << "XML tag \"" << xml->nameGet() << "\" doesn't exist." << 
endl;
 
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"" << _version << "\">";
-  _body << "<status><warningmode><";
-  _body << BAD_CAST xml->nameGet();
-  _body << ">unimplemented</" << BAD_CAST xml->nameGet();
-  _body <<  "></warningmode>" << "</status>"; 
-  _body << "</powerguru>";
-  _body << ends;
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"" << _version << "\">";
+    _body << "<status><warningmode><";
+    _body << BAD_CAST xml->nameGet();
+    _body << ">unimplemented</" << BAD_CAST xml->nameGet();
+    _body <<  "></warningmode>" << "</status>"; 
+    _body << "</powerguru>";
+    _body << ends;
 
-  if (writeNet(_body.str())) {
-    return ERROR;
-  } else {
-    return SUCCESS;
-  }
+    if (writeNet(_body.str())) {
+        return ERROR;
+    } else {
+        return SUCCESS;
+    }
 }
 
 void
 Msgs::process(XMLNode *xml)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  methodPtr_t   fptr;
-  const xmlChar *str;
-  retcode_t     ret;
-  int           i;
-
-  str = xml->nameGet();
-  fptr = methodGet(str);
-  //methodsDump();
-  
-  if (fptr != 0) {
-    dbglogfile << "XML tag \"" << str << "\" has method pointer" << endl;
-    ret = (this->*fptr)(xml);
-  } else {
-    dbglogfile << "WARNING: XML tag \"" << str << "\" doesn't have a method 
pointer" << endl;
-  }
-
-  if (ret < 0) {
-    dbglogfile << "ERROR: Got an error from executing function pointer!" << 
endl;
-  } else {    
-    dbglogfile << "executed function pointer successfully!" << endl;
-  }
-  
-  // Process the children too
-  for (i=0; i<xml->childrenSize(); i++) {
-    process(xml->childGet(i));
-  }  
+    DEBUGLOG_REPORT_FUNCTION;
+    methodPtr_t   fptr;
+    const xmlChar *str;
+    retcode_t     ret;
+    int           i;
+
+    str = xml->nameGet();
+    fptr = methodGet(str);
+    //methodsDump();
+  
+    if (fptr != 0) {
+        dbglogfile << "XML tag \"" << str << "\" has method pointer" << endl;
+        ret = (this->*fptr)(xml);
+    } else {
+        dbglogfile << "WARNING: XML tag \"" << str << "\" doesn't have a 
method pointer" << endl;
+    }
+
+    if (ret < 0) {
+        dbglogfile << "ERROR: Got an error from executing function pointer!" 
<< endl;
+    } else {    
+        dbglogfile << "executed function pointer successfully!" << endl;
+    }
+  
+    // Process the children too
+    for (i=0; i<xml->childrenSize(); i++) {
+        process(xml->childGet(i));
+    }  
 }
 
 void
 Msgs::dump(XMLNode *xml)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  int           child,  i;
-  XMLNode       *childnode;
-
-  dbglogfile << "processing node " << xml->nameGet() << endl;
-
-  // Process the node's value, if it has one.
-  if (xml->valueGet() == 0) {
-    dbglogfile << "No content for node " << xml->nameGet() << endl;
-  } else {
-    dbglogfile << "Content for node " << xml->nameGet()
-               << " is " << xml->valueGet() << endl;
-  }
-  
-  // Process the attributes, if any
-  if (xml->attributesSize() == 0) {
-    dbglogfile << "\tNo attributes for node " << xml->nameGet() << endl;
-  } else {
-    for (i=0; i<xml->attributesSize(); i++) {
-      dbglogfile << "\tAttribute is " << xml->attribGet(i)->nameGet()
-                 << " who's value is " << xml->attribGet(i)->valueGet() << 
endl;
+    // DEBUGLOG_REPORT_FUNCTION;
+    int           child,  i;
+    XMLNode       *childnode;
+
+    dbglogfile << "processing node " << xml->nameGet() << endl;
+
+    // Process the node's value, if it has one.
+    if (xml->valueGet() == 0) {
+        dbglogfile << "No content for node " << xml->nameGet() << endl;
+    } else {
+        dbglogfile << "Content for node " << xml->nameGet()
+                   << " is " << xml->valueGet() << endl;
     }
-  }
-
-  // Process the children, if there are any
-  if (xml->childrenSize()) {
-    dbglogfile << "\tProcessing " << xml->childrenSize() << " children nodes 
for "
-               << xml->nameGet() << endl;
-    for (child=0; child<xml->childrenSize(); child++) {
-      childnode = xml->childGet(child);
-      dump(childnode); // setup child node
+  
+    // Process the attributes, if any
+    if (xml->attributesSize() == 0) {
+        dbglogfile << "\tNo attributes for node " << xml->nameGet() << endl;
+    } else {
+        for (i=0; i<xml->attributesSize(); i++) {
+            dbglogfile << "\tAttribute is " << xml->attribGet(i)->nameGet()
+                       << " who's value is " << xml->attribGet(i)->valueGet() 
<< endl;
+        }
+    }
+
+    // Process the children, if there are any
+    if (xml->childrenSize()) {
+        dbglogfile << "\tProcessing " << xml->childrenSize() << " children 
nodes for "
+                   << xml->nameGet() << endl;
+        for (child=0; child<xml->childrenSize(); child++) {
+            childnode = xml->childGet(child);
+            dump(childnode); // setup child node
+        }
+    } else {
+        dbglogfile << "Node " << xml->nameGet() << " has no children" << endl;
     }
-  } else {
-    dbglogfile << "Node " << xml->nameGet() << " has no children" << endl;
-  }
 }
 
 // These format client side messages to the daemon
 string
 Msgs::statusCreate(meter_data_t *md)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 #if 1
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"";
-  _body << _version << "\">";
-  _body << "<status>" << "</status>"; 
-  _body << "</powerguru>";
-  _body << ends;
-  
-  return _body.str();
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"";
+    _body << _version << "\">";
+    _body << "<status>" << "</status>"; 
+    _body << "</powerguru>";
+    _body << ends;
+  
+    return _body.str();
 #else
-  int rc;
-  xmlTextWriterPtr writer;
-  xmlBufferPtr buf;
-  xmlChar *tmp;
-  
-  if ((buf = xmlBufferCreate()) == NULL) {
-    printf("testXmlwriterMemory: Error creating the xml buffer\n");
-    return "";
-  }
-  
-  if ((writer = xmlNewTextWriterMemory(buf, 0)) == NULL) {
-    printf("testXmlwriterMemory: Error creating the xml writer\n");
-    return "";
-  }
-  
-  /* Start the document with the xml default for the version,
-   * encoding ISO 8859-1 and the default for the standalone
-   * declaration. */
-  if ((rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL)) < 0) {
-    printf("testXmlwriterMemory: Error at xmlTextWriterStartDocument\n");
-    return "";
-  }
-  
-  if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "powerguru")) < 0) {
-    printf
-      ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
-    return "";
-  }
-  
-  if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "status")) < 0) {
-    printf
-      ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
-    return "";
-  }
+    int rc;
+    xmlTextWriterPtr writer;
+    xmlBufferPtr buf;
+    xmlChar *tmp;
+  
+    if ((buf = xmlBufferCreate()) == NULL) {
+        printf("testXmlwriterMemory: Error creating the xml buffer\n");
+        return "";
+    }
+  
+    if ((writer = xmlNewTextWriterMemory(buf, 0)) == NULL) {
+        printf("testXmlwriterMemory: Error creating the xml writer\n");
+        return "";
+    }
+  
+    /* Start the document with the xml default for the version,
+     * encoding ISO 8859-1 and the default for the standalone
+     * declaration. */
+    if ((rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL)) < 
0) {
+        printf("testXmlwriterMemory: Error at xmlTextWriterStartDocument\n");
+        return "";
+    }
+  
+    if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "powerguru")) < 0) {
+        printf
+            ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+        return "";
+    }
+  
+    if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "status")) < 0) {
+        printf
+            ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+        return "";
+    }
     
-  /* Add an attribute with name "version" and value "1.0" to status. */
-  if ((rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "version",
+    /* Add an attribute with name "version" and value "1.0" to status. */
+    if ((rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "version",
                                           BAD_CAST "1.0")) < 0) {
-    printf
-      ("testXmlwriterMemory: Error at xmlTextWriterWriteAttribute\n");
-    return "";
-  }
-  
-  // end status tag
-  if ((rc = xmlTextWriterEndElement(writer)) < 0) {
-    printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
-    return "";
-  }
-  
-  /* Close the element named FOOTER. */
-  if ((rc = xmlTextWriterEndElement(writer)) < 0) {
-    printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
-    return "";
-  }
-  
-  if ((rc = xmlTextWriterEndDocument(writer)) < 0) {
-    printf("testXmlwriterMemory: Error at xmlTextWriterEndDocument\n");
-    return "";
-  }
-  
-  xmlFreeTextWriter(writer);
-  
-  //    cerr << "Buffer says: " << (const char *) buf->content << endl;
-  string str = (const char *) buf->content;
-  xmlBufferFree(buf);
-  return str;
+        printf
+            ("testXmlwriterMemory: Error at xmlTextWriterWriteAttribute\n");
+        return "";
+    }
+  
+    // end status tag
+    if ((rc = xmlTextWriterEndElement(writer)) < 0) {
+        printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
+        return "";
+    }
+  
+    /* Close the element named FOOTER. */
+    if ((rc = xmlTextWriterEndElement(writer)) < 0) {
+        printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
+        return "";
+    }
+  
+    if ((rc = xmlTextWriterEndDocument(writer)) < 0) {
+        printf("testXmlwriterMemory: Error at xmlTextWriterEndDocument\n");
+        return "";
+    }
+  
+    xmlFreeTextWriter(writer);
+  
+    //    cerr << "Buffer says: " << (const char *) buf->content << endl;
+    string str = (const char *) buf->content;
+    xmlBufferFree(buf);
+    return str;
 #endif  
 }
 
@@ -609,866 +610,871 @@ Msgs::statusCreate(meter_data_t *md)
 string
 Msgs::heloCreate(float version)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"";
-  _body << _version << "\">";
-  _body << "<client ip=\"" << _remoteip << "\">" << _remotehost << 
"</client>"; 
-  _body << "<server ip=\"" << _thisip   << "\">" << _thishost   << 
"</server>"; 
-  _body << "</powerguru>";
-  _body << ends;
-
-  return _body.str();
+    DEBUGLOG_REPORT_FUNCTION;
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"";
+    _body << _version << "\">";
+    _body << "<client ip=\"" << _remoteip << "\">" << _remotehost << 
"</client>"; 
+    _body << "<server ip=\"" << _thisip   << "\">" << _thishost   << 
"</server>"; 
+    _body << "</powerguru>";
+    _body << ends;
+
+    return _body.str();
 }
 
 string
 Msgs::metersRequestCreate(std::string str) {
-  DEBUGLOG_REPORT_FUNCTION;
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"";
-  _body << _version << "\">";
-  _body << "<meters>" << str.c_str() << "</meters>"; 
-  _body << "</powerguru>";
-  _body << ends;
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"";
+    _body << _version << "\">";
+    _body << "<meters>" << str.c_str() << "</meters>"; 
+    _body << "</powerguru>";
+    _body << ends;
+
+    return _body.str();  
 }
 
 string
 Msgs::metersRequestCreate(xml_meters_e val) {
-  DEBUGLOG_REPORT_FUNCTION;
-  string str;
-
-  switch (val) {
-  case CHARGE_AMPS:
-    str = "charge-amps";
-    break;
-  case AC_LOAD_AMPS:
-    str = "load-amps";
-    break;
-  case BATTERY_VOLTS:
-    str = "battery-volts";
-    break;
-  case AC_VOLTS_OUT:
-    str = "ac-volts-out";
-    break;
-  case AC1_VOLTS_IN:
-    str = "ac1-volts-in";
-    break;
-  case AC2_VOLTS_IN:
-    str = "ac2-volts-in";
-    break;
-  case PV_AMPS_IN:
-    str = "pv-amps-in";
-    break;
-  case PV_VOLTS_IN:
-    str = "pv-volts-in";
-    break;
-  case BUY_AMPS:
-    str = "buy-amps";
-    break;
-  case SELL_AMPS:
-    str = "sell-amps";
-    break;
-  case DAILY_KWH:
-    str = "daily-kwh";
-    break;
-  case HERTZ:
-    str = "hertz";
-    break;
-  case TEMPCOMP_VOLTS:
-    str = "tempcomp";
-    break;
-  default:
-    break;                      // you should never be
-  };
-
-  return metersRequestCreate(str);
+    DEBUGLOG_REPORT_FUNCTION;
+    string str;
+
+    switch (val) {
+      case CHARGE_AMPS:
+          str = "charge-amps";
+          break;
+      case AC_LOAD_AMPS:
+          str = "load-amps";
+          break;
+      case BATTERY_VOLTS:
+          str = "battery-volts";
+          break;
+      case AC_VOLTS_OUT:
+          str = "ac-volts-out";
+          break;
+      case AC1_VOLTS_IN:
+          str = "ac1-volts-in";
+          break;
+      case AC2_VOLTS_IN:
+          str = "ac2-volts-in";
+          break;
+      case PV_AMPS_IN:
+          str = "pv-amps-in";
+          break;
+      case PV_VOLTS_IN:
+          str = "pv-volts-in";
+          break;
+      case BUY_AMPS:
+          str = "buy-amps";
+          break;
+      case SELL_AMPS:
+          str = "sell-amps";
+          break;
+      case DAILY_KWH:
+          str = "daily-kwh";
+          break;
+      case HERTZ:
+          str = "hertz";
+          break;
+      case TEMPCOMP_VOLTS:
+          str = "tempcomp";
+          break;
+      default:
+          break;                      // you should never be
+    };
+
+    return metersRequestCreate(str);
 }
 
 std::string
 Msgs::metersResponseCreate(const xmlChar * type, int val) {
-  DEBUGLOG_REPORT_FUNCTION;
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"";
-  _body << _version << "\">";
-  _body << "<meters><" << (const char *)type << ">";
-  _body << val;
-  _body << "</" << (const char *)type << ">" << "</meters>"; 
-  _body << "</powerguru>";
-  _body << ends;
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"";
+    _body << _version << "\">";
+    _body << "<meters><" << (const char *)type << ">";
+    _body << val;
+    _body << "</" << (const char *)type << ">" << "</meters>"; 
+    _body << "</powerguru>";
+    _body << ends;
+
+    return _body.str();  
 }
 
 std::string
 Msgs::metersResponseCreate(const xmlChar *type, float val) {
-  DEBUGLOG_REPORT_FUNCTION;
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"";
-  _body << _version << "\">";
-  _body << "<meters><" << (const char *)type << ">";
-  _body << val;
-  _body << "</" << (const char *)type << ">" << "</meters>"; 
-  _body << "</powerguru>";
-  _body << ends;
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"";
+    _body << _version << "\">";
+    _body << "<meters><" << (const char *)type << ">";
+    _body << val;
+    _body << "</" << (const char *)type << ">" << "</meters>"; 
+    _body << "</powerguru>";
+    _body << ends;
+
+    return _body.str();  
 }
 
 std::string
 Msgs::metersResponseCreate(const xmlChar *type, string val) {
-  DEBUGLOG_REPORT_FUNCTION;
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"";
-  _body << _version << "\">";
-  _body << "<meters><" << (const char *)type << ">";
-  _body << val;
-  _body << "</" << (const char *)type << ">" << "</meters>"; 
-  _body << "</powerguru>";
-  _body << ends;
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"";
+    _body << _version << "\">";
+    _body << "<meters><" << (const char *)type << ">";
+    _body << val;
+    _body << "</" << (const char *)type << ">" << "</meters>"; 
+    _body << "</powerguru>";
+    _body << ends;
+
+    return _body.str();  
 }
 
 std::string
 Msgs::requestCreate(xml_meters_e tag)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"" << _version << "\"><meters>";
-  switch (tag) {
-  case CHARGE_AMPS:
-    _body << "charge-amps";
-    break;
-  case AC_LOAD_AMPS:
-    _body << "load-amps";
-    break;
-  case BATTERY_VOLTS:
-    _body << "battery-volts";
-    break;
-  case AC_VOLTS_OUT:
-    _body << "ac-volts-out";
-    break;
-  case AC1_VOLTS_IN:
-    _body << "ac1-volts-in";
-    break;
-  case AC2_VOLTS_IN:
-    _body << "ac2-volts-in";
-    break;
-  case PV_AMPS_IN:
-    _body << "pv-amps-in";
-    break;
-  case PV_VOLTS_IN:
-    _body << "pv-volts-in";
-    break;
-  case BUY_AMPS:
-    _body << "buy-amps";
-    break;
-  case SELL_AMPS:
-    _body << "sell-amps";
-    break;
-  case DAILY_KWH:
-    _body << "daily-kwh";
-    break;
-  case HERTZ:
-    _body << "hertz";
-    break;
-  case TEMPCOMP_VOLTS:
-    _body << "tempcomp";
-    break;
-  default:
-    break;                      // you should never be
-  };
-  _body << "</meters></powerguru>";
-  _body << ends;
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"" << _version << "\"><meters>";
+    switch (tag) {
+      case CHARGE_AMPS:
+          _body << "charge-amps";
+          break;
+      case AC_LOAD_AMPS:
+          _body << "load-amps";
+          break;
+      case BATTERY_VOLTS:
+          _body << "battery-volts";
+          break;
+      case AC_VOLTS_OUT:
+          _body << "ac-volts-out";
+          break;
+      case AC1_VOLTS_IN:
+          _body << "ac1-volts-in";
+          break;
+      case AC2_VOLTS_IN:
+          _body << "ac2-volts-in";
+          break;
+      case PV_AMPS_IN:
+          _body << "pv-amps-in";
+          break;
+      case PV_VOLTS_IN:
+          _body << "pv-volts-in";
+          break;
+      case BUY_AMPS:
+          _body << "buy-amps";
+          break;
+      case SELL_AMPS:
+          _body << "sell-amps";
+          break;
+      case DAILY_KWH:
+          _body << "daily-kwh";
+          break;
+      case HERTZ:
+          _body << "hertz";
+          break;
+      case TEMPCOMP_VOLTS:
+          _body << "tempcomp";
+          break;
+      default:
+          break;                      // you should never be
+    };
+    _body << "</meters></powerguru>";
+    _body << ends;
+
+    return _body.str();  
 }
 
 string
 Msgs::requestCreate(xml_status_e tag)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"" << _version << "\"><status>";
-  switch (tag) {
-  case SYSVERSION:
-    _body << "sysversion";
-    break;
-  case REVISION:
-    _body << "revision";
-    break;
-  case ERRORMODE:
-    _body << "errormode";
-    break;
-  case WARNINGMODE:
-    _body << "warningmode";
-    break;
-  case OPMODE:
-    _body << "opmode";
-    break;
-  default:
-    break;
-  };
-  _body << "</status></powerguru>";
-
-  _body << ends;  
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"" << _version << "\"><status>";
+    switch (tag) {
+      case SYSVERSION:
+          _body << "sysversion";
+          break;
+      case REVISION:
+          _body << "revision";
+          break;
+      case ERRORMODE:
+          _body << "errormode";
+          break;
+      case WARNINGMODE:
+          _body << "warningmode";
+          break;
+      case OPMODE:
+          _body << "opmode";
+          break;
+      default:
+          break;
+    };
+    _body << "</status></powerguru>";
+
+    _body << ends;  
+
+    return _body.str();  
 }
 
 string
 Msgs::requestCreate(xml_config_e tag)
 {
-  DEBUGLOG_REPORT_FUNCTION;  
-
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"" << _version << "\"><config>";
-  switch (tag) {
-  case GENCONFIG:
-    _body << "generator";
-    break;
-  case GRIDCONFIG:
-    _body << "grid";
-    break;
-  case BUY:
-    _body << "buy";
-    break;
-  case SELL:
-    _body << "sell";
-    break;
-  case CHARGE:
-    _body << "charge";
-    break;
-  default:
-    break;
-  };
-  _body << "</config></powerguru>";
-
-  _body << ends;  
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;  
+
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"" << _version << "\"><config>";
+    switch (tag) {
+      case GENCONFIG:
+          _body << "generator";
+          break;
+      case GRIDCONFIG:
+          _body << "grid";
+          break;
+      case BUY:
+          _body << "buy";
+          break;
+      case SELL:
+          _body << "sell";
+          break;
+      case CHARGE:
+          _body << "charge";
+          break;
+      default:
+          break;
+    };
+    _body << "</config></powerguru>";
+
+    _body << ends;  
+
+    return _body.str();  
 }
 
 string
 Msgs::requestCreate(xml_command_e tag)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"" << _version << "\"><status>";
-  switch (tag) {
-  case GENERATOR:
-    _body << "generator";
-    break;
-  case GRID:
-    _body << "grid";
-    break;
-  case RELAY:
-    _body << "relay";
-    break;
-  case AUXILARY:
-    _body << "auxilary";
-    break;
-  case POLL:
-    _body << "poll";
-    break;
-  case INVERTER:
-    _body << "inverter";
-    break;
-  case CHARGER:
-    _body << "charger";
-    break;
-  default:
-    break;
-  };
-  _body << "</status></powerguru>";
-
-  _body << ends;  
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"" << _version << "\"><status>";
+    switch (tag) {
+      case GENERATOR:
+          _body << "generator";
+          break;
+      case GRID:
+          _body << "grid";
+          break;
+      case RELAY:
+          _body << "relay";
+          break;
+      case AUXILARY:
+          _body << "auxilary";
+          break;
+      case POLL:
+          _body << "poll";
+          break;
+      case INVERTER:
+          _body << "inverter";
+          break;
+      case CHARGER:
+          _body << "charger";
+          break;
+      default:
+          break;
+    };
+    _body << "</status></powerguru>";
+
+    _body << ends;  
+
+    return _body.str();  
 }
 
 
 std::string
 Msgs::responseCreate(xml_msg_e type, const xmlChar *tag, string val)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string str;
-  
-  switch (type) {
-  case HEARTBEAT:
-    str = "heartbeat";
-    break;
-  case STATUS:
-    str = "status";
-    break;
-  case METER:
-    str = "meters";
-    break;
-  case CONFIG:
-    str = "meters";
-    break;
-  case COMMAND:
-    str = "meters";
-    break;
-  };
-  
-  _body.str("");                // erase the current string
-  _body << "<powerguru version=\"";
-  _body << _version << "\"><" << str;
-  _body << "><" << (const char *)tag << ">";
-  _body << val;
-  _body << "</" << (const char *)tag << "></" << str; 
-  _body << "></powerguru>";
-  _body << ends;
-
-  return _body.str();  
+    DEBUGLOG_REPORT_FUNCTION;
+    string str;
+  
+    switch (type) {
+      case HEARTBEAT:
+          str = "heartbeat";
+          break;
+      case STATUS:
+          str = "status";
+          break;
+      case METER:
+          str = "meters";
+          break;
+      case CONFIG:
+          str = "meters";
+          break;
+      case COMMAND:
+          str = "meters";
+          break;
+    };
+  
+    _body.str("");                // erase the current string
+    _body << "<powerguru version=\"";
+    _body << _version << "\"><" << str;
+    _body << "><" << (const char *)tag << ">";
+    _body << val;
+    _body << "</" << (const char *)tag << "></" << str; 
+    _body << "></powerguru>";
+    _body << ends;
+
+    return _body.str();  
 }
 
 string
 Msgs::configCreate(string tag, int value)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  _body.str("");                // erase the current string
-  _body << "<powerguru>";
-  _body << "<" << tag << ">" << value << "</" << tag << ">";
-  _body << "</powerguru>";
-  _body << ends;
-  
-  return _body.str();
+    DEBUGLOG_REPORT_FUNCTION;
+    _body.str("");                // erase the current string
+    _body << "<powerguru>";
+    _body << "<" << tag << ">" << value << "</" << tag << ">";
+    _body << "</powerguru>";
+    _body << ends;
+  
+    return _body.str();
 }
 
 void
 Msgs::print_msg(std::string msg)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  int level = 1;
-  int start = 0;
-  size_t pos;
-  string str, prefix, newmsg;
-  const char *tabs[] = {
-    "\r\n\t",
-    "\r\n\t\t",
-    "\r\n\t\t\t",
-    "\r\n\t\t\t\t",
-    "\r\n\t\t\t\t",
-    "\r\n\t\t\t\t\t",
-  };
-  
-  xmlDebugDumpString(stderr, (const xmlChar *)msg.c_str());
-  //  cerr << "++++++++++++++++++++++" << endl;
-  
-  // Strip off the DTD header, as we're not bothering to validate
-  // our XML.
-  if ((pos = msg.find("?>\n", start)) != string::npos) {
-    newmsg = msg.substr(pos+3, msg.size());
-  } else {
-    newmsg = msg;
-  }  
-
-  start = 0;
-  while ((pos = newmsg.find('\n', start)) != string::npos) {
-    newmsg.erase(pos, 1);
-  }  
+    // DEBUGLOG_REPORT_FUNCTION;
+    int level = 1;
+    int start = 0;
+    size_t pos;
+    string str, prefix, newmsg;
+    const char *tabs[] = {
+        "\r\n\t",
+        "\r\n\t\t",
+        "\r\n\t\t\t",
+        "\r\n\t\t\t\t",
+        "\r\n\t\t\t\t",
+        "\r\n\t\t\t\t\t",
+    };
+  
+    xmlDebugDumpString(stderr, (const xmlChar *)msg.c_str());
+    //  cerr << "++++++++++++++++++++++" << endl;
+  
+    // Strip off the DTD header, as we're not bothering to validate
+    // our XML.
+    if ((pos = msg.find("?>\n", start)) != string::npos) {
+        newmsg = msg.substr(pos+3, msg.size());
+    } else {
+        newmsg = msg;
+    }  
+
+    start = 0;
+    while ((pos = newmsg.find('\n', start)) != string::npos) {
+        newmsg.erase(pos, 1);
+    }  
 
 //   while ((pos = newmsg.find("><", start)) != string::npos) {
 //     newmsg.insert(pos+1, "GGGGGG");
 //   }  
 
-  start = 0;
-  while ((pos = newmsg.find('>', start)) != string::npos) {
-    str = newmsg.substr(start, newmsg.find('>', start) - start + 1);
-    start += str.size();
-    if ((pos = str.rfind(">", start)) != string::npos) {
-      //      str.insert(pos+1, "FFFF");
-      str.insert(pos+1, tabs[level]);
-      level++;
-    }
-    if ((pos = str.rfind("</", start)) != string::npos) {
-      //      cerr << "EEEE";
-      //      str.insert(pos, "EEEE");
-      level--;
-      str.insert(pos, tabs[level]);
-    }
+    start = 0;
+    while ((pos = newmsg.find('>', start)) != string::npos) {
+        str = newmsg.substr(start, newmsg.find('>', start) - start + 1);
+        start += str.size();
+        if ((pos = str.rfind(">", start)) != string::npos) {
+            //      str.insert(pos+1, "FFFF");
+            str.insert(pos+1, tabs[level]);
+            level++;
+        }
+        if ((pos = str.rfind("</", start)) != string::npos) {
+            //      cerr << "EEEE";
+            //      str.insert(pos, "EEEE");
+            level--;
+            str.insert(pos, tabs[level]);
+        }
       
-    cerr << str;
-    //    cerr << prefix << str;
-  }
-  //cerr << newmsg.substr(start, newmsg.size()) << endl;
+        cerr << str;
+        //    cerr << prefix << str;
+    }
+    //cerr << newmsg.substr(start, newmsg.size()) << endl;
 }
 
 // These parse incoming messages for the daemon
 retcode_t
 Msgs::statusProcess(XMLNode *node)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  //  XMLNode *child;
-  //  unsigned int i;
-  string str;
-  _body.str("");
-  _body << _version;
-
-  // dbglogfile << BAD_CAST node->valueGet() << endl;
-  
-  if (_net_mode == DAEMON) {
-    if (xmlStrcmp(node->valueGet(), BAD_CAST "sysversion") == 0) {
-      str = responseCreate(STATUS, node->valueGet(), _body.str().c_str());
-    } else if (xmlStrcmp(node->valueGet(), BAD_CAST "revision") == 0) {
-      str = responseCreate(STATUS, node->valueGet(), "0.0");
-    } else if (xmlStrcmp(node->valueGet(), BAD_CAST "opmode") == 0) {
-      str = responseCreate(STATUS, node->valueGet(), "none");
-    } else if (xmlStrcmp(node->valueGet(), BAD_CAST "warningmode") == 0) {
-      str = responseCreate(STATUS, node->valueGet(), "none");    
-    } else if (xmlStrcmp(node->valueGet(), BAD_CAST "errormode") == 0) {
-      str = responseCreate(STATUS, node->valueGet(), "none");
-    }
+    DEBUGLOG_REPORT_FUNCTION;
+    //  XMLNode *child;
+    //  unsigned int i;
+    string str;
+    _body.str("");
+    _body << _version;
+
+    // dbglogfile << BAD_CAST node->valueGet() << endl;
+  
+    if (_net_mode == DAEMON) {
+        if (xmlStrcmp(node->valueGet(), BAD_CAST "sysversion") == 0) {
+            str = responseCreate(STATUS, node->valueGet(), 
_body.str().c_str());
+        } else if (xmlStrcmp(node->valueGet(), BAD_CAST "revision") == 0) {
+            str = responseCreate(STATUS, node->valueGet(), "0.0");
+        } else if (xmlStrcmp(node->valueGet(), BAD_CAST "opmode") == 0) {
+            str = responseCreate(STATUS, node->valueGet(), "none");
+        } else if (xmlStrcmp(node->valueGet(), BAD_CAST "warningmode") == 0) {
+            str = responseCreate(STATUS, node->valueGet(), "none");    
+        } else if (xmlStrcmp(node->valueGet(), BAD_CAST "errormode") == 0) {
+            str = responseCreate(STATUS, node->valueGet(), "none");
+        }
     
-    if (writeNet(str)) {
-      return ERROR;
-    } else {
-      return SUCCESS;
+        if (writeNet(str)) {
+            return ERROR;
+        } else {
+            return SUCCESS;
+        }
     }
-  }
 
-  if (_net_mode == CLIENT) {
-    if (xmlStrcmp(node->nameGet(), BAD_CAST "status") == 0) {
-      return SUCCESS;
-    }
+    if (_net_mode == CLIENT) {
+        if (xmlStrcmp(node->nameGet(), BAD_CAST "status") == 0) {
+            return SUCCESS;
+        }
 
 #if 0
-    if        (xmlStrcmp(node->nameGet(), BAD_CAST "revision") == 0) {
-      //cerr << "VER" << endl;
-    } else if (xmlStrcmp(node->nameGet(), BAD_CAST "sysversion") == 0) {
-      //cerr << "REV" << endl;
-    } else if (xmlStrcmp(node->nameGet(), BAD_CAST "opmode") == 0) {
-      //cerr << "OP" << endl;
-    } else if (xmlStrcmp(node->nameGet(), BAD_CAST "warningmode") == 0) {
-      //cerr << "WARN" << endl;
-    } else if (xmlStrcmp(node->nameGet(), BAD_CAST "errormode") == 0) {
-      //cerr << "ERROR" << endl;
-    }
+        if        (xmlStrcmp(node->nameGet(), BAD_CAST "revision") == 0) {
+            //cerr << "VER" << endl;
+        } else if (xmlStrcmp(node->nameGet(), BAD_CAST "sysversion") == 0) {
+            //cerr << "REV" << endl;
+        } else if (xmlStrcmp(node->nameGet(), BAD_CAST "opmode") == 0) {
+            //cerr << "OP" << endl;
+        } else if (xmlStrcmp(node->nameGet(), BAD_CAST "warningmode") == 0) {
+            //cerr << "WARN" << endl;
+        } else if (xmlStrcmp(node->nameGet(), BAD_CAST "errormode") == 0) {
+            //cerr << "ERROR" << endl;
+        }
 #endif
 
-    cacheAdd(node->nameGet(), (const char*)node->valueGet());
-    dbglogfile << "tag \"" << node->nameGet() << "\" has a value of: " << 
node->valueGet() << endl;
+        cacheAdd(node->nameGet(), (const char*)node->valueGet());
+        dbglogfile << "tag \"" << node->nameGet() << "\" has a value of: " << 
node->valueGet() << endl;
     
-    return SUCCESS;
-  }
+        return SUCCESS;
+    }
   
-  return ERROR;                 // FIXME: implement this method
+    return ERROR;                 // FIXME: implement this method
 }
 
 retcode_t
 Msgs::heloProcess(XMLNode *node)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  dbglogfile << "WARNING: unimplemented method" << endl;
+    DEBUGLOG_REPORT_FUNCTION;
+    dbglogfile << "WARNING: unimplemented method" << endl;
   
-  return ERROR;                 // FIXME: implement this method
+    return ERROR;                 // FIXME: implement this method
 }
 
 retcode_t
 Msgs::configProcess(XMLNode *node)
 {
-   DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  return unimplementedProcess(node);    // FIXME: implement this method
+    return unimplementedProcess(node);    // FIXME: implement this method
 }
 
 retcode_t
 Msgs::metersProcess(XMLNode *node)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet()
-             << " and mode is: " << (int)_net_mode << endl;
-
-  if(_net_mode == DAEMON) {
-    //cacheDump();
-    //    const xmlChar *xxx = node->nameGet();
-    string value = cacheGet(node->valueGet());
-    dbglogfile << "value for \"" << node->valueGet() << "\" is " << 
value.c_str() << endl;
-    if (value.size() == 0) {
-    } else {
+    DEBUGLOG_REPORT_FUNCTION;
+
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet()
+               << " and mode is: " << (int)_net_mode << endl;
+
+    if(_net_mode == DAEMON) {
+        //cacheDump();
+        //    const xmlChar *xxx = node->nameGet();
+        string value = cacheGet(node->valueGet());
+        dbglogfile << "value for \"" << node->valueGet() << "\" is " << 
value.c_str() << endl;
+        if (value.size() == 0) {
+        } else {
       
-    }
+        }
   
-    string str = metersResponseCreate(node->valueGet(), value);
-    if (writeNet(str)) {
-      return ERROR;
-    } else {
-      return SUCCESS;
+        string str = metersResponseCreate(node->valueGet(), value);
+        if (writeNet(str)) {
+            return ERROR;
+        } else {
+            return SUCCESS;
+        }
     }
-  }
 
-  if (_net_mode == CLIENT) {
-    //dbglogfile << node->valueGet()
-    // Process the result
-  }
+    if (_net_mode == CLIENT) {
+        //dbglogfile << node->valueGet()
+        // Process the result
+    }
 
-  return ERROR;
+    return ERROR;
 }
 
 retcode_t
 Msgs::serverProcess(XMLNode *node)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
-  XMLAttr *attr;
+    //  DEBUGLOG_REPORT_FUNCTION;
+    XMLAttr *attr;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->hasAttributes()) {
-    if ((attr = node->attribGet(0))) {
-      dbglogfile << "\tAttribute is \"" << attr->nameGet()
-                 << "\" with a value of " << attr->valueGet() << endl;
-      if (xmlStrcmp(attr->valueGet(), (const xmlChar *)_thisip.c_str()) != 0) {
-        dbglogfile << "WARNING: IP's don't match!!!!" << endl;
-        return ERROR;
-      }
+    if (node->hasAttributes()) {
+        if ((attr = node->attribGet(0))) {
+            dbglogfile << "\tAttribute is \"" << attr->nameGet()
+                       << "\" with a value of " << attr->valueGet() << endl;
+            if (xmlStrcmp(attr->valueGet(), (const xmlChar *)_thisip.c_str()) 
!= 0) {
+                dbglogfile << "WARNING: IP's don't match!!!!" << endl;
+                return ERROR;
+            }
+        }
     }
-  }
 
-  if (xmlStrcmp(node->valueGet(), (const xmlChar *)_thishost.c_str()) != 0) {
-    dbglogfile << "WARNING: Host's don't match!!!!" << endl;
-    return ERROR;
-  }
+    if (xmlStrcmp(node->valueGet(), (const xmlChar *)_thishost.c_str()) != 0) {
+        dbglogfile << "WARNING: Host's don't match!!!!" << endl;
+        return ERROR;
+    }
 
-  dbglogfile << "Host and IP data match" << endl;
-  return SUCCESS;
+    dbglogfile << "Host and IP data match" << endl;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::clientProcess(XMLNode *node)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  XMLAttr *attr;
+    // DEBUGLOG_REPORT_FUNCTION;
+    XMLAttr *attr;
 
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (_remoteip.size() > 0) {
-    if (node->hasAttributes()) {
-      if ((attr = node->attribGet(0))) {
-        dbglogfile << "\tAttribute is \"" << attr->nameGet()
-                   << "\" with a value of " << attr->valueGet() << endl;
-        if (xmlStrcmp(attr->valueGet(), (const xmlChar *)_remoteip.c_str()) != 
0) {
-          dbglogfile << "WARNING: IP's don't match!!!!" << endl;
-          return ERROR;
+    if (_remoteip.size() > 0) {
+        if (node->hasAttributes()) {
+            if ((attr = node->attribGet(0))) {
+                dbglogfile << "\tAttribute is \"" << attr->nameGet()
+                           << "\" with a value of " << attr->valueGet() << 
endl;
+                if (xmlStrcmp(attr->valueGet(), (const xmlChar 
*)_remoteip.c_str()) != 0) {
+                    dbglogfile << "WARNING: IP's don't match!!!!" << endl;
+                    return ERROR;
+                }
+            }
         }
-      }
     }
-  }
 
-  if (_remotehost.size() != 0) {
-    if (xmlStrcmp(node->valueGet(), (const xmlChar *)_remotehost.c_str()) != 
0) {
-      dbglogfile << "WARNING: Host's don't match!!!!" << endl;
-      return ERROR;
+    if (_remotehost.size() != 0) {
+        if (xmlStrcmp(node->valueGet(), (const xmlChar *)_remotehost.c_str()) 
!= 0) {
+            dbglogfile << "WARNING: Host's don't match!!!!" << endl;
+            return ERROR;
+        }
     }
-  }
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Process the top level header tag.
 retcode_t
 Msgs::powerguruProcess(XMLNode *node)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  XMLAttr *attr;
+    DEBUGLOG_REPORT_FUNCTION;
+    XMLAttr *attr;
 
-  _body.str("");
-  _body << _version;
+    _body.str("");
+    _body << _version;
   
 //   dbglogfile << "Node is \"" << node->nameGet()
 //              << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->hasAttributes()) {
-    if ((attr = node->attribGet(0))) {
+    if (node->hasAttributes()) {
+        if ((attr = node->attribGet(0))) {
 //       dbglogfile << "\tAttribute is \"" << attr->nameGet().c_str()
 //                  << "\" with a value of " << attr->valueGet().c_str() << 
endl;
-      if (xmlStrcmp((const xmlChar *)_body.str().c_str(), attr->valueGet()) != 
0) {
-        dbglogfile << "Versions in header don't match!" << endl;
-      } else {
-        dbglogfile << "Versions in header match" << endl;        
-      }
+            if (xmlStrcmp((const xmlChar *)_body.str().c_str(), 
attr->valueGet()) != 0) {
+                dbglogfile << "Versions in header don't match!" << endl;
+            } else {
+                dbglogfile << "Versions in header match" << endl;        
+            }
+        }
     }
-  }
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::chargeAmpsProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::loadAmpsProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    //    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        //    return ERROR;
+    }
   
-  if (_net_mode == CLIENT) {
-    dbglogfile << "Battery voltage is: " << node->valueGet() << endl;
+    if (_net_mode == CLIENT) {
+        dbglogfile << "Battery voltage is: " << node->valueGet() << endl;
     
-    return SUCCESS;
-  }
+        return SUCCESS;
+    }
   
-  if (_net_mode == DAEMON) {
-    string str = metersResponseCreate(node->valueGet(), 
_cache[node->nameGet()]);
+    if (_net_mode == DAEMON) {
+        string str = metersResponseCreate(node->valueGet(), 
_cache[node->nameGet()]);
     
-    return SUCCESS;
-  }
+        return SUCCESS;
+    }
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::pvAmpsProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::pvVoltsProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::dailyKwhProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::hertzProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::batteryVoltsProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
 //   dbglogfile << "Node is \"" << node->nameGet()
 //              << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    //    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        //    return ERROR;
+    }
 
-  if (_net_mode == CLIENT) {
-    dbglogfile << "Battery voltage is: " << node->valueGet() << endl;
+    if (_net_mode == CLIENT) {
+        dbglogfile << "Battery voltage is: " << node->valueGet() << endl;
     
-    return SUCCESS;
-  }
+        return SUCCESS;
+    }
   
-  if (_net_mode == DAEMON) {
-    string str = metersResponseCreate(node->valueGet(), 
_cache[node->nameGet()]);
+    if (_net_mode == DAEMON) {
+        string str = metersResponseCreate(node->valueGet(), 
_cache[node->nameGet()]);
     
-    return SUCCESS;
-  }
+        return SUCCESS;
+    }
   
-  return ERROR;
+    return ERROR;
 }
 
 retcode_t
 Msgs::buyAmpsProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::sellAmpsProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::acVoltsOutProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
   
 retcode_t
 Msgs::ac1InProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::ac2InProcess(XMLNode *node) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
+    }
       
-  return SUCCESS;
+    return SUCCESS;
 }
 
 retcode_t
 Msgs::findTag(std::string tag)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  size_t pos;
+    DEBUGLOG_REPORT_FUNCTION;
+    size_t pos;
 
-  _body.str("");
+    _body.str("");
 
-  _body << "<" << tag << ">";
-  if ((pos = tag.find(_body.str(), 0)) != string::npos) {
-    return SUCCESS;
-  }
-  return ERROR;
+    _body << "<" << tag << ">";
+    if ((pos = tag.find(_body.str(), 0)) != string::npos) {
+        return SUCCESS;
+    }
+    return ERROR;
 }
 
 
 retcode_t
 Msgs::commandProcess(XMLNode *node)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string str;
+    DEBUGLOG_REPORT_FUNCTION;
+    string str;
   
-  dbglogfile << "Node is \"" << node->nameGet()
-             << "\" with a value of " << node->valueGet() << endl;
+    dbglogfile << "Node is \"" << node->nameGet()
+               << "\" with a value of " << node->valueGet() << endl;
       
-  if (node->valueGet() <= 0) {
-    dbglogfile << "ERROR: no value in messages!" << endl;
-    return ERROR;
-  }
-
-  _body.str("");
-  _body << _version;
-
-  // dbglogfile << BAD_CAST node->valueGet() << endl;
-  
-  if (_net_mode == DAEMON) {
-    if (xmlStrcmp(node->valueGet(), BAD_CAST "auxilary") == 0) {
-      str = responseCreate(COMMAND, node->valueGet(), "0.0");
-    } else if (xmlStrcmp(node->valueGet(), BAD_CAST "relay") == 0) {
-      str = responseCreate(COMMAND, node->valueGet(), "none");
-    } else if (xmlStrcmp(node->valueGet(), BAD_CAST "poll") == 0) {
-      str = responseCreate(COMMAND, node->valueGet(), "inverter");    
-    } else if (xmlStrcmp(node->valueGet(), BAD_CAST "") == 0) {
-      str = responseCreate(COMMAND, node->valueGet(), "charger");
+    if (node->valueGet() <= 0) {
+        dbglogfile << "ERROR: no value in messages!" << endl;
+        return ERROR;
     }
+
+    _body.str("");
+    _body << _version;
+
+    // dbglogfile << BAD_CAST node->valueGet() << endl;
+  
+    if (_net_mode == DAEMON) {
+        if (xmlStrcmp(node->valueGet(), BAD_CAST "auxilary") == 0) {
+            str = responseCreate(COMMAND, node->valueGet(), "0.0");
+        } else if (xmlStrcmp(node->valueGet(), BAD_CAST "relay") == 0) {
+            str = responseCreate(COMMAND, node->valueGet(), "none");
+        } else if (xmlStrcmp(node->valueGet(), BAD_CAST "poll") == 0) {
+            str = responseCreate(COMMAND, node->valueGet(), "inverter");    
+        } else if (xmlStrcmp(node->valueGet(), BAD_CAST "") == 0) {
+            str = responseCreate(COMMAND, node->valueGet(), "charger");
+        }
     
-    if (writeNet(str)) {
-      return ERROR;
-    } else {
-      return SUCCESS;
+        if (writeNet(str)) {
+            return ERROR;
+        } else {
+            return SUCCESS;
+        }
     }
-  }
 
-  if (_net_mode == CLIENT) {
-    if (xmlStrcmp(node->nameGet(), BAD_CAST "command") == 0) {
-      return SUCCESS;
-    }
+    if (_net_mode == CLIENT) {
+        if (xmlStrcmp(node->nameGet(), BAD_CAST "command") == 0) {
+            return SUCCESS;
+        }
 
 
-    cacheAdd(node->nameGet(), (const char*)node->valueGet());
-    dbglogfile << "tag \"" << node->nameGet() << "\" has a value of: " << 
node->valueGet() << endl;
+        cacheAdd(node->nameGet(), (const char*)node->valueGet());
+        dbglogfile << "tag \"" << node->nameGet() << "\" has a value of: " << 
node->valueGet() << endl;
     
-    return SUCCESS;
-  }
-  return ERROR;  
+        return SUCCESS;
+    }
+    return ERROR;  
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/msgs.h b/lib/msgs.h
index 4225b96..35ae275 100644
--- a/lib/msgs.h
+++ b/lib/msgs.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -40,65 +41,65 @@
 #include "tcpip.h"
 
 class Msgs : public Tcpip {
- public:
-
-  typedef enum {
-    NONET,
-    DAEMON,
-    CLIENT
-  } net_mode_e;
-
-  typedef enum {
-    CHARGE_AMPS,
-    AC_LOAD_AMPS,
-    BATTERY_VOLTS,
-    AC_VOLTS_OUT,
-    AC1_VOLTS_IN,
-    AC2_VOLTS_IN,
-    PV_AMPS_IN,
-    PV_VOLTS_IN,
-    BUY_AMPS,
-    SELL_AMPS,
-    DAILY_KWH,
-    HERTZ,
-    TEMPCOMP_VOLTS
-  } xml_meters_e;
-
-  typedef enum {
-    SYSVERSION,
-    REVISION,
-    OPMODE,
-    ERRORMODE,
-    WARNINGMODE
-  } xml_status_e;
+public:
+
+    typedef enum {
+        NONET,
+        DAEMON,
+        CLIENT
+    } net_mode_e;
+
+    typedef enum {
+        CHARGE_AMPS,
+        AC_LOAD_AMPS,
+        BATTERY_VOLTS,
+        AC_VOLTS_OUT,
+        AC1_VOLTS_IN,
+        AC2_VOLTS_IN,
+        PV_AMPS_IN,
+        PV_VOLTS_IN,
+        BUY_AMPS,
+        SELL_AMPS,
+        DAILY_KWH,
+        HERTZ,
+        TEMPCOMP_VOLTS
+    } xml_meters_e;
+
+    typedef enum {
+        SYSVERSION,
+        REVISION,
+        OPMODE,
+        ERRORMODE,
+        WARNINGMODE
+    } xml_status_e;
   
-  typedef enum {
-    GENERATOR,
-    GRID,
-    RELAY,
-    AUXILARY,
-    POLL,
-    INVERTER,
-    CHARGER
-  } xml_command_e;
+    typedef enum {
+        GENERATOR,
+        GRID,
+        RELAY,
+        AUXILARY,
+        POLL,
+        INVERTER,
+        CHARGER
+    } xml_command_e;
   
-  typedef enum {
-    GENCONFIG,
-    GRIDCONFIG,
-    BUY,
-    SELL,
-    CHARGE
-  } xml_config_e;
-
-  typedef enum {
-    METER,
-    STATUS,
-    COMMAND,
-    CONFIG,
-    HEARTBEAT
-  } xml_msg_e;
+    typedef enum {
+        GENCONFIG,
+        GRIDCONFIG,
+        BUY,
+        SELL,
+        CHARGE
+    } xml_config_e;
+
+    typedef enum {
+        METER,
+        STATUS,
+        COMMAND,
+        CONFIG,
+        HEARTBEAT
+    } xml_msg_e;
   
-  typedef retcode_t (Msgs::*methodPtr_t)(XMLNode *node);
+    typedef retcode_t (Msgs::*methodPtr_t)(XMLNode *node);
 
 //   struct msg_data 
 //   {
@@ -106,107 +107,112 @@ class Msgs : public Tcpip {
 //     std::string name;
 //   };
 
-  Msgs();
-  Msgs(std::string host, std::string ip);
-  Msgs(Tcpip *tcpip);
-  ~Msgs();
-
-  retcode_t init(void);
-  retcode_t init(net_mode_e mode);
-  retcode_t init(std::string hostname);
-  retcode_t init(net_mode_e mode, std::string hostname);
-  retcode_t init(bool block);
-  retcode_t init(net_mode_e mode, bool block);
+    Msgs();
+    Msgs(std::string host, std::string ip);
+    Msgs(Tcpip *tcpip);
+    ~Msgs();
+
+    retcode_t init(void);
+    retcode_t init(net_mode_e mode);
+    retcode_t init(std::string hostname);
+    retcode_t init(net_mode_e mode, std::string hostname);
+    retcode_t init(bool block);
+    retcode_t init(net_mode_e mode, bool block);
   
-  void dump(XMLNode *datain);
-  void process(XMLNode *datain);
+    void dump(XMLNode *datain);
+    void process(XMLNode *datain);
   
-  // These parse incoming messages for the daemon
-  retcode_t statusProcess(XMLNode *node);
-  retcode_t powerguruProcess(XMLNode *node);
+    // These parse incoming messages for the daemon
+    retcode_t statusProcess(XMLNode *node);
+    retcode_t powerguruProcess(XMLNode *node);
   
-  retcode_t heloProcess(XMLNode *node);
-  retcode_t serverProcess(XMLNode *node);
-  retcode_t clientProcess(XMLNode *node);
+    retcode_t heloProcess(XMLNode *node);
+    retcode_t serverProcess(XMLNode *node);
+    retcode_t clientProcess(XMLNode *node);
   
-  retcode_t configProcess(XMLNode *node);
-
-  // These are all the tags associated with meters
-  retcode_t metersProcess(XMLNode *node);
-  retcode_t chargeAmpsProcess(XMLNode *node);
-  retcode_t loadAmpsProcess(XMLNode *node);
-  retcode_t pvAmpsProcess(XMLNode *node);
-  retcode_t pvVoltsProcess(XMLNode *node);
-  retcode_t dailyKwhProcess(XMLNode *node);
-  retcode_t hertzProcess(XMLNode *node);
-  retcode_t batteryVoltsProcess(XMLNode *node);
-  retcode_t buyAmpsProcess(XMLNode *node);
-  retcode_t sellAmpsProcess(XMLNode *node);
-  retcode_t acVoltsOutProcess(XMLNode *node);
-  retcode_t ac1InProcess(XMLNode *node);
-  retcode_t ac2InProcess(XMLNode *node);
-
-  retcode_t unimplementedProcess(XMLNode *node);
-
-  // These are all the system commands
-  retcode_t commandProcess(XMLNode *node);
-
-  // These format client side messages to the daemon
-  std::string statusCreate(meter_data_t *data);
+    retcode_t configProcess(XMLNode *node);
+
+    // These are all the tags associated with meters
+    retcode_t metersProcess(XMLNode *node);
+    retcode_t chargeAmpsProcess(XMLNode *node);
+    retcode_t loadAmpsProcess(XMLNode *node);
+    retcode_t pvAmpsProcess(XMLNode *node);
+    retcode_t pvVoltsProcess(XMLNode *node);
+    retcode_t dailyKwhProcess(XMLNode *node);
+    retcode_t hertzProcess(XMLNode *node);
+    retcode_t batteryVoltsProcess(XMLNode *node);
+    retcode_t buyAmpsProcess(XMLNode *node);
+    retcode_t sellAmpsProcess(XMLNode *node);
+    retcode_t acVoltsOutProcess(XMLNode *node);
+    retcode_t ac1InProcess(XMLNode *node);
+    retcode_t ac2InProcess(XMLNode *node);
+
+    retcode_t unimplementedProcess(XMLNode *node);
+
+    // These are all the system commands
+    retcode_t commandProcess(XMLNode *node);
+
+    // These format client side messages to the daemon
+    std::string statusCreate(meter_data_t *data);
   
-  std::string heloCreate(float version);
+    std::string heloCreate(float version);
   
-  std::string configCreate(std::string tag, int value);
-  std::string configCreate(std::string tag, float value);
-  std::string metersRequestCreate(std::string str);
-  std::string metersRequestCreate(xml_meters_e type);
+    std::string configCreate(std::string tag, int value);
+    std::string configCreate(std::string tag, float value);
+    std::string metersRequestCreate(std::string str);
+    std::string metersRequestCreate(xml_meters_e type);
 
-  // This formats a response from the daemon to the client
-  std::string metersResponseCreate(const xmlChar *tag, int val);
-  std::string metersResponseCreate(const xmlChar *tag, float val);
-  std::string metersResponseCreate(const xmlChar *tag, std::string);
+    // This formats a response from the daemon to the client
+    std::string metersResponseCreate(const xmlChar *tag, int val);
+    std::string metersResponseCreate(const xmlChar *tag, float val);
+    std::string metersResponseCreate(const xmlChar *tag, std::string);
 
-  std::string responseCreate(xml_msg_e type, const xmlChar *tag, std::string);
+    std::string responseCreate(xml_msg_e type, const xmlChar *tag, 
std::string);
   
-  std::string requestCreate(xml_meters_e tag);
-  std::string requestCreate(xml_status_e tag);
-  std::string requestCreate(xml_config_e tag);
-  std::string requestCreate(xml_command_e tag);
+    std::string requestCreate(xml_meters_e tag);
+    std::string requestCreate(xml_status_e tag);
+    std::string requestCreate(xml_config_e tag);
+    std::string requestCreate(xml_command_e tag);
 
-  std::string packet(void) { return _body.str(); }
-  void print_msg(std::string msg);
+    std::string packet(void) { return _body.str(); }
+    void print_msg(std::string msg);
 
-  void methodSet(const xmlChar *name, methodPtr_t func);
-  methodPtr_t methodGet(const xmlChar *name);
-  retcode_t methodProcess(const xmlChar *name, XMLNode *node);
-  void methodsDump(void);
+    void methodSet(const xmlChar *name, methodPtr_t func);
+    methodPtr_t methodGet(const xmlChar *name);
+    retcode_t methodProcess(const xmlChar *name, XMLNode *node);
+    void methodsDump(void);
 
-  std::string cacheGet(const xmlChar *name);
-  retcode_t cacheAdd(const xmlChar *name, std::string);
-  void cacheDump(void);
+    std::string cacheGet(const xmlChar *name);
+    retcode_t cacheAdd(const xmlChar *name, std::string);
+    void cacheDump(void);
 
-  std::string thisIPGet(void) { return _thisip; };
-  std::string remoteIPGet(void) { return _thishost; }; 
-  std::string thisHostnameGet(void) { return _remoteip; };
-  std::string remoteHostnameGet(void) { return _remotehost; };
+    std::string thisIPGet(void) { return _thisip; };
+    std::string remoteIPGet(void) { return _thishost; }; 
+    std::string thisHostnameGet(void) { return _remoteip; };
+    std::string remoteHostnameGet(void) { return _remotehost; };
 
-  retcode_t findTag(std::string tag);
+    retcode_t findTag(std::string tag);
   
 private:
-  float               _version;
-  static std::map<const xmlChar *, methodPtr_t> _methods;
-  static std::map<const xmlChar *, std::string> _cache;
-  static net_mode_e   _net_mode;
+    float               _version;
+    static std::map<const xmlChar *, methodPtr_t> _methods;
+    static std::map<const xmlChar *, std::string> _cache;
+    static net_mode_e   _net_mode;
 #ifdef __STDC_HOSTED__
-  std::ostringstream  _body;
+    std::ostringstream  _body;
 #else
-  std::ostrstream     _body;
+    std::ostrstream     _body;
 #endif
-  std::string         _thisip;
-  std::string         _thishost;
-  std::string         _remoteip;
-  std::string         _remotehost;
+    std::string         _thisip;
+    std::string         _thishost;
+    std::string         _remoteip;
+    std::string         _remotehost;
 };
 
 // end of __MSGS_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/mysql.cc b/lib/mysql.cc
index 228ac92..cd9cf32 100644
--- a/lib/mysql.cc
+++ b/lib/mysql.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -62,9 +63,9 @@ Database::Database()
 
 Database::~Database()
 {
-  if (_connection) {
-    //closeDB();
-  }
+    if (_connection) {
+        //closeDB();
+    }
 }
 
 // Accessors
@@ -96,7 +97,7 @@ Database::dbHostSet(std::string host)
 bool
 Database::openDB (void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 
     unsigned long flag = 0;
 
@@ -106,12 +107,12 @@ Database::openDB (void)
 
     mysql_init(&_mysql);
     _connection = mysql_real_connect(&_mysql, _dbhost.c_str(), _dbuser.c_str(),
-        _dbpasswd.c_str(), _dbname.c_str(), 0, NULL, flag);
+                                     _dbpasswd.c_str(), _dbname.c_str(), 0, 
NULL, flag);
 
     /* check for a connection error */
     if(_connection == NULL) {
         /* print the error message */
-      dbglogfile << "MySQL error when connecting: \n" << mysql_error(&_mysql) 
<< endl;
+        dbglogfile << "MySQL error when connecting: \n" << 
mysql_error(&_mysql) << endl;
         return false;
     }
 
@@ -121,7 +122,7 @@ Database::openDB (void)
 #if 0
     if(mysql_select_db(&_mysql, "mydb")){ 
         DBG_MSG(DBG_EROR, "%s: MySQL error when selecting database: %s\n",
-            (mysql_error(&_mysql)));
+                (mysql_error(&_mysql)));
         exit(1);
     }
 #endif
@@ -141,59 +142,59 @@ Database::closeDB (void)
 bool
 Database::queryInsert(const char *query)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  int retries, result;
+    int retries, result;
   
-  retries = 2;
+    retries = 2;
   
-  dbglogfile << "Query is: " << query << endl;
+    dbglogfile << "Query is: " << query << endl;
   
 #if 0
-  string str = query;
-  // FIXME: We shouldn't ever get this condition
-  if (str.find("INSERT", 10) != string::npos) {        
-    dbglogfile << "Extra INSERT in query!\n", query << endl;
-  }
+    string str = query;
+    // FIXME: We shouldn't ever get this condition
+    if (str.find("INSERT", 10) != string::npos) {        
+        dbglogfile << "Extra INSERT in query!\n", query << endl;
+    }
 #endif
   
-  while (retries--) {
-    result = mysql_real_query(&_mysql, query, strlen(query));
+    while (retries--) {
+        result = mysql_real_query(&_mysql, query, strlen(query));
     
-    switch (result) {
-    case CR_SERVER_LOST:
-    case CR_COMMANDS_OUT_OF_SYNC:
-    case CR_SERVER_GONE_ERROR:
-      dbglogfile << "MySQL connection error: " << mysql_error(&_mysql) << endl;
-      // Try to reconnect to the database
-      closeDB();
-      openDB();
-      continue;
-      break;
-    case -1:
-    case CR_UNKNOWN_ERROR:
-      dbglogfile << "MySQL error on query for:\n\t " <<
-        mysql_error(&_mysql) << endl;
-      dbglogfile << "Query was: " << query << endl;
-            return false;
-            break;            
-    default:
-      return true;
-    }
+        switch (result) {
+          case CR_SERVER_LOST:
+          case CR_COMMANDS_OUT_OF_SYNC:
+          case CR_SERVER_GONE_ERROR:
+              dbglogfile << "MySQL connection error: " << mysql_error(&_mysql) 
<< endl;
+              // Try to reconnect to the database
+              closeDB();
+              openDB();
+              continue;
+              break;
+          case -1:
+          case CR_UNKNOWN_ERROR:
+              dbglogfile << "MySQL error on query for:\n\t " <<
+                  mysql_error(&_mysql) << endl;
+              dbglogfile << "Query was: " << query << endl;
+              return false;
+              break;            
+          default:
+              return true;
+        }
     
-    dbglogfile << "Lost connection to the database server, shutting down..." 
<< endl;
+        dbglogfile << "Lost connection to the database server, shutting 
down..." << endl;
     
-    return false;
-  }
+        return false;
+    }
   
-  return false;
+    return false;
 }
 
   
 void *
 Database::queryResults(const char *query)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
     MYSQL_RES  *result;
     MYSQL_ROW  row;
@@ -206,23 +207,23 @@ Database::queryResults(const char *query)
     res = mysql_real_query(&_mysql, query, strlen(query));
     
     switch (res)
-    {
-      case CR_SERVER_LOST:
-      case CR_COMMANDS_OUT_OF_SYNC:
-      case CR_SERVER_GONE_ERROR:
-        dbglogfile << "MySQL connection error: "
-             << mysql_error(&_mysql) << endl;
-        // Try to reconnect to the database
-        closeDB();
-        openDB();
-        break;
-      case CR_UNKNOWN_ERROR:
-        dbglogfile << "MySQL error on query for:" << mysql_error(&_mysql) << 
endl;
+        {
+          case CR_SERVER_LOST:
+          case CR_COMMANDS_OUT_OF_SYNC:
+          case CR_SERVER_GONE_ERROR:
+              dbglogfile << "MySQL connection error: "
+                         << mysql_error(&_mysql) << endl;
+              // Try to reconnect to the database
+              closeDB();
+              openDB();
+              break;
+          case CR_UNKNOWN_ERROR:
+              dbglogfile << "MySQL error on query for:" << 
mysql_error(&_mysql) << endl;
 //        ACE_DEBUG((LM_INFO, "Query was: %s\n", query));
 //        return false;
 //      default:
 //        return true;
-    }
+        }
     
     
     result = mysql_store_result(&_mysql);
@@ -232,14 +233,14 @@ Database::queryResults(const char *query)
     mysql_num_fields(result);      
 
     while((row = mysql_fetch_row(result)))
-    {
-        for (i=0; i<mysql_num_fields(result); i++)
         {
+            for (i=0; i<mysql_num_fields(result); i++)
+                {
 //        fields = mysql_fetch_fields(result);
 //        ACE_DEBUG((LM_INFO, "%s: ", field->name));
 //            ACE_DEBUG((LM_INFO, "Row is: %s\n", row[i]));
+                }
         }
-    }
 
     mysql_free_result(result);
 
@@ -250,68 +251,68 @@ Database::queryResults(const char *query)
 bool
 Database::queryInsert(vector<meter_data_t *> data)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  struct tm      *ttm;
-  struct timeval tp;
-  unsigned int   i;
-  //char           query[QUERYLEN];
-  //char           *ptr;
+    struct tm      *ttm;
+    struct timeval tp;
+    unsigned int   i;
+    //char           query[QUERYLEN];
+    //char           *ptr;
 #ifdef __STDC_HOSTED__
-  ostringstream  query;
+    ostringstream  query;
 #else
-  ostrstream     query;
+    ostrstream     query;
 #endif
 
-  if (data.size() == 0) {
-    dbglogfile << "No data to insert." << endl;
-    return false;
-  }
+    if (data.size() == 0) {
+        dbglogfile << "No data to insert." << endl;
+        return false;
+    }
   
-  gettimeofday(&tp, 0);
-  ttm = localtime (&tp.tv_sec);
-  ttm->tm_year+= 1900;          // years since 1900
-  ttm->tm_mon+=1;               // months since January
+    gettimeofday(&tp, 0);
+    ttm = localtime (&tp.tv_sec);
+    ttm->tm_year+= 1900;          // years since 1900
+    ttm->tm_mon+=1;               // months since January
 
-  query << "INSERT INTO inverter () VALUES ";
+    query << "INSERT INTO inverter () VALUES ";
 
-  for (i=0; i< data.size(); i++) {
-    queryInsert(data[i]);
-  }
+    for (i=0; i< data.size(); i++) {
+        queryInsert(data[i]);
+    }
   
-  return true;  
+    return true;  
 }
   
 bool
 Database::queryInsert(meter_data_t *data)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  struct tm             *ttm;
-  struct timeval        tp;
-  //char                  query[QUERYLEN];
-  char                  *type = "MX";
+    struct tm             *ttm;
+    struct timeval        tp;
+    //char                  query[QUERYLEN];
+    char                  *type = "MX";
 #ifdef __STDC_HOSTED__
-  std::ostringstream    query;
+    std::ostringstream    query;
 #else
-  std::ostrstream       query;
+    std::ostrstream       query;
 #endif
 
-  query.str("");
-  //  memset (query, 0, QUERYLEN);
+    query.str("");
+    //  memset (query, 0, QUERYLEN);
   
-  // EtaMsg em;
-  // em.dump(*data);
+    // EtaMsg em;
+    // em.dump(*data);
   
-  gettimeofday(&tp, 0);
-  ttm = localtime (&tp.tv_sec);
-  ttm->tm_year+= 1900;          // years since 1900
-  ttm->tm_mon+=1;               // months since January
+    gettimeofday(&tp, 0);
+    ttm = localtime (&tp.tv_sec);
+    ttm->tm_year+= 1900;          // years since 1900
+    ttm->tm_mon+=1;               // months since January
 
 #if 0  
-  // FIXME: For now source is the facility
-  // Build the query string to insert the data
-  sprintf(query, "INSERT INTO meters () VALUES ( \
+    // FIXME: For now source is the facility
+    // Build the query string to insert the data
+    sprintf(query, "INSERT INTO meters () VALUES ( \
         '%d',                   // Unit address (int)\
         '%s',                   // Device Type enum)\
         '%d-%d-%d %d:%d:%d',    // timestamp\
@@ -329,56 +330,56 @@ Database::queryInsert(meter_data_t *data)
         '%d',                   // Frequency in Hertz (int)\
         '%f'                    // Battery Temperature Compenation (float)\
         )",
-          //  sprintf(query, "INSERT INTO meters () VALUES 
('%d','%s','%0.4d-%0.2d-%d 
%0.2d:%0.2d:%0.2d','%d','%d','%f','%f','%f','%f','%d','%f','%f','%f','%d','%f','%f')",
-          data->unit,
-          type,
-          
ttm->tm_year,ttm->tm_mon,ttm->tm_mday,ttm->tm_hour,ttm->tm_min,ttm->tm_sec,
-          data->charge_amps,
-          data->ac_load_amps,
-          data->battery_volts,
-          data->ac_volts_out,
-          data->ac1_volts_in,
-          data->ac2_volts_in,
-          data->pv_amps_in,
-          data->pv_volts_in,
-          data->buy_amps,
-          data->sell_amps,
-          data->daily_kwh,
-          data->hertz,
-          data->tempcomp_volts
-          );
+            //  sprintf(query, "INSERT INTO meters () VALUES 
('%d','%s','%0.4d-%0.2d-%d 
%0.2d:%0.2d:%0.2d','%d','%d','%f','%f','%f','%f','%d','%f','%f','%f','%d','%f','%f')",
+            data->unit,
+            type,
+            
ttm->tm_year,ttm->tm_mon,ttm->tm_mday,ttm->tm_hour,ttm->tm_min,ttm->tm_sec,
+            data->charge_amps,
+            data->ac_load_amps,
+            data->battery_volts,
+            data->ac_volts_out,
+            data->ac1_volts_in,
+            data->ac2_volts_in,
+            data->pv_amps_in,
+            data->pv_volts_in,
+            data->buy_amps,
+            data->sell_amps,
+            data->daily_kwh,
+            data->hertz,
+            data->tempcomp_volts
+        );
 #else
-  query << "INSERT INTO meters () VALUES (";
-  query << data->unit << ",";
-  query << "\'" << type << "\',";
-  query << "\'" << ttm->tm_year << "-" << ttm->tm_mon << "-" << ttm->tm_mday 
<< " ";
-  query << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec << "\',";
-  query << data->charge_amps << ",";
-  query << data->ac_load_amps << ",";
-  query << data->battery_volts << ",";
-  query << data->ac_volts_out << ",";
-  query << data->ac1_volts_in << ",";
-  query << data->ac2_volts_in << ",";
-  query << data->pv_amps_in << ",";
-  query << data->pv_volts_in << ",";
-  query << data->buy_amps << ",";
-  query << data->sell_amps << ",";
-  query << data->daily_kwh << ",";
-  query << data->hertz << ",";
-  query << data->tempcomp_volts << ")";
-  query << ends;
+    query << "INSERT INTO meters () VALUES (";
+    query << data->unit << ",";
+    query << "\'" << type << "\',";
+    query << "\'" << ttm->tm_year << "-" << ttm->tm_mon << "-" << ttm->tm_mday 
<< " ";
+    query << ttm->tm_hour << ":" << ttm->tm_min << ":" << ttm->tm_sec << "\',";
+    query << data->charge_amps << ",";
+    query << data->ac_load_amps << ",";
+    query << data->battery_volts << ",";
+    query << data->ac_volts_out << ",";
+    query << data->ac1_volts_in << ",";
+    query << data->ac2_volts_in << ",";
+    query << data->pv_amps_in << ",";
+    query << data->pv_volts_in << ",";
+    query << data->buy_amps << ",";
+    query << data->sell_amps << ",";
+    query << data->daily_kwh << ",";
+    query << data->hertz << ",";
+    query << data->tempcomp_volts << ")";
+    query << ends;
 #endif
 
 #ifdef __STDC_HOSTED__
-  string str = query.str().c_str();
+    string str = query.str().c_str();
 #else
-  string str = query.str();
+    string str = query.str();
 #endif
   
-  // Execute the query
-  queryInsert(str.c_str());
+    // Execute the query
+    queryInsert(str.c_str());
   
-  return true;
+    return true;
 }
 
 char *
@@ -398,3 +399,8 @@ Database::gettime()
 //    DBG_MSG(DBG_INFO, "TIMESTAMP is %s\n", tmpbuf);
     return tmpbuf;
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/outbackpower.cc b/lib/outbackpower.cc
index 7593f23..4d13b9a 100644
--- a/lib/outbackpower.cc
+++ b/lib/outbackpower.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -36,21 +37,21 @@ const int PACKET_SIZE = 49;
 
 outback::outback() : _type(OUTBACK_NONE), _address('x'),_inverter_current(0), 
_charge_current(0), _buy_current(0), _pv_current(0), _sell_current(0), 
_AC_input_voltage(0), _AC_output_voltage(0), _pv_input_voltage(0), 
_battery_voltage(0), _daily_kwh(0), _operating_mode(SUPPORT), _AC_mode(NO_AC), 
_misc_byte(RESERVE1), _aux_mode(DISABLED),_charge_mode(SILENT_MODE), 
_error_mode(NO_ERROR), _warning_mode(NO_WARNING), _checksum(0)
 {
-  DEBUGLOG_REPORT_FUNCTION;  
+    DEBUGLOG_REPORT_FUNCTION;  
 }
 
 outback::outback(string filespec) :  _type(OUTBACK_NONE), 
_address('x'),_inverter_current(0),_charge_current(0), _buy_current(0), 
_pv_current(0), _sell_current(0), _AC_input_voltage(0), _AC_output_voltage(0), 
_pv_input_voltage(0), _battery_voltage(0), _daily_kwh(0), 
_operating_mode(SUPPORT), _AC_mode(NO_AC), _misc_byte(RESERVE1), 
_aux_mode(DISABLED), _charge_mode(SILENT_MODE), _error_mode(NO_ERROR), 
_warning_mode(NO_WARNING), _checksum(0)
 
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  commInit(filespec);
+    DEBUGLOG_REPORT_FUNCTION;
+    commInit(filespec);
 }
 
 outback::outback(const char *filespec) : _type(OUTBACK_NONE), 
_address('x'),_inverter_current(0),_charge_current(0), _buy_current(0), 
_pv_current(0), _sell_current(0), _AC_input_voltage(0), _AC_output_voltage(0), 
_pv_input_voltage(0), _battery_voltage(0), _daily_kwh(0), 
_operating_mode(SUPPORT), _AC_mode(NO_AC), _misc_byte(RESERVE1), 
_aux_mode(DISABLED), _charge_mode(SILENT_MODE), _error_mode(NO_ERROR), 
_warning_mode(NO_WARNING), _checksum(0)
 
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  commInit(filespec);
+    DEBUGLOG_REPORT_FUNCTION;
+    commInit(filespec);
 }
 
 outback::~outback()
@@ -61,137 +62,137 @@ outback::~outback()
 const char *
 outback::readSerial()
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 
-  int ret;
-  char *buf = new char[PACKET_SIZE+1];
+    int ret;
+    char *buf = new char[PACKET_SIZE+1];
   
-  memset(buf, 0, PACKET_SIZE+1);
+    memset(buf, 0, PACKET_SIZE+1);
 
-  ret = Read(buf, PACKET_SIZE);
+    ret = Read(buf, PACKET_SIZE);
   
-  if (ret > 0) {
-    //dbglogfile << "FIXME3: Read " << ret << " bytes: " << buf << "\t" << buf 
<< endl;
-    return buf;
-  }
+    if (ret > 0) {
+        //dbglogfile << "FIXME3: Read " << ret << " bytes: " << buf << "\t" << 
buf << endl;
+        return buf;
+    }
 
-  //  calcChecksum(packet);
+    //  calcChecksum(packet);
 
-  return "";
+    return "";
 }
 
 retcode_t
 outback::commInit(string filespec)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  if (filespec.size() == 0) {
-    dbglogfile << "ERROR: no serial device specified!" << endl;
-    exit(0);
-  }    
+    if (filespec.size() == 0) {
+        dbglogfile << "ERROR: no serial device specified!" << endl;
+        exit(0);
+    }    
 
 #if 0
     Open(filespec);
 #else
-  try {
-    Open(filespec);
-  }
-  catch (ErrCond catch_err) {
-    dbglogfile << catch_err << endl;
-    exit(1);
-  }
+    try {
+        Open(filespec);
+    }
+    catch (ErrCond catch_err) {
+        dbglogfile << catch_err << endl;
+        exit(1);
+    }
 #endif
   
-  return commInit(GetFD());
+    return commInit(GetFD());
 }
 
 retcode_t
 outback::commInit(int fd)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  SetRaw();
-  SetBaud(B19200);
+    SetRaw();
+    SetBaud(B19200);
   
 #if 0
-  termios thistty;
-  tcgetattr(GetFD(), &thistty);
-  thistty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
-  thistty.c_oflag &= ~(OPOST|~ONLCR);
-  thistty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
-  thistty.c_cflag &= ~(CSIZE|PARENB|HUPCL);
-  thistty.c_cflag |= CREAD;
-  //thistty.c_cflag |= CS8;
-  thistty.c_cc[VMIN] = 1;
-  thistty.c_cc[VTIME] = 100;
-  tcsetattr(GetFD(), TCSANOW, &thistty);
+    termios thistty;
+    tcgetattr(GetFD(), &thistty);
+    thistty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    thistty.c_oflag &= ~(OPOST|~ONLCR);
+    thistty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    thistty.c_cflag &= ~(CSIZE|PARENB|HUPCL);
+    thistty.c_cflag |= CREAD;
+    //thistty.c_cflag |= CS8;
+    thistty.c_cc[VMIN] = 1;
+    thistty.c_cc[VTIME] = 100;
+    tcsetattr(GetFD(), TCSANOW, &thistty);
 #endif
-  SetDTR(true);
+    SetDTR(true);
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // The main loop for an outback device
 retcode_t
 outback::main()
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  Console con;
-  Database db;
-  return main(con, db);
+    DEBUGLOG_REPORT_FUNCTION;
+    Console con;
+    Database db;
+    return main(con, db);
 }
 
 retcode_t
 outback::main(Console &con, Database &db)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  string str;
-  int ch;
+    string str;
+    int ch;
   
-  while ((ch = con.Getc()) != 'q') {
-    if (ch > 0){                // If we have something, process it
-      //con.Putc (ch);          // echo inputted character to screen
+    while ((ch = con.Getc()) != 'q') {
+        if (ch > 0){                // If we have something, process it
+            //con.Putc (ch);          // echo inputted character to screen
       
-      switch (ch) {
-        // Toggle the DTR state, which is as close as we get to
-        // flow control.
-      case 'd':
-        SetDTR(false);
-        break;
-      case 'D':
-        SetDTR(true);
-        break;
-      case 'Q':
-      case 'q':
-        return SUCCESS;
-        break;
-      case '?':
-        con.Puts("PowerGuru - Outback Mode\r\n");
-        con.Puts("\t? - help\r\n");
-        con.Puts("\tq - Quit\r\n");
-        con.Puts("\tQ - Quit\r\n");
-        sleep(2);
-      default:
-        break;
-      };
-    }
+            switch (ch) {
+                // Toggle the DTR state, which is as close as we get to
+                // flow control.
+              case 'd':
+                  SetDTR(false);
+                  break;
+              case 'D':
+                  SetDTR(true);
+                  break;
+              case 'Q':
+              case 'q':
+                  return SUCCESS;
+                  break;
+              case '?':
+                  con.Puts("PowerGuru - Outback Mode\r\n");
+                  con.Puts("\t? - help\r\n");
+                  con.Puts("\tq - Quit\r\n");
+                  con.Puts("\tQ - Quit\r\n");
+                  sleep(2);
+              default:
+                  break;
+            };
+        }
     
-    str = readSerial();
-    if (str.size() > 0) {
-      // con.Puts(str); con.Puts("\r\n");
-      calcChecksum(str.c_str());
-      {
-        parse(str.c_str());
-        meter_data_t md;
-        exportMeterData(&md);
-        db.queryInsert(&md);
-      }
-      str.erase();
+        str = readSerial();
+        if (str.size() > 0) {
+            // con.Puts(str); con.Puts("\r\n");
+            calcChecksum(str.c_str());
+            {
+                parse(str.c_str());
+                meter_data_t md;
+                exportMeterData(&md);
+                db.queryInsert(&md);
+            }
+            str.erase();
+        }
     }
-  }
   
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Send a command to the master FX inverter. Each command is a single
@@ -199,15 +200,15 @@ outback::main(Console &con, Database &db)
 retcode_t
 outback::sendFXCommand(fx_commands_t cmd) 
 {
-  char buf[3];
-  memset(buf,0, 3);
-  buf[0] = buf[1] = cmd;
+    char buf[3];
+    memset(buf,0, 3);
+    buf[0] = buf[1] = cmd;
 
-  if (Write(buf, 2) != 2) {
-    return ERROR;
-  }
+    if (Write(buf, 2) != 2) {
+        return ERROR;
+    }
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Parse the ASCII packet into numerical data.
@@ -219,422 +220,422 @@ outback::sendFXCommand(fx_commands_t cmd)
 // addition of all the characters in the message.
 retcode_t outback::parse(const char *data)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  string packet = data;
+    string packet = data;
   
-  // The address is byte 1
-  _address = packet[1];
-  if ((_address >= '0') && (_address <= '9')) {
-    _type = OUTBACK_FX;
-  } else if ((_address >= 'A') && (_address <= 'K')) {
-    _type = OUTBACK_MX;
-  } else {
-    dbglogfile << "ERROR: bad address in packet!" << endl;
-    return ERROR;
-  }
-
-  _type = OUTBACK_MX;           // FIXME: 
+    // The address is byte 1
+    _address = packet[1];
+    if ((_address >= '0') && (_address <= '9')) {
+        _type = OUTBACK_FX;
+    } else if ((_address >= 'A') && (_address <= 'K')) {
+        _type = OUTBACK_MX;
+    } else {
+        dbglogfile << "ERROR: bad address in packet!" << endl;
+        return ERROR;
+    }
+
+    _type = OUTBACK_MX;           // FIXME: 
   
-  // The inverter current is bytes 4 & 4 on an FX, but unused on the MX.
-  _inverter_current = strtol(packet.substr(3,2).c_str(), NULL, 0);
+    // The inverter current is bytes 4 & 4 on an FX, but unused on the MX.
+    _inverter_current = strtol(packet.substr(3,2).c_str(), NULL, 0);
   
-  // The charger current is bytes 7 & 8.
-  _charge_current = strtol(packet.substr(6,2).c_str(), NULL, 0);
-
-  // Bytes 9 & 10 are the Buy current on an FX, and the PV current on
-  // an MX.
-  if (_type == OUTBACK_FX) {
-    _buy_current = strtol(packet.substr(9,2).c_str(), NULL, 0);
-  } else {
-    _pv_current = strtol(packet.substr(9,2).c_str(), NULL, 0);;
-  }   
+    // The charger current is bytes 7 & 8.
+    _charge_current = strtol(packet.substr(6,2).c_str(), NULL, 0);
+
+    // Bytes 9 & 10 are the Buy current on an FX, and the PV current on
+    // an MX.
+    if (_type == OUTBACK_FX) {
+        _buy_current = strtol(packet.substr(9,2).c_str(), NULL, 0);
+    } else {
+        _pv_current = strtol(packet.substr(9,2).c_str(), NULL, 0);;
+    }   
   
-  // Bytes 13, 14, & 15 are the AC Input Voltage on an FX, and the PV
-  // input voltage on an MX.
-  if (_type == OUTBACK_FX) {
-    _AC_input_voltage = strtol(packet.substr(13,3).c_str(), NULL, 0);
-  } else {
-    _pv_input_voltage = strtol(packet.substr(13,3).c_str(), NULL, 0);
-  }
-
-  // Bytes 16, 17, & 18 are the AC Output Voltage on an FX, and the
-  // Daily Kilowatts on an MX.
-  if (_type == OUTBACK_FX) {
-    _AC_output_voltage = strtol(packet.substr(16,3).c_str(), NULL, 0);
-  } else {
-    _daily_kwh = strtol(packet.substr(16,3).c_str(), NULL, 0);
-  }
-
-  // Bytes 20 & 21 are the Sell current on an FX, but unused on an MX.
-  if (_type == OUTBACK_FX) {
-    _sell_current = strtol(packet.substr(20,2).c_str(), NULL, 0);
-  }
-
-  // Bytes 23 & 24 are the Operating Mode on an FX, but is the AUX Mode
-  // on an MX.
-  if (_type == OUTBACK_FX) {
-    _operating_mode = 
static_cast<op_mode_t>(strtol(packet.substr(23,2).c_str(), NULL, 0));
-  } else {
-    _aux_mode = static_cast<aux_mode_t>(strtol(packet.substr(23,2).c_str(), 
NULL, 0));
-  }
+    // Bytes 13, 14, & 15 are the AC Input Voltage on an FX, and the PV
+    // input voltage on an MX.
+    if (_type == OUTBACK_FX) {
+        _AC_input_voltage = strtol(packet.substr(13,3).c_str(), NULL, 0);
+    } else {
+        _pv_input_voltage = strtol(packet.substr(13,3).c_str(), NULL, 0);
+    }
+
+    // Bytes 16, 17, & 18 are the AC Output Voltage on an FX, and the
+    // Daily Kilowatts on an MX.
+    if (_type == OUTBACK_FX) {
+        _AC_output_voltage = strtol(packet.substr(16,3).c_str(), NULL, 0);
+    } else {
+        _daily_kwh = strtol(packet.substr(16,3).c_str(), NULL, 0);
+    }
+
+    // Bytes 20 & 21 are the Sell current on an FX, but unused on an MX.
+    if (_type == OUTBACK_FX) {
+        _sell_current = strtol(packet.substr(20,2).c_str(), NULL, 0);
+    }
+
+    // Bytes 23 & 24 are the Operating Mode on an FX, but is the AUX Mode
+    // on an MX.
+    if (_type == OUTBACK_FX) {
+        _operating_mode = 
static_cast<op_mode_t>(strtol(packet.substr(23,2).c_str(), NULL, 0));
+    } else {
+        _aux_mode = 
static_cast<aux_mode_t>(strtol(packet.substr(23,2).c_str(), NULL, 0));
+    }
   
-  // Bytes 26, 27, & 28 are the Error Mode, but is unimplemented on
-  // the MX at this time. (2005/7/12)
-  if (_type == OUTBACK_FX) {
-    _error_mode = 
static_cast<error_mode_t>(strtol(packet.substr(13,3).c_str(), NULL, 0));
-  }
-
-  // Bytes 30 & 31 are the AC Mode on an FX, but is the Charger Mode
-  // on an MX.
-  if (_type == OUTBACK_FX) {
-    _AC_mode = static_cast<AC_mode_t>(strtol(packet.substr(30,2).c_str(), 
NULL, 0));
-  } else {
-    _charge_mode = 
static_cast<charge_mode_t>(strtol(packet.substr(30,2).c_str(), NULL, 0));
-  }
+    // Bytes 26, 27, & 28 are the Error Mode, but is unimplemented on
+    // the MX at this time. (2005/7/12)
+    if (_type == OUTBACK_FX) {
+        _error_mode = 
static_cast<error_mode_t>(strtol(packet.substr(13,3).c_str(), NULL, 0));
+    }
+
+    // Bytes 30 & 31 are the AC Mode on an FX, but is the Charger Mode
+    // on an MX.
+    if (_type == OUTBACK_FX) {
+        _AC_mode = static_cast<AC_mode_t>(strtol(packet.substr(30,2).c_str(), 
NULL, 0));
+    } else {
+        _charge_mode = 
static_cast<charge_mode_t>(strtol(packet.substr(30,2).c_str(), NULL, 0));
+    }
   
-  // Bytes 33, 34, & 35 are the battery voltage.
-  _battery_voltage = strtol(packet.substr(33,3).c_str(), NULL, 0);
+    // Bytes 33, 34, & 35 are the battery voltage.
+    _battery_voltage = strtol(packet.substr(33,3).c_str(), NULL, 0);
 
-  // Bytes 37, 38, & 39 are the Misc Byte on an FX, but are unused on
-  // an MX.
-  if (_type == OUTBACK_FX) {
-    _misc_byte = static_cast<misc_byte_t>(strtol(packet.substr(37,3).c_str(), 
NULL, 0));
-  }
+    // Bytes 37, 38, & 39 are the Misc Byte on an FX, but are unused on
+    // an MX.
+    if (_type == OUTBACK_FX) {
+        _misc_byte = 
static_cast<misc_byte_t>(strtol(packet.substr(37,3).c_str(), NULL, 0));
+    }
 
-  // Bytes 41, 42, & 43 are the Warning Mode on an FX, but unused on an MX.
-  if (_type == OUTBACK_FX) {
-    _warning_mode = 
static_cast<warning_mode_t>(strtol(packet.substr(13,3).c_str(), NULL, 0));
-  }
+    // Bytes 41, 42, & 43 are the Warning Mode on an FX, but unused on an MX.
+    if (_type == OUTBACK_FX) {
+        _warning_mode = 
static_cast<warning_mode_t>(strtol(packet.substr(13,3).c_str(), NULL, 0));
+    }
 
-  // Bytes 45, 46, & 47 are the packet checksum.
-  _checksum = strtol(packet.substr(45,3).c_str(), NULL, 0);
+    // Bytes 45, 46, & 47 are the packet checksum.
+    _checksum = strtol(packet.substr(45,3).c_str(), NULL, 0);
 
-  dump();
+    dump();
   
-  return SUCCESS;
+    return SUCCESS;
 }
 
 //
 void
 outback::dump()
 {
-  switch (_type) {
-  case OUTBACK_MX:
-    dbglogfile << "Outback Power Systems MX Charge Controller" << endl;
-    break;
-  case OUTBACK_FX:
-    dbglogfile << "Outback Power Systems FX inverter" << endl;
-    break;
-  case OUTBACK_NONE:
-  default:
-    dbglogfile << "Outback Power Systems, no type specified!" << endl;
-    break;
-  };
+    switch (_type) {
+      case OUTBACK_MX:
+          dbglogfile << "Outback Power Systems MX Charge Controller" << endl;
+          break;
+      case OUTBACK_FX:
+          dbglogfile << "Outback Power Systems FX inverter" << endl;
+          break;
+      case OUTBACK_NONE:
+      default:
+          dbglogfile << "Outback Power Systems, no type specified!" << endl;
+          break;
+    };
   
-  // The address of the unit.
-  string addr;
-  addr = "Unit #";
-  if ((_address >= '0') && (_address <= '9')) {
-    addr += _address;
-  } else if ((_address >= 'A') && (_address <= 'K')) {
-    addr += _address;
-  }
-  dbglogfile << "The address is: " << addr.c_str() << endl;
-
-  // Amperage readings. These range from 0-99 in 1 amp increments
-  if (_inverter_current) {
-    dbglogfile << "Inverter current is: " << _inverter_current << endl;
-  }
-
-  if (_charge_current) {
-    dbglogfile << "Charge current is: " << _charge_current << " Amps" << endl;
-  }
-  if (_buy_current) {
-    dbglogfile << "Buy current is: " <<  _buy_current << " Amps" << endl;
-  }
-  if (_pv_current) {
-    dbglogfile << "PV current is: " <<  _pv_current << " Amps" << endl;
-  }
-  if (_sell_current) {
-    dbglogfile << "Sell current is: " <<  _sell_current << " Amps" << endl;
-  }
-
-  // Voltage readings. These range from 0-256. If the Misc Mode bit is
-  // set, then this number is multiplied by 2.
-  if (_AC_input_voltage) {
-    dbglogfile << "AC Input voltage is: " << _AC_input_voltage << " VAC" << 
endl;
-  }
-  if (_AC_output_voltage) {
-    dbglogfile << "AC Output voltage is: " << _AC_output_voltage << " VAC" << 
endl;
-  }
-  // one volt increments, ignore the misc Byte. FIXME: Do we devide this by 2 ?
-  if (_pv_input_voltage) {
-    dbglogfile << "PV Input voltage is: " << _pv_input_voltage/2 << " VDC" << 
endl;
-  }
+    // The address of the unit.
+    string addr;
+    addr = "Unit #";
+    if ((_address >= '0') && (_address <= '9')) {
+        addr += _address;
+    } else if ((_address >= 'A') && (_address <= 'K')) {
+        addr += _address;
+    }
+    dbglogfile << "The address is: " << addr.c_str() << endl;
+
+    // Amperage readings. These range from 0-99 in 1 amp increments
+    if (_inverter_current) {
+        dbglogfile << "Inverter current is: " << _inverter_current << endl;
+    }
+
+    if (_charge_current) {
+        dbglogfile << "Charge current is: " << _charge_current << " Amps" << 
endl;
+    }
+    if (_buy_current) {
+        dbglogfile << "Buy current is: " <<  _buy_current << " Amps" << endl;
+    }
+    if (_pv_current) {
+        dbglogfile << "PV current is: " <<  _pv_current << " Amps" << endl;
+    }
+    if (_sell_current) {
+        dbglogfile << "Sell current is: " <<  _sell_current << " Amps" << endl;
+    }
+
+    // Voltage readings. These range from 0-256. If the Misc Mode bit is
+    // set, then this number is multiplied by 2.
+    if (_AC_input_voltage) {
+        dbglogfile << "AC Input voltage is: " << _AC_input_voltage << " VAC" 
<< endl;
+    }
+    if (_AC_output_voltage) {
+        dbglogfile << "AC Output voltage is: " << _AC_output_voltage << " VAC" 
<< endl;
+    }
+    // one volt increments, ignore the misc Byte. FIXME: Do we devide this by 
2 ?
+    if (_pv_input_voltage) {
+        dbglogfile << "PV Input voltage is: " << _pv_input_voltage/2 << " VDC" 
<< endl;
+    }
   
-  // the resolution is 0.1 volts for a 12VDC system, 0.2 volts for a
-  // 24VDC system, and 0.4 for a 48 volt system.
-  if (_battery_voltage) {
-    dbglogfile << "Battery voltage is: " << _battery_voltage/10
-               << "." << _battery_voltage%10 << " VDC" << endl;
-  }
-  // The total kilowatts used daily. This ranges from 0-999, with the
-  // last digit being the fraction. ie... 99 = 99.9.
-  if (_daily_kwh) {
-    dbglogfile << "The daily Kilowatts used is: " << _daily_kwh/10
-               << "." << _daily_kwh%10 << " KW" << endl;
-  }
-
-  // Modes. Not all modes are currently implemented on the MX
-  // series. All the modes range from 0-99 except for the error and
-  // warning modes which range from 0-256.
-  dbglogfile << "The operating mode is: ";
-  switch (_operating_mode){
-  case INV_OFF:
-    dbglogfile << "Inverter OFF" << endl;
-    break;
-  case INV_SEARCH:
-    dbglogfile << "Inverter SEARCH" << endl;
-    break;
-  case INV_ON:
-    dbglogfile << "Inverter ON" << endl;    
-    break;
-  case CHARGE:
-    dbglogfile << "Charge" << endl;
-    break;
-  case SILENT:
-    dbglogfile << "Silent" << endl;
-    break;
-  case FLOAT:
-    dbglogfile << "Float" << endl;
-    break;
-  case EQ:
-    dbglogfile << "Equalize" << endl;
-    break;
-  case CHARGER_OFF:
-    dbglogfile << "Charger Off" << endl;
-    break;
-  case SUPPORT:
-    dbglogfile << "Support" << endl;
-    break;
-  case SELL_ON:
-    dbglogfile << "Sell On" << endl;
-    break;
-  case PASS_THRU:
-    dbglogfile << "Pass Thru" << endl;
-    break;
-  case FX_ERR:
-    dbglogfile << "FX Error" << endl;
-    break;
-  case AGS_ERR:
-    dbglogfile << "AGS Error" << endl;
-    break;
-  case COM_ERR:
-    dbglogfile << "Communications Error" << endl;
-    break;
-  default:
-    dbglogfile << "No operating mode!" << endl;
-    break;
-  };
+    // the resolution is 0.1 volts for a 12VDC system, 0.2 volts for a
+    // 24VDC system, and 0.4 for a 48 volt system.
+    if (_battery_voltage) {
+        dbglogfile << "Battery voltage is: " << _battery_voltage/10
+                   << "." << _battery_voltage%10 << " VDC" << endl;
+    }
+    // The total kilowatts used daily. This ranges from 0-999, with the
+    // last digit being the fraction. ie... 99 = 99.9.
+    if (_daily_kwh) {
+        dbglogfile << "The daily Kilowatts used is: " << _daily_kwh/10
+                   << "." << _daily_kwh%10 << " KW" << endl;
+    }
+
+    // Modes. Not all modes are currently implemented on the MX
+    // series. All the modes range from 0-99 except for the error and
+    // warning modes which range from 0-256.
+    dbglogfile << "The operating mode is: ";
+    switch (_operating_mode){
+      case INV_OFF:
+          dbglogfile << "Inverter OFF" << endl;
+          break;
+      case INV_SEARCH:
+          dbglogfile << "Inverter SEARCH" << endl;
+          break;
+      case INV_ON:
+          dbglogfile << "Inverter ON" << endl;    
+          break;
+      case CHARGE:
+          dbglogfile << "Charge" << endl;
+          break;
+      case SILENT:
+          dbglogfile << "Silent" << endl;
+          break;
+      case FLOAT:
+          dbglogfile << "Float" << endl;
+          break;
+      case EQ:
+          dbglogfile << "Equalize" << endl;
+          break;
+      case CHARGER_OFF:
+          dbglogfile << "Charger Off" << endl;
+          break;
+      case SUPPORT:
+          dbglogfile << "Support" << endl;
+          break;
+      case SELL_ON:
+          dbglogfile << "Sell On" << endl;
+          break;
+      case PASS_THRU:
+          dbglogfile << "Pass Thru" << endl;
+          break;
+      case FX_ERR:
+          dbglogfile << "FX Error" << endl;
+          break;
+      case AGS_ERR:
+          dbglogfile << "AGS Error" << endl;
+          break;
+      case COM_ERR:
+          dbglogfile << "Communications Error" << endl;
+          break;
+      default:
+          dbglogfile << "No operating mode!" << endl;
+          break;
+    };
   
-  dbglogfile << "The AC mode is: \t";
-  switch (_AC_mode) {
-  case NO_AC:
-    dbglogfile << "No AC" << endl;
-    break;
-  case AC_DROP:
-    dbglogfile << "AC Dropped" << endl;
-    break;
-  case AC_USE:
-    dbglogfile << "AC In Use" << endl;    
-    break;
-  default:
-    dbglogfile << "No AC mode!" << endl;
-    break;
-  };
-
-  dbglogfile << "The Misc Byte is: \t";
-  switch (_misc_byte) {
-  case 0:
-    dbglogfile << "No Misc byte" << endl;
-  case AC_UNIT:
-    dbglogfile << "AC Unit" << endl;
-    break;
-  case AUX_OUT_ON:
-    dbglogfile << "Aux Mode On set" << endl;
-    break;
-  default:
-    dbglogfile << "Reserved" << endl;
-    break;
-  };
-
-  dbglogfile << "The Aux mode is: \t";
-  switch (_aux_mode) {
-  case DISABLED:
-    dbglogfile << "Aux Mode Disabled" << endl;
-    break;
-  case DIVERSION:
-    dbglogfile << "Diversion" << endl;
-    break;
-  case REMOTE:
-    dbglogfile << "Remote" << endl;
-    break;
-  case MANUAL:
-    dbglogfile << "Manual" << endl;
-    break;
-  case VENT_FAN:
-    dbglogfile << "Vent Fan" << endl;
-    break;
-  case PV_TRIGGER:
-    dbglogfile << "PV Trigger" << endl;
-    break;
-  default:
-    dbglogfile << "No AUX mode set" << endl;
-    break;
-  };
-
-  dbglogfile << "The charge mode is: \t";
-  switch (_charge_mode) {
-  case SILENT_MODE:
-    dbglogfile << "Silent Charge mode" << endl;
-    break;
-  case FLOAT_MODE:
-    dbglogfile << "Float Charge mode" << endl;
-    break;
-  case BULK_MODE:
-    dbglogfile << "Bulk Charge mode" << endl;
-    break;
-  case ABSORB_MODE:
-    dbglogfile << "Absorb Charge mode" << endl;
-    break;
-  case EQ_MODE:
-    dbglogfile << "Equalization Charge mode" << endl;
-    break;
-  default:
-    dbglogfile << "No Charge mode" << endl;
-    break;
-  };
-
-  dbglogfile << "The error mode is: \t";
-  switch (_error_mode) {
-  case NO_ERROR:
-    dbglogfile << "No error" << endl;
-    break;
-  case LOW_VAC:
-    dbglogfile << "ERROR: Low Volts AC" << endl;
-    break;
-  case STACKING:
-    dbglogfile << "ERROR: Stacking" << endl;
-    break;
-  case OVER_TEMP:
-    dbglogfile << "ERROR: Over Temperature" << endl;
-    break;
-  case LOW_BATT:
-    dbglogfile << "ERROR: Low Battery" << endl;
-    break;
-  case PHASE_LOSS:
-    dbglogfile << "ERROR: Phase Loss" << endl;
-    break;
-  case HIGH_BATT:
-    dbglogfile << "ERROR: High Battery" << endl;
-    break;
-  case SHORT:
-    dbglogfile << "ERROR: Short" << endl;
-    break;
-  case BACKFEED:
-    dbglogfile << "ERROR: Backfeed" << endl;
-    break;
-  default:
-    dbglogfile << "No error mode" << endl;
-    break;
-  };
-
-  dbglogfile << "The warning mode is: \t";
-  switch (_warning_mode) {
-  case NO_WARNING:
-    dbglogfile << "No warning" << endl;
-    break;
-  case AC_IN_FREQ_HIGH:
-    dbglogfile << "WARNING: Input Frequency High" << endl;
-    break;
-  case AC_IN_FREQ_LOW:
-    dbglogfile << "WARNING: Input Frequency Low" << endl;
-    break;
-  case IN_VAC_HIGH:
-    dbglogfile << "WARNING: Input Volts AC High" << endl;
-    break;
-  case IN_VAC_LOW:
-    dbglogfile << "WARNING: Input Volts AC low" << endl;
-    break;
-  case BUY_IN_SIZE:
-    dbglogfile << "WARNING: Buy in size" << endl;
-    break;
-  case TEMP_FAILED:
-    dbglogfile << "WARNING: Temperature Failure" << endl;
-    break;
-  case COMM_ERROR:
-    dbglogfile << "WARNING: Communications error" << endl;
-    break;
-  case FAN_FAILURE:
-    dbglogfile << "WARNING: Fan Failure" << endl;
-    break;
-  default:
-    dbglogfile << "No warning mode" << endl;
-    break;
-  };
+    dbglogfile << "The AC mode is: \t";
+    switch (_AC_mode) {
+      case NO_AC:
+          dbglogfile << "No AC" << endl;
+          break;
+      case AC_DROP:
+          dbglogfile << "AC Dropped" << endl;
+          break;
+      case AC_USE:
+          dbglogfile << "AC In Use" << endl;    
+          break;
+      default:
+          dbglogfile << "No AC mode!" << endl;
+          break;
+    };
+
+    dbglogfile << "The Misc Byte is: \t";
+    switch (_misc_byte) {
+      case 0:
+          dbglogfile << "No Misc byte" << endl;
+      case AC_UNIT:
+          dbglogfile << "AC Unit" << endl;
+          break;
+      case AUX_OUT_ON:
+          dbglogfile << "Aux Mode On set" << endl;
+          break;
+      default:
+          dbglogfile << "Reserved" << endl;
+          break;
+    };
+
+    dbglogfile << "The Aux mode is: \t";
+    switch (_aux_mode) {
+      case DISABLED:
+          dbglogfile << "Aux Mode Disabled" << endl;
+          break;
+      case DIVERSION:
+          dbglogfile << "Diversion" << endl;
+          break;
+      case REMOTE:
+          dbglogfile << "Remote" << endl;
+          break;
+      case MANUAL:
+          dbglogfile << "Manual" << endl;
+          break;
+      case VENT_FAN:
+          dbglogfile << "Vent Fan" << endl;
+          break;
+      case PV_TRIGGER:
+          dbglogfile << "PV Trigger" << endl;
+          break;
+      default:
+          dbglogfile << "No AUX mode set" << endl;
+          break;
+    };
+
+    dbglogfile << "The charge mode is: \t";
+    switch (_charge_mode) {
+      case SILENT_MODE:
+          dbglogfile << "Silent Charge mode" << endl;
+          break;
+      case FLOAT_MODE:
+          dbglogfile << "Float Charge mode" << endl;
+          break;
+      case BULK_MODE:
+          dbglogfile << "Bulk Charge mode" << endl;
+          break;
+      case ABSORB_MODE:
+          dbglogfile << "Absorb Charge mode" << endl;
+          break;
+      case EQ_MODE:
+          dbglogfile << "Equalization Charge mode" << endl;
+          break;
+      default:
+          dbglogfile << "No Charge mode" << endl;
+          break;
+    };
+
+    dbglogfile << "The error mode is: \t";
+    switch (_error_mode) {
+      case NO_ERROR:
+          dbglogfile << "No error" << endl;
+          break;
+      case LOW_VAC:
+          dbglogfile << "ERROR: Low Volts AC" << endl;
+          break;
+      case STACKING:
+          dbglogfile << "ERROR: Stacking" << endl;
+          break;
+      case OVER_TEMP:
+          dbglogfile << "ERROR: Over Temperature" << endl;
+          break;
+      case LOW_BATT:
+          dbglogfile << "ERROR: Low Battery" << endl;
+          break;
+      case PHASE_LOSS:
+          dbglogfile << "ERROR: Phase Loss" << endl;
+          break;
+      case HIGH_BATT:
+          dbglogfile << "ERROR: High Battery" << endl;
+          break;
+      case SHORT:
+          dbglogfile << "ERROR: Short" << endl;
+          break;
+      case BACKFEED:
+          dbglogfile << "ERROR: Backfeed" << endl;
+          break;
+      default:
+          dbglogfile << "No error mode" << endl;
+          break;
+    };
+
+    dbglogfile << "The warning mode is: \t";
+    switch (_warning_mode) {
+      case NO_WARNING:
+          dbglogfile << "No warning" << endl;
+          break;
+      case AC_IN_FREQ_HIGH:
+          dbglogfile << "WARNING: Input Frequency High" << endl;
+          break;
+      case AC_IN_FREQ_LOW:
+          dbglogfile << "WARNING: Input Frequency Low" << endl;
+          break;
+      case IN_VAC_HIGH:
+          dbglogfile << "WARNING: Input Volts AC High" << endl;
+          break;
+      case IN_VAC_LOW:
+          dbglogfile << "WARNING: Input Volts AC low" << endl;
+          break;
+      case BUY_IN_SIZE:
+          dbglogfile << "WARNING: Buy in size" << endl;
+          break;
+      case TEMP_FAILED:
+          dbglogfile << "WARNING: Temperature Failure" << endl;
+          break;
+      case COMM_ERROR:
+          dbglogfile << "WARNING: Communications error" << endl;
+          break;
+      case FAN_FAILURE:
+          dbglogfile << "WARNING: Fan Failure" << endl;
+          break;
+      default:
+          dbglogfile << "No warning mode" << endl;
+          break;
+    };
 }
 
 // Calculate the checksum for a packet and see if it matches.
 retcode_t
 outback::calcChecksum(const char *packet)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-
-  const char *ptr = packet;
-  int index = 45;
-  int chk_field = 0;
-  int checksum = 0;
-  int elem = 0;
-
-  // extract the checksum field from the packet. Also strip off any
-  // leading zeros, as this makes strtol() thinks it's octal by
-  // mistake.
-  char chk[4];
-  memset(chk,0, 4);
-  while (index <= 47) {
-    if (packet[index] != '0') {
-      chk[elem++] = packet[index];
+    DEBUGLOG_REPORT_FUNCTION;
+
+    const char *ptr = packet;
+    int index = 45;
+    int chk_field = 0;
+    int checksum = 0;
+    int elem = 0;
+
+    // extract the checksum field from the packet. Also strip off any
+    // leading zeros, as this makes strtol() thinks it's octal by
+    // mistake.
+    char chk[4];
+    memset(chk,0, 4);
+    while (index <= 47) {
+        if (packet[index] != '0') {
+            chk[elem++] = packet[index];
+        }
+        index++;
     }
-    index++;
-  }
   
-  // Convert the checksum to a number
-  chk_field = strtol(chk, NULL, 0);
+    // Convert the checksum to a number
+    chk_field = strtol(chk, NULL, 0);
   
-  do {
-    if (*ptr == ',') {
-      ptr++;
-      continue;
+    do {
+        if (*ptr == ',') {
+            ptr++;
+            continue;
+        }
+        if (*ptr == '*') {
+            ptr++;
+            continue;
+        }
+        checksum+= (*ptr++) - '0';
+    } while ((ptr - packet) <= 44); // Don't add the checksum itself
+
+    //dbglogfile << "Transmitted checksum for packet is: " << chk << endl;
+    //dbglogfile << "Calculated checksum for packet is: " << checksum << endl;
+
+    // See if the calculated checksum matches the checksum from the
+    // packet checksum field. (the last 3 bytes before the CR terminator)
+    if (checksum != chk_field) {
+        dbglogfile << "ERROR: Checksums don't match!" << endl;
+        return ERROR;
     }
-    if (*ptr == '*') {
-      ptr++;
-      continue;
-    }
-    checksum+= (*ptr++) - '0';
-  } while ((ptr - packet) <= 44); // Don't add the checksum itself
-
-  //dbglogfile << "Transmitted checksum for packet is: " << chk << endl;
-  //dbglogfile << "Calculated checksum for packet is: " << checksum << endl;
-
-  // See if the calculated checksum matches the checksum from the
-  // packet checksum field. (the last 3 bytes before the CR terminator)
-  if (checksum != chk_field) {
-    dbglogfile << "ERROR: Checksums don't match!" << endl;
-    return ERROR;
-  }
   
-  return SUCCESS;
+    return SUCCESS;
 }
 
 
@@ -656,58 +657,62 @@ outback::calcChecksum(const char *packet)
 meter_data_t *
 outback::exportMeterData(meter_data_t *data)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  // The unit number for the device
-  data->unit = _address;
+    // The unit number for the device
+    data->unit = _address;
   
-  // The type of the device
-  switch (_type) {
-  case OUTBACK_MX:
-    data->type = MX_OUTBACK;
-    data->unit = _address - '0';
-    break;
-  case OUTBACK_FX:
-    data->type = FX_OUTBACK;
-    data->unit = _address - 'A';
-    break;
-  case SW_XANTREX:
-  default:
-    break;
-  };
+    // The type of the device
+    switch (_type) {
+      case OUTBACK_MX:
+          data->type = MX_OUTBACK;
+          data->unit = _address - '0';
+          break;
+      case OUTBACK_FX:
+          data->type = FX_OUTBACK;
+          data->unit = _address - 'A';
+          break;
+      case SW_XANTREX:
+      default:
+          break;
+    };
   
-  // The amperage being put into the batteries
-  data->charge_amps = _charge_current;
-  // The load in amps
-  data->ac_load_amps = _inverter_current;
-  // Actual Battery Voltage
-  data->battery_volts = _battery_voltage/10.0;
-  // Battery Voltage temperature compensated. This isn't used by
-  // Outback products.
-  data->tempcomp_volts = 0;
-  // The voltage the inverter is producing
-  data->ac_volts_out = _AC_output_voltage;
-  // Grid AC input
-  data->ac1_volts_in = _AC_input_voltage;
-  // The AC current taken from the Grid and used to charge the batteries.
-  data->buy_amps = _buy_current;
-  // The AC current the batteries are putting into the grid.
-  data->sell_amps = _sell_current;
-  // The daily kilowatts put into the batteries from the PV source.
-  data->daily_kwh = _daily_kwh/10.0;
-  // The frequency in hertz. This doesn't exist on an Outback, but does on
-  // a Xantrex. It should always be 60 though, so we set it so other
-  // software can handle this  the same way.
-  data->hertz = 60;
-  // The generator is AC2 on a Xantrex, but doesn't have a separete
-  // input on an Outback.
-  data->ac2_volts_in = 0.0;
-  // The current coming in from the PV panels before MPPT
-  data->pv_amps_in = _pv_current;
-  // The Voltage coming in from the PV panels before MPPT
-  data->pv_volts_in = _pv_input_voltage;
+    // The amperage being put into the batteries
+    data->charge_amps = _charge_current;
+    // The load in amps
+    data->ac_load_amps = _inverter_current;
+    // Actual Battery Voltage
+    data->battery_volts = _battery_voltage/10.0;
+    // Battery Voltage temperature compensated. This isn't used by
+    // Outback products.
+    data->tempcomp_volts = 0;
+    // The voltage the inverter is producing
+    data->ac_volts_out = _AC_output_voltage;
+    // Grid AC input
+    data->ac1_volts_in = _AC_input_voltage;
+    // The AC current taken from the Grid and used to charge the batteries.
+    data->buy_amps = _buy_current;
+    // The AC current the batteries are putting into the grid.
+    data->sell_amps = _sell_current;
+    // The daily kilowatts put into the batteries from the PV source.
+    data->daily_kwh = _daily_kwh/10.0;
+    // The frequency in hertz. This doesn't exist on an Outback, but does on
+    // a Xantrex. It should always be 60 though, so we set it so other
+    // software can handle this  the same way.
+    data->hertz = 60;
+    // The generator is AC2 on a Xantrex, but doesn't have a separete
+    // input on an Outback.
+    data->ac2_volts_in = 0.0;
+    // The current coming in from the PV panels before MPPT
+    data->pv_amps_in = _pv_current;
+    // The Voltage coming in from the PV panels before MPPT
+    data->pv_volts_in = _pv_input_voltage;
 
   
-  return data;
+    return data;
 }
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/outbackpower.h b/lib/outbackpower.h
index 56185cd..349a6ae 100644
--- a/lib/outbackpower.h
+++ b/lib/outbackpower.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -36,59 +37,59 @@
 namespace outbackpower
 {
 
-  // Outback FX Inverter protocol
+// Outback FX Inverter protocol
 struct outback_fx
 {
-  char start;                   // 1. This is an ASCII(10) New Line character
-                                // denoting the start of the status page.
-  char address;                 // 2. This is the Inverter address.
-  char comma1;                  // 3. ASCII(44) a comma as a data separator.
-  char inverter_current[2];     // 4. High byte of Inverter current.
-                                // 5. Low byte of Inverter current.
-  char comma2;                  // 6. ASCII(44) a comma as a data separator.
-  char charger_current[2];      // 7. High byte of Charger current..
-                                // 8. Low byte of Charger current.
-  char comma3;                  // 9. ASCII(44) a comma as a data separator.
-  char buy_current[2];          // 10. High byte of Buy current..
-                                // 11. Low byte of Buy current.
-  char comma4;                  // 12. ASCII(44) a comma as a data separator.
-  char ac_input_voltage[3];     // 13. High byte of the AC input voltage.
-                                // 14. Middle byte of AC input voltage.
-                                // 15. Low byte of AC input voltage.
-  char comma5;                  // 16. ASCII(44) a comma as a data separator.
-  char ac_output_voltage[3];    // 17. High byte of the AC output voltage.
-                                // 18. Middle byte of AC output voltage.
-                                // 19. Low byte of AC output voltage.
-  char comma6;                  // 20. ASCII(44) a comma as a data separator.
-  char sell_current[2];         // 21. High byte of Sell current.
-                                // 22. Low byte of Sell current.
-  char comma7;                  // 23. ASCII(44) a comma as a data separator.
-  char operating_mode[2];       // 24. High byte of FX operating mode.
-                                // 25. Low byte of FX operating mode.
-  char comma8;                  // 26. ASCII(44) a comma as a data separator.
-  char error_mode[3];           // 27. High byte of FX Error mode.
-                                // 28. Middle byte of FX Error mode.
-                                // 29. Low byte of FX Error mode.
-  char comma9;                  // 30. ASCII(44) a comma as a data separator.
-  char ac_mode[2];              // 31. High byte of FX AC mode.
-                                // 32. Low byte of FX AC mode
-  char comma10;                 // 33. ASCII(44) a comma as a data separator.
-  char battery_voltage[3];      // 34. High byte of FX battery voltage.
-                                // 35. Middle byte of FX battery voltage.
-                                // 36. Low byte of FX battery voltage.
-  char comma11;                 // 37. ASCII(44) a comma as a data separator.
-  char misc[3];                 // 38. High byte of FX Misc.
-                                // 39. Middle byte of FX Misc.
-                                // 40. Low byte of FX Misc.
-  char comma12;                 // 41. ASCII(44) a comma as a data separator.
-  char warning_mode[3];         // 42. High byte of FX Warning mode.
-                                // 43. Middle byte of FX Warning mode.
-                                // 44. Low byte of FX Warning mode.
-  char comma13;                 // 45. ASCII(44) a comma as a data separator.
-  char checksum[3];             // 46. High byte of Chksum.
-                                // 47. Middle byte of Chksum.
-                                // 48. Low byte of Chksum.
-  char end;                     // 49. ASCII(13) carriage return. Denotes end 
of status page.*
+    char start;                   // 1. This is an ASCII(10) New Line character
+    // denoting the start of the status page.
+    char address;                 // 2. This is the Inverter address.
+    char comma1;                  // 3. ASCII(44) a comma as a data separator.
+    char inverter_current[2];     // 4. High byte of Inverter current.
+    // 5. Low byte of Inverter current.
+    char comma2;                  // 6. ASCII(44) a comma as a data separator.
+    char charger_current[2];      // 7. High byte of Charger current..
+    // 8. Low byte of Charger current.
+    char comma3;                  // 9. ASCII(44) a comma as a data separator.
+    char buy_current[2];          // 10. High byte of Buy current..
+    // 11. Low byte of Buy current.
+    char comma4;                  // 12. ASCII(44) a comma as a data separator.
+    char ac_input_voltage[3];     // 13. High byte of the AC input voltage.
+    // 14. Middle byte of AC input voltage.
+    // 15. Low byte of AC input voltage.
+    char comma5;                  // 16. ASCII(44) a comma as a data separator.
+    char ac_output_voltage[3];    // 17. High byte of the AC output voltage.
+    // 18. Middle byte of AC output voltage.
+    // 19. Low byte of AC output voltage.
+    char comma6;                  // 20. ASCII(44) a comma as a data separator.
+    char sell_current[2];         // 21. High byte of Sell current.
+    // 22. Low byte of Sell current.
+    char comma7;                  // 23. ASCII(44) a comma as a data separator.
+    char operating_mode[2];       // 24. High byte of FX operating mode.
+    // 25. Low byte of FX operating mode.
+    char comma8;                  // 26. ASCII(44) a comma as a data separator.
+    char error_mode[3];           // 27. High byte of FX Error mode.
+    // 28. Middle byte of FX Error mode.
+    // 29. Low byte of FX Error mode.
+    char comma9;                  // 30. ASCII(44) a comma as a data separator.
+    char ac_mode[2];              // 31. High byte of FX AC mode.
+    // 32. Low byte of FX AC mode
+    char comma10;                 // 33. ASCII(44) a comma as a data separator.
+    char battery_voltage[3];      // 34. High byte of FX battery voltage.
+    // 35. Middle byte of FX battery voltage.
+    // 36. Low byte of FX battery voltage.
+    char comma11;                 // 37. ASCII(44) a comma as a data separator.
+    char misc[3];                 // 38. High byte of FX Misc.
+    // 39. Middle byte of FX Misc.
+    // 40. Low byte of FX Misc.
+    char comma12;                 // 41. ASCII(44) a comma as a data separator.
+    char warning_mode[3];         // 42. High byte of FX Warning mode.
+    // 43. Middle byte of FX Warning mode.
+    // 44. Low byte of FX Warning mode.
+    char comma13;                 // 45. ASCII(44) a comma as a data separator.
+    char checksum[3];             // 46. High byte of Chksum.
+    // 47. Middle byte of Chksum.
+    // 48. Low byte of Chksum.
+    char end;                     // 49. ASCII(13) carriage return. Denotes 
end of status page.*
 
 };
 
@@ -96,259 +97,259 @@ struct outback_fx
 
 struct outback_mx
 {
-  char start;                   // 1. This is an ASCII(10) New Line character
-                                // denoting the start of the status page.
-  char address;                 // 2. This is the MX address.
-  char comma1;                  // 3. ASCII(44) a comma as a data separator.
-  char unused1[2];              // 4. Unused, ASCII(48).
-                                // 5. Unused, ASCII(48).
-  char comma2;                  // 6. ASCII(44) a comma as a data separator.
-  char charger_current[2];      // 7. High byte of Charger current.
-                                // 8. Low byte of Charger current.
-  char comma3;                  // 9. ASCII(44) a comma as a data separator.
-  char pv_current[2];           // 10. High byte of PV current.
-                                // 11. Low byte of PV current.
-  char comma4;                  // 12. ASCII(44) a comma as a data separator.
-  char pv_input_voltage[3];     // 13. High byte of the PV input voltage.
-                                // 14. Middle byte of PV input voltage.
-                                // 15. Low byte of PV input voltage.
-  char comma5;                  // 16. ASCII(44) a comma as a data separator.
-  char daily_kwh[3];            // 17. High byte of Daily KWH.
-                                // 18. Middle byte of Daily KWH.
-                                // 19. Low byte of Daily KWH.
-  char comma6;                  // 20. ASCII(44) a comma as a data separator.
-  char unused2[2];              // 21. Unused, ASCII(48).
-                                // 22. Unused, ASCII(48).
-  char comma7;                  // 23. ASCII(44) a comma as a data separator.
-  char aux_mode[2];             // 24. High byte of MX Aux mode.
-                                // 25. Low byte of MX Aux mode.
-  char comma8;                  // 26. ASCII(44) a comma as a data separator.
-  char error_mode[3];           // 27. High byte of MX Error mode.
-                                // 28. Middle byte of MX Error mode.
-                                // 29. Low byte of MX Error mode.
-  char comma9;                  // 30. ASCII(44) a comma as a data separator.
-  char charger_mode[2];         // 31. High byte of MX charger mode.
-                                // 32. Low byte of MX charger mode.
-  char comma10;                 // 33. ASCII(44) a comma as a data separator.
-  char battery_voltage[3];      // 34. High byte of MX battery voltage.
-                                // 35. Middle byte of MX battery voltage.
-                                // 36. Low byte of MX battery voltage.
-  char comma11;                 // 37. ASCII(44) a comma as a data separator.
-  char unused3[3];              // 38. Unused, ASCII(48).
-                                // 39. Unused, ASCII(48).
-                                // 40. Unused, ASCII(48).
-  char comma12;                 // 41. ASCII(44) a comma as a data separator.
-  char unused4[3];              // 42. Unused, ASCII(48).
-                                // 43. Unused, ASCII(48)
-                                // 44. Unused, ASCII(48).
-  char comma13;                 // 45. ASCII(44) a comma as a data separator.
-  char checksum[3];             // 46. High byte of Chksum.
-                                // 47. Middle byte of Chksum.
-                                // 48. Low byte of Chksum.
-  char end;                     // 49. ASCII(13) carriage return. Denotes end 
of status page.
+    char start;                   // 1. This is an ASCII(10) New Line character
+    // denoting the start of the status page.
+    char address;                 // 2. This is the MX address.
+    char comma1;                  // 3. ASCII(44) a comma as a data separator.
+    char unused1[2];              // 4. Unused, ASCII(48).
+    // 5. Unused, ASCII(48).
+    char comma2;                  // 6. ASCII(44) a comma as a data separator.
+    char charger_current[2];      // 7. High byte of Charger current.
+    // 8. Low byte of Charger current.
+    char comma3;                  // 9. ASCII(44) a comma as a data separator.
+    char pv_current[2];           // 10. High byte of PV current.
+    // 11. Low byte of PV current.
+    char comma4;                  // 12. ASCII(44) a comma as a data separator.
+    char pv_input_voltage[3];     // 13. High byte of the PV input voltage.
+    // 14. Middle byte of PV input voltage.
+    // 15. Low byte of PV input voltage.
+    char comma5;                  // 16. ASCII(44) a comma as a data separator.
+    char daily_kwh[3];            // 17. High byte of Daily KWH.
+    // 18. Middle byte of Daily KWH.
+    // 19. Low byte of Daily KWH.
+    char comma6;                  // 20. ASCII(44) a comma as a data separator.
+    char unused2[2];              // 21. Unused, ASCII(48).
+    // 22. Unused, ASCII(48).
+    char comma7;                  // 23. ASCII(44) a comma as a data separator.
+    char aux_mode[2];             // 24. High byte of MX Aux mode.
+    // 25. Low byte of MX Aux mode.
+    char comma8;                  // 26. ASCII(44) a comma as a data separator.
+    char error_mode[3];           // 27. High byte of MX Error mode.
+    // 28. Middle byte of MX Error mode.
+    // 29. Low byte of MX Error mode.
+    char comma9;                  // 30. ASCII(44) a comma as a data separator.
+    char charger_mode[2];         // 31. High byte of MX charger mode.
+    // 32. Low byte of MX charger mode.
+    char comma10;                 // 33. ASCII(44) a comma as a data separator.
+    char battery_voltage[3];      // 34. High byte of MX battery voltage.
+    // 35. Middle byte of MX battery voltage.
+    // 36. Low byte of MX battery voltage.
+    char comma11;                 // 37. ASCII(44) a comma as a data separator.
+    char unused3[3];              // 38. Unused, ASCII(48).
+    // 39. Unused, ASCII(48).
+    // 40. Unused, ASCII(48).
+    char comma12;                 // 41. ASCII(44) a comma as a data separator.
+    char unused4[3];              // 42. Unused, ASCII(48).
+    // 43. Unused, ASCII(48)
+    // 44. Unused, ASCII(48).
+    char comma13;                 // 45. ASCII(44) a comma as a data separator.
+    char checksum[3];             // 46. High byte of Chksum.
+    // 47. Middle byte of Chksum.
+    // 48. Low byte of Chksum.
+    char end;                     // 49. ASCII(13) carriage return. Denotes 
end of status page.
 };
 
 // Voltages on an Outback need to be scaled based on the battery voltage.
 typedef enum {
-  CONVERT_12VDC = 1,
-  CONVERT_24VDC = 2,
-  CONVERT_48VDC = 4
+    CONVERT_12VDC = 1,
+    CONVERT_24VDC = 2,
+    CONVERT_48VDC = 4
 } voltage_conversion_t;
 
 
 // Bit masks for warning messages
 typedef enum {
-  NO_WARNING      = 0,
-  AC_IN_FREQ_HIGH = 1,
-  AC_IN_FREQ_LOW  = 1 << 1,
-  IN_VAC_HIGH     = 1 << 2,
-  IN_VAC_LOW      = 1 << 3,
-  BUY_IN_SIZE     = 1 << 4,
-  TEMP_FAILED     = 1 << 5,
-  COMM_ERROR      = 1 << 6,
-  FAN_FAILURE     = 1 << 7
+    NO_WARNING      = 0,
+    AC_IN_FREQ_HIGH = 1,
+    AC_IN_FREQ_LOW  = 1 << 1,
+    IN_VAC_HIGH     = 1 << 2,
+    IN_VAC_LOW      = 1 << 3,
+    BUY_IN_SIZE     = 1 << 4,
+    TEMP_FAILED     = 1 << 5,
+    COMM_ERROR      = 1 << 6,
+    FAN_FAILURE     = 1 << 7
 } warning_mode_t;
 
 // Bit masks for error messages
 typedef enum {
-  NO_ERROR   = 0,
-  LOW_VAC    = 1,
-  STACKING   = 1 << 1,
-  OVER_TEMP  = 1 << 2,
-  LOW_BATT   = 1 << 3,
-  PHASE_LOSS = 1 << 4,
-  HIGH_BATT  = 1 << 5,
-  SHORT      = 1 << 6,
-  BACKFEED   = 1 << 7
+    NO_ERROR   = 0,
+    LOW_VAC    = 1,
+    STACKING   = 1 << 1,
+    OVER_TEMP  = 1 << 2,
+    LOW_BATT   = 1 << 3,
+    PHASE_LOSS = 1 << 4,
+    HIGH_BATT  = 1 << 5,
+    SHORT      = 1 << 6,
+    BACKFEED   = 1 << 7
 } error_mode_t;
 
 // "Misc" field bit masks
 typedef enum {
-  AC_UNIT    = 1,
-  RESERVE1   = 1 << 1,
-  RESERVE2   = 1 << 2,
-  RESERVE3   = 1 << 3,
-  RESERVE4   = 1 << 4,
-  RESERVE5   = 1 << 5,
-  RESERVE6   = 1 << 6,
-  AUX_OUT_ON = 1 << 7
+    AC_UNIT    = 1,
+    RESERVE1   = 1 << 1,
+    RESERVE2   = 1 << 2,
+    RESERVE3   = 1 << 3,
+    RESERVE4   = 1 << 4,
+    RESERVE5   = 1 << 5,
+    RESERVE6   = 1 << 6,
+    AUX_OUT_ON = 1 << 7
 } misc_byte_t;
 
 // These are the numeric equivalents for the ASCII representation
 typedef enum {
-  INV_OFF     = 0,
-  INV_SEARCH  = 1,
-  INV_ON      = 2,
-  CHARGE      = 3,
-  SILENT      = 4,
-  FLOAT       = 5,
-  EQ          = 6,
-  CHARGER_OFF = 7,
-  SUPPORT     = 8,
-  SELL_ON     = 9,
-  PASS_THRU   = 10,
-  FX_ERR      = 90,
-  AGS_ERR     = 91,
-  COM_ERR     = 92
+    INV_OFF     = 0,
+    INV_SEARCH  = 1,
+    INV_ON      = 2,
+    CHARGE      = 3,
+    SILENT      = 4,
+    FLOAT       = 5,
+    EQ          = 6,
+    CHARGER_OFF = 7,
+    SUPPORT     = 8,
+    SELL_ON     = 9,
+    PASS_THRU   = 10,
+    FX_ERR      = 90,
+    AGS_ERR     = 91,
+    COM_ERR     = 92
 } op_mode_t;
 
 typedef enum {
-  DISABLED    = 0,
-  DIVERSION   = 1,
-  REMOTE      = 2,
-  MANUAL      = 3,
-  VENT_FAN    = 4,
-  PV_TRIGGER  = 5
+    DISABLED    = 0,
+    DIVERSION   = 1,
+    REMOTE      = 2,
+    MANUAL      = 3,
+    VENT_FAN    = 4,
+    PV_TRIGGER  = 5
 } aux_mode_t;
 
 typedef enum {
-  SILENT_MODE = 0,
-  FLOAT_MODE  = 1,
-  BULK_MODE   = 2,
-  ABSORB_MODE = 3,
-  EQ_MODE     = 4
+    SILENT_MODE = 0,
+    FLOAT_MODE  = 1,
+    BULK_MODE   = 2,
+    ABSORB_MODE = 3,
+    EQ_MODE     = 4
 } charge_mode_t;
 
 typedef enum {
-  NO_AC = 0,
-  AC_DROP = 1,
-  AC_USE = 2  
+    NO_AC = 0,
+    AC_DROP = 1,
+    AC_USE = 2  
 } AC_mode_t ;
 
 // When sending the command, each of these bytes needs to be sent twice
 typedef enum {
-  ON          = 'O',
-  SEARCH      = 'S',
-  OFF         = 'F',
-  USE         = 'U',
-  DROP        = 'D',
-  AUX_ON      = 'Z',
-  AUX_OFF     = 'X'
+    ON          = 'O',
+    SEARCH      = 'S',
+    OFF         = 'F',
+    USE         = 'U',
+    DROP        = 'D',
+    AUX_ON      = 'Z',
+    AUX_OFF     = 'X'
 } fx_commands_t;
 
 typedef enum {
-  OUTBACK_NONE,
-  OUTBACK_MX,
-  OUTBACK_FX
+    OUTBACK_NONE,
+    OUTBACK_MX,
+    OUTBACK_FX
 } outback_type_t;
 
 class outback : public Serial
 {
- public:
-  outback();
-  outback(const char *filespec);
-  outback(std::string filespec);
-  ~outback();
-  // Set up the object with data from the packet.
-  retcode_t parse(const char *packet);
-
-  // Initialize the serial port
-  retcode_t commInit(std::string);
-  retcode_t commInit(int fd);
-
-  // The main loop for an outback device
-  retcode_t main();
-  retcode_t main(Console &con);
-  retcode_t main(Console &con, Database &db);
+public:
+    outback();
+    outback(const char *filespec);
+    outback(std::string filespec);
+    ~outback();
+    // Set up the object with data from the packet.
+    retcode_t parse(const char *packet);
+
+    // Initialize the serial port
+    retcode_t commInit(std::string);
+    retcode_t commInit(int fd);
+
+    // The main loop for an outback device
+    retcode_t main();
+    retcode_t main(Console &con);
+    retcode_t main(Console &con, Database &db);
   
-  // calculate the ASCII packet
-  retcode_t calcChecksum(const char *packet);  
+    // calculate the ASCII packet
+    retcode_t calcChecksum(const char *packet);  
 
-  // Get the type of device
-  outback_type_t typeGet();
+    // Get the type of device
+    outback_type_t typeGet();
   
-  // Get the address of the unit.
-  char addressGet() { return _address; }
+    // Get the address of the unit.
+    char addressGet() { return _address; }
   
-  // Get the current readings
-  int inverterCurrentGet()        { return _inverter_current; };
-  int chargerCurrentGet()         { return _charge_current; };
-  int buyCurrentGet()             { return _buy_current; };
-  int pvCurrentGet()              { return _pv_current; };
-  int sellCurrentGet()            { return _sell_current; };
+    // Get the current readings
+    int inverterCurrentGet()        { return _inverter_current; };
+    int chargerCurrentGet()         { return _charge_current; };
+    int buyCurrentGet()             { return _buy_current; };
+    int pvCurrentGet()              { return _pv_current; };
+    int sellCurrentGet()            { return _sell_current; };
   
-  // Get the voltage readings
-  int pvInputVoltageGet()         { return _pv_input_voltage; };
-  int ACInputVoltageGet()         { return _AC_input_voltage; };
-  int ACOutputVoltageGet()        { return _AC_output_voltage; };
-  int batteryVoltageGet()         { return _battery_voltage; };
-
-  // Get the modes
-  op_mode_t operatingModeGet()    { return _operating_mode; };
-  error_mode_t errorModeGet()     { return _error_mode; };
-  warning_mode_t warningModeGet() { return _warning_mode; };
-  AC_mode_t ACModeGet()           { return  _AC_mode; };
-  misc_byte_t miscByteGet()       { return _misc_byte; };
-  aux_mode_t auxModeGet()         { return _aux_mode; };
-  charge_mode_t chargeModeGet()   { return _charge_mode; };
-
-  // Read from the serial port
-  const char *readSerial();
-
-  // Write an FX command to the serial port
-  retcode_t sendFXCommand(fx_commands_t cmd);
-
-  void dump();
-
-  meter_data_t *exportMeterData(meter_data_t *data);
+    // Get the voltage readings
+    int pvInputVoltageGet()         { return _pv_input_voltage; };
+    int ACInputVoltageGet()         { return _AC_input_voltage; };
+    int ACOutputVoltageGet()        { return _AC_output_voltage; };
+    int batteryVoltageGet()         { return _battery_voltage; };
+
+    // Get the modes
+    op_mode_t operatingModeGet()    { return _operating_mode; };
+    error_mode_t errorModeGet()     { return _error_mode; };
+    warning_mode_t warningModeGet() { return _warning_mode; };
+    AC_mode_t ACModeGet()           { return  _AC_mode; };
+    misc_byte_t miscByteGet()       { return _misc_byte; };
+    aux_mode_t auxModeGet()         { return _aux_mode; };
+    charge_mode_t chargeModeGet()   { return _charge_mode; };
+
+    // Read from the serial port
+    const char *readSerial();
+
+    // Write an FX command to the serial port
+    retcode_t sendFXCommand(fx_commands_t cmd);
+
+    void dump();
+
+    meter_data_t *exportMeterData(meter_data_t *data);
   
- private:
-  outback_type_t _type;
-  // The address of the unit.
-  char _address;
-
-  // Amperage readings. These range from 0-99 in 1 amp increments
-  int _inverter_current;
-  int _charge_current;
-  int _buy_current;
-  int _pv_current;
-  int _sell_current;
-
-  // Voltage readings. These range from 0-256. If the Misc Mode bit is
-  // set, then this number is multiplied by 2.
-  int _AC_input_voltage;
-  int _AC_output_voltage;
-  // one volt increments, ignore the misc Byte
-  int _pv_input_voltage;
-  // the resolution is 0.1 volts for a 12VDC system, 0.2 volts for a
-  // 24VDC system, and 0.4 for a 48 volt system.
-  int _battery_voltage;
-  // The total kilowatts used daily. This ranges from 0-999, with the
-  // last digit being the fraction. ie... 99 = 99.9.
-  int _daily_kwh;
-
-  // Modes. Not all modes are currently implemented on the MX
-  // series. All the modes range from 0-99 except for the error and
-  // warning modes which range from 0-256.
-  op_mode_t _operating_mode;
-  AC_mode_t _AC_mode;
-  misc_byte_t _misc_byte;
-  aux_mode_t _aux_mode;
-  charge_mode_t _charge_mode;
-
-  error_mode_t _error_mode;
-  warning_mode_t _warning_mode;
-  int _checksum;
+private:
+    outback_type_t _type;
+    // The address of the unit.
+    char _address;
+
+    // Amperage readings. These range from 0-99 in 1 amp increments
+    int _inverter_current;
+    int _charge_current;
+    int _buy_current;
+    int _pv_current;
+    int _sell_current;
+
+    // Voltage readings. These range from 0-256. If the Misc Mode bit is
+    // set, then this number is multiplied by 2.
+    int _AC_input_voltage;
+    int _AC_output_voltage;
+    // one volt increments, ignore the misc Byte
+    int _pv_input_voltage;
+    // the resolution is 0.1 volts for a 12VDC system, 0.2 volts for a
+    // 24VDC system, and 0.4 for a 48 volt system.
+    int _battery_voltage;
+    // The total kilowatts used daily. This ranges from 0-999, with the
+    // last digit being the fraction. ie... 99 = 99.9.
+    int _daily_kwh;
+
+    // Modes. Not all modes are currently implemented on the MX
+    // series. All the modes range from 0-99 except for the error and
+    // warning modes which range from 0-256.
+    op_mode_t _operating_mode;
+    AC_mode_t _AC_mode;
+    misc_byte_t _misc_byte;
+    aux_mode_t _aux_mode;
+    charge_mode_t _charge_mode;
+
+    error_mode_t _error_mode;
+    warning_mode_t _warning_mode;
+    int _checksum;
 };
 
 // end of namespace outback
@@ -356,3 +357,8 @@ class outback : public Serial
 
 // __OUTBACK_POWER_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/proc.cc b/lib/proc.cc
index 391d78d..28dafc1 100644
--- a/lib/proc.cc
+++ b/lib/proc.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -40,8 +41,8 @@ Proc::~Proc (void) {
 
 bool
 Proc::Start (void) {
-  cerr << __PRETTY_FUNCTION__ << ": not implemented!" << endl;
-  return false;
+    cerr << __PRETTY_FUNCTION__ << ": not implemented!" << endl;
+    return false;
 }
 
 bool
@@ -117,8 +118,8 @@ Proc::Find (string procname) {
 
 bool
 Proc::Stop (void) {
-  cerr << __PRETTY_FUNCTION__ << ": not implemented!" << endl;
-  return false;
+    cerr << __PRETTY_FUNCTION__ << ": not implemented!" << endl;
+    return false;
 }
     
 bool
@@ -148,7 +149,7 @@ Proc::GetOutput (string procname) {
     return output[procname];
 }
 
-
-
-
-
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/proc.h b/lib/proc.h
index 7e194d9..2006c4c 100644
--- a/lib/proc.h
+++ b/lib/proc.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -42,3 +43,8 @@ public:
     bool Stop (void);
     bool Stop (std::string);
 };
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/rc.cc b/lib/rc.cc
index cee02be..c83962e 100644
--- a/lib/rc.cc
+++ b/lib/rc.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -46,112 +47,113 @@ RCinitFile::~RCinitFile()
 retcode_t
 RCinitFile::load_files()
 {
-  char *home;
-  string loadfile;
+    char *home;
+    string loadfile;
   
-  // Check the default system location
-  loadfile = "/etc/powerguru/config";
-  parse_file(loadfile);
+    // Check the default system location
+    loadfile = "/etc/powerguru/config";
+    parse_file(loadfile);
 
-  // Check the default config location
-  loadfile = "/usr/local/etc/powerguru/config";
-  parse_file(loadfile);
+    // Check the default config location
+    loadfile = "/usr/local/etc/powerguru/config";
+    parse_file(loadfile);
   
-  // Check the users home directory
-  home = getenv("HOME");
-  if (home) {
-    loadfile = home;
-    loadfile += "/.powerguru/config";
-    return parse_file(loadfile);
-  }
+    // Check the users home directory
+    home = getenv("HOME");
+    if (home) {
+        loadfile = home;
+        loadfile += "/.powerguru/config";
+        return parse_file(loadfile);
+    }
   
-  return ERROR;
+    return ERROR;
 }
 
 // Parse the config file and set the variables.
 retcode_t
 RCinitFile::parse_file(string filespec)
 {
-  struct stat stats;
-  string action;
-  string variable;
-  string value;
-  ifstream in;
-
-  dbglogfile << "Seeing if " << filespec << " exists." << endl;
-  if (filespec.size() == 0) {
-    return ERROR;
-  }
+    struct stat stats;
+    string action;
+    string variable;
+    string value;
+    ifstream in;
+
+    dbglogfile << "Seeing if " << filespec << " exists." << endl;
+    if (filespec.size() == 0) {
+        return ERROR;
+    }
   
-  if (stat(filespec.c_str(), &stats) == 0) {
-    in.open(filespec.c_str());
+    if (stat(filespec.c_str(), &stats) == 0) {
+        in.open(filespec.c_str());
     
-    if (!in) {
-      dbglogfile << "ERROR: Couldn't open file: " << filespec << endl;
-      return ERROR;
-    }
+        if (!in) {
+            dbglogfile << "ERROR: Couldn't open file: " << filespec << endl;
+            return ERROR;
+        }
 
-    // Read in each line and parse it
-    while (!in.eof()) {
-      // Get the first token
-      in >> action;
-      // Ignore comment lines
-      if (action == "#" ) {
-        dbglogfile << "Ignoring comment line " << endl;
-        continue;
-      }
+        // Read in each line and parse it
+        while (!in.eof()) {
+            // Get the first token
+            in >> action;
+            // Ignore comment lines
+            if (action == "#" ) {
+                dbglogfile << "Ignoring comment line " << endl;
+                continue;
+            }
       
-      in >> variable >> value;
-      //      dbglogfile << action << variable << value << endl;
-
-      if (action == "set") {
-        if (variable == "dbhost") {
-          dbglogfile << "Database host configured to be " << value << endl;
-          _dbhost = value;
-        }
-        if (variable == "dbuser") {
-          dbglogfile << "Database user configured to be " << value << endl;
-          _dbuser = value;
-        }
-        if (variable == "dbpasswd") {
-          dbglogfile << "Database password configured to be " << value << endl;
-          _dbpasswd = value;
+            in >> variable >> value;
+            //      dbglogfile << action << variable << value << endl;
+
+            if (action == "set") {
+                if (variable == "dbhost") {
+                    dbglogfile << "Database host configured to be " << value 
<< endl;
+                    _dbhost = value;
+                }
+                if (variable == "dbuser") {
+                    dbglogfile << "Database user configured to be " << value 
<< endl;
+                    _dbuser = value;
+                }
+                if (variable == "dbpasswd") {
+                    dbglogfile << "Database password configured to be " << 
value << endl;
+                    _dbpasswd = value;
+                }
+                if (variable == "dbname") {
+                    dbglogfile << "Database name configured to be " << value 
<< endl;
+                    _dbname = value;
+                }
+                if (variable == "devmode") {
+                    dbglogfile << "Device mode configured to be " << value << 
endl;
+                    _devmode = value;
+                }
+                if (variable == "device") {
+                    dbglogfile << "Device is " << value << endl;
+                    _device = value;
+                }
+            }
         }
-        if (variable == "dbname") {
-          dbglogfile << "Database name configured to be " << value << endl;
-          _dbname = value;
+    } else {
+        if (in) {
+            in.close();
         }
-        if (variable == "devmode") {
-          dbglogfile << "Device mode configured to be " << value << endl;
-          _devmode = value;
-        }
-        if (variable == "device") {
-          dbglogfile << "Device is " << value << endl;
-          _device = value;
-        }
-      }
-    }
-  } else {
+        return ERROR;
+    }  
+
     if (in) {
-      in.close();
+        in.close();
     }
-    return ERROR;
-  }  
-
-  if (in) {
-    in.close();
-  }
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Write the changed settings to the config file
 retcode_t
 RCinitFile::update_file(string filespec)
 {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return ERROR;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return ERROR;
 }
 
-
-
-
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/rc.h b/lib/rc.h
index c39c65a..df84501 100644
--- a/lib/rc.h
+++ b/lib/rc.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -30,29 +31,29 @@ namespace rcinit {
   
 class RCinitFile 
 {
- public:
-  RCinitFile();
-  ~RCinitFile();
-  retcode_t load_files();
-  retcode_t parse_file(std::string filespec);
-  retcode_t update_file(std::string filespec);
-
-  // Database config options
-  std::string dbhostGet()   { return _dbhost; }
-  std::string dbuserGet()   { return _dbuser; };
-  std::string dbpasswdGet() { return _dbpasswd; };
-  std::string dbnameGet()   { return _dbname; };
-  std::string devmodeGet()  { return _devmode; };
-  std::string deviceGet()   { return _device; };
-
- private:
-  std::string _filespec;
-  std::string _dbhost;
-  std::string _dbuser;
-  std::string _dbpasswd;
-  std::string _dbname;
-  std::string _devmode;
-  std::string _device;
+public:
+    RCinitFile();
+    ~RCinitFile();
+    retcode_t load_files();
+    retcode_t parse_file(std::string filespec);
+    retcode_t update_file(std::string filespec);
+
+    // Database config options
+    std::string dbhostGet()   { return _dbhost; }
+    std::string dbuserGet()   { return _dbuser; };
+    std::string dbpasswdGet() { return _dbpasswd; };
+    std::string dbnameGet()   { return _dbname; };
+    std::string devmodeGet()  { return _devmode; };
+    std::string deviceGet()   { return _device; };
+
+private:
+    std::string _filespec;
+    std::string _dbhost;
+    std::string _dbuser;
+    std::string _dbpasswd;
+    std::string _dbname;
+    std::string _devmode;
+    std::string _device;
 }; 
 
 // End of rcinit namespace 
@@ -60,3 +61,8 @@ class RCinitFile
 
 // __RC_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/sem.cc b/lib/sem.cc
index ebc2990..9721c76 100644
--- a/lib/sem.cc
+++ b/lib/sem.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -88,158 +89,160 @@ int SysVSem::semid;
 string SysVSem::keypath;
 
 Sem::Sem (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
 }
 
 Sem::~Sem (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
 }
 
 int
 Sem::Init (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 Sem::Try (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 Sem::Wait (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 Sem::Destroy (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 Sem::GetValue (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 Sem::Post (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 // SysV style semaphores
 SysVSem::SysVSem (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
 }
 
 SysVSem::~SysVSem (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
 }
 
 int
 SysVSem::Init (void) {
-  union semun semopts;
-  int i;
+    union semun semopts;
+    int i;
 
-  key = ftok(".", 's');
+    key = ftok(".", 's');
 
-  if((semid = semget(key, MEMBERS, IPC_CREAT|IPC_EXCL|0666)) == -1) {
-    fprintf(stderr, "Semaphore set already exists!\n");
-    exit(1);
-  }
+    if((semid = semget(key, MEMBERS, IPC_CREAT|IPC_EXCL|0666)) == -1) {
+        fprintf(stderr, "Semaphore set already exists!\n");
+        exit(1);
+    }
   
-  semopts.val = 1;
+    semopts.val = 1;
   
-  /* Initialize all members (could be done with SETALL) */        
-  for(i=0; i < MEMBERS; i++) {
-    semctl(semid, i, SETVAL, semopts);
-  }
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    /* Initialize all members (could be done with SETALL) */        
+    for(i=0; i < MEMBERS; i++) {
+        semctl(semid, i, SETVAL, semopts);
+    }
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 SysVSem::Try (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 SysVSem::Wait (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 SysVSem::Destroy (void) {
-  return semctl(semid, 0, IPC_RMID, 0);
+    return semctl(semid, 0, IPC_RMID, 0);
 }
 
 int
 SysVSem::GetValue (void) {
-  return semctl(semid, MEMBERS, GETVAL, 0);
+    return semctl(semid, MEMBERS, GETVAL, 0);
 }
 
 int
 SysVSem::Post (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 
 // POSIX pthread style semaphores
 POSIXSem::POSIXSem (void) {
-  Init();
+    Init();
 }
 
 POSIXSem::~POSIXSem (void) {
-  Destroy();
+    Destroy();
 }
 
 int
 POSIXSem::Init (void) {
-  // the middle paramemter must be 0 on Linux, cause process
-  // side semaphores aren't supported.
-  return sem_init(sem, 0, 1);
+    // the middle paramemter must be 0 on Linux, cause process
+    // side semaphores aren't supported.
+    return sem_init(sem, 0, 1);
 }
 
 int
 POSIXSem::Try (void) {
-  //  return sem_trywait(sem);
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    //  return sem_trywait(sem);
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 POSIXSem::Wait (void) {
-  //  return sem_wait(sem);
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    //  return sem_wait(sem);
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 POSIXSem::Destroy (void) {
-  //  return sem_destroy(sem);
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    //  return sem_destroy(sem);
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 POSIXSem::GetValue (void) {
-  //  return sem_getvalue(sem);
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    //  return sem_getvalue(sem);
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
 int
 POSIXSem::Post (void) {
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return -1;
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return -1;
 }
 
-
-
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/sem.h b/lib/sem.h
index 3734c4e..33f1c8a 100644
--- a/lib/sem.h
+++ b/lib/sem.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -108,47 +109,51 @@ extern "C" {
 #define MEMBERS 1
 
 class Sem {
- private:
-  static bool initialized;
-  std::map<std::string, int> tbl;
- public:
-  Sem (void);
-  ~Sem (void);
-  virtual int Init (void);
-  virtual int Try (void);
-  virtual int Wait (void);
-  virtual int Destroy (void);
-  virtual int GetValue (void);
-  virtual int Post (void);
+private:
+    static bool initialized;
+    std::map<std::string, int> tbl;
+public:
+    Sem (void);
+    ~Sem (void);
+    virtual int Init (void);
+    virtual int Try (void);
+    virtual int Wait (void);
+    virtual int Destroy (void);
+    virtual int GetValue (void);
+    virtual int Post (void);
 };
 
 class SysVSem: public Sem {
- private:
-  static key_t key;
-  static int semid;
-  static std::string keypath;
- public:
-  SysVSem (void);
-  ~SysVSem (void);
-  int Init (void);
-  int Try (void);
-  int Wait (void);
-  int Destroy (void);
-  int GetValue (void);
-  int Post (void);
+private:
+    static key_t key;
+    static int semid;
+    static std::string keypath;
+public:
+    SysVSem (void);
+    ~SysVSem (void);
+    int Init (void);
+    int Try (void);
+    int Wait (void);
+    int Destroy (void);
+    int GetValue (void);
+    int Post (void);
 };
 
 class POSIXSem: public Sem {
- private:
-  sem_t *sem;
- public:
-  POSIXSem (void);
-  ~POSIXSem (void);
-  int Init (void);
-  int Try (void);
-  int Wait (void);
-  int Destroy (void);
-  int GetValue (void);
-  int Post (void);
+private:
+    sem_t *sem;
+public:
+    POSIXSem (void);
+    ~POSIXSem (void);
+    int Init (void);
+    int Try (void);
+    int Wait (void);
+    int Destroy (void);
+    int GetValue (void);
+    int Post (void);
 };
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/serial.cc b/lib/serial.cc
index d905390..9d0c6e2 100644
--- a/lib/serial.cc
+++ b/lib/serial.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -45,28 +46,28 @@ using namespace std;
 extern LogFile dbglogfile;
 LogFile seriallogfile; // ("tserial.log")
 
-  // Set the names of the baud rates so we can dump them in a human
-  // readable fashion.
+// Set the names of the baud rates so we can dump them in a human
+// readable fashion.
 const char *serial_speeds[] = {
-  "B0",
-  "B50",
-  "B75",
-  "B110",
-  "B134",
-  "B150",
-  "B200",
-  "B300",
-  "B600",
-  "B1200",
-  "B1800",
-  "B2400",
-  "B4800",
-  "B9600",
-  "B19200",
-  "B38400",
-  "B57600",
-  "B115200",
-  "B230400"
+    "B0",
+    "B50",
+    "B75",
+    "B110",
+    "B134",
+    "B150",
+    "B200",
+    "B300",
+    "B600",
+    "B1200",
+    "B1800",
+    "B2400",
+    "B4800",
+    "B9600",
+    "B19200",
+    "B38400",
+    "B57600",
+    "B115200",
+    "B230400"
 };
 
 
@@ -76,55 +77,55 @@ struct damnbaud {
     int code;
 };
 struct damnbaud baudtab[] = {
-  {50, B50},
-  {75, B75},
-  {110, B110},
-  {134, B134},
-  {150, B150},
-  {200, B200},
-  {300, B300},
-  {600, B600},
-  {1200, B1200},
-  {1800, B1800},
-  {2400, B2400},
-  {4800, B4800},
-  {9600, B9600},
-  {19200, B19200},
-  {38400, B38400},
+    {50, B50},
+    {75, B75},
+    {110, B110},
+    {134, B134},
+    {150, B150},
+    {200, B200},
+    {300, B300},
+    {600, B600},
+    {1200, B1200},
+    {1800, B1800},
+    {2400, B2400},
+    {4800, B4800},
+    {9600, B9600},
+    {19200, B19200},
+    {38400, B38400},
 #ifdef B57600
-  {57600, B57600},
+    {57600, B57600},
 #endif
 #ifdef B115200
-  {115200, B115200},
+    {115200, B115200},
 #endif
-  {-1, -1},
+    {-1, -1},
 };
 
 int
 rate_to_code(int rate) {
-  int i;
+    int i;
 
-  for (i = 0; baudtab[i].rate != -1; i++)
-    if (rate == baudtab[i].rate)
-      return baudtab[i].code;
+    for (i = 0; baudtab[i].rate != -1; i++)
+        if (rate == baudtab[i].rate)
+            return baudtab[i].code;
 
-  return -1;
+    return -1;
 }
 
 Serial::Serial(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 
-  // FIXME: for some reason, on Solaris 2.5.1, the static constructor
-  // doesn't work, and we have to reopen it to get things to really work.
-  seriallogfile.Open ("tserial.log");
+    // FIXME: for some reason, on Solaris 2.5.1, the static constructor
+    // doesn't work, and we have to reopen it to get things to really work.
+    seriallogfile.Open ("tserial.log");
 
 }
 
 Serial::~Serial(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  //Close();
+    // DEBUGLOG_REPORT_FUNCTION;
+    //Close();
 }
 
 // Open the serial port. This function must initialize the serial port so that
@@ -132,273 +133,273 @@ Serial::~Serial(void)
 retcode_t
 Serial::Open(string name)
 {
-  return Open(name.c_str());
+    return Open(name.c_str());
 }
 
 
 retcode_t
 Serial::Open(const char *filespec)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << "Opening host device " << filespec << endl;
+    dbglogfile << "Opening host device " << filespec << endl;
 
-  // We don't want to timestamp
-  seriallogfile.SetStamp(false);
+    // We don't want to timestamp
+    seriallogfile.SetStamp(false);
 
-  seriallogfile << "<?xml version='1.0'?>" << endl;
-  seriallogfile << "<device>\"" << filespec << "\"</device>" << endl;
+    seriallogfile << "<?xml version='1.0'?>" << endl;
+    seriallogfile << "<device>\"" << filespec << "\"</device>" << endl;
   
-  //  serialin.open(name, ios::in|ios::out);
-
-  if (filespec != 0) {
-    if ((_uartfd = open(filespec, O_RDWR | O_NONBLOCK)) < 0) { //  | O_NONBLOCK
-      if (_uartfd < 0) {
-        errcond << "couldn't open " << filespec << endl;
-       throw errcond;
-      }
+    //  serialin.open(name, ios::in|ios::out);
+
+    if (filespec != 0) {
+        if ((_uartfd = open(filespec, O_RDWR | O_NONBLOCK)) < 0) { //  | 
O_NONBLOCK
+            if (_uartfd < 0) {
+                errcond << "couldn't open " << filespec << endl;
+                throw errcond;
+            }
+        }
     }
-  }
 
-  uartfile = fdopen(_uartfd, "w+");
+    uartfile = fdopen(_uartfd, "w+");
 
-  // store the tty configuration so we can reset it when we're done
-  tcgetattr(_uartfd, &origtty);
+    // store the tty configuration so we can reset it when we're done
+    tcgetattr(_uartfd, &origtty);
 
-  // for now, this is also the current settings
-  tcgetattr(_uartfd, &currenttty);
+    // for now, this is also the current settings
+    tcgetattr(_uartfd, &currenttty);
   
-  DumpTtyState();
+    DumpTtyState();
   
-  // set to raw mode, so all I/O is unbuffered
-  //SetRaw();
+    // set to raw mode, so all I/O is unbuffered
+    //SetRaw();
 
 #if 0
-  // set the timeout value for communications
-  if (SetTimeout (20, errcond) == ERROR) {
-    dbglogfile << "ERROR: Couldn't set the timeout value";
-    return ERROR;
-  }
-  DumpTtyState();
+    // set the timeout value for communications
+    if (SetTimeout (20, errcond) == ERROR) {
+        dbglogfile << "ERROR: Couldn't set the timeout value";
+        return ERROR;
+    }
+    DumpTtyState();
 #endif
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Close the serial port
 retcode_t
 Serial::Close(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  dbglogfile << endl << "Closing host device" << endl;
-  seriallogfile << endl << "Closing host device" << endl;
+    dbglogfile << endl << "Closing host device" << endl;
+    seriallogfile << endl << "Closing host device" << endl;
 
-  tcsetattr(_uartfd, TCSANOW, &origtty);
+    tcsetattr(_uartfd, TCSANOW, &origtty);
 
-  ::close (_uartfd);
+    ::close (_uartfd);
 
-  _uartfd = -1;
-  uartfile = 0;
+    _uartfd = -1;
+    uartfile = 0;
   
-  return ERROR;
+    return ERROR;
 }
 
 retcode_t
 Serial::Flush  (void)
 {
-  tcflush(_uartfd, TCIOFLUSH);
+    tcflush(_uartfd, TCIOFLUSH);
 
-  return SUCCESS;               // FIXME: this should be a real check
+    return SUCCESS;               // FIXME: this should be a real check
 }
 
 int
 Serial::Read(char *buf, int nbytes)
 {
-  //DEBUGLOG_REPORT_FUNCTION;
-
-  int ret, sret, i;
-  fd_set fdset;
-  int retries = 2;
-  string data;
-  struct timeval timeout;
-
-  ret = -1;
-  char *tmpbuf = new char[nbytes+1];
-  if (_uartfd > 0) {
-
-    // Wait till we know there's data
-    while (retries-- > 0) {
-      timeout.tv_sec = 2;
-      timeout.tv_usec = 20;  // 1500
+    //DEBUGLOG_REPORT_FUNCTION;
+
+    int ret, sret, i;
+    fd_set fdset;
+    int retries = 2;
+    string data;
+    struct timeval timeout;
+
+    ret = -1;
+    char *tmpbuf = new char[nbytes+1];
+    if (_uartfd > 0) {
+
+        // Wait till we know there's data
+        while (retries-- > 0) {
+            timeout.tv_sec = 2;
+            timeout.tv_usec = 20;  // 1500
       
-      FD_ZERO(&fdset);
-      FD_SET(_uartfd, &fdset);
+            FD_ZERO(&fdset);
+            FD_SET(_uartfd, &fdset);
       
-      sret = select(_uartfd+1, &fdset, NULL, NULL, &timeout);
-      dbglogfile << "select returned " << sret
-                 << " for file descriptor  " << _uartfd << endl;
+            sret = select(_uartfd+1, &fdset, NULL, NULL, &timeout);
+            dbglogfile << "select returned " << sret
+                       << " for file descriptor  " << _uartfd << endl;
 #if 1
-      if (sret == 0) {
-        memset(buf, 0, nbytes);
-        //seriallogfile << "<device><select>Timeout</select></device>" << endl;
-        return sret;
-      }
-      if ((sret < 0) && (errno == EAGAIN)) {
-        memset(buf, 0, nbytes);
-        return sret;
-      }
+            if (sret == 0) {
+                memset(buf, 0, nbytes);
+                //seriallogfile << "<device><select>Timeout</select></device>" 
<< endl;
+                return sret;
+            }
+            if ((sret < 0) && (errno == EAGAIN)) {
+                memset(buf, 0, nbytes);
+                return sret;
+            }
 #endif
       
-      memset(tmpbuf, 0, nbytes+1);
-      memset(buf, 0, nbytes);
-      ret = ::read (_uartfd, tmpbuf, nbytes);
-      dbglogfile << "read returned " << ret << " for file descriptor  " << 
_uartfd << endl;
-      if (ret == 0) {
-        continue;
-      }
+            memset(tmpbuf, 0, nbytes+1);
+            memset(buf, 0, nbytes);
+            ret = ::read (_uartfd, tmpbuf, nbytes);
+            dbglogfile << "read returned " << ret << " for file descriptor  " 
<< _uartfd << endl;
+            if (ret == 0) {
+                continue;
+            }
       
-      if (ret > 0) {
-        dbglogfile << "Read " << ret << " bytes" << endl;
-        //if ((line.find('\n', 0) == string::npos) && (ret > 0)) 
-        // Filter out the control characters that appear on the
-        // end of the line
-        for (i=0; i<ret; i++) {
-          if (isascii(tmpbuf[i])) {
-            if ((tmpbuf[i] == 10) || (tmpbuf[i] == 13)) {
-              continue;
+            if (ret > 0) {
+                dbglogfile << "Read " << ret << " bytes" << endl;
+                //if ((line.find('\n', 0) == string::npos) && (ret > 0)) 
+                // Filter out the control characters that appear on the
+                // end of the line
+                for (i=0; i<ret; i++) {
+                    if (isascii(tmpbuf[i])) {
+                        if ((tmpbuf[i] == 10) || (tmpbuf[i] == 13)) {
+                            continue;
+                        }
+                        data += tmpbuf[i];
+                    }
+                } // end of for loop
+                // dbglogfile << "Reading more data, data left before is \"" 
<< tmpbuf << "\"" << endl;
             }
-            data += tmpbuf[i];
-          }
-        } // end of for loop
-        // dbglogfile << "Reading more data, data left before is \"" << tmpbuf 
<< "\"" << endl;
-      }
       
-      //if (ret < 0)
-      {
-        //data = line.substr(0, line.find('\n', 0));
-        if (data.size() > 0) {
-          seriallogfile << "<read time=" << timestamp()
-                        << " bytes=" << (int)data.size()
-                        << ">" << data << "</read>" << endl;
+            //if (ret < 0)
+            {
+                //data = line.substr(0, line.find('\n', 0));
+                if (data.size() > 0) {
+                    seriallogfile << "<read time=" << timestamp()
+                                  << " bytes=" << (int)data.size()
+                                  << ">" << data << "</read>" << endl;
           
-          memcpy(buf, data.c_str(), data.size());
-          return data.size();
+                    memcpy(buf, data.c_str(), data.size());
+                    return data.size();
+                }
+            }
         }
-      }
-    }
     
-    memcpy(buf, data.c_str(), data.size());
-    return ret;
-  }
+        memcpy(buf, data.c_str(), data.size());
+        return ret;
+    }
   
   
 #if 0                
                   
         
-        //if ((ret == 1) && (ret == 0xa)) {
-        if (ret == 1) {
-          dbglogfile << "Read CR " << endl;
-          //ret = ::read (_uartfd, buf, 36);
-        }
+    //if ((ret == 1) && (ret == 0xa)) {
+    if (ret == 1) {
+        dbglogfile << "Read CR " << endl;
+        //ret = ::read (_uartfd, buf, 36);
+    }
         
-        if (ret > 0) {
-          dbglogfile << "Read " << ret << " bytes" << endl;
-          for (i=0; i< nbytes; i++){
+    if (ret > 0) {
+        dbglogfile << "Read " << ret << " bytes" << endl;
+        for (i=0; i< nbytes; i++){
 #if 0
             if (buf[i] == 0xa) {
-              buf[i] = ' ';
-              continue;
+                buf[i] = ' ';
+                continue;
             }
 #endif
             if ((buf[i] > ' ') && (buf[i] < 'z')) {
-              dbglogfile << "Copying character: " << i << endl;
-              *bufptr++ = buf[i];
+                dbglogfile << "Copying character: " << i << endl;
+                *bufptr++ = buf[i];
             } else {
-              buf[i] = ' ';
+                buf[i] = ' ';
             }
-          }
-          *bufptr = 0;
-          seriallogfile << "<read  time=" << timestamp()
-                        << " bytes=" << ret
-                        << ">" << buf << "</read>" << endl;
         }
+        *bufptr = 0;
+        seriallogfile << "<read  time=" << timestamp()
+                      << " bytes=" << ret
+                      << ">" << buf << "</read>" << endl;
     }
+}
 
-    if ((sret == 0) && (ret <= 0)) {
-      dbglogfile << "WARNING: Too many retries." << endl;
-    }
+if ((sret == 0) && (ret <= 0)) {
+    dbglogfile << "WARNING: Too many retries." << endl;
+}
 
-    //    seriallogfile.Write((const char *)buf, ret);
+//    seriallogfile.Write((const char *)buf, ret);
 
-    //seriallogfile << "<read>" << buf << "</read>" << endl;
-    } else {
+//seriallogfile << "<read>" << buf << "</read>" << endl;
+} else {
       return ERROR;
-    }
+  }
 #endif
 
-    return ret;
+return ret;
 }
 
 int
 Serial::Write(const char *buf, int nbytes) const
 {
-  //DEBUGLOG_REPORT_FUNCTION;
-  int ret;
+    //DEBUGLOG_REPORT_FUNCTION;
+    int ret;
   
-  // Sometimes Iostreams are so weird... To make read/write
-  // stream, we need to make the output stream use the input streams
-  // buffer.
-  //  ostream outserial (serialin.rdbuf());
+    // Sometimes Iostreams are so weird... To make read/write
+    // stream, we need to make the output stream use the input streams
+    // buffer.
+    //  ostream outserial (serialin.rdbuf());
   
-  if (_uartfd > 0) {
-    ret = ::write (_uartfd, buf, nbytes);
-    tcdrain(_uartfd);
-    //    seriallogfile.write((const char *)buf, ret);
-    //   seriallogfile << buf;
-    seriallogfile << "<write time=" << timestamp()
-                  << " bytes=" << ret
-                  << ">" << buf << "</write>" << endl;
-    return nbytes;
-  } else {
-    return -1;
-  }
+    if (_uartfd > 0) {
+        ret = ::write (_uartfd, buf, nbytes);
+        tcdrain(_uartfd);
+        //    seriallogfile.write((const char *)buf, ret);
+        //   seriallogfile << buf;
+        seriallogfile << "<write time=" << timestamp()
+                      << " bytes=" << ret
+                      << ">" << buf << "</write>" << endl;
+        return nbytes;
+    } else {
+        return -1;
+    }
 }
 
 retcode_t
 Serial::SetBaud (int baudcode)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  speed_t ibaud;
-  speed_t obaud;
-  termios ctty;
+    speed_t ibaud;
+    speed_t obaud;
+    termios ctty;
 
-  tcgetattr(_uartfd, &ctty);
+    tcgetattr(_uartfd, &ctty);
 #if 0
-  currenttty.c_cflag &= ~(CBAUD|CIBAUD);
-  currenttty.c_cflag |= baudcode;  
+    currenttty.c_cflag &= ~(CBAUD|CIBAUD);
+    currenttty.c_cflag |= baudcode;  
 #else
-  cfsetispeed(&ctty, baudcode);
-  cfsetospeed(&ctty, baudcode);
+    cfsetispeed(&ctty, baudcode);
+    cfsetospeed(&ctty, baudcode);
 #endif
-  int ret = tcsetattr(_uartfd, TCSANOW, &ctty);
-  if (ret == 0) {
-    dbglogfile << __PRETTY_FUNCTION__ << " worked" << endl;
-    return SUCCESS;
-  }
+    int ret = tcsetattr(_uartfd, TCSANOW, &ctty);
+    if (ret == 0) {
+        dbglogfile << __PRETTY_FUNCTION__ << " worked" << endl;
+        return SUCCESS;
+    }
   
-  seriallogfile << "<device><baud>\"" << serial_speeds[baudcode] << 
"\"</baud></device>" << endl;
+    seriallogfile << "<device><baud>\"" << serial_speeds[baudcode] << 
"\"</baud></device>" << endl;
 
-  // See if it worked
-  //int ret = tcsetattr(_uartfd, TCSADRAIN, &currenttty);
-  ibaud = cfgetispeed(&currenttty);
-  obaud = cfgetospeed(&currenttty);
-  dbglogfile << "Input baud is now set to " << serial_speeds[ibaud] << endl;
-  dbglogfile << "Output baud is now set to " << serial_speeds[obaud] << endl;
+    // See if it worked
+    //int ret = tcsetattr(_uartfd, TCSADRAIN, &currenttty);
+    ibaud = cfgetispeed(&currenttty);
+    obaud = cfgetospeed(&currenttty);
+    dbglogfile << "Input baud is now set to " << serial_speeds[ibaud] << endl;
+    dbglogfile << "Output baud is now set to " << serial_speeds[obaud] << endl;
 
-  dbglogfile << __PRETTY_FUNCTION__ << " failed" << endl;
-  return ERROR;
+    dbglogfile << __PRETTY_FUNCTION__ << " failed" << endl;
+    return ERROR;
 }
 
 #if 0
@@ -416,16 +417,16 @@ Serial::send_break (struct errcond *err) const
 retcode_t
 Serial::SetBlocking(bool mode)
 {
-  tcgetattr(_uartfd, &currenttty);
+    tcgetattr(_uartfd, &currenttty);
   
-  //seriallogfile << "<device><blocking>True</device>" << endl;
+    //seriallogfile << "<device><blocking>True</device>" << endl;
 
-  currenttty.c_cc[VMIN] = 0;
-  currenttty.c_cc[VTIME] = 10;
+    currenttty.c_cc[VMIN] = 0;
+    currenttty.c_cc[VTIME] = 10;
   
-  tcsetattr(_uartfd, TCSANOW, &currenttty);
+    tcsetattr(_uartfd, TCSANOW, &currenttty);
 
-  return SUCCESS;               // FIXME: this should be a real check
+    return SUCCESS;               // FIXME: this should be a real check
 }
 
 //  modem control lines
@@ -435,194 +436,198 @@ Serial::SetBlocking(bool mode)
 retcode_t
 Serial::SetDTR (void)
 {
-  return SetDTR(true);
+    return SetDTR(true);
 }
 
 retcode_t
 Serial::SetDTR (bool value)
 {
-  int arg = 0;
+    int arg = 0;
 
-  ioctl(_uartfd, TIOCMGET, (unsigned long) &arg);
+    ioctl(_uartfd, TIOCMGET, (unsigned long) &arg);
 
-  cerr << "ARG is " << arg << endl;
+    cerr << "ARG is " << arg << endl;
   
-  // Turn off everything but DTR
-  if (value) {  
-    seriallogfile << "<device><DTR>True</DTR></device>" << endl;
-    arg = TIOCM_DTR;
-  } else { 
-    seriallogfile << "<device><DTR>False</DTR></device>" << endl;
-    arg = 0;
-  }
-  // arg |= TIOCM_DTR | ~TIOCM_RTS;
+    // Turn off everything but DTR
+    if (value) {  
+        seriallogfile << "<device><DTR>True</DTR></device>" << endl;
+        arg = TIOCM_DTR;
+    } else { 
+        seriallogfile << "<device><DTR>False</DTR></device>" << endl;
+        arg = 0;
+    }
+    // arg |= TIOCM_DTR | ~TIOCM_RTS;
 
-  ioctl(_uartfd, TIOCMSET, (unsigned long) &arg);
+    ioctl(_uartfd, TIOCMSET, (unsigned long) &arg);
 
-  return SUCCESS;               // FIXME: this should be a real check
+    return SUCCESS;               // FIXME: this should be a real check
 }
 
 retcode_t
 Serial::SetRaw (void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  // speed 38400 baud; line = 0;
-  // min = 1; time = 0;
-  // ignbrk -brkint -icrnl -imaxbel
-  // -opost
-  // -isig -icanon -iexten -echo
+    // speed 38400 baud; line = 0;
+    // min = 1; time = 0;
+    // ignbrk -brkint -icrnl -imaxbel
+    // -opost
+    // -isig -icanon -iexten -echo
   
-  tcgetattr(_uartfd, &currenttty);
+    tcgetattr(_uartfd, &currenttty);
 
 #if 1
-  cfmakeraw(&currenttty);
+    cfmakeraw(&currenttty);
 #else
-  //currenttty.c_iflag &= 
~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
-  currenttty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP);
-  currenttty.c_oflag &= ~OPOST;
-  currenttty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
-  currenttty.c_cflag &= ~(CSIZE|PARENB);
-  currenttty.c_cflag |= CS8;
-  currenttty.c_cc[VMIN] = 0;
-  currenttty.c_cc[VTIME] = 10;
+    //currenttty.c_iflag &= 
~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    currenttty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP);
+    currenttty.c_oflag &= ~OPOST;
+    currenttty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    currenttty.c_cflag &= ~(CSIZE|PARENB);
+    currenttty.c_cflag |= CS8;
+    currenttty.c_cc[VMIN] = 0;
+    currenttty.c_cc[VTIME] = 10;
 #endif
   
-  tcsetattr(_uartfd, TCSANOW, &currenttty);
+    tcsetattr(_uartfd, TCSANOW, &currenttty);
 
-  return SUCCESS;               // FIXME: this should be a real check
+    return SUCCESS;               // FIXME: this should be a real check
 }
 
 void
 Serial::DumpTtyState (void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  int ibaud, obaud;
+    DEBUGLOG_REPORT_FUNCTION;
+    int ibaud, obaud;
 
-  ibaud = cfgetispeed(&currenttty);
-  dbglogfile << "Input baud rate is " << serial_speeds[ibaud] << endl;
+    ibaud = cfgetispeed(&currenttty);
+    dbglogfile << "Input baud rate is " << serial_speeds[ibaud] << endl;
 
-  obaud = cfgetospeed(&currenttty);
-  dbglogfile << "Output baud rate is " << serial_speeds[obaud] << endl;
+    obaud = cfgetospeed(&currenttty);
+    dbglogfile << "Output baud rate is " << serial_speeds[obaud] << endl;
   
 }
 
 termios *
 Serial::SetTtyState (termios *tty)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  tcsetattr(_uartfd, TCSANOW, tty);
-  return &currenttty;
+    tcsetattr(_uartfd, TCSANOW, tty);
+    return &currenttty;
 }
 
 termios *
 Serial::GetTtyState(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  tcgetattr(_uartfd, &currenttty);
-  return &currenttty;
+    tcgetattr(_uartfd, &currenttty);
+    return &currenttty;
 }
 
 // These methods do byte oriented I/O on the serial port
 int
 Serial::Getc   (void)
 { 
-  // DEBUGLOG_REPORT_FUNCTION;
-  if (uartfile != NULL)
-    return getc(uartfile);
-  else
-    return -1;
+    // DEBUGLOG_REPORT_FUNCTION;
+    if (uartfile != NULL)
+        return getc(uartfile);
+    else
+        return -1;
 }
 
 int
 Serial::UnGetc (int ch)
 {  
-  // DEBUGLOG_REPORT_FUNCTION;
-  if (uartfile != NULL)
-    return ungetc(ch, uartfile);
-  else
-    return -1;
+    // DEBUGLOG_REPORT_FUNCTION;
+    if (uartfile != NULL)
+        return ungetc(ch, uartfile);
+    else
+        return -1;
 }
 
 int
 Serial::Putc (int x)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  if (uartfile != NULL) {
-    return putc(x, uartfile);
-  } else {
-    return -1;
-  }
+    // DEBUGLOG_REPORT_FUNCTION;
+    if (uartfile != NULL) {
+        return putc(x, uartfile);
+    } else {
+        return -1;
+    }
 }
 
 // This grabs the endl operator. If we see this, then we are done
 // formatting the string. We currently don't do anything with this.
 ostream&
 Serial::operator << (ostream & (&)(ostream &)) {
-  ostream outserial (serialin.rdbuf());
-  outserial.write("\n", 1);
-  return cout;                  // FIXME: this is probably bogus
+    ostream outserial (serialin.rdbuf());
+    outserial.write("\n", 1);
+    return cout;                  // FIXME: this is probably bogus
 }
 
 Serial& 
 Serial::operator << (char const *x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  ostream outserial (serialin.rdbuf());
-  outserial.write(x, strlen(x));
+    ostream outserial (serialin.rdbuf());
+    outserial.write(x, strlen(x));
 
-  seriallogfile << x;
+    seriallogfile << x;
 
-  return *this;
+    return *this;
 }
 
 Serial& 
 Serial::operator << (string &x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  ostream outserial (serialin.rdbuf());
+    ostream outserial (serialin.rdbuf());
 
-  //outserial.write(x, x.length());
+    //outserial.write(x, x.length());
 
-  seriallogfile << x;
+    seriallogfile << x;
   
-  return *this;
+    return *this;
 }
 
 ostream& 
 operator << (ostream &os, Serial& e)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  string msg;
+    string msg;
 
 #if 0
-  if (e.GetCode() > EMEDIUMTYPE) {
-    msg = "WARNING: ";
-  } else {
-    msg = "ERROR: ";
-  }
+    if (e.GetCode() > EMEDIUMTYPE) {
+        msg = "WARNING: ";
+    } else {
+        msg = "ERROR: ";
+    }
   
-  if (e.GetFunc().size() > 0)
-    msg += e.GetFunc();
+    if (e.GetFunc().size() > 0)
+        msg += e.GetFunc();
 
-  if (e.GetLine() > 0)
-    msg += e.GetFunc();
+    if (e.GetLine() > 0)
+        msg += e.GetFunc();
   
-  if (e.GetMsg().size() > 0)
-    msg += e.GetMsg();
+    if (e.GetMsg().size() > 0)
+        msg += e.GetMsg();
 
-  if (errno) {
-    msg += " (";
-    msg += strerror(errno);
-    msg += ") ";
-  }
+    if (errno) {
+        msg += " (";
+        msg += strerror(errno);
+        msg += ") ";
+    }
 #endif
   
-  return os << msg;
+    return os << msg;
 }
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/serial.h b/lib/serial.h
index 5dfb489..b56a40d 100644
--- a/lib/serial.h
+++ b/lib/serial.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -56,7 +57,7 @@ public:
     retcode_t SetBaud (int x);
 
     int GetFD() {
-      return _uartfd;
+        return _uartfd;
     }
     
     
@@ -86,7 +87,7 @@ public:
     // This is so we can print ourselves
     friend std::ostream & operator << (std::ostream &os, Serial& s);
     std::ostream& operator << (std::ostream & (&)(std::ostream &));
- private:
+private:
     std::ifstream  serialin;
     std::ofstream  serialout;
     int            _uartfd;
@@ -99,5 +100,7 @@ public:
 // __SERIAL_H__
 #endif
 
-
-
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/sharedlib.cc b/lib/sharedlib.cc
index 73f2f38..5d4a985 100644
--- a/lib/sharedlib.cc
+++ b/lib/sharedlib.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -32,168 +33,172 @@ extern LogFile dbglogfile;
 retcode_t
 SharedLib::CloseLib (ErrCond &err)
 {
-  lt_dlclose (dlhandle);
+    lt_dlclose (dlhandle);
 }
 
 retcode_t
 SharedLib::OpenLib (string &filespec, ErrCond &Err)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  retcode_t (*FuncAddr)(void);
-  int errors = 0;
-  char *errmsg;
-  char pwd[512];
+    retcode_t (*FuncAddr)(void);
+    int errors = 0;
+    char *errmsg;
+    char pwd[512];
 
 #if 0
-  struct stat ostats;
-  if (stat (filespec.c_str(), &ostats)) {
-    switch (errno) {
-    case EBADF:
-    case ENOENT:
-      Err.SetMsg("Specified shared library doesn't exist");
-      dbglogfile << "ERROR: Dynamic library, " << filespec << " doesn't 
exist!" << endl;
-      return ERROR;
-      break;
+    struct stat ostats;
+    if (stat (filespec.c_str(), &ostats)) {
+        switch (errno) {
+          case EBADF:
+          case ENOENT:
+              Err.SetMsg("Specified shared library doesn't exist");
+              dbglogfile << "ERROR: Dynamic library, " << filespec << " 
doesn't exist!" << endl;
+              return ERROR;
+              break;
+        }
     }
-  }
 #endif  
 
 #if 0
-  // ltdl should use the same mallocation as us
-  lt_dlmalloc = (lt_ptr (*) (size_t)) xmalloc;
-  lt_dlfree = (void (*) (lt_ptr)) free;
+    // ltdl should use the same mallocation as us
+    lt_dlmalloc = (lt_ptr (*) (size_t)) xmalloc;
+    lt_dlfree = (void (*) (lt_ptr)) free;
 
 #endif
 
-  // Make sure preloaded modules are initialised
-  LTDL_SET_PRELOADED_SYMBOLS();
+    // Make sure preloaded modules are initialised
+    LTDL_SET_PRELOADED_SYMBOLS();
 
-  // Initialize libtool's dynamic library loader
-  errors = lt_dlinit ();
+    // Initialize libtool's dynamic library loader
+    errors = lt_dlinit ();
 
-  if (errors) {
-    Err << "Couldn't initialize ltdl";
-    return ERROR;
-  }
+    if (errors) {
+        Err << "Couldn't initialize ltdl";
+        return ERROR;
+    }
 
-  dbglogfile << "Initialized ltdl" << endl;
+    dbglogfile << "Initialized ltdl" << endl;
   
     // Get the path to look for libraries in, or force a default one 
-  // if the ABELMON environment variable isn't set.
-  const char *abelmon = (char *)getenv ("ABELMON");
-  if (abelmon == NULL) {
-    getcwd((char *)&pwd, 512);
-    abelmon = pwd;
-    dbglogfile << "WARNING: using default DL search path" << endl;
-  }
+    // if the ABELMON environment variable isn't set.
+    const char *abelmon = (char *)getenv ("ABELMON");
+    if (abelmon == NULL) {
+        getcwd((char *)&pwd, 512);
+        abelmon = pwd;
+        dbglogfile << "WARNING: using default DL search path" << endl;
+    }
   
-  errors = lt_dladdsearchdir (abelmon);
-  if (errors) {
-    Err << lt_dlerror();
-    return ERROR;
-  }
+    errors = lt_dladdsearchdir (abelmon);
+    if (errors) {
+        Err << lt_dlerror();
+        return ERROR;
+    }
 
-  dbglogfile << "Added " << abelmon << " to the search paths" << endl;
+    dbglogfile << "Added " << abelmon << " to the search paths" << endl;
   
-  dbglogfile << "Trying to open shared library " << filespec << endl;
+    dbglogfile << "Trying to open shared library " << filespec << endl;
 
-  dlhandle = lt_dlopenext (filespec.c_str());
+    dlhandle = lt_dlopenext (filespec.c_str());
 
-  if (dlhandle == NULL) {
-    Err << lt_dlerror();
-    return ERROR;
-  }
+    if (dlhandle == NULL) {
+        Err << lt_dlerror();
+        return ERROR;
+    }
 
-  dlname = filespec;
+    dlname = filespec;
   
-  dbglogfile << "Opened dynamic library " << filespec << endl;
-  return SUCCESS;
+    dbglogfile << "Opened dynamic library " << filespec << endl;
+    return SUCCESS;
 }
 
 entrypoint *
 SharedLib::GetSymbol (std::string &symbol, ErrCond &err)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  entrypoint *run = NULL;
+    entrypoint *run = NULL;
  
-  run  = (entrypoint *) lt_dlsym (dlhandle, symbol.c_str());
+    run  = (entrypoint *) lt_dlsym (dlhandle, symbol.c_str());
 
-  // Realistically, we should never get a valid pointer with a value of 0
-  if (run == (entrypoint *)0) {
-    err << "Couldn't find symbol" << symbol << endl;
-    return NULL;
-  } else {
-    dbglogfile << "Found symbol " << symbol << " @ " << (void *)run << endl;
-  }
+    // Realistically, we should never get a valid pointer with a value of 0
+    if (run == (entrypoint *)0) {
+        err << "Couldn't find symbol" << symbol << endl;
+        return NULL;
+    } else {
+        dbglogfile << "Found symbol " << symbol << " @ " << (void *)run << 
endl;
+    }
 
-  return run;
+    return run;
 }
 
 #if 0
 // Open the database
 retcode_t
 SharedLib::ScanDir (void) {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  int i;
-  struct device_info *info;
-  struct dirent *entry;
-  lt_dlhandle dlhandle;
-  retcode_t (*InitDBaddr)(void);
-  lt_ptr_t addr;
-  struct errcond err;
-
-  // Initialize libdl
-  lt_dlinit ();
-  LTDL_SET_PRELOADED_SYMBOLS();
-
-  // Get the path to look for libraries in, or force a default one 
-  // if the ABELMON environment variable isn't set.
-  const char *abelmon = (char *)getenv ("ABELMON");
-  if (abelmon == NULL) {
-    abelmon = "/usr/local/lib/abelmon";
-    dbglogfile << "ERROR: You need to set ABELMON" << endl;
-  }
+    int i;
+    struct device_info *info;
+    struct dirent *entry;
+    lt_dlhandle dlhandle;
+    retcode_t (*InitDBaddr)(void);
+    lt_ptr_t addr;
+    struct errcond err;
+
+    // Initialize libdl
+    lt_dlinit ();
+    LTDL_SET_PRELOADED_SYMBOLS();
+
+    // Get the path to look for libraries in, or force a default one 
+    // if the ABELMON environment variable isn't set.
+    const char *abelmon = (char *)getenv ("ABELMON");
+    if (abelmon == NULL) {
+        abelmon = "/usr/local/lib/abelmon";
+        dbglogfile << "ERROR: You need to set ABELMON" << endl;
+    }
   
-  lt_dladdsearchdir (abelmon);
-  // dbglogfile << timestamp << "Searching in " << abelmon << "for database 
drivers" << endl;
+    lt_dladdsearchdir (abelmon);
+    // dbglogfile << timestamp << "Searching in " << abelmon << "for database 
drivers" << endl;
   
-  DIR *library_dir = opendir (abelmon);
+    DIR *library_dir = opendir (abelmon);
 
-  // By convention, the first two entries in each directory are for . and
-  // .. (``dot'' and ``dot dot''), so we ignore those.
-  entry = readdir(library_dir);
-  entry = readdir(library_dir);
-  
-  for (i=0; entry>0; i++) {
-    // We only want shared libraries than end with the suffix, otherwise
-    // we get all the duplicates.
+    // By convention, the first two entries in each directory are for . and
+    // .. (``dot'' and ``dot dot''), so we ignore those.
     entry = readdir(library_dir);
-    if ((int)entry < 1)
-      return SUCCESS;
-
-    //    handle = dlopen (entry->d_name, RTLD_NOW|RTLD_GLOBAL);
-    dlhandle = lt_dlopen (entry->d_name);
-    if (dlhandle == NULL) {
-      continue;
-    }
-    cout << "Opening " << entry->d_name << endl;
-    //    InitDBaddr = (retcode_t (*)(...))dlsym (handle, "InitDB");
-    (lt_ptr_t) InitDBaddr = lt_dlsym (dlhandle, "InitDB");
-    if (InitDBaddr != NULL) {
-      //      dbglogfile << "Found OpenDB in " << entry->d_name << endl;
-      cout << "Found InitDB in " << entry->d_name << " at " << addr << endl;
-      InitDBaddr();
-    } else {
-      //      dbglogfile << "Didn't find OpenDB in " << entry->d_name << endl;
-      cout << "Didn't find InitDB in " << entry->d_name << endl;
+    entry = readdir(library_dir);
+  
+    for (i=0; entry>0; i++) {
+        // We only want shared libraries than end with the suffix, otherwise
+        // we get all the duplicates.
+        entry = readdir(library_dir);
+        if ((int)entry < 1)
+            return SUCCESS;
+
+        //    handle = dlopen (entry->d_name, RTLD_NOW|RTLD_GLOBAL);
+        dlhandle = lt_dlopen (entry->d_name);
+        if (dlhandle == NULL) {
+            continue;
+        }
+        cout << "Opening " << entry->d_name << endl;
+        //    InitDBaddr = (retcode_t (*)(...))dlsym (handle, "InitDB");
+        (lt_ptr_t) InitDBaddr = lt_dlsym (dlhandle, "InitDB");
+        if (InitDBaddr != NULL) {
+            //      dbglogfile << "Found OpenDB in " << entry->d_name << endl;
+            cout << "Found InitDB in " << entry->d_name << " at " << addr << 
endl;
+            InitDBaddr();
+        } else {
+            //      dbglogfile << "Didn't find OpenDB in " << entry->d_name << 
endl;
+            cout << "Didn't find InitDB in " << entry->d_name << endl;
+        }
+        lt_dlclose (dlhandle);
     }
-    lt_dlclose (dlhandle);
-  }
-  closedir(library_dir);
+    closedir(library_dir);
 
 }
 #endif
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/sharedlib.h b/lib/sharedlib.h
index 198786d..ff01970 100644
--- a/lib/sharedlib.h
+++ b/lib/sharedlib.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -31,18 +32,23 @@ typedef retcode_t IOentrypoint (FILE *, struct errcond 
*err);
 class SharedLib
 {
 public:
-  retcode_t OpenLib (std::string &name, ErrCond &Err);
-  retcode_t CloseLib (ErrCond &Err);
-  entrypoint *GetSymbol (std::string &name, ErrCond &Err);
+    retcode_t OpenLib (std::string &name, ErrCond &Err);
+    retcode_t CloseLib (ErrCond &Err);
+    entrypoint *GetSymbol (std::string &name, ErrCond &Err);
 
-  // Accessors for the protocol name
-  std::string &GetDllName (void) { return dlname; }
-  void SetDllName (std::string &x) { dlname = x; }
+    // Accessors for the protocol name
+    std::string &GetDllName (void) { return dlname; }
+    void SetDllName (std::string &x) { dlname = x; }
 
 protected:
-  lt_dlhandle dlhandle;
-  std::string dlname;
+    lt_dlhandle dlhandle;
+    std::string dlname;
 };
 
 // __SHAREDLIB_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/snmp.cc b/lib/snmp.cc
index a6de259..89dba47 100644
--- a/lib/snmp.cc
+++ b/lib/snmp.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -70,63 +71,63 @@ SnmpClient::~SnmpClient()
 retcode_t
 SnmpClient::open(std::string init, std::string mibname)
 {
-  // PowerGuru
-  init_snmp(init.c_str());
-
-  snmp_sess_init( &_session );
-  _session.version = SNMP_VERSION_1;
-  _session.community = (u_char *)"public";
-  _session.community_len = strlen((const char *)_session.community);
-  //  _session.peername = _hostname.c_str();
-  _handle = snmp_open(&_session);
-
-  add_mibdir(".");
-  // "XANTREX-MIB.txt"
-  _mibtree = read_mib(mibname.c_str());
-
-  _pdu = snmp_pdu_create(SNMP_MSG_GET);
-
-  return SUCCESS;
+    // PowerGuru
+    init_snmp(init.c_str());
+    
+    snmp_sess_init( &_session );
+    _session.version = SNMP_VERSION_1;
+    _session.community = (u_char *)"public";
+    _session.community_len = strlen((const char *)_session.community);
+    //  _session.peername = _hostname.c_str();
+    _handle = snmp_open(&_session);
+    
+    add_mibdir(".");
+    // "XANTREX-MIB.txt"
+    _mibtree = read_mib(mibname.c_str());
+    
+    _pdu = snmp_pdu_create(SNMP_MSG_GET);
+    
+    return SUCCESS;
 }
 
 retcode_t
 SnmpClient::close(void)
 {
-  snmp_close(_handle);
-  cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
-  return ERROR;
+    snmp_close(_handle);
+    cerr << __PRETTY_FUNCTION__ << "ERROR: unimplemented!" << endl;
+    return ERROR;
 }
 
 struct snmp_pdu *
 SnmpClient::read(std::string mibnode)
 {
-  struct variable_list *vars;
-  oid id_oid[MAX_OID_LEN];
-  //  oid serial_oid[MAX_OID_LEN];
-  //  size_t serial_len = MAX_OID_LEN;
-  size_t id_len = MAX_OID_LEN;
-  int status;                             
-
-  // read_objid("XANTREX-MIB::xantrex.0", id_oid, &id_len);
-  read_objid(mibnode.c_str(), id_oid, &id_len);
-  snmp_add_null_var(_pdu, id_oid, id_len);
-
-  status = snmp_synch_response(_handle, _pdu, &_response);
-  
-  for(vars = _response->variables; vars; vars = vars->next_variable) {
-    print_value(vars->name, vars->name_length, vars);
-  }
-  
-  snmp_free_pdu(_response);
-
-  return _response;             // FIXME: this may be incorrect
+    struct variable_list *vars;
+    oid id_oid[MAX_OID_LEN];
+    //  oid serial_oid[MAX_OID_LEN];
+    //  size_t serial_len = MAX_OID_LEN;
+    size_t id_len = MAX_OID_LEN;
+    int status;                             
+    
+    // read_objid("XANTREX-MIB::xantrex.0", id_oid, &id_len);
+    read_objid(mibnode.c_str(), id_oid, &id_len);
+    snmp_add_null_var(_pdu, id_oid, id_len);
+    
+    status = snmp_synch_response(_handle, _pdu, &_response);
+    
+    for(vars = _response->variables; vars; vars = vars->next_variable) {
+        print_value(vars->name, vars->name_length, vars);
+    }
+    
+    snmp_free_pdu(_response);
+    
+    return _response;             // FIXME: this may be incorrect
 }
 
-
 static int keep_running;
 
 RETSIGTYPE
-stop_server(int a) {
+stop_server(int a)
+{
     keep_running = 0;
 }
 
@@ -140,90 +141,95 @@ SnmpDaemon::~SnmpDaemon()
 
 
 retcode_t
-SnmpDaemon::master(bool background) {
-  // print log errors to syslog or stderr
-  snmp_enable_stderrlog();
-  snmp_debug_init();  
-
-  snmp_set_do_debugging(1);
-  
-  // run in the background
-  Proc daemon;
-  if (background) {
-    daemon.Start("pgd");
-    exit(1);
-  }
-
-  // initialize tcpip, if necessary
-  SOCK_STARTUP;
-
-  // initialize MIB agent
-  init_agent("pgd");
-  //init_mib_modules();
-  
-  // mib generated code
-  init_powerguru();
-
+SnmpDaemon::master(bool background)
+{
+    // print log errors to syslog or stderr
+    snmp_enable_stderrlog();
+    snmp_debug_init();
+    
+    snmp_set_do_debugging(1);
+    
+    // run in the background
+    Proc daemon;
+    if (background) {
+        daemon.Start("pgd");
+        exit(1);
+    }
+    
+    // initialize tcpip, if necessary
+    SOCK_STARTUP;
+    
+    // initialize MIB agent
+    init_agent("pgd");
+    //init_mib_modules();
+    
+    // mib generated code
+    init_powerguru();
+    
 #if 0
-  // initialize vacm/usm access control
-  init_vacm_vars();
-  init_usmUser();
+    // initialize vacm/usm access control
+    init_vacm_vars();
+    init_usmUser();
 #endif
-  
-  init_snmp("pgd");
-
-  snmp_store("pgd");
-  
-  // open the port to listen on (defaults to udp:161)
-  init_master_agent();
-
-  // In case we receive a request to stop (kill -TERM or kill -INT)
-  keep_running = 1;
-  signal(SIGTERM, stop_server);
-  signal(SIGINT, stop_server);
-
-  snmp_log(LOG_INFO,"powerguru is up and running.\n");
-
-  // main loop
-  while(keep_running) {
-    // if you use select(), see snmp_select_info() in snmp_api(3)
-    //     --- OR ---
-    if (agent_check_and_process(1) > 0) { // 0 == don't block
-      printf("GOT SNMP Message!\n");
+    
+    init_snmp("pgd");
+    
+    snmp_store("pgd");
+    
+    // open the port to listen on (defaults to udp:161)
+    init_master_agent();
+    
+    // In case we receive a request to stop (kill -TERM or kill -INT)
+    keep_running = 1;
+    signal(SIGTERM, stop_server);
+    signal(SIGINT, stop_server);
+    
+    snmp_log(LOG_INFO,"powerguru is up and running.\n");
+    
+    // main loop
+    while(keep_running) {
+        // if you use select(), see snmp_select_info() in snmp_api(3)
+        //     --- OR ---
+        if (agent_check_and_process(1) > 0) { // 0 == don't block
+            printf("GOT SNMP Message!\n");
+        }
     }
-  }
-
-  if (background) {
-    //daemon.Stop("pgd");
-  }
-  
-  snmp_shutdown("powerguru");
-  SOCK_CLEANUP;
-
-  return SUCCESS;
+    
+    if (background) {
+        //daemon.Stop("pgd");
+    }
+    
+    snmp_shutdown("powerguru");
+    SOCK_CLEANUP;
+    
+    return SUCCESS;
 }
 
 #if 0
 retcode_t
 SnmpDaemon::process(void)
 {
-  int             numfds, count;
-
-  fd_set          readfds, writefds, exceptfds;
-  struct timeval  timeout, *tvp = &timeout;
-  int             block = 1;
-  
-
-  snmp_select_info(&numfds, &readfds, tvp, &block);
-  netsnmp_external_event_info(&numfds, &readfds, &writefds, &exceptfds);
-  netsnmp_dispatch_external_events(&count, &readfds,
-                                   &writefds, &exceptfds);
-  /* If there are still events leftover, process them */
-  if (count > 0) {
-    snmp_read(&readfds);
-  }
-
-  return SUCCESS;
+    int             numfds, count;
+    
+    fd_set          readfds, writefds, exceptfds;
+    struct timeval  timeout, *tvp = &timeout;
+    int             block = 1;
+    
+    
+    snmp_select_info(&numfds, &readfds, tvp, &block);
+    netsnmp_external_event_info(&numfds, &readfds, &writefds, &exceptfds);
+    netsnmp_dispatch_external_events(&count, &readfds,
+                                     &writefds, &exceptfds);
+    /* If there are still events leftover, process them */
+    if (count > 0) {
+        snmp_read(&readfds);
+    }
+    
+    return SUCCESS;
 }
 #endif
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/snmp.h b/lib/snmp.h
index 0a9322d..b6e01cc 100644
--- a/lib/snmp.h
+++ b/lib/snmp.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -73,39 +74,43 @@
 
 class SnmpClient
 {
- public:
-  SnmpClient();
-  ~SnmpClient();
-  retcode_t open(std::string init, std::string mibname);
-  retcode_t close(void);
-  struct snmp_pdu *read(std::string mibnode);
- private:
-  std::string           *_hostname;
+public:
+    SnmpClient();
+    ~SnmpClient();
+    retcode_t open(std::string init, std::string mibname);
+    retcode_t close(void);
+    struct snmp_pdu *read(std::string mibnode);
+private:
+    std::string           *_hostname;
 #ifdef USE_SNMP
-  struct snmp_session   _session;
-  struct snmp_session   *_handle;
-  struct tree           *_mibtree;
-  struct snmp_pdu       *_pdu;
-  struct snmp_pdu       *_response;
+    struct snmp_session   _session;
+    struct snmp_session   *_handle;
+    struct tree           *_mibtree;
+    struct snmp_pdu       *_pdu;
+    struct snmp_pdu       *_response;
 #endif
 };
 
 
 class SnmpDaemon
 {
- public:
-  SnmpDaemon();
-  ~SnmpDaemon();
-  retcode_t master(bool background);
-  retcode_t start(std::string init, std::string mibname);
-  retcode_t close(void);
-  struct snmp_pdu *readSnmp(std::string mibnode);
-  retcode_t process(void);
+public:
+    SnmpDaemon();
+    ~SnmpDaemon();
+    retcode_t master(bool background);
+    retcode_t start(std::string init, std::string mibname);
+    retcode_t close(void);
+    struct snmp_pdu *readSnmp(std::string mibnode);
+    retcode_t process(void);
   
- private:
-  std::string           *_hostname;
+private:
+    std::string           *_hostname;
 };
 
-
 // end of __SNMP_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/tcpip.cc b/lib/tcpip.cc
index 766d1a8..0cdd9e8 100644
--- a/lib/tcpip.cc
+++ b/lib/tcpip.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -67,7 +68,11 @@ int  Tcpip::_sockfd;
 int  Tcpip::_sockIOfd;
 
 Tcpip::Tcpip(void)
-    : _ipaddr(INADDR_ANY),  _proto(0), _debug(false), _console(false)// 
_sockfd(-1), _sockIOfd(-1), 
+    : _ipaddr(INADDR_ANY),
+      _proto(0),
+      _debug(false),
+      _console(false)
+      // _sockfd(-1), _sockIOfd(-1), 
 {
     // Get the low level host data for this machine
     hostDataGet();
@@ -80,25 +85,25 @@ Tcpip::~Tcpip(void)
 const string
 Tcpip::remoteIP(void)
 {
-  return inet_ntoa(_client.sin_addr);
+    return inet_ntoa(_client.sin_addr);
 }
 
 const string
 Tcpip::remoteIP(struct in_addr sockin)
 {
-  return inet_ntoa(sockin);
+    return inet_ntoa(sockin);
 }
 
 const string
 Tcpip::remoteName(void)
 {
-  return hostByAddrGet(inet_ntoa(_client.sin_addr));
+    return hostByAddrGet(inet_ntoa(_client.sin_addr));
 }
 
 const string
 Tcpip::remoteName(struct in_addr sockin)
 {
-  return hostByAddrGet(inet_ntoa(sockin));
+    return hostByAddrGet(inet_ntoa(sockin));
 }
 
 // Description: Create a tcp/ip network server. This creates a server
@@ -108,175 +113,175 @@ Tcpip::remoteName(struct in_addr sockin)
 retcode_t
 Tcpip::createNetServer(void)
 {
-  return createNetServer(DEFAULTPORT);
+    return createNetServer(DEFAULTPORT);
 }
 
 retcode_t
 Tcpip::createNetServer(short port)
 {
-  string str = DEFAULTPROTO;
-  return createNetServer(port, str);
+    string str = DEFAULTPROTO;
+    return createNetServer(port, str);
 }
 
 retcode_t
 Tcpip::createNetServer(string &service)
 {
-  string str = DEFAULTPROTO;
-  return createNetServer(service, str);
+    string str = DEFAULTPROTO;
+    return createNetServer(service, str);
 }
 
 retcode_t
 Tcpip::createNetServer(string &service, string &proto)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  const struct servent  *serv;
+    const struct servent  *serv;
 
-  serv = lookupService(service);
+    serv = lookupService(service);
   
-  // See if we got a service data structure
-  if (serv == 0) {
-    dbglogfile << "ERROR: unable to get " << service
-               << " service entry" << endl;
-    _port = 0;
-    return ERROR;
-  }
+    // See if we got a service data structure
+    if (serv == 0) {
+        dbglogfile << "ERROR: unable to get " << service
+                   << " service entry" << endl;
+        _port = 0;
+        return ERROR;
+    }
 
-  dbglogfile << "Port number is " << serv->s_port
-             << ", byte swapped is " << htons(serv->s_port) << endl;
+    dbglogfile << "Port number is " << serv->s_port
+               << ", byte swapped is " << htons(serv->s_port) << endl;
 
-  // Store the port number
-  _port = serv->s_port;
-  _proto = serv->s_proto;
+    // Store the port number
+    _port = serv->s_port;
+    _proto = serv->s_proto;
   
-  return createNetServer(serv->s_port, proto);
+    return createNetServer(serv->s_port, proto);
 }
 
 retcode_t
 Tcpip::createNetServer(short port, string &protocol)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  struct protoent *ppe;
-  struct sockaddr_in sock_in;
-  int             on, type;
-  int             retries = 0;
-  const struct hostent  *host;
-  struct in_addr  *thisaddr, newaddr;
-  in_addr_t       nodeaddr, netaddr;
+    struct protoent *ppe;
+    struct sockaddr_in sock_in;
+    int             on, type;
+    int             retries = 0;
+    const struct hostent  *host;
+    struct in_addr  *thisaddr, newaddr;
+    in_addr_t       nodeaddr, netaddr;
   
-  host = hostDataGet("localhost");
-  thisaddr = reinterpret_cast<struct in_addr *>(host->h_addr_list[0]);
-  _ipaddr = thisaddr->s_addr;
-  memset(&sock_in, 0, sizeof(sock_in));
+    host = hostDataGet("localhost");
+    thisaddr = reinterpret_cast<struct in_addr *>(host->h_addr_list[0]);
+    _ipaddr = thisaddr->s_addr;
+    memset(&sock_in, 0, sizeof(sock_in));
   
-  //  sock_in.sin_addr.s_addr = thisaddr->s_addr;
-  sock_in.sin_addr.s_addr = INADDR_ANY;
+    //  sock_in.sin_addr.s_addr = thisaddr->s_addr;
+    sock_in.sin_addr.s_addr = INADDR_ANY;
   
-  _ipaddr = sock_in.sin_addr.s_addr;
-  sock_in.sin_family = AF_INET;
-  sock_in.sin_port = htons(port);
+    _ipaddr = sock_in.sin_addr.s_addr;
+    sock_in.sin_family = AF_INET;
+    sock_in.sin_port = htons(port);
   
   
-  //    dbglogfile << "Trying to make a server for service "
-  //               <<
-  //      srvname << " at port " <<  ntohs(sock_in.sin_port) << nedl;
+    //    dbglogfile << "Trying to make a server for service "
+    //               <<
+    //      srvname << " at port " <<  ntohs(sock_in.sin_port) << nedl;
   
-  if ((ppe = getprotobyname(protocol.c_str())) == 0) {
-    // error, wasn't able to get a protocol entry
-    dbglogfile << "WARNING: unable to get " << protocol
-               << " protocol entry" << endl;
-    return ERROR;
-  }
+    if ((ppe = getprotobyname(protocol.c_str())) == 0) {
+        // error, wasn't able to get a protocol entry
+        dbglogfile << "WARNING: unable to get " << protocol
+                   << " protocol entry" << endl;
+        return ERROR;
+    }
   
-  // set protocol type
-  if (protocol == "udp") {
-    type = SOCK_DGRAM;
-  } else {
-    type = SOCK_STREAM;
-  }
+    // set protocol type
+    if (protocol == "udp") {
+        type = SOCK_DGRAM;
+    } else {
+        type = SOCK_STREAM;
+    }
   
-  // Get a file descriptor for this socket connection
-  _sockIOfd = socket(PF_INET, type, ppe->p_proto);
+    // Get a file descriptor for this socket connection
+    _sockIOfd = socket(PF_INET, type, ppe->p_proto);
   
-  // error, wasn't able to create a socket
-  if (_sockIOfd < 0) {
-    dbglogfile << "unable to create socket: " << strerror(errno) << endl;
-    return SUCCESS;
-  }
+    // error, wasn't able to create a socket
+    if (_sockIOfd < 0) {
+        dbglogfile << "unable to create socket: " << strerror(errno) << endl;
+        return SUCCESS;
+    }
 
-  on = 1;
-  if (setsockopt(_sockIOfd, SOL_SOCKET, SO_REUSEADDR,
-                 (char *)&on, sizeof(on)) < 0) {
-    dbglogfile << "setsockopt SO_REUSEADDR failed" << endl;
-    return ERROR;
-  }
+    on = 1;
+    if (setsockopt(_sockIOfd, SOL_SOCKET, SO_REUSEADDR,
+                   (char *)&on, sizeof(on)) < 0) {
+        dbglogfile << "setsockopt SO_REUSEADDR failed" << endl;
+        return ERROR;
+    }
 
-  retries = 0;
+    retries = 0;
   
-  nodeaddr = inet_lnaof(*thisaddr);
-  while (retries < 5) {
-    if (bind(_sockIOfd, reinterpret_cast<struct sockaddr *>(&sock_in),
-             sizeof(sock_in)) == -1) {
-      dbglogfile << "WARNING: unable to bind to"
-                 << inet_ntoa(sock_in.sin_addr)
-                 << " port!" << strerror(errno) << endl;
+    nodeaddr = inet_lnaof(*thisaddr);
+    while (retries < 5) {
+        if (bind(_sockIOfd, reinterpret_cast<struct sockaddr *>(&sock_in),
+                 sizeof(sock_in)) == -1) {
+            dbglogfile << "WARNING: unable to bind to"
+                       << inet_ntoa(sock_in.sin_addr)
+                       << " port!" << strerror(errno) << endl;
       
-      // If there is something already bound to this IP number,
-      // then we increment the number to be the next one in the
-      // range. This lets multiple tcp/ip servers operate on the
-      // same machine using the same tcp/ip port.
-      if (errno == EADDRINUSE) {
-        //            nodeaddr = inet_lnaof(*thisaddr);
-        netaddr = inet_netof(*thisaddr);
-        nodeaddr++;
-        newaddr = inet_makeaddr(netaddr, nodeaddr);
-        sock_in.sin_addr.s_addr = newaddr.s_addr;
-        // There are always two interfaces on any machine, the loopback
-        // device, and the default ethernet port. With IP aliasing, there
-        // will be more devices, but if not, we have an error, and can't
-        // continue.
-        if (numberOfInterfaces() - 2 > retries) {
-          retries++;
-          continue;
-        } else {
-          dbglogfile <<
-            "ERROR: There is another process already bound to this port!" << 
endl;
-          return ERROR;
+            // If there is something already bound to this IP number,
+            // then we increment the number to be the next one in the
+            // range. This lets multiple tcp/ip servers operate on the
+            // same machine using the same tcp/ip port.
+            if (errno == EADDRINUSE) {
+                //            nodeaddr = inet_lnaof(*thisaddr);
+                netaddr = inet_netof(*thisaddr);
+                nodeaddr++;
+                newaddr = inet_makeaddr(netaddr, nodeaddr);
+                sock_in.sin_addr.s_addr = newaddr.s_addr;
+                // There are always two interfaces on any machine, the loopback
+                // device, and the default ethernet port. With IP aliasing, 
there
+                // will be more devices, but if not, we have an error, and 
can't
+                // continue.
+                if (numberOfInterfaces() - 2 > retries) {
+                    retries++;
+                    continue;
+                } else {
+                    dbglogfile <<
+                        "ERROR: There is another process already bound to this 
port!" << endl;
+                    return ERROR;
+                }
+            }
+            retries++;
         }
-      }
-      retries++;
-    }
     
-    _hostname = hostByAddrGet(inet_ntoa(sock_in.sin_addr));
+        _hostname = hostByAddrGet(inet_ntoa(sock_in.sin_addr));
     
 #if 0
-    char                ascip[32];
-    inet_ntop(AF_INET, &_ipaddr, ascip, INET_ADDRSTRLEN);
-    dbglogfile << "Host Name is " << host->h_name << " IP is " <<
-      ascip << endl;
+        char                ascip[32];
+        inet_ntop(AF_INET, &_ipaddr, ascip, INET_ADDRSTRLEN);
+        dbglogfile << "Host Name is " << host->h_name << " IP is " <<
+            ascip << endl;
 #endif
     
-    dbglogfile << "Server bound to service "
-               << " on port: " << ntohs(sock_in.sin_port)
-               << " on IP " << inet_ntoa(sock_in.sin_addr)
-               << " using fd #" << _sockIOfd << endl;
+        dbglogfile << "Server bound to service "
+                   << " on port: " << ntohs(sock_in.sin_port)
+                   << " on IP " << inet_ntoa(sock_in.sin_addr)
+                   << " using fd #" << _sockIOfd << endl;
     
-    if (type == SOCK_STREAM && listen(_sockIOfd, 5) < 0) {
-      dbglogfile << "ERROR: unable to listen on port: "
-                 << port << ": " <<  strerror(errno) << endl; 
-      return ERROR;
-    }
+        if (type == SOCK_STREAM && listen(_sockIOfd, 5) < 0) {
+            dbglogfile << "ERROR: unable to listen on port: "
+                       << port << ": " <<  strerror(errno) << endl; 
+            return ERROR;
+        }
 
-    _port = port;
+        _port = port;
     
 #if 0
-    dbglogfile << "Listening for net traffic on fd #\n" << _sockfd << endl;
+        dbglogfile << "Listening for net traffic on fd #\n" << _sockfd << endl;
 #endif
     
-    return SUCCESS;
-  }
-  return ERROR;
+        return SUCCESS;
+    }
+    return ERROR;
 }
 
 // Description: Accept a new network connection for the port we have
@@ -285,353 +290,353 @@ Tcpip::createNetServer(short port, string &protocol)
 retcode_t
 Tcpip::newNetConnection(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  return newNetConnection(true);
+    DEBUGLOG_REPORT_FUNCTION;
+    return newNetConnection(true);
 }
 
 retcode_t
 Tcpip::newNetConnection(bool block)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  struct sockaddr      fsin;
-  socklen_t            alen;
-  int                  ret;
-  struct timeval        tval;
-  fd_set                fdset;
-  int                   retries = 3;
+    DEBUGLOG_REPORT_FUNCTION;
+    struct sockaddr    fsin;
+    socklen_t          alen;
+    int                        ret;
+    struct timeval        tval;
+    fd_set                fdset;
+    int                   retries = 3;
   
-  alen = sizeof(struct sockaddr_in);
+    alen = sizeof(struct sockaddr_in);
   
 #ifdef NET_DEBUG
-  dbglogfile << "Trying to accept net traffic on fd #" << _sockfd << endl;
+    dbglogfile << "Trying to accept net traffic on fd #" << _sockfd << endl;
 #endif
   
-  if (_sockIOfd <= 2) {
-    return ERROR;
-  }
-  
-  while (retries--) {
-    // We use select to wait for the read file descriptor to be
-    // active, which means there is a client waiting to connect.
-    FD_ZERO(&fdset);
-    // also return on any input from stdin
-    if (_console) {
-      FD_SET(fileno(stdin), &fdset);
+    if (_sockIOfd <= 2) {
+        return ERROR;
     }
-    FD_SET(_sockIOfd, &fdset);
+  
+    while (retries--) {
+        // We use select to wait for the read file descriptor to be
+        // active, which means there is a client waiting to connect.
+        FD_ZERO(&fdset);
+        // also return on any input from stdin
+        if (_console) {
+            FD_SET(fileno(stdin), &fdset);
+        }
+        FD_SET(_sockIOfd, &fdset);
     
-    // Reset the timeout value, since select modifies it on return. To
-    // block, set the timeout to zero.
-    tval.tv_sec = 1;
-    tval.tv_usec = 0;
+        // Reset the timeout value, since select modifies it on return. To
+        // block, set the timeout to zero.
+        tval.tv_sec = 1;
+        tval.tv_usec = 0;
     
-    if (block) {
-      ret = select(_sockIOfd+1, &fdset, NULL, NULL, NULL);
-    } else {
-      ret = select(_sockIOfd+1, &fdset, NULL, NULL, &tval);
-    }
+        if (block) {
+            ret = select(_sockIOfd+1, &fdset, NULL, NULL, NULL);
+        } else {
+            ret = select(_sockIOfd+1, &fdset, NULL, NULL, &tval);
+        }
     
-    if (FD_ISSET(0, &fdset)) {
-      dbglogfile << "There is data at the console for stdin!" << endl;
-      return SUCCESS;
-    }
+        if (FD_ISSET(0, &fdset)) {
+            dbglogfile << "There is data at the console for stdin!" << endl;
+            return SUCCESS;
+        }
 
-    // If interupted by a system call, try again
-    if (ret == -1 && errno == EINTR) {
-      dbglogfile <<
-        "The accept() socket for fd #%d was interupted by a system call!"
-                 << _sockIOfd << endl;
-    }
+        // If interupted by a system call, try again
+        if (ret == -1 && errno == EINTR) {
+            dbglogfile <<
+                "The accept() socket for fd #%d was interupted by a system 
call!"
+                       << _sockIOfd << endl;
+        }
     
-    if (ret == -1) {
-      dbglogfile << "ERROR: The accept() socket for fd " << _sockIOfd
-                 << " never was available for writing!" << endl;
-      return ERROR;
-    }
+        if (ret == -1) {
+            dbglogfile << "ERROR: The accept() socket for fd " << _sockIOfd
+                       << " never was available for writing!" << endl;
+            return ERROR;
+        }
     
-    if (ret == 0) {
-      if (_debug) {
-        dbglogfile <<
-          "ERROR: The accept() socket for fd #%d timed out waiting to write!"
-                   << _sockIOfd << endl;
-      }
+        if (ret == 0) {
+            if (_debug) {
+                dbglogfile <<
+                    "ERROR: The accept() socket for fd #%d timed out waiting 
to write!"
+                           << _sockIOfd << endl;
+            }
+        }
     }
-  }
   
-  fcntl(_sockIOfd, F_SETFL, O_NONBLOCK); // Don't let accept() block
-  _sockfd = accept(_sockIOfd, &fsin, &alen);
+    fcntl(_sockIOfd, F_SETFL, O_NONBLOCK); // Don't let accept() block
+    _sockfd = accept(_sockIOfd, &fsin, &alen);
   
-  if (_sockfd < 0) {
-    dbglogfile << "unable to accept : " << strerror(errno) << endl;
-    return ERROR;
-  }
+    if (_sockfd < 0) {
+        dbglogfile << "unable to accept : " << strerror(errno) << endl;
+        return ERROR;
+    }
   
-  dbglogfile << "Accepting tcp/ip connection on fd #"
-             << _sockfd << endl;
+    dbglogfile << "Accepting tcp/ip connection on fd #"
+               << _sockfd << endl;
 
-  memcpy(&_client, &fsin, sizeof(struct sockaddr));
+    memcpy(&_client, &fsin, sizeof(struct sockaddr));
   
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Description: Create a new conection to a tcp/ip server.
 retcode_t
 Tcpip::createNetClient(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string str = DEFAULTPROTO;
-  string host = "localhost";
+    DEBUGLOG_REPORT_FUNCTION;
+    string str = DEFAULTPROTO;
+    string host = "localhost";
   
-  return createNetClient(host, DEFAULTPORT, str);
+    return createNetClient(host, DEFAULTPORT, str);
 }
 
 retcode_t
 Tcpip::createNetClient(short port)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string str = DEFAULTPROTO;
-  string host = "localhost";
+    DEBUGLOG_REPORT_FUNCTION;
+    string str = DEFAULTPROTO;
+    string host = "localhost";
   
-  return createNetClient(host, port, str);
+    return createNetClient(host, port, str);
 }
 
 retcode_t
 Tcpip::createNetClient(string &hostname, short port)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string str = DEFAULTPROTO;
-  return createNetClient(hostname, port, str);
+    DEBUGLOG_REPORT_FUNCTION;
+    string str = DEFAULTPROTO;
+    return createNetClient(hostname, port, str);
 }
 
 retcode_t
 Tcpip::createNetClient(string &hostname)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string str = DEFAULTPROTO;
-  return createNetClient(hostname, DEFAULTPORT, str);
+    DEBUGLOG_REPORT_FUNCTION;
+    string str = DEFAULTPROTO;
+    return createNetClient(hostname, DEFAULTPORT, str);
 }
 
 retcode_t
 Tcpip::createNetClient(string &hostname, string &srvname, string &protocol)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  //    return createNetClient(hostname, srvname, "tcp");
+    DEBUGLOG_REPORT_FUNCTION;
+    //    return createNetClient(hostname, srvname, "tcp");
 }
 
 retcode_t
 Tcpip::createNetClient(string &hostname, short port, string &protocol)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  struct sockaddr_in   sock_in;
-  int                  type;
-  char                thishostname[MAXHOSTNAMELEN];
-  fd_set              fdset;
-  struct timeval      tval;
-  int                 ret;
-  int                 retries;
+    DEBUGLOG_REPORT_FUNCTION;
+    struct sockaddr_in sock_in;
+    int                type;
+    char                thishostname[MAXHOSTNAMELEN];
+    fd_set              fdset;
+    struct timeval      tval;
+    int                 ret;
+    int                 retries;
   
-  memset(&sock_in, 0, sizeof(struct sockaddr_in));
-  memset(&thishostname, 0, MAXHOSTNAMELEN);
+    memset(&sock_in, 0, sizeof(struct sockaddr_in));
+    memset(&thishostname, 0, MAXHOSTNAMELEN);
   
-  // If there is no supplied hostname, assume it's a local process
-  //  if ((hostname.size() == 0) || (hostname == "localhost")) {
-  if (hostname.size() == 0) {
-    if (gethostname(thishostname, MAXHOSTNAMELEN) == 0) {
-      if (_debug) {
-        dbglogfile << "The hostname for this machine is "
-                   << thishostname;
-      }
+    // If there is no supplied hostname, assume it's a local process
+    //  if ((hostname.size() == 0) || (hostname == "localhost")) {
+    if (hostname.size() == 0) {
+        if (gethostname(thishostname, MAXHOSTNAMELEN) == 0) {
+            if (_debug) {
+                dbglogfile << "The hostname for this machine is "
+                           << thishostname;
+            }
+        } else {
+            dbglogfile << "WARNING: Couldn't get the hostname for this 
machine!" << endl;
+        }
     } else {
-      dbglogfile << "WARNING: Couldn't get the hostname for this machine!" << 
endl;
+        strcpy(thishostname, hostname.c_str());
     }
-  } else {
-    strcpy(thishostname, hostname.c_str());
-  }
   
-  const struct hostent *hent = hostByNameGet(thishostname);
-  memcpy(&sock_in.sin_addr, hent->h_addr, hent->h_length);
+    const struct hostent *hent = hostByNameGet(thishostname);
+    memcpy(&sock_in.sin_addr, hent->h_addr, hent->h_length);
   
-  sock_in.sin_family = AF_INET;
+    sock_in.sin_family = AF_INET;
   
 #if 0
-  char                ascip[32];
-  inet_ntop(AF_INET, &sock_in.sin_addr.s_addr, ascip, INET_ADDRSTRLEN);
-  dbglogfile << "The IP address for this client socket is " << ascip << endl;
+    char                ascip[32];
+    inet_ntop(AF_INET, &sock_in.sin_addr.s_addr, ascip, INET_ADDRSTRLEN);
+    dbglogfile << "The IP address for this client socket is " << ascip << endl;
 #endif
   
-  sock_in.sin_port = htons(port);
-  //    sock_in.sin_port = (strtol(srvname.c_str(), &end, 0)) & 0xffff;
+    sock_in.sin_port = htons(port);
+    //    sock_in.sin_port = (strtol(srvname.c_str(), &end, 0)) & 0xffff;
   
-  // Set the protocol type
-  if (protocol == "udp") {
-    type = SOCK_DGRAM;
-  } else {
-    type = SOCK_STREAM;
-  }
+    // Set the protocol type
+    if (protocol == "udp") {
+        type = SOCK_DGRAM;
+    } else {
+        type = SOCK_STREAM;
+    }
   
-  if (protoDataGet(protocol) == 0) {
-    dbglogfile << "unable to get <%s> protocol entry\n"
-               << protoNameGet() << endl;
-    return ERROR;
-  }
+    if (protoDataGet(protocol) == 0) {
+        dbglogfile << "unable to get <%s> protocol entry\n"
+                   << protoNameGet() << endl;
+        return ERROR;
+    }
   
-  _sockfd = socket(PF_INET, type, protoNumGet());
+    _sockfd = socket(PF_INET, type, protoNumGet());
   
-  if (_sockfd < 0) {
-    dbglogfile << "WARNING: unable to create socket: "
-               << strerror(errno) << endl;
-    return ERROR;
-  }
+    if (_sockfd < 0) {
+        dbglogfile << "WARNING: unable to create socket: "
+                   << strerror(errno) << endl;
+        return ERROR;
+    }
 
-  if (connect(_sockfd,
-              reinterpret_cast<struct sockaddr *>(&sock_in),
-              sizeof(sock_in)) < 0) {
-    retries = 1;
-    while (retries-- > 0) {
-      // We use select to wait for the read file descriptor to be
-      // active, which means there is a client waiting to connect.
-      FD_ZERO(&fdset);
-      FD_SET(_sockfd, &fdset);
+    if (connect(_sockfd,
+                reinterpret_cast<struct sockaddr *>(&sock_in),
+                sizeof(sock_in)) < 0) {
+        retries = 1;
+        while (retries-- > 0) {
+            // We use select to wait for the read file descriptor to be
+            // active, which means there is a client waiting to connect.
+            FD_ZERO(&fdset);
+            FD_SET(_sockfd, &fdset);
       
-      // Reset the timeout value, since select modifies it on return. To
-      // block, set the timeout to zero.
-      tval.tv_sec = 5;
-      tval.tv_usec = 0;
+            // Reset the timeout value, since select modifies it on return. To
+            // block, set the timeout to zero.
+            tval.tv_sec = 5;
+            tval.tv_usec = 0;
       
-      ret = select(_sockfd+1, &fdset, NULL, NULL, &tval);
+            ret = select(_sockfd+1, &fdset, NULL, NULL, &tval);
       
-      // If interupted by a system call, try again
-      if (ret == -1 && errno == EINTR) {
-        dbglogfile <<
-          "The connect() socket for fd #%d was interupted by a system call!"
-                   << _sockfd << endl;
-      }
+            // If interupted by a system call, try again
+            if (ret == -1 && errno == EINTR) {
+                dbglogfile <<
+                    "The connect() socket for fd #%d was interupted by a 
system call!"
+                           << _sockfd << endl;
+            }
       
-      if (ret == -1) {
-        dbglogfile <<
-          "The connect() socket for fd #%d never was available for writing!"
-                   << _sockfd << endl;
-        shutdown(_sockfd, SHUT_RDWR);
-        return ERROR;
-      }
+            if (ret == -1) {
+                dbglogfile <<
+                    "The connect() socket for fd #%d never was available for 
writing!"
+                           << _sockfd << endl;
+                shutdown(_sockfd, SHUT_RDWR);
+                return ERROR;
+            }
       
-      if (ret == 0) {
-        if (_debug) {
-          dbglogfile <<
-            "WARNING: The connect() socket for fd #%d timed out waiting to 
write!"
-                     << _sockfd << endl;
+            if (ret == 0) {
+                if (_debug) {
+                    dbglogfile <<
+                        "WARNING: The connect() socket for fd #%d timed out 
waiting to write!"
+                               << _sockfd << endl;
+                }
+            }
         }
-      }
-    }
     
-    if (connect(_sockfd,
-                reinterpret_cast<struct sockaddr *>(&sock_in),
-                sizeof(sock_in)) < 0) {
-      dbglogfile << "unable to connect to "
-                 << thishostname
-                 << ", port " << port
-                 << ": " << strerror(errno) << endl;
-      close(_sockfd);
-      return ERROR;
+        if (connect(_sockfd,
+                    reinterpret_cast<struct sockaddr *>(&sock_in),
+                    sizeof(sock_in)) < 0) {
+            dbglogfile << "unable to connect to "
+                       << thishostname
+                       << ", port " << port
+                       << ": " << strerror(errno) << endl;
+            close(_sockfd);
+            return ERROR;
+        }
     }
-  }
 
-  dbglogfile << "Client connected to service at port " << port
-             << " at IP " << inet_ntoa(sock_in.sin_addr)
-             << " using fd #" << _sockfd << endl;
+    dbglogfile << "Client connected to service at port " << port
+               << " at IP " << inet_ntoa(sock_in.sin_addr)
+               << " using fd #" << _sockfd << endl;
   
-  // For a client, the IO file descriptor is the same as the default one
-  _sockIOfd = _sockfd;
+    // For a client, the IO file descriptor is the same as the default one
+    _sockIOfd = _sockfd;
 
-  memcpy(&_client, &sock_in, sizeof(struct sockaddr));
+    memcpy(&_client, &sock_in, sizeof(struct sockaddr));
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Description: Close an open socket connection.
 retcode_t
 Tcpip::closeConnection(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  if (_sockfd > 0) {
-    closeConnection(_sockfd);
-    _sockIOfd = 0;
-  }
+    if (_sockfd > 0) {
+        closeConnection(_sockfd);
+        _sockIOfd = 0;
+    }
   
-  return ERROR;
+    return ERROR;
 }
 
 retcode_t
 Tcpip::closeConnection(int fd)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  if (fd > 0) {
-    closeConnection(fd);
-  }
+    if (fd > 0) {
+        closeConnection(fd);
+    }
   
-  return ERROR;
+    return ERROR;
 }
 
 retcode_t
 Tcpip::closeNet(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  closeNet(_sockfd);
-  _sockfd = 0;
+    closeNet(_sockfd);
+    _sockfd = 0;
   
-  return ERROR;
+    return ERROR;
 }
 
 retcode_t
 Tcpip::closeNet(int sockfd)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  int retries = 0;
+    DEBUGLOG_REPORT_FUNCTION;
+    int retries = 0;
   
-  // If we can't close the socket, other processes must be
-  // locked on it, so we wait a second, and try again. After a
-  // few tries, we give up, cause there must be something
-  // wrong.
+    // If we can't close the socket, other processes must be
+    // locked on it, so we wait a second, and try again. After a
+    // few tries, we give up, cause there must be something
+    // wrong.
 
-  if (sockfd <= 0) {
-    return SUCCESS;
-  }
+    if (sockfd <= 0) {
+        return SUCCESS;
+    }
   
-  while (retries < 3) {
-    if (sockfd) {
-      // Shutdown the socket connection
+    while (retries < 3) {
+        if (sockfd) {
+            // Shutdown the socket connection
 #if 0
-      if (shutdown(sockfd, SHUT_RDWR) < 0) {
-        if (errno != ENOTCONN) {
-          dbglogfile << "WARNING: Unable to shutdown socket for fd #"
-                     << sockfd << strerror(errno) << endl;
-        } else {
-          dbglogfile << "The socket using fd #" << sockfd
-                     << " has been shut down successfully." << endl;
-          return SUCCESS;
-        }
-      }
+            if (shutdown(sockfd, SHUT_RDWR) < 0) {
+                if (errno != ENOTCONN) {
+                    dbglogfile << "WARNING: Unable to shutdown socket for fd #"
+                               << sockfd << strerror(errno) << endl;
+                } else {
+                    dbglogfile << "The socket using fd #" << sockfd
+                               << " has been shut down successfully." << endl;
+                    return SUCCESS;
+                }
+            }
 #endif 
-      if (close(sockfd) < 0) {
-        dbglogfile <<
-          "WARNING: Unable to close the socket for fd "
-                   <<  sockfd << strerror(errno) << endl;
-        sleep(1);
-        retries++;
-      } else {
-        dbglogfile << "Closed the socket for "
-                   << serviceNameGet()
-                   << " on fd " << sockfd << endl;
-        return SUCCESS;
-      }
+            if (close(sockfd) < 0) {
+                dbglogfile <<
+                    "WARNING: Unable to close the socket for fd "
+                           <<  sockfd << strerror(errno) << endl;
+                sleep(1);
+                retries++;
+            } else {
+                dbglogfile << "Closed the socket for "
+                           << serviceNameGet()
+                           << " on fd " << sockfd << endl;
+                return SUCCESS;
+            }
+        }
     }
-  }
 
   
-  return ERROR;
+    return ERROR;
 }
 
 void
@@ -648,9 +653,9 @@ Tcpip::toggleDebug(bool val)
 retcode_t
 Tcpip::anydata(vector<const xmlChar *> &msgs)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  //printf("%s: \n", __FUNCTION__);
-  return anydata(_sockfd, msgs);
+    DEBUGLOG_REPORT_FUNCTION;
+    //printf("%s: \n", __FUNCTION__);
+    return anydata(_sockfd, msgs);
 }
 
 // This waits for data on the socket, and on stdin. This way we can sit
@@ -658,265 +663,265 @@ Tcpip::anydata(vector<const xmlChar *> &msgs)
 retcode_t
 Tcpip::anydata(int fd, vector<const xmlChar *> &msgs)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  fd_set                fdset;
-  struct timeval        tval;
-  int                   ret = 0;
-  char                  buf[INBUF];
-  char                  *packet;
-  int                   retries = 10;
-  char                  *ptr, *eom;
-  int                   cr, index = 0;
-  static char           *leftover = 0;
-  int                   adjusted_size;
-
-  if (fd <= 0) {
-    return ERROR;
-  }
-  
-  //fcntl(_sockfd, F_SETFL, O_NONBLOCK);
-
-  //msgs = (char **)realloc(msgs, sizeof(char *));
-  while (retries-- > 0) {
-    FD_ZERO(&fdset);
-    // also return on any input from stdin
-    if (_console) {
-      FD_SET(fileno(stdin), &fdset);
+    DEBUGLOG_REPORT_FUNCTION;
+    fd_set                fdset;
+    struct timeval        tval;
+    int                   ret = 0;
+    char                  buf[INBUF];
+    char                  *packet;
+    int                   retries = 10;
+    char                  *ptr, *eom;
+    int                   cr, index = 0;
+    static char           *leftover = 0;
+    int                   adjusted_size;
+
+    if (fd <= 0) {
+        return ERROR;
     }
-    FD_SET(fd, &fdset);
+  
+    //fcntl(_sockfd, F_SETFL, O_NONBLOCK);
+
+    //msgs = (char **)realloc(msgs, sizeof(char *));
+    while (retries-- > 0) {
+        FD_ZERO(&fdset);
+        // also return on any input from stdin
+        if (_console) {
+            FD_SET(fileno(stdin), &fdset);
+        }
+        FD_SET(fd, &fdset);
     
-    tval.tv_sec = 10;
-    tval.tv_usec = 10;
+        tval.tv_sec = 10;
+        tval.tv_usec = 10;
     
-    ret = ::select(fd+1, &fdset, NULL, NULL, &tval);
+        ret = ::select(fd+1, &fdset, NULL, NULL, &tval);
 
-    // If interupted by a system call, try again
-    if (ret == -1 && (errno == EINTR || errno == EAGAIN)) {
-      dbglogfile << "The socket for fd #%d was interupted by a system call!"
-                 << fd << endl;
-      continue;
-    }
-    if (ret == 0) {
-      dbglogfile << "There is no data in the socket for fd #" << fd << endl;
-      msgs.clear();
-      return SUCCESS;
-    }
-    if (ret == -1) {
-      dbglogfile << "The socket for fd #%d never was available!"
-                 << fd << endl;
-      return ERROR;
-    }
-    if (ret > 0) {
-      if (FD_ISSET(fileno(stdin), &fdset)) {
-        dbglogfile << "There is data at the console for stdin!" << endl;
-        msgs.clear();
-        return SUCCESS;
-      }
-      dbglogfile << "There is data in the socket for fd #" << fd << endl;
-    }
-    memset(buf, 0, INBUF);
-    if (FD_ISSET(_sockfd, &fdset)) {
-      ret = ::read(_sockfd, buf, INBUF-2);
-    } else {
-      return ERROR;
-    }
+        // If interupted by a system call, try again
+        if (ret == -1 && (errno == EINTR || errno == EAGAIN)) {
+            dbglogfile << "The socket for fd #%d was interupted by a system 
call!"
+                       << fd << endl;
+            continue;
+        }
+        if (ret == 0) {
+            dbglogfile << "There is no data in the socket for fd #" << fd << 
endl;
+            msgs.clear();
+            return SUCCESS;
+        }
+        if (ret == -1) {
+            dbglogfile << "The socket for fd #%d never was available!"
+                       << fd << endl;
+            return ERROR;
+        }
+        if (ret > 0) {
+            if (FD_ISSET(fileno(stdin), &fdset)) {
+                dbglogfile << "There is data at the console for stdin!" << 
endl;
+                msgs.clear();
+                return SUCCESS;
+            }
+            dbglogfile << "There is data in the socket for fd #" << fd << endl;
+        }
+        memset(buf, 0, INBUF);
+        if (FD_ISSET(_sockfd, &fdset)) {
+            ret = ::read(_sockfd, buf, INBUF-2);
+        } else {
+            return ERROR;
+        }
     
-    if (ret == 0) {
-      return ERROR;
-    }
+        if (ret == 0) {
+            return ERROR;
+        }
     
-    if (ret == -1) {
-      switch (errno) {
-      case EAGAIN:
-        continue;
-        break;
-      default:
-        break;
-      };
-      return ERROR;
-    }
-    cr = strlen(buf);
+        if (ret == -1) {
+            switch (errno) {
+              case EAGAIN:
+                  continue;
+                  break;
+              default:
+                  break;
+            };
+            return ERROR;
+        }
+        cr = strlen(buf);
 //     dbglogfile << "read " << ret << " bytes, first msg terminates at " << 
cr << endl;
 //     dbglogfile << "read " << buf << endl;
-    ptr = buf;
-    // If we get a single XML message, do less work
-    if (ret == cr + 1) {
-      adjusted_size = memadjust(ret + 1);
-      packet = new char[adjusted_size];
-      //printf("Packet size is %d at %p\n", ret + 1, packet);
-      memset(packet, 0, adjusted_size);
-      strcpy(packet, ptr);
-      eom = strrchr(packet, '\n'); // drop the CR off the end if there is one
-      if (eom) {
-        *eom = 0;
-      }
-      //    msgs[index] = (const xmlChar *)packet;
-      msgs.push_back((const xmlChar *)packet);
-      //      msgs[index+1] = 0;
-      //printf("%d: Pushing Packet of size %d at %p\n", __LINE__, 
strlen(packet), packet);
-      //processing(false);
+        ptr = buf;
+        // If we get a single XML message, do less work
+        if (ret == cr + 1) {
+            adjusted_size = memadjust(ret + 1);
+            packet = new char[adjusted_size];
+            //printf("Packet size is %d at %p\n", ret + 1, packet);
+            memset(packet, 0, adjusted_size);
+            strcpy(packet, ptr);
+            eom = strrchr(packet, '\n'); // drop the CR off the end if there 
is one
+            if (eom) {
+                *eom = 0;
+            }
+            //    msgs[index] = (const xmlChar *)packet;
+            msgs.push_back((const xmlChar *)packet);
+            //      msgs[index+1] = 0;
+            //printf("%d: Pushing Packet of size %d at %p\n", __LINE__, 
strlen(packet), packet);
+            //processing(false);
       
-      return SUCCESS;
-    }
-
-    // If we get multiple messages in a single transmission, break the buffer
-    // into separate messages.
-    while ((strchr(ptr, '\0') > 0) && (ptr > 0)) {
-      if (leftover) {
-        //processing(false);
-        printf("%s: The remainder is: \"%s\"\n", __FUNCTION__, leftover);
-        printf("%s: The rest of the message is: \"%s\"\n", __FUNCTION__, ptr);
-        adjusted_size = memadjust(cr + strlen(leftover) + 1);
-        packet = new char[adjusted_size];
-        memset(packet, 0, adjusted_size);
-        strcpy(packet, leftover);
-        strcat(packet, ptr);
-        eom = strrchr(packet, '\0'); // drop the CR off the end there is one
-        if (eom) {
-          *eom = 0;
-        }
-        printf("%s: The whole message is: \"%s\"\n", __FUNCTION__, packet);
-        ptr = strchr(ptr, '\0') + 2; // messages are delimited by a "\n\0"
-        delete leftover;
-        leftover = 0;
-      } else {
-        adjusted_size = memadjust(cr + 1);
-        packet = new char[adjusted_size];
-        memset(packet, 0, adjusted_size);
-        strcpy(packet, ptr);
-        ptr += cr + 1;
-        //dbglogfile << "Packet is: " << packet << endl;
-      } // end of if remainder
-      if (*packet == '<') {
-        eom = strrchr(packet, '\n'); // drop the CR off the end there is one
-        if (eom) {
-          *eom = 0;
-        }
-        //printf("Allocating new packet at %p\n", packet);
-        //data.push_back(packet);
-        //        msgs[index++] = (const xmlChar *)packet;
-        msgs.push_back((const xmlChar *)packet);
-      } else {
-        if (*packet == *ptr) {
-          // dbglogfile << "Read all XML messages in packet " << packet << 
endl;
-          break;
-        } else { 
-          //dbglogfile << "WARNING: Throwing out partial packet " << endl;
-          dbglogfile << "WARNING: Throwing out partial packet " << packet << 
endl;
-          break;
+            return SUCCESS;
         }
-      }
+
+        // If we get multiple messages in a single transmission, break the 
buffer
+        // into separate messages.
+        while ((strchr(ptr, '\0') > 0) && (ptr > 0)) {
+            if (leftover) {
+                //processing(false);
+                printf("%s: The remainder is: \"%s\"\n", __FUNCTION__, 
leftover);
+                printf("%s: The rest of the message is: \"%s\"\n", 
__FUNCTION__, ptr);
+                adjusted_size = memadjust(cr + strlen(leftover) + 1);
+                packet = new char[adjusted_size];
+                memset(packet, 0, adjusted_size);
+                strcpy(packet, leftover);
+                strcat(packet, ptr);
+                eom = strrchr(packet, '\0'); // drop the CR off the end there 
is one
+                if (eom) {
+                    *eom = 0;
+                }
+                printf("%s: The whole message is: \"%s\"\n", __FUNCTION__, 
packet);
+                ptr = strchr(ptr, '\0') + 2; // messages are delimited by a 
"\n\0"
+                delete leftover;
+                leftover = 0;
+            } else {
+                adjusted_size = memadjust(cr + 1);
+                packet = new char[adjusted_size];
+                memset(packet, 0, adjusted_size);
+                strcpy(packet, ptr);
+                ptr += cr + 1;
+                //dbglogfile << "Packet is: " << packet << endl;
+            } // end of if remainder
+            if (*packet == '<') {
+                eom = strrchr(packet, '\n'); // drop the CR off the end there 
is one
+                if (eom) {
+                    *eom = 0;
+                }
+                //printf("Allocating new packet at %p\n", packet);
+                //data.push_back(packet);
+                //        msgs[index++] = (const xmlChar *)packet;
+                msgs.push_back((const xmlChar *)packet);
+            } else {
+                if (*packet == *ptr) {
+                    // dbglogfile << "Read all XML messages in packet " << 
packet << endl;
+                    break;
+                } else { 
+                    //dbglogfile << "WARNING: Throwing out partial packet " << 
endl;
+                    dbglogfile << "WARNING: Throwing out partial packet " << 
packet << endl;
+                    break;
+                }
+            }
       
-      cr = strlen(ptr);
-    } // end of while (cr)
+            cr = strlen(ptr);
+        } // end of while (cr)
     
-    if (strlen(ptr) > 0) {
-      leftover = new char[strlen(ptr) + 1];
-      strcpy(leftover, ptr);
-      //processing(true);
-      printf("%s: Adding remainder: \"%s\"\n", __FUNCTION__, leftover);
-    }
+        if (strlen(ptr) > 0) {
+            leftover = new char[strlen(ptr) + 1];
+            strcpy(leftover, ptr);
+            //processing(true);
+            printf("%s: Adding remainder: \"%s\"\n", __FUNCTION__, leftover);
+        }
     
-    //processing(false);
-    if (msgs.size() == 0) {
-      return ERROR;
-      //      printf("Returning %d messages\n", msgs.size());
-    }
-    return SUCCESS;
+        //processing(false);
+        if (msgs.size() == 0) {
+            return ERROR;
+            //      printf("Returning %d messages\n", msgs.size());
+        }
+        return SUCCESS;
     
-  } // end of while (retires)
+    } // end of while (retires)
 
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // Read from the socket
 int
 Tcpip::readNet(char *buffer, int nbytes)
 {
-  return readNet(_sockfd, buffer, nbytes, DEFAULTTIMEOUT);
+    return readNet(_sockfd, buffer, nbytes, DEFAULTTIMEOUT);
 }
 
 int
 Tcpip::readNet(int fd, char *buffer, int nbytes)
 {
-  return readNet(fd, buffer, nbytes, DEFAULTTIMEOUT);
+    return readNet(fd, buffer, nbytes, DEFAULTTIMEOUT);
 }
 
 int
 Tcpip::readNet(char *buffer, int nbytes, int timeout)
 {
-  return readNet(_sockfd, buffer, nbytes, timeout);
+    return readNet(_sockfd, buffer, nbytes, timeout);
 }
 
 int
 Tcpip::readNet(int fd, char *buffer, int nbytes, int timeout)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  fd_set              fdset;
-  int                 ret = 0;
-  struct timeval      tval;
+    DEBUGLOG_REPORT_FUNCTION;
+    fd_set              fdset;
+    int                 ret = 0;
+    struct timeval      tval;
   
-  // have ensible limits...
-  if (fd == 0 || fd > 100) {
-    return -1;
-  }
+    // have ensible limits...
+    if (fd == 0 || fd > 100) {
+        return -1;
+    }
     
-  // Wait for the socket to be ready for reading
-  if (fd > 2) {
-    FD_ZERO(&fdset);
-    FD_SET(fd, &fdset);
-  } else {
-    dbglogfile << "WARNING: Can't do anything with socket fd #"
-               << fd << endl;
-    return -1;
-  }
+    // Wait for the socket to be ready for reading
+    if (fd > 2) {
+        FD_ZERO(&fdset);
+        FD_SET(fd, &fdset);
+    } else {
+        dbglogfile << "WARNING: Can't do anything with socket fd #"
+                   << fd << endl;
+        return -1;
+    }
   
-  // Reset the timeout value, since select modifies it on return
-  if (timeout >= 0) {
-    tval.tv_sec = timeout;
-  } else {
-    tval.tv_sec = DEFAULTTIMEOUT;
-  }
-  tval.tv_usec = 0;
-  if (timeout != BLOCKING_TIMEOUT) {
-    ret = select(fd+1, &fdset, NULL, NULL, &tval);
-  } else {
-    ret = select(fd+1, &fdset, NULL, NULL, NULL);        
-  }
+    // Reset the timeout value, since select modifies it on return
+    if (timeout >= 0) {
+        tval.tv_sec = timeout;
+    } else {
+        tval.tv_sec = DEFAULTTIMEOUT;
+    }
+    tval.tv_usec = 0;
+    if (timeout != BLOCKING_TIMEOUT) {
+        ret = select(fd+1, &fdset, NULL, NULL, &tval);
+    } else {
+        ret = select(fd+1, &fdset, NULL, NULL, NULL);        
+    }
   
 
-  // If interupted by a system call, try again
-  if (ret == -1 && errno == EINTR) {
-    dbglogfile <<
-      "The socket for fd #" << fd << " we interupted by a system call!"
-               << endl;
-    dbglogfile << "WARNING: error is " << strerror(errno) << endl;
-    return 0;
-  }
+    // If interupted by a system call, try again
+    if (ret == -1 && errno == EINTR) {
+        dbglogfile <<
+            "The socket for fd #" << fd << " we interupted by a system call!"
+                                  << endl;
+        dbglogfile << "WARNING: error is " << strerror(errno) << endl;
+        return 0;
+    }
   
-  if (ret == -1) {
-    dbglogfile <<
-      "The socket for fd #" << fd << " never was available for reading!"
-               << endl;
-    return -1;
-  }
+    if (ret == -1) {
+        dbglogfile <<
+            "The socket for fd #" << fd << " never was available for reading!"
+                                  << endl;
+        return -1;
+    }
   
-  if (ret == 0) {
+    if (ret == 0) {
 #if 0                           // FIXME: too verbose
-    dbglogfile <<
-      "The socket for fd #" << fd << " timed out waiting to read!" << endl;
+        dbglogfile <<
+            "The socket for fd #" << fd << " timed out waiting to read!" << 
endl;
 #endif
-    return 0;
-  }
+        return 0;
+    }
 
-  ret = read(fd, buffer, nbytes);
+    ret = read(fd, buffer, nbytes);
 #if 0
-  if (ret != 0) {
-    dbglogfile << "Read " << ret << " bytes from fd #" << fd << endl;
-    dbglogfile << "Buffer says " << buffer << endl;
-  }
+    if (ret != 0) {
+        dbglogfile << "Read " << ret << " bytes from fd #" << fd << endl;
+        dbglogfile << "Buffer says " << buffer << endl;
+    }
 #endif
-  return ret;
+    return ret;
 }
 
 // Write data to the socket. We first make sure the socket is ready for
@@ -924,134 +929,134 @@ Tcpip::readNet(int fd, char *buffer, int nbytes, int 
timeout)
 int
 Tcpip::writeNet(string buffer)
 {
-  return writeNet(_sockfd, buffer.c_str(), buffer.size(), DEFAULTTIMEOUT);
+    return writeNet(_sockfd, buffer.c_str(), buffer.size(), DEFAULTTIMEOUT);
 }
 
 int
 Tcpip::writeNet(char const *buffer)
 {
-  return writeNet(_sockfd, buffer, strlen(buffer), DEFAULTTIMEOUT);
+    return writeNet(_sockfd, buffer, strlen(buffer), DEFAULTTIMEOUT);
 }
 
 int
 Tcpip::writeNet(char const *buffer, int nbytes)
 {
-  return writeNet(_sockfd, buffer, nbytes,DEFAULTTIMEOUT );
+    return writeNet(_sockfd, buffer, nbytes,DEFAULTTIMEOUT );
 }
 
 int
 Tcpip::writeNet(int fd, char const *buffer)
 {
-  return writeNet(fd, buffer, strlen(buffer), DEFAULTTIMEOUT);
+    return writeNet(fd, buffer, strlen(buffer), DEFAULTTIMEOUT);
 }
 
 int
 Tcpip::writeNet(int fd, char const *buffer, int nbytes)
 {
-  return writeNet(fd, buffer, nbytes, DEFAULTTIMEOUT);
+    return writeNet(fd, buffer, nbytes, DEFAULTTIMEOUT);
 }
 
 int
 Tcpip::writeNet(int fd, char const *buffer, int nbytes, int timeout)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  fd_set              fdset;
-  int                 ret = 0;
-  const char         *bufptr;
-  struct timeval      tval;
-  int                 retries = 3;
+    DEBUGLOG_REPORT_FUNCTION;
+    fd_set              fdset;
+    int                 ret = 0;
+    const char         *bufptr;
+    struct timeval      tval;
+    int                 retries = 3;
   
-  bufptr = buffer;
+    bufptr = buffer;
 
-  dbglogfile << "Writing to socket: \r\n\t" << buffer << endl;
+    dbglogfile << "Writing to socket: \r\n\t" << buffer << endl;
 
-  while (retries-- > 1) {
-    // Wait for the socket to be ready for writing
-    if (_sockfd > 2) {
-      FD_ZERO(&fdset);
-      FD_SET(fd, &fdset);
-    } else {
-      dbglogfile << "WARNING: Can't do anything with socket fd #!"
-              << fd << endl;
-      return -1;
-    }
+    while (retries-- > 1) {
+        // Wait for the socket to be ready for writing
+        if (_sockfd > 2) {
+            FD_ZERO(&fdset);
+            FD_SET(fd, &fdset);
+        } else {
+            dbglogfile << "WARNING: Can't do anything with socket fd #!"
+                       << fd << endl;
+            return -1;
+        }
     
-    // Reset the timeout value, since select modifies it on return
-    if (timeout) {
-      tval.tv_sec = timeout;
-    } else {
-      tval.tv_sec = DEFAULTTIMEOUT;
-    }
-    tval.tv_usec = 100;
-    ret = select(fd+1, NULL, &fdset, NULL, &tval);
+        // Reset the timeout value, since select modifies it on return
+        if (timeout) {
+            tval.tv_sec = timeout;
+        } else {
+            tval.tv_sec = DEFAULTTIMEOUT;
+        }
+        tval.tv_usec = 100;
+        ret = select(fd+1, NULL, &fdset, NULL, &tval);
     
-    // If interupted by a system call, try again
-    if (ret == -1 && errno == EINTR) {
-      dbglogfile <<
-        "The socket for fd #" << fd << " we interupted by a system call!" << 
endl;
-    }
+        // If interupted by a system call, try again
+        if (ret == -1 && errno == EINTR) {
+            dbglogfile <<
+                "The socket for fd #" << fd << " we interupted by a system 
call!" << endl;
+        }
     
-    if (ret == -1) {
-      dbglogfile << "The socket for fd #" << fd
-                 << " never was available for writing!" << endl;
-      continue;
-    }
+        if (ret == -1) {
+            dbglogfile << "The socket for fd #" << fd
+                       << " never was available for writing!" << endl;
+            continue;
+        }
     
-    if (ret == 0) {
-      dbglogfile << "The socket for fd #"
-                 << fd << " timed out waiting to write!" << endl;
-      continue;
-    }
-    ret = write(fd, bufptr, nbytes);
-    // Add a LF/CR to flush the buffer.
-    // write(fd, "\r\n", 2);
+        if (ret == 0) {
+            dbglogfile << "The socket for fd #"
+                       << fd << " timed out waiting to write!" << endl;
+            continue;
+        }
+        ret = write(fd, bufptr, nbytes);
+        // Add a LF/CR to flush the buffer.
+        // write(fd, "\r\n", 2);
     
     
-    if (ret == 0) {
-      dbglogfile << "Couldn't write any bytes to fd #" << fd << endl;
-      return ret;
-    }
+        if (ret == 0) {
+            dbglogfile << "Couldn't write any bytes to fd #" << fd << endl;
+            return ret;
+        }
     
-    if (ret < 0) {
-      dbglogfile << "Couldn't write " << nbytes << " bytes to fd #"
-                 << fd << endl;
-      return ret;
-    }
+        if (ret < 0) {
+            dbglogfile << "Couldn't write " << nbytes << " bytes to fd #"
+                       << fd << endl;
+            return ret;
+        }
     
-    if (ret > 0) {
-      bufptr += ret;            
-      if (ret != nbytes) {
-        dbglogfile << "wrote " << ret << " bytes to fd #"
-                   << fd << " expected " <<  nbytes << endl;
-        retries++;
-      } else {
+        if (ret > 0) {
+            bufptr += ret;            
+            if (ret != nbytes) {
+                dbglogfile << "wrote " << ret << " bytes to fd #"
+                           << fd << " expected " <<  nbytes << endl;
+                retries++;
+            } else {
 #if 0
-        dbglogfile << "Wrote " << ret << " bytes to fd #" << fd << endl;
+                dbglogfile << "Wrote " << ret << " bytes to fd #" << fd << 
endl;
 #endif
-        return ret;
-      }
+                return ret;
+            }
       
-      if (ret == 0) {
-        dbglogfile << "Wrote 0 bytes to fd #" << fd << endl;
-      }
+            if (ret == 0) {
+                dbglogfile << "Wrote 0 bytes to fd #" << fd << endl;
+            }
+        }
     }
-  }
   
-  return ret;
+    return ret;
 }
 
 Tcpip &
 Tcpip::operator = (Tcpip &tcp) 
 {
 #if 1
-  _sockfd = _sockfd;
-  _sockIOfd = _sockIOfd;
-  _ipaddr = _ipaddr;
-  _hostname = _hostname;
-  //memcpy(_client, tcp._client, sizeof(sockaddr_in);
-  //_proto = strdup(_proto);
-  _port = _port;
-  _debug = _debug;
+    _sockfd = _sockfd;
+    _sockIOfd = _sockIOfd;
+    _ipaddr = _ipaddr;
+    _hostname = _hostname;
+    //memcpy(_client, tcp._client, sizeof(sockaddr_in);
+    //_proto = strdup(_proto);
+    _port = _port;
+    _debug = _debug;
 #endif
 }
 
@@ -1063,11 +1068,15 @@ Tcpip::netNameGet(void)
     char hostname[MAXHOSTNAMELEN];
 
     if (_hostname.size() == 0) {
-      gethostname(hostname, MAXHOSTNAMELEN);
-      _hostname = hostname;
+        gethostname(hostname, MAXHOSTNAMELEN);
+        _hostname = hostname;
     }
     
     return _hostname;
 }
 #endif
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/tcpip.h b/lib/tcpip.h
index b53f247..761dd74 100644
--- a/lib/tcpip.h
+++ b/lib/tcpip.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -41,84 +42,89 @@
 
 class Tcpip : public Tcputil
 {
- public:
-  Tcpip();
-  ~Tcpip();
-
-  // Create a new server. After creating it, then you have to wait for an
-  // incoming connection.
-  retcode_t createNetServer(void);
-  retcode_t createNetServer(short port);
-  retcode_t createNetServer(std::string &service);
-  retcode_t createNetServer(std::string &service, std::string &protocol);
-  retcode_t createNetServer(short port, std::string &protocol);
-
-  // Accept a client connection for the current server.
-  retcode_t newNetConnection(void);
-  retcode_t newNetConnection(bool block);
+public:
+    Tcpip();
+    ~Tcpip();
+
+    // Create a new server. After creating it, then you have to wait for an
+    // incoming connection.
+    retcode_t createNetServer(void);
+    retcode_t createNetServer(short port);
+    retcode_t createNetServer(std::string &service);
+    retcode_t createNetServer(std::string &service, std::string &protocol);
+    retcode_t createNetServer(short port, std::string &protocol);
+
+    // Accept a client connection for the current server.
+    retcode_t newNetConnection(void);
+    retcode_t newNetConnection(bool block);
   
-  // Create a client connection to a tcp/ip server
-  retcode_t createNetClient(void);
-  retcode_t createNetClient(short port);
-  retcode_t createNetClient(std::string &hostname);
-  retcode_t createNetClient(std::string &hostname, short port);
-  retcode_t createNetClient(std::string &hostname, std::string &service);
-  retcode_t createNetClient(std::string &hostname, std::string &service, 
std::string &protocol);
-  retcode_t createNetClient(std::string &hostname, short port, std::string 
&protocol);
-
-  // If there is any data, process it
-  retcode_t anydata(std::vector<const xmlChar *> &msgs);
-  retcode_t anydata(int sockfd, std::vector<const xmlChar *> &msgs);
-
-  // Read from the socket
-  int readNet(char *buffer, int nbytes);
-  int readNet(char *buffer, int nbytes, int timeout);
-  int readNet(int fd, char *buffer, int nbytes);
-  int readNet(int fd, char *buffer, int nbytes, int timeout);
+    // Create a client connection to a tcp/ip server
+    retcode_t createNetClient(void);
+    retcode_t createNetClient(short port);
+    retcode_t createNetClient(std::string &hostname);
+    retcode_t createNetClient(std::string &hostname, short port);
+    retcode_t createNetClient(std::string &hostname, std::string &service);
+    retcode_t createNetClient(std::string &hostname, std::string &service, 
std::string &protocol);
+    retcode_t createNetClient(std::string &hostname, short port, std::string 
&protocol);
+
+    // If there is any data, process it
+    retcode_t anydata(std::vector<const xmlChar *> &msgs);
+    retcode_t anydata(int sockfd, std::vector<const xmlChar *> &msgs);
+
+    // Read from the socket
+    int readNet(char *buffer, int nbytes);
+    int readNet(char *buffer, int nbytes, int timeout);
+    int readNet(int fd, char *buffer, int nbytes);
+    int readNet(int fd, char *buffer, int nbytes, int timeout);
   
-  // Write to the socket  
-  int writeNet(std::string buffer);
-  int writeNet(char const *buffer);
-  int writeNet(char const *buffer, int nbytes);
-  int writeNet(int fd, char const *buffer);
-  int writeNet(int fd, char const *buffer, int nbytes);
-  int writeNet(int fd, char const *buffer, int nbytes, int timeout);
+    // Write to the socket  
+    int writeNet(std::string buffer);
+    int writeNet(char const *buffer);
+    int writeNet(char const *buffer, int nbytes);
+    int writeNet(int fd, char const *buffer);
+    int writeNet(int fd, char const *buffer, int nbytes);
+    int writeNet(int fd, char const *buffer, int nbytes, int timeout);
                                                                            
-  // Close the connection
-  retcode_t closeNet();
-  retcode_t closeNet(int fd);
-  retcode_t closeConnection();
-  retcode_t closeConnection(int fd);
-
-  // Change the debug flag
-  void toggleDebug(bool val);  
+    // Close the connection
+    retcode_t closeNet();
+    retcode_t closeNet(int fd);
+    retcode_t closeConnection();
+    retcode_t closeConnection(int fd);
+
+    // Change the debug flag
+    void toggleDebug(bool val);  
   
-  // Authenticate the socket connection
-  retcode_t authNetClient(void);
-  retcode_t authNetServer(void);
+    // Authenticate the socket connection
+    retcode_t authNetClient(void);
+    retcode_t authNetServer(void);
 
-  // Extract some info from the other end of the connection.
-  const std::string remoteIP(void);
-  const std::string remoteIP(struct in_addr addr);
-  const std::string remoteName(void);
-  const std::string remoteName(struct in_addr addr);
+    // Extract some info from the other end of the connection.
+    const std::string remoteIP(void);
+    const std::string remoteIP(struct in_addr addr);
+    const std::string remoteName(void);
+    const std::string remoteName(struct in_addr addr);
 
-  Tcpip &operator = (Tcpip &tcp);
+    Tcpip &operator = (Tcpip &tcp);
 
-  void checkConsole(void) { _console = true; };
+    void checkConsole(void) { _console = true; };
   
   
 private:
-  static int               _sockfd;
-  static int               _sockIOfd;
-  in_addr_t                _ipaddr;
-  std::string              _hostname;
-  struct sockaddr_in      _client;
-  const char              *_proto;
-  short                    _port;
-  bool                     _debug;
-  bool                    _console;
+    static int               _sockfd;
+    static int               _sockIOfd;
+    in_addr_t                _ipaddr;
+    std::string              _hostname;
+    struct sockaddr_in    _client;
+    const char              *_proto;
+    short                    _port;
+    bool                     _debug;
+    bool                    _console;
 };
 
 // EOF __TCPIP_H__ */
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/tcputil.cc b/lib/tcputil.cc
index 4de7d98..5139629 100644
--- a/lib/tcputil.cc
+++ b/lib/tcputil.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -64,13 +65,13 @@ const int
 Tcputil::servicePortGet(struct servent *x)
 {
     if (_debug)
-    {
-        if (x)
         {
-          dbglogfile <<  "Port for service entry " << x->s_name
-                     << " is " << ntohs(x->s_port) << endl;
+            if (x)
+                {
+                    dbglogfile <<  "Port for service entry " << x->s_name
+                               << " is " << ntohs(x->s_port) << endl;
+                }
         }
-    }
     
     return x->s_port;
 }
@@ -86,16 +87,16 @@ Tcputil::serviceNameGet(void)
 const std::string
 Tcputil::serviceNameGet(struct servent *x)
 {
-  if (_debug) {
-    if (x) {
-      if (x->s_name) {
-        dbglogfile << "Name for this service entry is " << x->s_name << endl;
-        return x->s_name;
-      }
+    if (_debug) {
+        if (x) {
+            if (x->s_name) {
+                dbglogfile << "Name for this service entry is " << x->s_name 
<< endl;
+                return x->s_name;
+            }
+        }
     }
-  }
   
-  return "";
+    return "";
 }
 
 // Description: get the protocol (tcp or udp) from a struct servent
@@ -110,12 +111,12 @@ const std::string
 Tcputil::serviceProtoGet(struct servent *x)
 {
     if (_debug)
-    {
-        if (x)
         {
-          dbglogfile <<  "Protocol for this service entry is " << x->s_proto 
<< endl;
+            if (x)
+                {
+                    dbglogfile <<  "Protocol for this service entry is " << 
x->s_proto << endl;
+                }
         }
-    }
 
     return x->s_proto;
 }
@@ -140,20 +141,20 @@ Tcputil::lookupService(struct servent *entry, string 
name, string protocol)
     entry = getservbyname(name.c_str(), protocol.c_str());
 
     if (entry)
-    {
-        memcpy(&_service, entry, sizeof(struct servent));
-        if (_debug)
         {
-          dbglogfile <<  "Found service file entry for " << name << endl;
+            memcpy(&_service, entry, sizeof(struct servent));
+            if (_debug)
+                {
+                    dbglogfile <<  "Found service file entry for " << name << 
endl;
+                }
         }
-    }
     else
-    {
-        if (_debug)
         {
-          dbglogfile << "Services file entry " << name << " was not found!" << 
endl;
+            if (_debug)
+                {
+                    dbglogfile << "Services file entry " << name << " was not 
found!" << endl;
+                }
         }
-    }
 
     return entry;
 }
@@ -186,27 +187,27 @@ Tcputil::hostDataGet(struct hostent *entry, string name)
     memset(hostname, 0, MAXHOSTNAMELEN);
     
     if (name.size() != 0) {
-      strcpy(hostname, name.c_str());
+        strcpy(hostname, name.c_str());
     } else {
-      if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
-        if (_debug) {
-          dbglogfile << "The hostname for this machine is " << hostname << 
endl;
+        if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
+            if (_debug) {
+                dbglogfile << "The hostname for this machine is " << hostname 
<< endl;
+            }
+        } else {
+            dbglogfile << "WARNING: Couldn't get the hostname for this 
machine!" << endl;
         }
-      } else {
-        dbglogfile << "WARNING: Couldn't get the hostname for this machine!" 
<< endl;
-      }
     }
     
     entry = gethostbyname(hostname);
     
     if (entry) {
-      memcpy(&_host, entry, sizeof(struct hostent));
-      if (_debug) {
-        dbglogfile <<  "The IP number for this machine is "
-                   << inet_ntoa(*(struct in_addr *)entry->h_addr_list[0]) << 
endl;
-      }
+        memcpy(&_host, entry, sizeof(struct hostent));
+        if (_debug) {
+            dbglogfile <<  "The IP number for this machine is "
+                       << inet_ntoa(*(struct in_addr *)entry->h_addr_list[0]) 
<< endl;
+        }
     } else {
-      dbglogfile << "WARNING: Couldn't get the host entry for this machine!" 
<< endl;
+        dbglogfile << "WARNING: Couldn't get the host entry for this machine!" 
<< endl;
     }
 
     return entry;
@@ -223,9 +224,9 @@ const string
 Tcputil::hostNameGet(struct hostent *x)
 {
     if (x != 0)
-    {
-        return x->h_name;
-    }
+        {
+            return x->h_name;
+        }
 
     return "";
 }
@@ -306,34 +307,34 @@ Tcputil::protoDataGet(struct protoent *entry)
 
 const struct protoent *
 Tcputil::protoDataGet(struct protoent *entry,
-    std::string name)
+                      std::string name)
 {
     char protoname[MAXHOSTNAMELEN];
     
     if (name.size() != 0)
-    {
-        strcpy(protoname, name.c_str());
-    }
+        {
+            strcpy(protoname, name.c_str());
+        }
 
     entry = getprotobyname(protoname);
  
     if (_debug)
-    {
-        if (entry)
-        {
-          dbglogfile << "The proto number for " << entry->p_name
-                                             << " is " << entry->p_proto << 
endl;
-        }
-        else
         {
-          dbglogfile << "WARNING: Couldn't get the host entry for this 
machine!" << endl;
+            if (entry)
+                {
+                    dbglogfile << "The proto number for " << entry->p_name
+                               << " is " << entry->p_proto << endl;
+                }
+            else
+                {
+                    dbglogfile << "WARNING: Couldn't get the host entry for 
this machine!" << endl;
+                }
         }
-    }
 
     if (entry != 0) 
-    {
-        memcpy(&_proto, entry, sizeof(struct protoent));
-    }
+        {
+            memcpy(&_proto, entry, sizeof(struct protoent));
+        }
     
     return &_proto;
 }
@@ -380,7 +381,7 @@ const string
 Tcputil::hostByAddrGet(void)
 {
     return hostNameGet(gethostbyaddr(_host.h_addr_list[0], _host.h_length,
-                           AF_INET));
+                                     AF_INET));
 }
 
 // Description: Get the host data based on the host name
@@ -414,10 +415,10 @@ Tcputil::numberOfInterfaces(void)
     struct ifreq *ifr;
 #endif
     if (0 > (fd = socket(AF_INET, SOCK_DGRAM,0)))
-    {
-      dbglogfile << "WARNING: Couldn't get file descriptor for AF_INET 
socket!" << endl;
-        return -1;
-    }
+        {
+            dbglogfile << "WARNING: Couldn't get file descriptor for AF_INET 
socket!" << endl;
+            return -1;
+        }
 #ifdef SIOCGLIFNUM
     // use AF_INET for IPv4 only or AF_INET6 for IPv6 only
     // note: if using AF_UNSPEC, some interface names may appear twice,
@@ -427,11 +428,11 @@ Tcputil::numberOfInterfaces(void)
 
 
     if(ioctl(fd,SIOCGLIFNUM,&ln) == -1)
-    {
-      dbglogfile << "Couldn't get ethernet interface data!: %s\n"
-                 << strerror(errno) << endl;
-        return -1;
-    }
+        {
+            dbglogfile << "Couldn't get ethernet interface data!: %s\n"
+                       << strerror(errno) << endl;
+            return -1;
+        }
 
     dbglogfile << "There are " <<  << ln.lifn_count " ethernet interfaces." << 
endl;
 
@@ -441,24 +442,28 @@ Tcputil::numberOfInterfaces(void)
     ifc.ifc_req = (struct ifreq *)buf;
     
     if(ioctl(fd, SIOCGIFCONF, &ifc) == -1)
-    {
-      dbglogfile << "Couldn't get ethernet interface data!: %s"
-                 << strerror(errno) << endl;
-        return -1;
-    }
+        {
+            dbglogfile << "Couldn't get ethernet interface data!: %s"
+                       << strerror(errno) << endl;
+            return -1;
+        }
 
     ifr = ifc.ifc_req;
     cplim = buf + ifc.ifc_len;
     for (cp = buf; cp < cplim; cp += sizeof(ifr->ifr_name) + 
sizeof(ifr->ifr_addr))
-    {
-        ifr = (struct ifreq *) cp;
+        {
+            ifr = (struct ifreq *) cp;
 #ifdef NET_DEBUG
-        dbglogfile << "interface name is: " << ifr->ifr_name << endl;
+            dbglogfile << "interface name is: " << ifr->ifr_name << endl;
 #endif
-        count++;
-    }
+            count++;
+        }
 #endif
 
     return count;
 }
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/tcputil.h b/lib/tcputil.h
index bbe2d6e..b3cb2f1 100644
--- a/lib/tcputil.h
+++ b/lib/tcputil.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -36,77 +37,82 @@
 #include "err.h"
 
 class Tcputil {
- public:
-  Tcputil();
-  ~Tcputil();
-  
-  // These get the hostent data for this machine
-  const struct hostent *hostDataGet();
-  const struct hostent *hostDataGet(std::string name);
-  const struct hostent *hostDataGet(struct hostent *entry);
-  const struct hostent *hostDataGet(struct hostent *entry,
-                                    std::string hostname);
-  const struct hostent *hostByNameGet();
-  const struct hostent *hostByNameGet(std::string addr);
-  
-  // These get the protoent data for this machine
-  const struct protoent *protoDataGet();
-  const struct protoent *protoDataGet(std::string name);
-  const struct protoent *protoDataGet(struct protoent *entry);
-  const struct protoent *protoDataGet(struct protoent *entry,
-                                      std::string protoname);
-  
-  // This gets the servent data that contains the port
-  // number as specified by it's /etc/services file entry.
-  const struct servent *lookupService(int number);
-  const struct servent *lookupService(std::string name);
-  const struct servent *lookupService(std::string name,
-                                      std::string protocol);
-  const struct servent *lookupService(struct servent *entry,
-                                      std::string name, std::string protocol);
-  
-  // These are accessors that extract the relevant field out
-  // of a struct servent structure as returned by getservbyname().
-  const int servicePortGet();
-  const int servicePortGet(struct servent *x);
-  const std::string serviceNameGet();
-  const std::string serviceNameGet(struct servent *x);
-  const std::string serviceProtoGet();
-  const std::string serviceProtoGet(struct servent *x);
-  
-  // These are accessors that extract the relevant field out
-  // of a struct protoent structure as returned by getprotobyname().
-  const std::string protoNameGet();
-  const std::string protoNameGet(struct protoent *x);
-  const int protoNumGet();
-  const int protoNumGet(struct protoent *x);
-  
-  // These are accessors that extract the relevant fields
-  // out of a struct hostent structure as returned by
-  // gethostbyname()
-  const std::string hostNameGet();
-  const std::string hostNameGet(struct hostent *x);
-  const std::string hostIPNameGet();
-  const std::string hostIPNameGet(struct hostent *x);
-  const int hostLengthGet();
-  const int hostLengthGet(struct hostent *x);
-  const in_addr_t *hostIPGet();
-  const in_addr_t *hostIPGet(struct hostent *x);
-
-  const std::string hostByAddrGet();
-  const std::string hostByAddrGet(std::string addr);
-
-  int numberOfInterfaces();
-  
-  // Change the debug flag
-  void toggleDebug(bool val);
-  
- private:
-  bool               _debug;
-  struct hostent     _host;
-  struct servent     _service;
-  struct protoent    _proto;
+public:
+    Tcputil();
+    ~Tcputil();
+    
+    // These get the hostent data for this machine
+    const struct hostent *hostDataGet();
+    const struct hostent *hostDataGet(std::string name);
+    const struct hostent *hostDataGet(struct hostent *entry);
+    const struct hostent *hostDataGet(struct hostent *entry,
+                                      std::string hostname);
+    const struct hostent *hostByNameGet();
+    const struct hostent *hostByNameGet(std::string addr);
+    
+    // These get the protoent data for this machine
+    const struct protoent *protoDataGet();
+    const struct protoent *protoDataGet(std::string name);
+    const struct protoent *protoDataGet(struct protoent *entry);
+    const struct protoent *protoDataGet(struct protoent *entry,
+                                        std::string protoname);
+    
+    // This gets the servent data that contains the port
+    // number as specified by it's /etc/services file entry.
+    const struct servent *lookupService(int number);
+    const struct servent *lookupService(std::string name);
+    const struct servent *lookupService(std::string name,
+                                        std::string protocol);
+    const struct servent *lookupService(struct servent *entry,
+                                        std::string name, std::string 
protocol);
+    
+    // These are accessors that extract the relevant field out
+    // of a struct servent structure as returned by getservbyname().
+    const int servicePortGet();
+    const int servicePortGet(struct servent *x);
+    const std::string serviceNameGet();
+    const std::string serviceNameGet(struct servent *x);
+    const std::string serviceProtoGet();
+    const std::string serviceProtoGet(struct servent *x);
+    
+    // These are accessors that extract the relevant field out
+    // of a struct protoent structure as returned by getprotobyname().
+    const std::string protoNameGet();
+    const std::string protoNameGet(struct protoent *x);
+    const int protoNumGet();
+    const int protoNumGet(struct protoent *x);
+    
+    // These are accessors that extract the relevant fields
+    // out of a struct hostent structure as returned by
+    // gethostbyname()
+    const std::string hostNameGet();
+    const std::string hostNameGet(struct hostent *x);
+    const std::string hostIPNameGet();
+    const std::string hostIPNameGet(struct hostent *x);
+    const int hostLengthGet();
+    const int hostLengthGet(struct hostent *x);
+    const in_addr_t *hostIPGet();
+    const in_addr_t *hostIPGet(struct hostent *x);
+    
+    const std::string hostByAddrGet();
+    const std::string hostByAddrGet(std::string addr);
+    
+    int numberOfInterfaces();
+    
+    // Change the debug flag
+    void toggleDebug(bool val);
+    
+private:
+    bool               _debug;
+    struct hostent     _host;
+    struct servent     _service;
+    struct protoent    _proto;
 };
 
 // EOF __TCPUTIL_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/thread.cc b/lib/thread.cc
index 044eb45..b28ff35 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -46,3 +47,8 @@ bool
 Thread::KillThread(void)
 {
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/thread.h b/lib/thread.h
index 9bf6994..b2f34bc 100644
--- a/lib/thread.h
+++ b/lib/thread.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -20,13 +21,17 @@
 
 class Thread {
 private:
-  bool initialized;
+    bool initialized;
 public:
-  Thread (void);
-  ~Thread (void);
-  bool StartThread (void);
-  bool DetachThread(void);
-  bool SuspendThread (void);
-  bool KillThread(void);
+    Thread (void);
+    ~Thread (void);
+    bool StartThread (void);
+    bool DetachThread(void);
+    bool SuspendThread (void);
+    bool KillThread(void);
 }
-
+    
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/xantrex-trace.cc b/lib/xantrex-trace.cc
index 4de8721..80ebb0f 100644
--- a/lib/xantrex-trace.cc
+++ b/lib/xantrex-trace.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -38,347 +39,347 @@ extern LogFile dbglogfile;
 
 XantrexUI::XantrexUI(void)
 {
-  SetDefaultValues();  
+    SetDefaultValues();  
 }
 
 XantrexUI::~XantrexUI(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 }
 
 string &
 XantrexUI::ReadSerial(void)
 {
-  int ret;
-  //DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    int ret;
+    //DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
 
 #if 0 
-  int retries = 1;
+    int retries = 1;
   
-  while (retries--) {
-    if (ret = Read((char *)&buffy, 99) < 0) {
-      //dbglogfile << "FIXME: " << retries << "\t" << buffy << endl;
-      //ret = Read((char *)&buffy, 100);
-      continue;
-    } else {
-      break;
+    while (retries--) {
+        if (ret = Read((char *)&buffy, 99) < 0) {
+            //dbglogfile << "FIXME: " << retries << "\t" << buffy << endl;
+            //ret = Read((char *)&buffy, 100);
+            continue;
+        } else {
+            break;
+        }
     }
-  }
 #else
-  ret = Read((char *)&buffy, 100);
+    ret = Read((char *)&buffy, 100);
 #endif
   
-  if (ret > 0) {
-    //dbglogfile << "FIXME3: Read " << ret << " bytes: " << buffy << "\t" << 
buffy << endl;
-    menudisp = buffy;
-  } else {
-    menudisp.erase();
-  }
+    if (ret > 0) {
+        //dbglogfile << "FIXME3: Read " << ret << " bytes: " << buffy << "\t" 
<< buffy << endl;
+        menudisp = buffy;
+    } else {
+        menudisp.erase();
+    }
   
-  return menudisp;
+    return menudisp;
 }
 
 string
 XantrexUI::GetLabel() {
-  //DEBUGLOG_REPORT_FUNCTION;
+    //DEBUGLOG_REPORT_FUNCTION;
 
-  dbglogfile << "menuheading: " << menuheading << " menuitem:" << menuitem << 
endl;
+    dbglogfile << "menuheading: " << menuheading << " menuitem:" << menuitem 
<< endl;
   
-  MenuItem ti = GetItem(menuheading, menuitem);
+    MenuItem ti = GetItem(menuheading, menuitem);
   
-  return ti.GetLabel();
+    return ti.GetLabel();
 }
 
 string &
 XantrexUI::WriteSerial(const char *buf, int nbytes)
 {
-  int ret;
+    int ret;
   
-  //DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    //DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  ret = Write(buf, nbytes);
-  //dbglogfile << "FIXME" << buffy << endl;
-  ret = Read(buffy, nbytes);
+    ret = Write(buf, nbytes);
+    //dbglogfile << "FIXME" << buffy << endl;
+    ret = Read(buffy, nbytes);
   
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 // This selects which inverter we want to control
 string &
 XantrexUI::SelectInverter(int x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
 
-  Write((char *)&x, 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write((char *)&x, 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 // These methods all go with the Xantrex display buttons
 string &
 XantrexUI::MenuHeadingMinus(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  //memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    //memset(buffy, 0, 100);
   
-  Write("L", 1);
-  //Read((char *)&buffy, 100);
-  menudisp = ReadSerial();
-  //dbglogfile << "FIXME" << menudisp << endl;
+    Write("L", 1);
+    //Read((char *)&buffy, 100);
+    menudisp = ReadSerial();
+    //dbglogfile << "FIXME" << menudisp << endl;
 
-  //cerr << "FIXMEh-: \"" << menudisp  << "\"" << endl;
-  //cerr << "FIXMEh-: \"" << GetLabel() << "\"" << endl;
+    //cerr << "FIXMEh-: \"" << menudisp  << "\"" << endl;
+    //cerr << "FIXMEh-: \"" << GetLabel() << "\"" << endl;
 
-  if (menuheading > 1) {
-    menuheading--;
-  }
-  menuitem = 0;
+    if (menuheading > 1) {
+        menuheading--;
+    }
+    menuitem = 0;
 
-  if (menudisp.find(GetLabel()) == string::npos) {
-    dbglogfile << "Heading Minus didn't Match!!" << menuheading << endl;  
-  } else {
-    dbglogfile << "Heading Minus Matched!!" << endl;
-  }
+    if (menudisp.find(GetLabel()) == string::npos) {
+        dbglogfile << "Heading Minus didn't Match!!" << menuheading << endl;  
+    } else {
+        dbglogfile << "Heading Minus Matched!!" << endl;
+    }
 
 
-  //menudisp = buffy;
-  return menudisp;
+    //menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::MenuHeadingPlus(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  //memset(buffy, 0, 100);
-  MenuItem mi;
+    DEBUGLOG_REPORT_FUNCTION;
+    //memset(buffy, 0, 100);
+    MenuItem mi;
   
-  Write("R", 1);
+    Write("R", 1);
   
-  //Read((char *)&buffy, 100);
-  menudisp = ReadSerial();
-  //mi = GetItem();
+    //Read((char *)&buffy, 100);
+    menudisp = ReadSerial();
+    //mi = GetItem();
 
-  //dbglogfile << menudisp << endl;
+    //dbglogfile << menudisp << endl;
 
-  menuheading++;
-  menuitem = 0;
+    menuheading++;
+    menuitem = 0;
 
-  //cerr << "FIXMEh+: \"" << menudisp  << "\"" << endl;
-  //cerr << "FIXMEh+: \"" << GetLabel() << "\"" << endl;
+    //cerr << "FIXMEh+: \"" << menudisp  << "\"" << endl;
+    //cerr << "FIXMEh+: \"" << GetLabel() << "\"" << endl;
   
-  if (menudisp.find(GetLabel()) == string::npos) {
-    dbglogfile << "Heading Plus didn't Match!!" << endl;  
-  } else {
-    dbglogfile << "Heading Plus Matched!!" << endl;
-  }
+    if (menudisp.find(GetLabel()) == string::npos) {
+        dbglogfile << "Heading Plus didn't Match!!" << endl;  
+    } else {
+        dbglogfile << "Heading Plus Matched!!" << endl;
+    }
 
 
 
-  //menudisp = buffy;
-  return menudisp;
+    //menudisp = buffy;
+    return menudisp;
 }
 
 // This decends through the sub menu items of a heading
 string &
 XantrexUI::MenuItemMinus(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  int retries = 5;
-  string label;
+    DEBUGLOG_REPORT_FUNCTION;
+    int retries = 5;
+    string label;
   
-  //memset(buffy, 0, 100);
+    //memset(buffy, 0, 100);
   
-  //Write("D", 1);
-  //Read((char *)&buffy, 100);
-  //menudisp = ReadSerial();
-  //dbglogfile << menudisp << endl;
+    //Write("D", 1);
+    //Read((char *)&buffy, 100);
+    //menudisp = ReadSerial();
+    //dbglogfile << menudisp << endl;
 
-  menuitem++;
+    menuitem++;
 
-  //cerr << "FIXME-I: \"" << menuheading << "," << menuitem << "\"" << endl;
-  while (retries--) {
-    Write("D", 1);
-    menudisp = ReadSerial();
-    //Flush();
-    //cerr << "FIXMEi-: \"" << menudisp  << "\"" << endl;
-    //cerr << "FIXMEi-: \"" << GetLabel() << "\"" << endl;
-
-    label = GetLabel();
-    if (label.size()) {
-      if (menudisp.find(label) == string::npos) {
-        dbglogfile << "Item Minus didn't Match!!" << endl;
-      } else {
-        dbglogfile << "Item Minus Matched!!" << endl;
-        break;
-      }
+    //cerr << "FIXME-I: \"" << menuheading << "," << menuitem << "\"" << endl;
+    while (retries--) {
+        Write("D", 1);
+        menudisp = ReadSerial();
+        //Flush();
+        //cerr << "FIXMEi-: \"" << menudisp  << "\"" << endl;
+        //cerr << "FIXMEi-: \"" << GetLabel() << "\"" << endl;
+
+        label = GetLabel();
+        if (label.size()) {
+            if (menudisp.find(label) == string::npos) {
+                dbglogfile << "Item Minus didn't Match!!" << endl;
+            } else {
+                dbglogfile << "Item Minus Matched!!" << endl;
+                break;
+            }
+        }
     }
-  }
 
-  //menudisp = buffy;
-  return menudisp;
+    //menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::MenuItemPlus(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  int retries = 5;
+    DEBUGLOG_REPORT_FUNCTION;
+    int retries = 5;
 
-  //memset(buffy, 0, 100);
+    //memset(buffy, 0, 100);
   
-  //Write("U", 1);
-  //Read((char *)&buffy, 100);
-  //menudisp = ReadSerial();
-  //dbglogfile << menudisp << endl;
-  //menudisp = buffy;
-  if (menuitem > 1)
-    menuitem--;
-
-  //  if (strcmp(label.c_str(), buffy) == 0)
-  //    dbglogfile << "AAAAHHHHHHH" << endl;
+    //Write("U", 1);
+    //Read((char *)&buffy, 100);
+    //menudisp = ReadSerial();
+    //dbglogfile << menudisp << endl;
+    //menudisp = buffy;
+    if (menuitem > 1)
+        menuitem--;
+
+    //  if (strcmp(label.c_str(), buffy) == 0)
+    //    dbglogfile << "AAAAHHHHHHH" << endl;
   
-  while (retries--) {
-    Write("U", 1);
-    menudisp = ReadSerial();
-    //Flush();
+    while (retries--) {
+        Write("U", 1);
+        menudisp = ReadSerial();
+        //Flush();
 
-    //cerr << "FIXMEi+: \"" << menudisp  << "\"" << endl;
-    //cerr << "FIXMEi+: \"" << GetLabel() << "\"" << endl;
+        //cerr << "FIXMEi+: \"" << menudisp  << "\"" << endl;
+        //cerr << "FIXMEi+: \"" << GetLabel() << "\"" << endl;
 
-    if (menudisp.find(GetLabel()) == string::npos) {
-      dbglogfile << "Item Plus didn't Match!!" << endl;
-    } else {
-      dbglogfile << "Item Plus Matched!!" << endl;
-      break;
+        if (menudisp.find(GetLabel()) == string::npos) {
+            dbglogfile << "Item Plus didn't Match!!" << endl;
+        } else {
+            dbglogfile << "Item Plus Matched!!" << endl;
+            break;
+        }
     }
-  }
 
-  //  if (menudisp != label)
-  //  dbglogfile << "FIXME: Wrong Item " << menuheading << ":" << menuitem << 
menudisp << "\t" << label << endl;
+    //  if (menudisp != label)
+    //  dbglogfile << "FIXME: Wrong Item " << menuheading << ":" << menuitem 
<< menudisp << "\t" << label << endl;
     
-  return menudisp;
+    return menudisp;
 }
 
 string &
 XantrexUI::SetPointMinus(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("-", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("-", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::SetPointPlus(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("+", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("+", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::Inverter(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("|", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("|", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::Generator(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("G", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("G", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::SetupMenu(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("\003", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("\003", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menuheading = 8;
-  menuitem = 0;
+    menuheading = 8;
+    menuitem = 0;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::LedStatus(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("?", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("?", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;  
+    menudisp = buffy;
+    return menudisp;  
 }
 
 string &
 XantrexUI::Version(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("V", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("V", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 string &
 XantrexUI::SetTerminalMode(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  memset(buffy, 0, 100);
+    DEBUGLOG_REPORT_FUNCTION;
+    memset(buffy, 0, 100);
   
-  Write("T", 1);
-  Read((char *)&buffy, 100);
-  dbglogfile << buffy << endl;
+    Write("T", 1);
+    Read((char *)&buffy, 100);
+    dbglogfile << buffy << endl;
 
-  menudisp = buffy;
-  return menudisp;
+    menudisp = buffy;
+    return menudisp;
 }
 
 #if 0
@@ -386,18 +387,18 @@ XantrexUI::SetTerminalMode(void)
 retcode_t
 XantrexUI::GotoSetupMenu(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 }
 
 retcode_t
 XantrexUI::GotoUserMenu(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 }
 string &
 XantrexUI::UserMenu(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 }
 
 #endif
@@ -408,199 +409,199 @@ XantrexUI::UserMenu(void)
 retcode_t
 XantrexUI::GotoMenuStart(void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  int i;
-  for (i=0; i<22; i++) {
-    // Don't use MenuheadingMinus, as it gets all confused
-    Write("L", 1);
-    menudisp = ReadSerial();
-    if (menudisp.find("Inverter", 0) != string::npos) {
-      break;
+    DEBUGLOG_REPORT_FUNCTION;
+    int i;
+    for (i=0; i<22; i++) {
+        // Don't use MenuheadingMinus, as it gets all confused
+        Write("L", 1);
+        menudisp = ReadSerial();
+        if (menudisp.find("Inverter", 0) != string::npos) {
+            break;
+        }
     }
-  }
   
-  menuheading = 1;
-  menuitem = 0;
-  dbglogfile << "At Start Of Menu" << endl;
+    menuheading = 1;
+    menuitem = 0;
+    dbglogfile << "At Start Of Menu" << endl;
   
-  return SUCCESS;
+    return SUCCESS;
 }
 
 // These methods manipulate values
 retcode_t
 XantrexUI::SetFloatValue(float )
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  cerr << "ERROR: unimplemented!" << endl;
-  return ERROR;
+    DEBUGLOG_REPORT_FUNCTION;
+    cerr << "ERROR: unimplemented!" << endl;
+    return ERROR;
 }
 
 float
 XantrexUI::GetFloatValue(std::string &str)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  return atof(GetValue(str).c_str());
+    return atof(GetValue(str).c_str());
 }
 
 retcode_t
 XantrexUI::SetIntValue(int x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  cerr << "ERROR: unimplemented!" << endl;
-  return ERROR;
+    cerr << "ERROR: unimplemented!" << endl;
+    return ERROR;
 }
 
 int
 XantrexUI::GetIntValue(std::string &str)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  return atoi(GetValue(str).c_str());
+    return atoi(GetValue(str).c_str());
 }
 
 bool
 XantrexUI::GetBoolValue(std::string &str)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  string tmpstr = GetValue(str).c_str();
+    string tmpstr = GetValue(str).c_str();
   
-  if (tmpstr == "NO" || tmpstr == "OFF")
-    return false;
-  else
-    return true;
+    if (tmpstr == "NO" || tmpstr == "OFF")
+        return false;
+    else
+        return true;
 }
 
 string &
 XantrexUI::GetValue (std::string &str)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string::size_type pos, pos2;
-  //string value;
-  int i = 0;
-  string lookfor;
+    DEBUGLOG_REPORT_FUNCTION;
+    string::size_type pos, pos2;
+    //string value;
+    int i = 0;
+    string lookfor;
 
-  //cout << "The Raw value string is: " << str << endl;
+    //cout << "The Raw value string is: " << str << endl;
 
 #if 0
-  pos = str.find("-00", str.length());
-  if (pos != string::npos) {
-    str.erase(pos, str.length() - pos);
-  }
+    pos = str.find("-00", str.length());
+    if (pos != string::npos) {
+        str.erase(pos, str.length() - pos);
+    }
 #endif
   
-  do {
-    lookfor = " ";
-    char j = '0' + i;
-    lookfor += j;
-    pos = str.find(lookfor, 0);
-    lookfor.erase();
-  } while ((pos == string::npos) && (i++ < 10));
+    do {
+        lookfor = " ";
+        char j = '0' + i;
+        lookfor += j;
+        pos = str.find(lookfor, 0);
+        lookfor.erase();
+    } while ((pos == string::npos) && (i++ < 10));
   
-  pos2 = str.find(' ', pos+1);
-  if (pos2 == string::npos) {
-    pos2 = pos + 4;
-  }
+    pos2 = str.find(' ', pos+1);
+    if (pos2 == string::npos) {
+        pos2 = pos + 4;
+    }
   
-  str = str.substr(pos+1, pos2 - pos);
+    str = str.substr(pos+1, pos2 - pos);
 
 #if 0
-  if (pos != string::npos) {
-    // We want just the last data item, which is the value
-    value = str.substr(pos+1, str.length() - pos);
-    str = value;
-  } else {
-    str.erase();
-  }
+    if (pos != string::npos) {
+        // We want just the last data item, which is the value
+        value = str.substr(pos+1, str.length() - pos);
+        str = value;
+    } else {
+        str.erase();
+    }
 #endif
   
-  return str;
+    return str;
 }
 
 vector<string> *
 XantrexUI::GetValues (std::string &str)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string::size_type pos;
-  string value;
-  vector<string> *array;
+    DEBUGLOG_REPORT_FUNCTION;
+    string::size_type pos;
+    string value;
+    vector<string> *array;
 
-  array = new vector<string>;
+    array = new vector<string>;
 
-  //cout << "The Raw values string is: " << str << endl;
+    //cout << "The Raw values string is: " << str << endl;
 
-  do {
-    pos = str.find("-00", str.length());
-    if (pos != string::npos) {
-      str.erase(pos, str.length() - pos);
-    }
+    do {
+        pos = str.find("-00", str.length());
+        if (pos != string::npos) {
+            str.erase(pos, str.length() - pos);
+        }
     
-    // Find the last space in the string
-    pos = str.rfind(' ' , str.length());
+        // Find the last space in the string
+        pos = str.rfind(' ' , str.length());
     
-    if (pos != string::npos) {
-      // We want just the last data item, which is the value
-      value = str.substr(pos+1, str.length() - pos);
-      str = value;
-      array->push_back(value);
-    } else {
-      str.erase();
-    }
-  } while (pos != string::npos);
+        if (pos != string::npos) {
+            // We want just the last data item, which is the value
+            value = str.substr(pos+1, str.length() - pos);
+            str = value;
+            array->push_back(value);
+        } else {
+            str.erase();
+        }
+    } while (pos != string::npos);
   
   
-  return array;
+    return array;
 }
 
 std::string
 XantrexUI::GetLabel(std::string &x)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string::size_type pos;
+    DEBUGLOG_REPORT_FUNCTION;
+    string::size_type pos;
 
-  // Find the last space in the string
-  pos = x.rfind(' ' , x.length());
-  //pos = x.rfind('\t' , x.length());
+    // Find the last space in the string
+    pos = x.rfind(' ' , x.length());
+    //pos = x.rfind('\t' , x.length());
 
-  if (pos != string::npos) {
-    return x.substr(0, pos);
-  }
+    if (pos != string::npos) {
+        return x.substr(0, pos);
+    }
   
-  return x;
+    return x;
 }
 
 
 string &
 XantrexUI::GotoMenuItem(int mh, int mi)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-  string tmpstr;
-  int i;
-  MenuItem item;
+    DEBUGLOG_REPORT_FUNCTION;
+    string tmpstr;
+    int i;
+    MenuItem item;
   
-  GotoMenuStart();
+    GotoMenuStart();
 
-  item = GetItem(mh, mi);
-  for (i=0; i < mh-1; i++) {
-    menudisp = MenuHeadingPlus();
-  }
+    item = GetItem(mh, mi);
+    for (i=0; i < mh-1; i++) {
+        menudisp = MenuHeadingPlus();
+    }
   
-  for (i=0; i < mi-1; i++) {
-    menudisp = MenuItemMinus();
-  }
+    for (i=0; i < mi-1; i++) {
+        menudisp = MenuItemMinus();
+    }
 
-  if (menudisp.find(item.GetLabel()) != string::npos) {
-    dbglogfile << "Didn't Match!!" << endl;  
-  }
+    if (menudisp.find(item.GetLabel()) != string::npos) {
+        dbglogfile << "Didn't Match!!" << endl;  
+    }
 
-  //menudisp = CleanUpData(tmpstr);
+    //menudisp = CleanUpData(tmpstr);
   
-  menuheading = mh;
-  menuitem = mi;
+    menuheading = mh;
+    menuitem = mi;
 
-  return menudisp;
+    return menudisp;
 }
 
 //std::map<std::string, float> *
@@ -608,169 +609,169 @@ XantrexUI::GotoMenuItem(int mh, int mi)
 vector<meter_data_t *>
 XantrexUI::PollMeters(int loops)
 {
-  MenuItem      ti;
-  int           mh = 4;
-  int           mi = 1;
-  int           items = 7;                // the number of data items to get
-  float         fltval;
-  int           intval;
-  int           i;
-  string        str, label;
-  meter_data_t *downdata, *updata;
-  vector<meter_data_t *> meters;
-
-  //memset(buffy, 0, 100);
-
-  GotoMenuItem(mh, mi);
-  while (loops-- > 0) {
-    downdata = new meter_data_t;
-    memset(downdata, 0, sizeof(meter_data_t));
+    MenuItem      ti;
+    int           mh = 4;
+    int           mi = 1;
+    int           items = 7;                // the number of data items to get
+    float         fltval;
+    int           intval;
+    int           i;
+    string        str, label;
+    meter_data_t *downdata, *updata;
+    vector<meter_data_t *> meters;
+
+    //memset(buffy, 0, 100);
+
+    GotoMenuItem(mh, mi);
+    while (loops-- > 0) {
+        downdata = new meter_data_t;
+        memset(downdata, 0, sizeof(meter_data_t));
     
-    for (i=mi; i<= mi+items; i++) {
-      str = MenuItemMinus();
-      fltval = 0.0;
-      intval = 0;
-      if (str.size() > 1) {
-        ti = GetItem();
-        if (ti.GetType() != MenuItem::INFO) {
-          label = GetLabel(); 
-          cout << "The Menu Item Label down is: " << label;
-        }
-        ti = GetItem();
-        if (ti.GetType() == MenuItem::FLOAT) {
-          fltval = GetFloatValue(str);
-          cout << ", with a float value is: " << fltval << endl;
-        }
-        if (ti.GetType() == MenuItem::INT) {
-          intval = GetIntValue(str);
-          cout << ", with an Integer value is: " << intval << endl;
-        }
-        if (ti.GetType() == MenuItem::INFO) {
-          cout << ", an INFO statement  " << endl;
-          break;
-        }
-        if (label.substr(0, 5) == "Input") {
-          //downdata->
-        }
-        if (label.substr(0, 4) == "Load") {
-          dbglogfile << "Matched label going down " << label;
-          dbglogfile << " value is: " << intval << endl;
-          downdata->ac_load_amps = intval;
-        }
-        if (label.substr(8, 6) == "actual") {
-          dbglogfile << "Matched label going down " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          downdata->battery_volts = fltval;
-        }
-        if (label.substr(8, 8) == "TempComp") {
-          dbglogfile << "Matched label going down " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          downdata->tempcomp_volts = fltval;
-        }
-        if (label.substr(0, 8) == "Inverter") {
-          dbglogfile << "Matched label going down " << label << endl;
-          dbglogfile << " value is: " << intval << endl;
-          downdata->ac_volts_out = intval;
+        for (i=mi; i<= mi+items; i++) {
+            str = MenuItemMinus();
+            fltval = 0.0;
+            intval = 0;
+            if (str.size() > 1) {
+                ti = GetItem();
+                if (ti.GetType() != MenuItem::INFO) {
+                    label = GetLabel(); 
+                    cout << "The Menu Item Label down is: " << label;
+                }
+                ti = GetItem();
+                if (ti.GetType() == MenuItem::FLOAT) {
+                    fltval = GetFloatValue(str);
+                    cout << ", with a float value is: " << fltval << endl;
+                }
+                if (ti.GetType() == MenuItem::INT) {
+                    intval = GetIntValue(str);
+                    cout << ", with an Integer value is: " << intval << endl;
+                }
+                if (ti.GetType() == MenuItem::INFO) {
+                    cout << ", an INFO statement  " << endl;
+                    break;
+                }
+                if (label.substr(0, 5) == "Input") {
+                    //downdata->
+                }
+                if (label.substr(0, 4) == "Load") {
+                    dbglogfile << "Matched label going down " << label;
+                    dbglogfile << " value is: " << intval << endl;
+                    downdata->ac_load_amps = intval;
+                }
+                if (label.substr(8, 6) == "actual") {
+                    dbglogfile << "Matched label going down " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    downdata->battery_volts = fltval;
+                }
+                if (label.substr(8, 8) == "TempComp") {
+                    dbglogfile << "Matched label going down " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    downdata->tempcomp_volts = fltval;
+                }
+                if (label.substr(0, 8) == "Inverter") {
+                    dbglogfile << "Matched label going down " << label << endl;
+                    dbglogfile << " value is: " << intval << endl;
+                    downdata->ac_volts_out = intval;
+                }
+                if (label.substr(0, 4) == "Grid") {
+                    dbglogfile << "Matched label going down " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    downdata->ac1_volts_in = fltval;
+                }
+                if (label.substr(0, 9) == "Generator") {
+                    dbglogfile << "Matched label going down " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    downdata->ac2_volts_in = fltval;
+                }
+                if (label.substr(0, 9) == "Read Freq") {
+                    dbglogfile << "Matched label going down " << label << endl;
+                    dbglogfile << " value is: " << intval << endl;
+                    downdata->hertz = intval;
+                }
+            }
         }
-        if (label.substr(0, 4) == "Grid") {
-          dbglogfile << "Matched label going down " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          downdata->ac1_volts_in = fltval;
-        }
-        if (label.substr(0, 9) == "Generator") {
-          dbglogfile << "Matched label going down " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          downdata->ac2_volts_in = fltval;
-        }
-        if (label.substr(0, 9) == "Read Freq") {
-          dbglogfile << "Matched label going down " << label << endl;
-          dbglogfile << " value is: " << intval << endl;
-          downdata->hertz = intval;
-        }
-      }
-    }
 
-    meters.push_back(downdata);
-    //MenuItemMinus();            // go one more, since the first thing
-                                // we do is come back up one item.
-    updata = new meter_data_t;
-    memset(updata, 0, sizeof(meter_data_t));
-    //ptr2 = (float *)((char *)updata + sizeof(meter_data_t)-sizeof(float));
-    //*ptr2-- = downdata->hertz;
+        meters.push_back(downdata);
+        //MenuItemMinus();            // go one more, since the first thing
+        // we do is come back up one item.
+        updata = new meter_data_t;
+        memset(updata, 0, sizeof(meter_data_t));
+        //ptr2 = (float *)((char *)updata + 
sizeof(meter_data_t)-sizeof(float));
+        //*ptr2-- = downdata->hertz;
     
-    // Now go up through the menu
-    for (i=mi+items; i>mi; i--) {
-      str = MenuItemPlus();
-      fltval = 0.0;
-      intval = 0;
-      if (str.size() > 0) {
-        label = GetLabel(); 
-        cout << "The Menu Item Label up is: " << label;
-        ti = GetItem();
-        if (ti.GetType() == MenuItem::FLOAT) {
-          fltval = GetFloatValue(str);
-          cout << ", with a float value is: " << fltval << endl;
-        }
-        if (ti.GetType() == MenuItem::INT) {
-          intval = GetIntValue(str);
-          cout << ", with an integer value is: " << intval << endl;
-        }
-        //Flush();
-        //_data.push(label, );
-        if (label.substr(0, 5) == "Input") {
-          //updata->
-        }
-        if (label.substr(0, 4) == "Load ") {
-          dbglogfile << "Matched label going up " << label << endl;
-          dbglogfile << " value is: " << intval << endl;
-          updata->ac_load_amps = intval;
-        }
-        if (label.substr(8, 6) == "actual") {
-          dbglogfile << "Matched label going up " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          updata->battery_volts = fltval;
-        }
-        if (label.substr(8, 8) == "TempComp") {
-          dbglogfile << "Matched label going up " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          updata->tempcomp_volts = fltval;
-        }
-        if (label.substr(0, 8) == "Inverter") {
-          dbglogfile << "Matched label going up " << label << endl;
-          dbglogfile << " value is: " << intval << endl;
-          updata->ac_volts_out = intval;
-        }
-        if (label.substr(0, 4) == "Grid") {
-          dbglogfile << "Matched label going up " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          updata->ac1_volts_in = fltval;
-        }
-        if (label.substr(0, 9) == "Generator") {
-          dbglogfile << "Matched label going up " << label << endl;
-          dbglogfile << " value is: " << fltval << endl;
-          updata->ac2_volts_in = fltval;
-        }
-        // Since this is the last and first reading, it doesn't really
-        // have time to change.
-        updata->hertz = downdata->hertz;
+        // Now go up through the menu
+        for (i=mi+items; i>mi; i--) {
+            str = MenuItemPlus();
+            fltval = 0.0;
+            intval = 0;
+            if (str.size() > 0) {
+                label = GetLabel(); 
+                cout << "The Menu Item Label up is: " << label;
+                ti = GetItem();
+                if (ti.GetType() == MenuItem::FLOAT) {
+                    fltval = GetFloatValue(str);
+                    cout << ", with a float value is: " << fltval << endl;
+                }
+                if (ti.GetType() == MenuItem::INT) {
+                    intval = GetIntValue(str);
+                    cout << ", with an integer value is: " << intval << endl;
+                }
+                //Flush();
+                //_data.push(label, );
+                if (label.substr(0, 5) == "Input") {
+                    //updata->
+                }
+                if (label.substr(0, 4) == "Load ") {
+                    dbglogfile << "Matched label going up " << label << endl;
+                    dbglogfile << " value is: " << intval << endl;
+                    updata->ac_load_amps = intval;
+                }
+                if (label.substr(8, 6) == "actual") {
+                    dbglogfile << "Matched label going up " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    updata->battery_volts = fltval;
+                }
+                if (label.substr(8, 8) == "TempComp") {
+                    dbglogfile << "Matched label going up " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    updata->tempcomp_volts = fltval;
+                }
+                if (label.substr(0, 8) == "Inverter") {
+                    dbglogfile << "Matched label going up " << label << endl;
+                    dbglogfile << " value is: " << intval << endl;
+                    updata->ac_volts_out = intval;
+                }
+                if (label.substr(0, 4) == "Grid") {
+                    dbglogfile << "Matched label going up " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    updata->ac1_volts_in = fltval;
+                }
+                if (label.substr(0, 9) == "Generator") {
+                    dbglogfile << "Matched label going up " << label << endl;
+                    dbglogfile << " value is: " << fltval << endl;
+                    updata->ac2_volts_in = fltval;
+                }
+                // Since this is the last and first reading, it doesn't really
+                // have time to change.
+                updata->hertz = downdata->hertz;
 //         if (label.substr(0, 9) == "Read Freq") {
 //           dbglogfile << "Matched label going up " << label << endl;
 //           dbglogfile << " value is: " << intval << endl;
 //           updata->hertz = intval;
 //         }
-      } // end of if str
-    } // end of for loop
-    meters.push_back(updata);
-  }
-  // Go back to the top
+            } // end of if str
+        } // end of for loop
+        meters.push_back(updata);
+    }
+    // Go back to the top
 //   for (i=items; i>=mi; i--) {
 //     MenuItemPlus();
 //   }
   
-  MenuHeadingPlus();
-  MenuHeadingMinus();          
+    MenuHeadingPlus();
+    MenuHeadingMinus();          
   
-  return meters;
+    return meters;
 }
 
 // This method takes the data as outputted by the Xantrex inverter,
@@ -780,490 +781,490 @@ XantrexUI::PollMeters(int loops)
 std::string &
 XantrexUI::CleanUpData(std::string &str)
 {
-  unsigned int i;
-
-  menudisp.erase();
-  for (i=0; i< str.length(); i++) {
-    switch (str[i]) {
-      // we ignore these characters
-    case '\r':
-    case '\n':
-      break;
-      // compress multiple spaces to be just one
-    case ' ':
-      if (str[i+1] == ' ') {
-        continue;
-      } else {
-        menudisp += ' ';
-        break;
-      }
-    default:
-      menudisp += str[i];
+    unsigned int i;
+
+    menudisp.erase();
+    for (i=0; i< str.length(); i++) {
+        switch (str[i]) {
+            // we ignore these characters
+          case '\r':
+          case '\n':
+              break;
+              // compress multiple spaces to be just one
+          case ' ':
+              if (str[i+1] == ' ') {
+                  continue;
+              } else {
+                  menudisp += ' ';
+                  break;
+              }
+          default:
+              menudisp += str[i];
+        }
     }
-  }
 
-  return menudisp;
+    return menudisp;
 }
 
 void
 XantrexUI::SetDefaultValues(void)
 {
 
-  MenuItem mi;
-
-  // We know we always have 20 major menu headings
-  _items.resize(21);
-
-  mi.SetItem ("Top of Menu", 0);
-  _items[0].push_back(mi);
-
-  // Inverter Mode - Menu Heading #1
-  mi.SetItem ("Inverter Mode",                      1);
-  _items[1].push_back(mi);
-
-  mi.SetItem ("Set Inverter     OFF SRCH ON CHG",   1, 1, "SetVert"); // 
FIXME: enum
-  _items[1].push_back(mi);
-  mi.SetItem ("CHG avail. Only  in FLT mode",       1, 2);
-  _items[1].push_back(mi);
-  mi.SetItem ("Press red or     setpoint button",   1, 3);
-  _items[1].push_back(mi);
-  mi.SetItem ("to move.         Move cursor to",    1, 4);
-  _items[1].push_back(mi);
-  mi.SetItem ("Inverter OFF to  resetOverCurrent",  1, 5);
-  _items[1].push_back(mi);
-
-  // Generator Mode - Menu Headings #2
-  mi.SetItem ("Generator Mode",                     2);
-  _items[2].push_back(mi);
-  mi.SetItem ("Set Generator    OFF AUTO ON EQ",    2, 1, "SetGen"); // FIXME: 
enum
-  _items[2].push_back(mi);
-  mi.SetItem ("Gen under/over   speed",             2, 2, false, "GenSpeed");
-  _items[2].push_back(mi);  
-  mi.SetItem ("Generator start  error",             2, 3, false, "GenStart");
-  _items[2].push_back(mi);
-  mi.SetItem ("Generator sync   error",             2, 4, false, "GenSync");
-  _items[2].push_back(mi);
-  mi.SetItem ("Gen max run Time error",             2, 5, false, "GenMax");
-  _items[2].push_back(mi);
-  mi.SetItem ("Load Amp Start   ready",             2, 6, false, "LoadAmp");
-  _items[2].push_back(mi);
-  mi.SetItem ("Voltage Start    ready",             2, 7, false, "VoltStart");
-  _items[2].push_back(mi);
-  mi.SetItem ("Exercise Start   ready",             2, 8, false, "ExerStart");
-  _items[2].push_back(mi);
+    MenuItem mi;
+
+    // We know we always have 20 major menu headings
+    _items.resize(21);
+
+    mi.SetItem ("Top of Menu", 0);
+    _items[0].push_back(mi);
+
+    // Inverter Mode - Menu Heading #1
+    mi.SetItem ("Inverter Mode",                      1);
+    _items[1].push_back(mi);
+
+    mi.SetItem ("Set Inverter     OFF SRCH ON CHG",   1, 1, "SetVert"); // 
FIXME: enum
+    _items[1].push_back(mi);
+    mi.SetItem ("CHG avail. Only  in FLT mode",       1, 2);
+    _items[1].push_back(mi);
+    mi.SetItem ("Press red or     setpoint button",   1, 3);
+    _items[1].push_back(mi);
+    mi.SetItem ("to move.         Move cursor to",    1, 4);
+    _items[1].push_back(mi);
+    mi.SetItem ("Inverter OFF to  resetOverCurrent",  1, 5);
+    _items[1].push_back(mi);
+
+    // Generator Mode - Menu Headings #2
+    mi.SetItem ("Generator Mode",                     2);
+    _items[2].push_back(mi);
+    mi.SetItem ("Set Generator    OFF AUTO ON EQ",    2, 1, "SetGen"); // 
FIXME: enum
+    _items[2].push_back(mi);
+    mi.SetItem ("Gen under/over   speed",             2, 2, false, "GenSpeed");
+    _items[2].push_back(mi);  
+    mi.SetItem ("Generator start  error",             2, 3, false, "GenStart");
+    _items[2].push_back(mi);
+    mi.SetItem ("Generator sync   error",             2, 4, false, "GenSync");
+    _items[2].push_back(mi);
+    mi.SetItem ("Gen max run Time error",             2, 5, false, "GenMax");
+    _items[2].push_back(mi);
+    mi.SetItem ("Load Amp Start   ready",             2, 6, false, "LoadAmp");
+    _items[2].push_back(mi);
+    mi.SetItem ("Voltage Start    ready",             2, 7, false, 
"VoltStart");
+    _items[2].push_back(mi);
+    mi.SetItem ("Exercise Start   ready",             2, 8, false, 
"ExerStart");
+    _items[2].push_back(mi);
   
-  // Xantrex Engineering - Menu Heading #3
-  // Xantrex was Trace, so this prompt varies depending on the
-  // software version on the inverter.
-  mi.SetItem ("Engineering",       3);
-  //mi.SetItem ("Trace            Engineering",       3);
-  _items[3].push_back(mi);
-  mi.SetItem ("Press reset now  for defaults",      3, 1);
-  _items[3].push_back(mi);
-  mi.SetItem ("Revision 4.01",                      3, 2, "XantrexRev");
-  _items[3].push_back(mi);
-  mi.SetItem ("5916 195th St NE Arlington, WA",     3, 3);
-  _items[3].push_back(mi);
-  mi.SetItem ("98223 USA",                          3, 4);
-  _items[3].push_back(mi);
-  mi.SetItem ("Ph  360-435-8826 Fax 360-435-2229",  3, 5);
-  _items[3].push_back(mi);
-
-  // Meters - Menu Heading #4
-  mi.SetItem ("Meters",                         4);
-  _items[4].push_back(mi);
-  mi.SetItem ("Inverter/charger amps AC",         4,  1, 0, "ChargerAmps");
-  _items[4].push_back(mi);
-  mi.SetItem ("Input            amps AC",         4,  2, 0, "InputAmps");
-  //mi.SetItem ("Input",                           4,  2, 0, "InputAmps");
-  _items[4].push_back(mi);
-  mi.SetItem ("Load             amps AC",         4,  3, 0, "LoadAmps");
-  _items[4].push_back(mi);
-  //mi.SetItem ("Battery actual",                   4,  4, (float)25.1, 
"BattVolts");
-  mi.SetItem ("Battery actual   volts DC",        4,  4, (float)25.1, 
"BattVolts");
-  _items[4].push_back(mi);
-  //mi.SetItem ("Battery TempComp",                4,  5, (float)25.1, 
"TempComp");
-  mi.SetItem ("Battery TempComp volts DC",        4,  5, (float)25.1, 
"TempComp");
-  _items[4].push_back(mi);
-  mi.SetItem ("Inverter         volts AC",        4,  6, 0, "InvertVolts");
-  _items[4].push_back(mi);
-  //mi.SetItem ("Grid (AC1)",                       4,  7, 0, "GridVolts");
-  mi.SetItem ("Grid (AC1)       volts AC",                             4,  7, 
0, "GridVolts");
-  _items[4].push_back(mi);
-  //mi.SetItem ("Generator (AC2)",                  4,  8, 0, "GenVolts");
-  mi.SetItem ("Generator (AC2)  volts AC",                             4,  8, 
0, "GenVolts");
-  _items[4].push_back(mi);
-  //mi.SetItem ("Read Frequency",                   4,  9, 0, "ReadHertz");
-  mi.SetItem ("Read Frequency   Hertz",                           4,  9, 0, 
"ReadHertz");
-  _items[4].push_back(mi);
-  mi.SetItem ("AC1 & AC2 volts  valid only when", 4, 10);
-  _items[4].push_back(mi);
-  mi.SetItem ("inverter synced  to that input.",  4, 11);
-  _items[4].push_back(mi);
-  mi.SetItem ("Batt volt actual is used for",     4, 12);
-  _items[4].push_back(mi);
-  mi.SetItem ("LBCO,HBCO,LBX,   LBCI,sell volts", 4, 13);
-  _items[4].push_back(mi);
-  mi.SetItem ("and gen starting",                 4, 14);
-  _items[4].push_back(mi);
-  mi.SetItem ("Batt volt temp   comp is used,",   4, 15);
-  _items[4].push_back(mi);
-  mi.SetItem ("for float, bulk, eq & aux relays", 4, 16);
-  _items[4].push_back(mi);
+    // Xantrex Engineering - Menu Heading #3
+    // Xantrex was Trace, so this prompt varies depending on the
+    // software version on the inverter.
+    mi.SetItem ("Engineering",       3);
+    //mi.SetItem ("Trace            Engineering",       3);
+    _items[3].push_back(mi);
+    mi.SetItem ("Press reset now  for defaults",      3, 1);
+    _items[3].push_back(mi);
+    mi.SetItem ("Revision 4.01",                      3, 2, "XantrexRev");
+    _items[3].push_back(mi);
+    mi.SetItem ("5916 195th St NE Arlington, WA",     3, 3);
+    _items[3].push_back(mi);
+    mi.SetItem ("98223 USA",                          3, 4);
+    _items[3].push_back(mi);
+    mi.SetItem ("Ph  360-435-8826 Fax 360-435-2229",  3, 5);
+    _items[3].push_back(mi);
+
+    // Meters - Menu Heading #4
+    mi.SetItem ("Meters",                         4);
+    _items[4].push_back(mi);
+    mi.SetItem ("Inverter/charger amps AC",         4,  1, 0, "ChargerAmps");
+    _items[4].push_back(mi);
+    mi.SetItem ("Input            amps AC",         4,  2, 0, "InputAmps");
+    //mi.SetItem ("Input",                           4,  2, 0, "InputAmps");
+    _items[4].push_back(mi);
+    mi.SetItem ("Load             amps AC",         4,  3, 0, "LoadAmps");
+    _items[4].push_back(mi);
+    //mi.SetItem ("Battery actual",                   4,  4, (float)25.1, 
"BattVolts");
+    mi.SetItem ("Battery actual   volts DC",        4,  4, (float)25.1, 
"BattVolts");
+    _items[4].push_back(mi);
+    //mi.SetItem ("Battery TempComp",                4,  5, (float)25.1, 
"TempComp");
+    mi.SetItem ("Battery TempComp volts DC",        4,  5, (float)25.1, 
"TempComp");
+    _items[4].push_back(mi);
+    mi.SetItem ("Inverter         volts AC",        4,  6, 0, "InvertVolts");
+    _items[4].push_back(mi);
+    //mi.SetItem ("Grid (AC1)",                       4,  7, 0, "GridVolts");
+    mi.SetItem ("Grid (AC1)       volts AC",                             4,  
7, 0, "GridVolts");
+    _items[4].push_back(mi);
+    //mi.SetItem ("Generator (AC2)",                  4,  8, 0, "GenVolts");
+    mi.SetItem ("Generator (AC2)  volts AC",                             4,  
8, 0, "GenVolts");
+    _items[4].push_back(mi);
+    //mi.SetItem ("Read Frequency",                   4,  9, 0, "ReadHertz");
+    mi.SetItem ("Read Frequency   Hertz",                           4,  9, 0, 
"ReadHertz");
+    _items[4].push_back(mi);
+    mi.SetItem ("AC1 & AC2 volts  valid only when", 4, 10);
+    _items[4].push_back(mi);
+    mi.SetItem ("inverter synced  to that input.",  4, 11);
+    _items[4].push_back(mi);
+    mi.SetItem ("Batt volt actual is used for",     4, 12);
+    _items[4].push_back(mi);
+    mi.SetItem ("LBCO,HBCO,LBX,   LBCI,sell volts", 4, 13);
+    _items[4].push_back(mi);
+    mi.SetItem ("and gen starting",                 4, 14);
+    _items[4].push_back(mi);
+    mi.SetItem ("Batt volt temp   comp is used,",   4, 15);
+    _items[4].push_back(mi);
+    mi.SetItem ("for float, bulk, eq & aux relays", 4, 16);
+    _items[4].push_back(mi);
   
-  // Error Cause - Menu Heading #5
-  mi.SetItem ("Error Causes",                 5);
-  _items[5].push_back(mi);
-  mi.SetItem ("Over Current",                 5,  1, false, "OverCurrent");
-  _items[5].push_back(mi);
-  mi.SetItem ("Transformer      overtemp",    5,  2, false, "OverTemp");
-  _items[5].push_back(mi);
-  mi.SetItem ("Heatsink         overtemp",    5,  3, false, "HeatSink");
-  _items[5].push_back(mi);
-  mi.SetItem ("High Battery     voltage",     5,  4, false, "HighBatt");
-  _items[5].push_back(mi);
-  mi.SetItem ("Low Battery      voltage",     5,  5, false, "LowBatt");
-  _items[5].push_back(mi);
-  mi.SetItem ("Inverter breaker tripped",     5,  6, false, "Tripped");
-  _items[5].push_back(mi);
-  mi.SetItem ("Manual Off",                   5,  7, false, "ManualOff");
-  _items[5].push_back(mi);
-  mi.SetItem ("AC source wired  to output",   5,  8, false, "ACWired");
-  _items[5].push_back(mi);
-  mi.SetItem ("External error   (Stacked)",   5,  9, false, "ExtError");
-  _items[5].push_back(mi);
-  mi.SetItem ("Generator start  error",       5, 10, false, "GenError");
-  _items[5].push_back(mi);
-  mi.SetItem ("Generator sync   error",       5, 11, false, "SyncError");
-  _items[5].push_back(mi);
-  mi.SetItem ("Gen maximum run  time error",  5, 12, false, "MaxRunError");
-  _items[5].push_back(mi);
-  mi.SetItem ("Gen Under/Over   speed",       5, 13, false, "SpeedError");
-  _items[5].push_back(mi);
-  mi.SetItem ("Inverter breaker tripped",     5, 14, false, "BreakerError");
-  _items[5].push_back(mi);
+    // Error Cause - Menu Heading #5
+    mi.SetItem ("Error Causes",                 5);
+    _items[5].push_back(mi);
+    mi.SetItem ("Over Current",                 5,  1, false, "OverCurrent");
+    _items[5].push_back(mi);
+    mi.SetItem ("Transformer      overtemp",    5,  2, false, "OverTemp");
+    _items[5].push_back(mi);
+    mi.SetItem ("Heatsink         overtemp",    5,  3, false, "HeatSink");
+    _items[5].push_back(mi);
+    mi.SetItem ("High Battery     voltage",     5,  4, false, "HighBatt");
+    _items[5].push_back(mi);
+    mi.SetItem ("Low Battery      voltage",     5,  5, false, "LowBatt");
+    _items[5].push_back(mi);
+    mi.SetItem ("Inverter breaker tripped",     5,  6, false, "Tripped");
+    _items[5].push_back(mi);
+    mi.SetItem ("Manual Off",                   5,  7, false, "ManualOff");
+    _items[5].push_back(mi);
+    mi.SetItem ("AC source wired  to output",   5,  8, false, "ACWired");
+    _items[5].push_back(mi);
+    mi.SetItem ("External error   (Stacked)",   5,  9, false, "ExtError");
+    _items[5].push_back(mi);
+    mi.SetItem ("Generator start  error",       5, 10, false, "GenError");
+    _items[5].push_back(mi);
+    mi.SetItem ("Generator sync   error",       5, 11, false, "SyncError");
+    _items[5].push_back(mi);
+    mi.SetItem ("Gen maximum run  time error",  5, 12, false, "MaxRunError");
+    _items[5].push_back(mi);
+    mi.SetItem ("Gen Under/Over   speed",       5, 13, false, "SpeedError");
+    _items[5].push_back(mi);
+    mi.SetItem ("Inverter breaker tripped",     5, 14, false, "BreakerError");
+    _items[5].push_back(mi);
   
-  // Time Of Day - Menu Heading #6
-  mi.SetItem ("Time of Day",                 6);
-  _items[6].push_back(mi);
-  mi.SetItem ("Time of Day      Set Clock hour", 6, 1, 0);
-  _items[6].push_back(mi);
-  mi.SetItem ("Set Clock minute",            6, 2, 0, "Minute");
-  _items[6].push_back(mi);
-  mi.SetItem ("Set Clock second",            6, 3, 0, "Second");
-  _items[6].push_back(mi);
-
-  // Generator timer - Menu Heading #7
-  mi.SetItem ("Generator Timer",           7);
-  _items[7].push_back(mi);
-  mi.SetItem ("Start Quiet      time h:m", 7, 1, 8 ); // FIXME: this should be 
a time
-  _items[7].push_back(mi);  
-  mi.SetItem ("End Quiet        time h:m", 7, 2, 8 ); // FIXME: this should be 
a time
-  _items[7].push_back(mi);
-
-  // End of User menus!
-  mi.SetItem ("END USER MENU", 8);
-  _items[8].push_back(mi);
-
-  // Inverter Setup - Menu heading #9
-  mi.SetItem ("Inverter Setup",               9);
-  _items[9].push_back(mi);
-  mi.SetItem ("Set Grid Usage",               9, 1); // FIXME: FLOAT
-  _items[9].push_back(mi);
-  mi.SetItem ("Set Low battery  cut out VDC", 9, 2, (float)22.0);
-  _items[9].push_back(mi);
-  mi.SetItem ("Set LBCO delay   minutes",     9, 3, 15);
-  _items[9].push_back(mi);
-  mi.SetItem ("Set Low battery  cut in VDC",  9, 4, (float)26.0);
-  _items[9].push_back(mi);
-  mi.SetItem ("Set High battery cut out VDC", 9, 5, (float)32.0);
-  _items[9].push_back(mi);
-  mi.SetItem ("Set search       watts",       9, 6, 48);
-  _items[9].push_back(mi);
-  mi.SetItem ("Set search       spacing",     9, 7, 59);
-  _items[9].push_back(mi);
-
-  // Battery Charging - Menu heading #10
-  mi.SetItem ("Battery Charging",                10);
-  _items[10].push_back(mi);
-  mi.SetItem ("Set Bulk         volts DC",       10, 1, (float)28.8);
-  _items[10].push_back(mi);
-  mi.SetItem ("Set Absorption   time h:m",       10, 2, 2);
-  _items[10].push_back(mi);
-  mi.SetItem ("Set Float        volts DC",       10, 3, (float)26.8);
-  _items[10].push_back(mi);
-  mi.SetItem ("Set Equalize     volts DC",       10, 4, (float)28.8);
-  _items[10].push_back(mi);
-  mi.SetItem ("Set Equalize     time h:m",       10, 5, 2);
-  _items[10].push_back(mi);
-  mi.SetItem ("Set Max Charge   amps DC",        10, 6, 30);
-  _items[10].push_back(mi);
-  mi.SetItem ("Set Temp Comp    LeadAcid Nicad", 10, 7); // FIXME: LEADACID
-  _items[10].push_back(mi);
-
-  // AC Inputs - Menu heading #11
-  mi.SetItem ("AC Inputs",                       11);
-  _items[11].push_back(mi);
-  mi.SetItem ("inverter synced  to that input.", 11);
-  _items[11].push_back(mi);
-  mi.SetItem ("Set Grid (AC1)   amps AC",        11, 1, 60);
-  _items[11].push_back(mi);
-  mi.SetItem ("Set Gen (AC2)    amps AC",        11, 2, 30);
-  _items[11].push_back(mi);
-  mi.SetItem ("Set Input lower  limit VAC",      11, 3, 108);
-  _items[11].push_back(mi);
-  mi.SetItem ("Set Input upper  limit VAC",      11, 4, 132);
-  _items[11].push_back(mi);
-
-  // Generator Auto Start Setup - Menu heading #12
-  //  genauto.state = OFF;
-  mi.SetItem ("Gen Auto Start   setup",           12);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set Load Start   amps AC",         12, 1, 33);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set Load Start   delay min",       12, 2, 5);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set Load Stop    delay min",       12, 3, 5);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set 24 hr start  volts DC",        12, 4, (float)24.6);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set 2 hr start   volts DC",        12, 5, (float)23.6);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set 15 min start volts DC",        12, 6, (float)22.6);
-  _items[12].push_back(mi);
-  mi.SetItem ("Read LBCO 30 sec start VDC",       12, 7, 22);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set Exercise     period days",     12, 8, 30);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set Maximum run  time h:m",        12, 9, 8);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set Max Run time to 0 to defeat.", 12, 10, 0);
-  _items[12].push_back(mi);
-  mi.SetItem ("Set Exercise to 0 to defeat.",     12, 11, 0);
-  _items[12].push_back(mi);
-  mi.SetItem ("See menu 9 to    to set LBCO.",    12, 12, 0);
-  _items[12].push_back(mi);
-
-  //Generator Starting Details - Menu heading #13
-  mi.SetItem ("Gen starting     details",      13);
-  _items[13].push_back(mi);
-  mi.SetItem ("Set RY7 Function GlowStop Run", 13, 1, 0);
-  _items[13].push_back(mi);
-  mi.SetItem ("Set Gen warmup   seconds",      13, 2, 60);
-  _items[13].push_back(mi);
-  mi.SetItem ("Set Pre Crank    seconds",      13, 3, 10);
-  _items[13].push_back(mi);
-  mi.SetItem ("Set Max Cranking seconds",      13, 4, 10);
-  _items[13].push_back(mi);
-  mi.SetItem ("Set Post Crank   seconds",      13, 5, 30);
-  _items[13].push_back(mi);
-
-  // Auxilary relays - Menu heading #14
-  mi.SetItem ("Auxiliary Relays R9 R10 R11", 14);
-  _items[14].push_back(mi);
-  mi.SetItem ("Set Relay 9      volts DC",       14, 1, 29);
-  _items[14].push_back(mi);
-  mi.SetItem ("R9 Hysteresis    volts DC",       14, 2, 2);
-  _items[14].push_back(mi);
-  mi.SetItem ("Set Relay 10     volts DC",       14, 3, (float)29.5);
-  _items[14].push_back(mi);
-  mi.SetItem ("R10 Hysteresis   volts DC",       14, 4, 2);
-  _items[14].push_back(mi);
-  mi.SetItem ("Set Relay 11     volts DC",       14, 5, 30);
-  _items[14].push_back(mi);
-  mi.SetItem ("R11 Hysteresis   volts DC",       14, 6, 2);
-  _items[14].push_back(mi);
-  mi.SetItem ("Close on batt >  setpoint.",      14, 7);
-  _items[14].push_back(mi);
-  mi.SetItem ("Open  on  batt < setpoint - Hys", 14, 8);
-  _items[14].push_back(mi);
-  mi.SetItem ("Relays have 2    second delay on",14, 9);
-  _items[14].push_back(mi);
-  mi.SetItem ("Close, 0.1 sec   delay on open",  14, 10);
-  _items[14].push_back(mi);
-
-  // Bulk Charge Trigger Time - Menu heading #15
-  mi.SetItem ("Bulk Charge      Trigger Timer",   15);
-  _items[15].push_back(mi);              
-  mi.SetItem ("Set Start Bulk   time",            15, 1, 0);
-  _items[15].push_back(mi);              
-  mi.SetItem ("To disable timer set to 00:00",    15, 2);
-  _items[15].push_back(mi);              
-  mi.SetItem ("If grid timer    active set bulk", 15, 3);
-  _items[15].push_back(mi);              
-  mi.SetItem ("time after start charge time.",    15, 4);
-  _items[15].push_back(mi);              
-  mi.SetItem ("In SLT mode don't disable this",   15, 5);
-  _items[15].push_back(mi);              
-  mi.SetItem ("timer. It is the daily chg time.", 15, 6);
-  _items[15].push_back(mi);              
-
-  // Low Battery Transfer - Menu heading #16
-  mi.SetItem ("Low Battery      Transfer (LBX)",    16);
-  _items[16].push_back(mi);
-  mi.SetItem ("Set Low Battery  TransferVDC",       16, 1, (float)26.8);
-  _items[16].push_back(mi);
-  mi.SetItem ("Set Low Battery  cut in  VDC",       16, 2, (float)26);
-  _items[16].push_back(mi);
-  mi.SetItem ("See menu 9 to    enable LBX mode.",  16, 3);
-  _items[16].push_back(mi);
-  mi.SetItem ("Make sure LBX is above LBCO volts.", 16, 4);
-  _items[16].push_back(mi);
-
-  //  Battery Power Selling - Menu heading #17
-  mi.SetItem ("Battery Selling",                    17);
-  _items[17].push_back(mi);
-  mi.SetItem ("Set Battery Sell volts",             17, 1, (float)26.8);
-  _items[17].push_back(mi);
-  mi.SetItem ("Set Max Sell     amps",              17, 2, 30);
-  _items[17].push_back(mi);
-  mi.SetItem ("See menu 9 to    enable SELL mode.", 17, 3);
-  _items[17].push_back(mi);
-  mi.SetItem ("Make sure LBX is above LBCO volts.", 17, 4);
-  _items[17].push_back(mi);
+    // Time Of Day - Menu Heading #6
+    mi.SetItem ("Time of Day",                 6);
+    _items[6].push_back(mi);
+    mi.SetItem ("Time of Day      Set Clock hour", 6, 1, 0);
+    _items[6].push_back(mi);
+    mi.SetItem ("Set Clock minute",            6, 2, 0, "Minute");
+    _items[6].push_back(mi);
+    mi.SetItem ("Set Clock second",            6, 3, 0, "Second");
+    _items[6].push_back(mi);
+
+    // Generator timer - Menu Heading #7
+    mi.SetItem ("Generator Timer",           7);
+    _items[7].push_back(mi);
+    mi.SetItem ("Start Quiet      time h:m", 7, 1, 8 ); // FIXME: this should 
be a time
+    _items[7].push_back(mi);  
+    mi.SetItem ("End Quiet        time h:m", 7, 2, 8 ); // FIXME: this should 
be a time
+    _items[7].push_back(mi);
+
+    // End of User menus!
+    mi.SetItem ("END USER MENU", 8);
+    _items[8].push_back(mi);
+
+    // Inverter Setup - Menu heading #9
+    mi.SetItem ("Inverter Setup",               9);
+    _items[9].push_back(mi);
+    mi.SetItem ("Set Grid Usage",               9, 1); // FIXME: FLOAT
+    _items[9].push_back(mi);
+    mi.SetItem ("Set Low battery  cut out VDC", 9, 2, (float)22.0);
+    _items[9].push_back(mi);
+    mi.SetItem ("Set LBCO delay   minutes",     9, 3, 15);
+    _items[9].push_back(mi);
+    mi.SetItem ("Set Low battery  cut in VDC",  9, 4, (float)26.0);
+    _items[9].push_back(mi);
+    mi.SetItem ("Set High battery cut out VDC", 9, 5, (float)32.0);
+    _items[9].push_back(mi);
+    mi.SetItem ("Set search       watts",       9, 6, 48);
+    _items[9].push_back(mi);
+    mi.SetItem ("Set search       spacing",     9, 7, 59);
+    _items[9].push_back(mi);
+
+    // Battery Charging - Menu heading #10
+    mi.SetItem ("Battery Charging",                10);
+    _items[10].push_back(mi);
+    mi.SetItem ("Set Bulk         volts DC",       10, 1, (float)28.8);
+    _items[10].push_back(mi);
+    mi.SetItem ("Set Absorption   time h:m",       10, 2, 2);
+    _items[10].push_back(mi);
+    mi.SetItem ("Set Float        volts DC",       10, 3, (float)26.8);
+    _items[10].push_back(mi);
+    mi.SetItem ("Set Equalize     volts DC",       10, 4, (float)28.8);
+    _items[10].push_back(mi);
+    mi.SetItem ("Set Equalize     time h:m",       10, 5, 2);
+    _items[10].push_back(mi);
+    mi.SetItem ("Set Max Charge   amps DC",        10, 6, 30);
+    _items[10].push_back(mi);
+    mi.SetItem ("Set Temp Comp    LeadAcid Nicad", 10, 7); // FIXME: LEADACID
+    _items[10].push_back(mi);
+
+    // AC Inputs - Menu heading #11
+    mi.SetItem ("AC Inputs",                       11);
+    _items[11].push_back(mi);
+    mi.SetItem ("inverter synced  to that input.", 11);
+    _items[11].push_back(mi);
+    mi.SetItem ("Set Grid (AC1)   amps AC",        11, 1, 60);
+    _items[11].push_back(mi);
+    mi.SetItem ("Set Gen (AC2)    amps AC",        11, 2, 30);
+    _items[11].push_back(mi);
+    mi.SetItem ("Set Input lower  limit VAC",      11, 3, 108);
+    _items[11].push_back(mi);
+    mi.SetItem ("Set Input upper  limit VAC",      11, 4, 132);
+    _items[11].push_back(mi);
+
+    // Generator Auto Start Setup - Menu heading #12
+    //  genauto.state = OFF;
+    mi.SetItem ("Gen Auto Start   setup",           12);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set Load Start   amps AC",         12, 1, 33);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set Load Start   delay min",       12, 2, 5);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set Load Stop    delay min",       12, 3, 5);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set 24 hr start  volts DC",        12, 4, (float)24.6);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set 2 hr start   volts DC",        12, 5, (float)23.6);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set 15 min start volts DC",        12, 6, (float)22.6);
+    _items[12].push_back(mi);
+    mi.SetItem ("Read LBCO 30 sec start VDC",       12, 7, 22);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set Exercise     period days",     12, 8, 30);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set Maximum run  time h:m",        12, 9, 8);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set Max Run time to 0 to defeat.", 12, 10, 0);
+    _items[12].push_back(mi);
+    mi.SetItem ("Set Exercise to 0 to defeat.",     12, 11, 0);
+    _items[12].push_back(mi);
+    mi.SetItem ("See menu 9 to    to set LBCO.",    12, 12, 0);
+    _items[12].push_back(mi);
+
+    //Generator Starting Details - Menu heading #13
+    mi.SetItem ("Gen starting     details",      13);
+    _items[13].push_back(mi);
+    mi.SetItem ("Set RY7 Function GlowStop Run", 13, 1, 0);
+    _items[13].push_back(mi);
+    mi.SetItem ("Set Gen warmup   seconds",      13, 2, 60);
+    _items[13].push_back(mi);
+    mi.SetItem ("Set Pre Crank    seconds",      13, 3, 10);
+    _items[13].push_back(mi);
+    mi.SetItem ("Set Max Cranking seconds",      13, 4, 10);
+    _items[13].push_back(mi);
+    mi.SetItem ("Set Post Crank   seconds",      13, 5, 30);
+    _items[13].push_back(mi);
+
+    // Auxilary relays - Menu heading #14
+    mi.SetItem ("Auxiliary Relays R9 R10 R11", 14);
+    _items[14].push_back(mi);
+    mi.SetItem ("Set Relay 9      volts DC",       14, 1, 29);
+    _items[14].push_back(mi);
+    mi.SetItem ("R9 Hysteresis    volts DC",       14, 2, 2);
+    _items[14].push_back(mi);
+    mi.SetItem ("Set Relay 10     volts DC",       14, 3, (float)29.5);
+    _items[14].push_back(mi);
+    mi.SetItem ("R10 Hysteresis   volts DC",       14, 4, 2);
+    _items[14].push_back(mi);
+    mi.SetItem ("Set Relay 11     volts DC",       14, 5, 30);
+    _items[14].push_back(mi);
+    mi.SetItem ("R11 Hysteresis   volts DC",       14, 6, 2);
+    _items[14].push_back(mi);
+    mi.SetItem ("Close on batt >  setpoint.",      14, 7);
+    _items[14].push_back(mi);
+    mi.SetItem ("Open  on  batt < setpoint - Hys", 14, 8);
+    _items[14].push_back(mi);
+    mi.SetItem ("Relays have 2    second delay on",14, 9);
+    _items[14].push_back(mi);
+    mi.SetItem ("Close, 0.1 sec   delay on open",  14, 10);
+    _items[14].push_back(mi);
+
+    // Bulk Charge Trigger Time - Menu heading #15
+    mi.SetItem ("Bulk Charge      Trigger Timer",   15);
+    _items[15].push_back(mi);              
+    mi.SetItem ("Set Start Bulk   time",            15, 1, 0);
+    _items[15].push_back(mi);              
+    mi.SetItem ("To disable timer set to 00:00",    15, 2);
+    _items[15].push_back(mi);              
+    mi.SetItem ("If grid timer    active set bulk", 15, 3);
+    _items[15].push_back(mi);              
+    mi.SetItem ("time after start charge time.",    15, 4);
+    _items[15].push_back(mi);              
+    mi.SetItem ("In SLT mode don't disable this",   15, 5);
+    _items[15].push_back(mi);              
+    mi.SetItem ("timer. It is the daily chg time.", 15, 6);
+    _items[15].push_back(mi);              
+
+    // Low Battery Transfer - Menu heading #16
+    mi.SetItem ("Low Battery      Transfer (LBX)",    16);
+    _items[16].push_back(mi);
+    mi.SetItem ("Set Low Battery  TransferVDC",       16, 1, (float)26.8);
+    _items[16].push_back(mi);
+    mi.SetItem ("Set Low Battery  cut in  VDC",       16, 2, (float)26);
+    _items[16].push_back(mi);
+    mi.SetItem ("See menu 9 to    enable LBX mode.",  16, 3);
+    _items[16].push_back(mi);
+    mi.SetItem ("Make sure LBX is above LBCO volts.", 16, 4);
+    _items[16].push_back(mi);
+
+    //  Battery Power Selling - Menu heading #17
+    mi.SetItem ("Battery Selling",                    17);
+    _items[17].push_back(mi);
+    mi.SetItem ("Set Battery Sell volts",             17, 1, (float)26.8);
+    _items[17].push_back(mi);
+    mi.SetItem ("Set Max Sell     amps",              17, 2, 30);
+    _items[17].push_back(mi);
+    mi.SetItem ("See menu 9 to    enable SELL mode.", 17, 3);
+    _items[17].push_back(mi);
+    mi.SetItem ("Make sure LBX is above LBCO volts.", 17, 4);
+    _items[17].push_back(mi);
   
-  // Grid Usage Timer - Menu heading #18
-  mi.SetItem ("Grid Usage Timer",                 18);
-  _items[18].push_back(mi);
-  mi.SetItem ("Set Charge       time",            18,  1, 21); // FIXME: TIME
-  _items[18].push_back(mi);
-  mi.SetItem ("End Charge       time",            18,  2, 21); // FIXME: TIME
-  _items[18].push_back(mi);
-  mi.SetItem ("After Start      Charge time:",    18,  3);
-  _items[18].push_back(mi);
-  mi.SetItem ("SELL mode        charges battery.",18,  4);
-  _items[18].push_back(mi);
-  mi.SetItem ("FLT mode         charges battery", 18,  5);
-  _items[18].push_back(mi);
-  mi.SetItem ("After End Charge time:",           18,  6);
-  _items[18].push_back(mi);
-  mi.SetItem ("SELL mode sells  battery to AC1.", 18,  7);
-  _items[18].push_back(mi);
-  mi.SetItem ("FLT mode drops   AC1 and inverts", 18,  8);
-  _items[18].push_back(mi);
-  mi.SetItem ("Timer on when    start < > end;",  18,  9);
-  _items[18].push_back(mi);
-  mi.SetItem ("timer off when   start = end",     18, 10);
-  _items[18].push_back(mi);
-  mi.SetItem ("Sell and float   modes use timer", 18, 11);
-  _items[18].push_back(mi);
-  mi.SetItem ("SLT and LBX mode ignore timer",    18, 12);
-  _items[18].push_back(mi);
+    // Grid Usage Timer - Menu heading #18
+    mi.SetItem ("Grid Usage Timer",                 18);
+    _items[18].push_back(mi);
+    mi.SetItem ("Set Charge       time",            18,  1, 21); // FIXME: TIME
+    _items[18].push_back(mi);
+    mi.SetItem ("End Charge       time",            18,  2, 21); // FIXME: TIME
+    _items[18].push_back(mi);
+    mi.SetItem ("After Start      Charge time:",    18,  3);
+    _items[18].push_back(mi);
+    mi.SetItem ("SELL mode        charges battery.",18,  4);
+    _items[18].push_back(mi);
+    mi.SetItem ("FLT mode         charges battery", 18,  5);
+    _items[18].push_back(mi);
+    mi.SetItem ("After End Charge time:",           18,  6);
+    _items[18].push_back(mi);
+    mi.SetItem ("SELL mode sells  battery to AC1.", 18,  7);
+    _items[18].push_back(mi);
+    mi.SetItem ("FLT mode drops   AC1 and inverts", 18,  8);
+    _items[18].push_back(mi);
+    mi.SetItem ("Timer on when    start < > end;",  18,  9);
+    _items[18].push_back(mi);
+    mi.SetItem ("timer off when   start = end",     18, 10);
+    _items[18].push_back(mi);
+    mi.SetItem ("Sell and float   modes use timer", 18, 11);
+    _items[18].push_back(mi);
+    mi.SetItem ("SLT and LBX mode ignore timer",    18, 12);
+    _items[18].push_back(mi);
   
-  // Information file battery - Menu Heading #19
-  mi.SetItem ("Information file battery",          19);
-  _items[19].push_back(mi);
-  mi.SetItem ("Batt temp comp   changes battery",  19, 1);
-  _items[19].push_back(mi);
-  mi.SetItem ("voltage reading  away from actual", 19, 2);
-  _items[19].push_back(mi);
-  mi.SetItem ("HBCO resets at:  6v/48, 3v/24 and", 19, 3);
-  _items[19].push_back(mi);
-  mi.SetItem ("1.5v/12v under   HBCO.",            19, 4);
-  _items[19].push_back(mi);
-  mi.SetItem ("LowBattTransfer  used in LBX, FLT", 19, 5);
-  _items[19].push_back(mi);
-  mi.SetItem ("Modes only. Goes back to battery",  19, 6);
-  _items[19].push_back(mi);
-  mi.SetItem ("at LowBattCutIn  (aka LBCI).",      19, 7);
-  _items[19].push_back(mi);
-  mi.SetItem ("For LBX mode set below LBCI so",    19, 8);
-  _items[19].push_back(mi);
-  mi.SetItem ("charger won't    cycle batteries",  19, 9);
-  _items[19].push_back(mi);
-  mi.SetItem ("up and down and  set LBCO below.",  19, 10);
-  _items[19].push_back(mi);
+    // Information file battery - Menu Heading #19
+    mi.SetItem ("Information file battery",          19);
+    _items[19].push_back(mi);
+    mi.SetItem ("Batt temp comp   changes battery",  19, 1);
+    _items[19].push_back(mi);
+    mi.SetItem ("voltage reading  away from actual", 19, 2);
+    _items[19].push_back(mi);
+    mi.SetItem ("HBCO resets at:  6v/48, 3v/24 and", 19, 3);
+    _items[19].push_back(mi);
+    mi.SetItem ("1.5v/12v under   HBCO.",            19, 4);
+    _items[19].push_back(mi);
+    mi.SetItem ("LowBattTransfer  used in LBX, FLT", 19, 5);
+    _items[19].push_back(mi);
+    mi.SetItem ("Modes only. Goes back to battery",  19, 6);
+    _items[19].push_back(mi);
+    mi.SetItem ("at LowBattCutIn  (aka LBCI).",      19, 7);
+    _items[19].push_back(mi);
+    mi.SetItem ("For LBX mode set below LBCI so",    19, 8);
+    _items[19].push_back(mi);
+    mi.SetItem ("charger won't    cycle batteries",  19, 9);
+    _items[19].push_back(mi);
+    mi.SetItem ("up and down and  set LBCO below.",  19, 10);
+    _items[19].push_back(mi);
   
-  // End of Setup - Menu Heading #20
-  mi.SetItem ("END SETUP MENU", 20);
-  _items[20].push_back(mi);
+    // End of Setup - Menu Heading #20
+    mi.SetItem ("END SETUP MENU", 20);
+    _items[20].push_back(mi);
 }
 
 // Dump all the MenuItem data
 void
 XantrexUI::Dump (void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  vector< vector< MenuItem > >::iterator mh;
-  vector< MenuItem >::iterator it;
+    vector< vector< MenuItem > >::iterator mh;
+    vector< MenuItem >::iterator it;
 
-  dbglogfile << "There are " << (int)_items.size() << " menu _items" << endl;
+    dbglogfile << "There are " << (int)_items.size() << " menu _items" << endl;
 
-  for (mh = _items.begin(); mh != _items.end(); ++mh) {
-    for (it = mh->begin(); it != mh->end(); ++it) {
-      //it->Dump();
-      cout << it->GetHeaderIndex()
-           << "," << it->GetItemIndex()
-           << ": " << it->GetLabel() << endl;
+    for (mh = _items.begin(); mh != _items.end(); ++mh) {
+        for (it = mh->begin(); it != mh->end(); ++it) {
+            //it->Dump();
+            cout << it->GetHeaderIndex()
+                 << "," << it->GetItemIndex()
+                 << ": " << it->GetLabel() << endl;
+        }
     }
-  }
 }
 
 void
 XantrexUI::DumpAliases (void)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  vector< vector< MenuItem > >::iterator mh;
-  vector< MenuItem >::iterator it;
-  string tmpstr;
-
-  cout << "Command Name\t\tMenu Item" << endl;
-  cout << "------------\t\t---------" << endl;
-  for (mh = _items.begin(); mh != _items.end(); ++mh) {
-    for (it = mh->begin(); it != mh->end(); ++it) {
-      tmpstr = it->GetLabel();
-      if (it->GetAlias().size() > 0)
-        cout << it->GetAlias() << "  \t- " << CleanUpData(tmpstr) << endl;
+    vector< vector< MenuItem > >::iterator mh;
+    vector< MenuItem >::iterator it;
+    string tmpstr;
+
+    cout << "Command Name\t\tMenu Item" << endl;
+    cout << "------------\t\t---------" << endl;
+    for (mh = _items.begin(); mh != _items.end(); ++mh) {
+        for (it = mh->begin(); it != mh->end(); ++it) {
+            tmpstr = it->GetLabel();
+            if (it->GetAlias().size() > 0)
+                cout << it->GetAlias() << "  \t- " << CleanUpData(tmpstr) << 
endl;
+        }
     }
-  }
 }
 
 MenuItem &
 XantrexUI::Match(string &str)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
   
-  vector< vector< MenuItem > >::iterator mh;
-  vector< MenuItem >::iterator it;
-  vector< MenuItem > arg;
-
-  for (mh = _items.begin(); mh != _items.end(); ++mh) {
-    arg = *mh;
-    for (it = arg.begin(); it != arg.end(); ++it) {
-      dbglogfile << "Matching \"" << it->GetAlias() << "\""
-                 << " against the argument \"" << str << "\"" << endl;
-      if (it->GetAlias() == str){
-        dbglogfile << "Matched " << it->GetLabel() << " !" << endl;
-        return *it;
-      }
+    vector< vector< MenuItem > >::iterator mh;
+    vector< MenuItem >::iterator it;
+    vector< MenuItem > arg;
+
+    for (mh = _items.begin(); mh != _items.end(); ++mh) {
+        arg = *mh;
+        for (it = arg.begin(); it != arg.end(); ++it) {
+            dbglogfile << "Matching \"" << it->GetAlias() << "\""
+                       << " against the argument \"" << str << "\"" << endl;
+            if (it->GetAlias() == str){
+                dbglogfile << "Matched " << it->GetLabel() << " !" << endl;
+                return *it;
+            }
+        }
     }
-  }
-  // FIXME: this is a hack to set an error condition
-  str.erase();
-  return *it;
+    // FIXME: this is a hack to set an error condition
+    str.erase();
+    return *it;
 }
 
 MenuItem &
 XantrexUI::GetItem(int x, int y)
 {
-   DEBUGLOG_REPORT_FUNCTION;
-   vector< vector< MenuItem > >::iterator mh;
-   vector< MenuItem >::iterator it;
-   vector< MenuItem > arg;
-   string tmp;
+    DEBUGLOG_REPORT_FUNCTION;
+    vector< vector< MenuItem > >::iterator mh;
+    vector< MenuItem >::iterator it;
+    vector< MenuItem > arg;
+    string tmp;
    
-   for (mh = _items.begin(); mh != _items.end(); ++mh) {
-     for (it = mh->begin(); it != mh->end(); ++it) {
-       tmp = it->GetLabel();
-       if ((it->GetHeaderIndex() == x) && (it->GetItemIndex() == y)) {
-         return *it;
-       }
-     }
-   }
-
-   return *it;                  // FIXME: This probably isn't what we want
+    for (mh = _items.begin(); mh != _items.end(); ++mh) {
+        for (it = mh->begin(); it != mh->end(); ++it) {
+            tmp = it->GetLabel();
+            if ((it->GetHeaderIndex() == x) && (it->GetItemIndex() == y)) {
+                return *it;
+            }
+        }
+    }
+
+    return *it;                  // FIXME: This probably isn't what we want
 }
 
 #if 0
@@ -1271,20 +1272,20 @@ retcode_t
 XantrexUI::xantrex_main(Console &con);
 {
 
-  #if 0
+#if 0
     if (item.size() > 0) {
-      // See if the name is actually a specified index
-      if (item.find(":",0) != string::npos)
-        {
-          menuhead = atoi(item.substr(0, item.find(":",0)).c_str());
-          menuitem = atoi(item.substr(item.find(":",0) + 1, 2).c_str());
-        } else {
-          // lookup the alias to get the indexes
-          ti = ui.Match(item);
-          if (item.size() > 0) {
-            menuhead = ti->GetHeaderIndex();
-            menuitem = ti.GetItemIndex();
-          }
+        // See if the name is actually a specified index
+        if (item.find(":",0) != string::npos)
+            {
+                menuhead = atoi(item.substr(0, item.find(":",0)).c_str());
+                menuitem = atoi(item.substr(item.find(":",0) + 1, 2).c_str());
+            } else {
+            // lookup the alias to get the indexes
+            ti = ui.Match(item);
+            if (item.size() > 0) {
+                menuhead = ti->GetHeaderIndex();
+                menuitem = ti.GetItemIndex();
+            }
         }
     }
 #endif
@@ -1293,240 +1294,240 @@ XantrexUI::xantrex_main(Console &con);
     // via the serial port. This just saves us from firing up
     // kermit or minicom
     if (console) {
-      Console con;
-      con.Open();
-      //ui.SetRaw();
-      while ((ch = con.Getc())!='q') {
-        if (ch > 0){             // If we have something, process it
-          if (echo)
-            con.Putc (ch);          // echo inputted character to screen
+        Console con;
+        con.Open();
+        //ui.SetRaw();
+        while ((ch = con.Getc())!='q') {
+            if (ch > 0){             // If we have something, process it
+                if (echo)
+                    con.Putc (ch);          // echo inputted character to 
screen
           
-          switch (ch) {
-          case 'Q':
-          case 'q':
-            con.Reset();
-            exit(0);
-            break;
-          case 'L':
-            display = ui.MenuHeadingMinus();
-            break;
-          case 'R':
-            display = ui.MenuHeadingPlus();
-            break;
-          case 'D':
-            display = ui.MenuItemMinus();
-            break;
-          case 'U':
-            display = ui.MenuItemPlus();
-            break;
-          case '+':
-            display = ui.SetPointPlus();
-            break;
-          case '-':
-            display = ui.SetPointMinus();
-            break;
-          case '|':
-            display = ui.Inverter();
-            break;
-          case 'G':
-            display = ui.Generator();
-            break;
-          case 'S':
-            display = ui.SetupMenu();
-            break;
-          case 's':
-            display = ui.GotoMenuStart();
-            break;
-          case '/':
-            display = ui.LedStatus();
-            break;
-          case 'V':
-            display = ui.Version();
-            break;
-          case 'T':
-            display = ui.SetTerminalMode();
-            break;
-          case '?':
-            con.Puts("PowerGuru - Xantrex mode\r\n");
-            con.Puts("\t? - help\r\n");
-            con.Puts("\tL - Menu Heading Minus\r\n");
-            con.Puts("\tR - Menu Heading Plus\r\n");
-            con.Puts("\tR - Menu Heading Plus\r\n");
-            con.Puts("\tD - Menu Item Minus\r\n");
-            con.Puts("\tU - Menu Item Plus\r\n");
-            con.Puts("\t+ - Value Plus\r\n");
-            con.Puts("\t- - Value Item Plus\r\n");
-
-            con.Puts("\t| - Inverter Mode\r\n");
-            con.Puts("\tG - Generator Mode\r\n");
-            con.Puts("\tS - Setup Menu\r\n");
-            con.Puts("\t/ - LED Status\r\n");
-            con.Puts("\tV - Version\r\n");
-            con.Puts("\tT - TerminalMode\r\n");
-            con.Puts("\tQ - Quit\r\n");
-          default:
-            break;
-          };
-
-          //          display += "\r";
-          con.Putc('\r');
-          con.Puts(display);
+                switch (ch) {
+                  case 'Q':
+                  case 'q':
+                      con.Reset();
+                      exit(0);
+                      break;
+                  case 'L':
+                      display = ui.MenuHeadingMinus();
+                      break;
+                  case 'R':
+                      display = ui.MenuHeadingPlus();
+                      break;
+                  case 'D':
+                      display = ui.MenuItemMinus();
+                      break;
+                  case 'U':
+                      display = ui.MenuItemPlus();
+                      break;
+                  case '+':
+                      display = ui.SetPointPlus();
+                      break;
+                  case '-':
+                      display = ui.SetPointMinus();
+                      break;
+                  case '|':
+                      display = ui.Inverter();
+                      break;
+                  case 'G':
+                      display = ui.Generator();
+                      break;
+                  case 'S':
+                      display = ui.SetupMenu();
+                      break;
+                  case 's':
+                      display = ui.GotoMenuStart();
+                      break;
+                  case '/':
+                      display = ui.LedStatus();
+                      break;
+                  case 'V':
+                      display = ui.Version();
+                      break;
+                  case 'T':
+                      display = ui.SetTerminalMode();
+                      break;
+                  case '?':
+                      con.Puts("PowerGuru - Xantrex mode\r\n");
+                      con.Puts("\t? - help\r\n");
+                      con.Puts("\tL - Menu Heading Minus\r\n");
+                      con.Puts("\tR - Menu Heading Plus\r\n");
+                      con.Puts("\tR - Menu Heading Plus\r\n");
+                      con.Puts("\tD - Menu Item Minus\r\n");
+                      con.Puts("\tU - Menu Item Plus\r\n");
+                      con.Puts("\t+ - Value Plus\r\n");
+                      con.Puts("\t- - Value Item Plus\r\n");
+
+                      con.Puts("\t| - Inverter Mode\r\n");
+                      con.Puts("\tG - Generator Mode\r\n");
+                      con.Puts("\tS - Setup Menu\r\n");
+                      con.Puts("\t/ - LED Status\r\n");
+                      con.Puts("\tV - Version\r\n");
+                      con.Puts("\tT - TerminalMode\r\n");
+                      con.Puts("\tQ - Quit\r\n");
+                  default:
+                      break;
+                };
+
+                //          display += "\r";
+                con.Putc('\r');
+                con.Puts(display);
 #if 0
-          switch (ui.GetDataType()) {
-          case MenuItem::NONE:
-          case MenuItem::MENUHEAD:
-          case MenuItem::MENUITEM:
-          case MenuItem::BOOL:
-            if (ui.GetBoolValue() == false)
-              dbglogfile << "\tBoolean value is: " << "OFF" ;
-            else
-              dbglogfile << "\tBoolean value is: " << "ON" ;      
-            dbglogfile << endl;
-            break;
-          case MenuItem::INT:
-            dbglogfile << "\tInteger value is: " << value.intval << endl;
-            break;
-          case MenuItem::FLOAT:
-            cerr << "\tFIXME: Float value is: " << value.floatval << endl;
-            break;
-          case MenuItem::TIME:
-            dbglogfile << "\tTime value is: " << value.timeval << endl;
-            break;
-          case MenuItem::EOL:
-          case MenuItem::CLOCK:
-          case MenuItem::ENUM:
-          case MenuItem::DATE:
-            dbglogfile << "\tFIXME: unsupported type! " << value.intval << 
endl;
-            break;
-          default:
-            dbglogfile << "Data Type out of range";
-            break;
-          };
+                switch (ui.GetDataType()) {
+                  case MenuItem::NONE:
+                  case MenuItem::MENUHEAD:
+                  case MenuItem::MENUITEM:
+                  case MenuItem::BOOL:
+                      if (ui.GetBoolValue() == false)
+                          dbglogfile << "\tBoolean value is: " << "OFF" ;
+                      else
+                          dbglogfile << "\tBoolean value is: " << "ON" ;      
+                      dbglogfile << endl;
+                      break;
+                  case MenuItem::INT:
+                      dbglogfile << "\tInteger value is: " << value.intval << 
endl;
+                      break;
+                  case MenuItem::FLOAT:
+                      cerr << "\tFIXME: Float value is: " << value.floatval << 
endl;
+                      break;
+                  case MenuItem::TIME:
+                      dbglogfile << "\tTime value is: " << value.timeval << 
endl;
+                      break;
+                  case MenuItem::EOL:
+                  case MenuItem::CLOCK:
+                  case MenuItem::ENUM:
+                  case MenuItem::DATE:
+                      dbglogfile << "\tFIXME: unsupported type! " << 
value.intval << endl;
+                      break;
+                  default:
+                      dbglogfile << "Data Type out of range";
+                      break;
+                };
 #endif
-        }
+            }
 
-        str += ui.ReadSerial();
-        if (str.size() > 0) {
-          con.Puts(str);
-          str.erase();
+            str += ui.ReadSerial();
+            if (str.size() > 0) {
+                con.Puts(str);
+                str.erase();
+            }
         }
-      }
     }
     
     // Get the value of a menu item
     if (getitem){
       
-      string str = ui.GotoMenuItem(menuhead, menuitem);
-      ti = ui.GetItem(menuhead, menuitem);
-            //    ui.Read((char *)&buffy, 100);
-      cerr << "Inverter returned: " << str << endl;
+        string str = ui.GotoMenuItem(menuhead, menuitem);
+        ti = ui.GetItem(menuhead, menuitem);
+        //    ui.Read((char *)&buffy, 100);
+        cerr << "Inverter returned: " << str << endl;
 
-      //      dbglogfile << "BREAK HERE" << endl;
+        //      dbglogfile << "BREAK HERE" << endl;
       
-      switch (ti.GetType()) {
-      case MenuItem::BOOL:
-        if (ui.GetBoolValue(str) == false)
-          cout << "The Boolean value is: NO" << endl;
-        else
-          cout << "The Boolean value is: YES" << endl;
-        break;
-      case MenuItem::INFO:
-        value = ui.GetValue(str);
-        cout << "The value is: " << value << endl;
-        break;
-      case MenuItem::INT:
-        intval = ui.GetIntValue(str);
-        cout << "The Integer value is: " << intval << endl;
-        break;
-      case MenuItem::FLOAT:
-        fltval= ui.GetFloatValue(str);
-        cout << "The Float value is: " << fltval << endl;
-        break;
-      case MenuItem::MENUHEAD:
-        cout << "The Menu Header is: " << "\"" <<
-          ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
-        break;
-      case MenuItem::MENUITEM:
-        cout << "The Menu Item is: " << "\"" <<
-          ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
-        break;
-      case MenuItem::TIME:
-        value = ui.GetValue(str);
-        cout << "The Time is: " << "\"" << value << endl;
-        break;
-      case MenuItem::EOL:
-        value = ui.GetValue(str);
-        cout << "The Time is: " << "\"" << value << endl;
-        break;
-      case MenuItem::CLOCK:
-        value = ui.GetValue(str);
-        cout << "The Clock value is: " << "\"" << value << endl;
-        break;
-      case MenuItem::ENUM:
-        value = ui.GetValue(str);
-        cout << "The Enum value is: " << "\"" << value << endl;
-        break;
-      case MenuItem::DATE:
-        value = ui.GetValue(str);
-        cout << "The Date is: " << "\"" << value << endl;
-        break;
-      default:
-        cout << "The value is: " << value << endl;
-        value = str;
-      };
+        switch (ti.GetType()) {
+          case MenuItem::BOOL:
+              if (ui.GetBoolValue(str) == false)
+                  cout << "The Boolean value is: NO" << endl;
+              else
+                  cout << "The Boolean value is: YES" << endl;
+              break;
+          case MenuItem::INFO:
+              value = ui.GetValue(str);
+              cout << "The value is: " << value << endl;
+              break;
+          case MenuItem::INT:
+              intval = ui.GetIntValue(str);
+              cout << "The Integer value is: " << intval << endl;
+              break;
+          case MenuItem::FLOAT:
+              fltval= ui.GetFloatValue(str);
+              cout << "The Float value is: " << fltval << endl;
+              break;
+          case MenuItem::MENUHEAD:
+              cout << "The Menu Header is: " << "\"" <<
+                  ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
+              break;
+          case MenuItem::MENUITEM:
+              cout << "The Menu Item is: " << "\"" <<
+                  ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
+              break;
+          case MenuItem::TIME:
+              value = ui.GetValue(str);
+              cout << "The Time is: " << "\"" << value << endl;
+              break;
+          case MenuItem::EOL:
+              value = ui.GetValue(str);
+              cout << "The Time is: " << "\"" << value << endl;
+              break;
+          case MenuItem::CLOCK:
+              value = ui.GetValue(str);
+              cout << "The Clock value is: " << "\"" << value << endl;
+              break;
+          case MenuItem::ENUM:
+              value = ui.GetValue(str);
+              cout << "The Enum value is: " << "\"" << value << endl;
+              break;
+          case MenuItem::DATE:
+              value = ui.GetValue(str);
+              cout << "The Date is: " << "\"" << value << endl;
+              break;
+          default:
+              cout << "The value is: " << value << endl;
+              value = str;
+        };
     } // endof getitem
 
     // Monitor an item. This means grabs successive values and
     // display them. This is for selections that constantly update
     // the value.
     if (monitor) {
-      string str = ui.GotoMenuItem(menuhead, menuitem);
-      ti = ui.GetItem(menuhead, menuitem);
+        string str = ui.GotoMenuItem(menuhead, menuitem);
+        ti = ui.GetItem(menuhead, menuitem);
 
-      cout << "The Menu Header is: " << "\"" <<
-        ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
-      
-      do {
-        memset(buffy, 0, 100);        
-        ret = ui.Read((char *)&buffy, 100);
-        str = buffy;
-        if (ret < 0)            // there is no input yet, try again
-          continue;
-
-        // We got something, so extract the type, and process the
-        // value.
-        switch (ti.GetType()) {
-        case MenuItem::BOOL:
-          if (ui.GetBoolValue(str) == false)
-            cout << "\tThe Boolean value is: NO" << endl;
-          else
-            cout << "\tThe Boolean value is: YES" << endl;
-          break;
-        case MenuItem::INFO:
-          value = ui.GetValue(str);
-          cout << "\tThe value is: " << value << endl;
-          break;
-        case MenuItem::INT:
-          intval = ui.GetIntValue(str);
-          cout << "\tThe Integer value is: " << intval << endl;
-          break;
-        case MenuItem::FLOAT:
-          fltval= ui.GetFloatValue(str);
-          cout << "\tThe Float value is: " << fltval << endl;
-          break;
-        case MenuItem::MENUHEAD:
-          cout << "\tThe Menu Header is: " << "\"" <<
-            ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
-          break;
-        case MenuItem::MENUITEM:
-          cout << "\tThe Menu Item is: " << "\"" <<
+        cout << "The Menu Header is: " << "\"" <<
             ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
-          break;
-        default:
-          cout << "\tThe value is: " << value << endl;
-          value = str;
-        };
-      } while (ret); // endof monitor   
+      
+        do {
+            memset(buffy, 0, 100);        
+            ret = ui.Read((char *)&buffy, 100);
+            str = buffy;
+            if (ret < 0)            // there is no input yet, try again
+                continue;
+
+            // We got something, so extract the type, and process the
+            // value.
+            switch (ti.GetType()) {
+              case MenuItem::BOOL:
+                  if (ui.GetBoolValue(str) == false)
+                      cout << "\tThe Boolean value is: NO" << endl;
+                  else
+                      cout << "\tThe Boolean value is: YES" << endl;
+                  break;
+              case MenuItem::INFO:
+                  value = ui.GetValue(str);
+                  cout << "\tThe value is: " << value << endl;
+                  break;
+              case MenuItem::INT:
+                  intval = ui.GetIntValue(str);
+                  cout << "\tThe Integer value is: " << intval << endl;
+                  break;
+              case MenuItem::FLOAT:
+                  fltval= ui.GetFloatValue(str);
+                  cout << "\tThe Float value is: " << fltval << endl;
+                  break;
+              case MenuItem::MENUHEAD:
+                  cout << "\tThe Menu Header is: " << "\"" <<
+                      ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
+                  break;
+              case MenuItem::MENUITEM:
+                  cout << "\tThe Menu Item is: " << "\"" <<
+                      ui.CleanUpData(ti.GetLabel()) << "\"" << endl;
+                  break;
+              default:
+                  cout << "\tThe value is: " << value << endl;
+                  value = str;
+            };
+        } while (ret); // endof monitor   
     }
 }
 #endif
@@ -1535,47 +1536,51 @@ meter_data_t *
 XantrexUI::exportMeterData(meter_data_t *data)
 {
 #if 0
-  // The unit number for the device
-  data->unit = _address;
+    // The unit number for the device
+    data->unit = _address;
   
-  // The type of the device
-  switch (_type) {
-  case OUTBACK_MX:
-    data->type = MX_OUTBACK;
-    break;
-  case OUTBACK_FX:
-    data->type = FX_OUTBACK;
-    break;
-  case SW_XANTREX:
-  default:
-    break;
-  };
+    // The type of the device
+    switch (_type) {
+      case OUTBACK_MX:
+          data->type = MX_OUTBACK;
+          break;
+      case OUTBACK_FX:
+          data->type = FX_OUTBACK;
+          break;
+      case SW_XANTREX:
+      default:
+          break;
+    };
   
-  // The amperage being put into the batteries
-  data->charge_amps = _charge_current;
-  // The load in amps
-  data->ac_load_amps = _inverter_current;
-  // Actual Battery Voltage
-  data->battery_volts = _battery_voltage;
-  // Battery Voltage temperature compensated. This isn't used by
-  // Outback products.
-  data->tempcomp_volts = 0;
-  // The voltage the inverter is producing
-  data->ac_volts_out = _AC_output_voltage;
-  // Grid AC input
-  data->ac1_volts_in = _AC_input_voltage;
-  // The AC current taken from the Grid and used to charge the batteries.
-  data->buy_amps = _buy_current;
-  // The AC current the batteries are putting into the grid.
-  data->sell_amps = _sell_current;
-  // The daily kilowatts put into the batteries from the PV source.
-  data->daily_kwh = _daily_kwh;
-  // The frequency in hertz. This doesn't exist on an Outback, but does on
-  // a Xantrex. It should always be 60 though, so we set it so other
-  // software can handle this  the same way.
-  data->hertz = 60;
+    // The amperage being put into the batteries
+    data->charge_amps = _charge_current;
+    // The load in amps
+    data->ac_load_amps = _inverter_current;
+    // Actual Battery Voltage
+    data->battery_volts = _battery_voltage;
+    // Battery Voltage temperature compensated. This isn't used by
+    // Outback products.
+    data->tempcomp_volts = 0;
+    // The voltage the inverter is producing
+    data->ac_volts_out = _AC_output_voltage;
+    // Grid AC input
+    data->ac1_volts_in = _AC_input_voltage;
+    // The AC current taken from the Grid and used to charge the batteries.
+    data->buy_amps = _buy_current;
+    // The AC current the batteries are putting into the grid.
+    data->sell_amps = _sell_current;
+    // The daily kilowatts put into the batteries from the PV source.
+    data->daily_kwh = _daily_kwh;
+    // The frequency in hertz. This doesn't exist on an Outback, but does on
+    // a Xantrex. It should always be 60 though, so we set it so other
+    // software can handle this  the same way.
+    data->hertz = 60;
 #endif
 
-  return data;
+    return data;
 }
 
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/xantrex-trace.h b/lib/xantrex-trace.h
index c5643e2..6f6975c 100644
--- a/lib/xantrex-trace.h
+++ b/lib/xantrex-trace.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -150,3 +151,8 @@ extern "C" {
 
 // end of __XANTREXUI_H__
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/xml.cc b/lib/xml.cc
index 5de3492..88d486d 100644
--- a/lib/xml.cc
+++ b/lib/xml.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -41,345 +42,345 @@ extern LogFile dbglogfile;
 
 XMLAttr::XMLAttr() : _name(0), _value(0)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 }
 
 const xmlChar *
 XMLAttr::nameGet(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _name;
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _name;
 }
 
 void
 XMLAttr::nameSet(const xmlChar *name)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _name = name;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _name = name;
 }
 
 const xmlChar *
 XMLAttr::valueGet(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _value;
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _value;
 }
 
 void
 XMLAttr::valueSet(const xmlChar *val)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _value = val;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _value = val;
 }
 
 XMLAttr::~XMLAttr()
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 }
 
 // XMLNode methods. An XMLNode holds all the info for an XML node,
 // including it's children and attributes.
 XMLNode::XMLNode() : _name(0), _value(0)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 }
 
 vector<XMLNode *>
 XMLNode::childrenGet(void)
 {
-  return _children;
+    return _children;
 }
 
 vector<XMLAttr *>
 XMLNode::attributesGet(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _attributes;
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _attributes;
 }
 
 XMLNode *
 XMLNode::childGet(int x)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _children[x];
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _children[x];
 }
 
 void
 XMLNode::childAdd(XMLNode *node)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _children.push_back(node);
+    // DEBUGLOG_REPORT_FUNCTION;
+    _children.push_back(node);
 }
 
 XMLAttr *
 XMLNode::attribGet(int x)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _attributes[x];
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _attributes[x];
 }
 
 void
 XMLNode::attribAdd(XMLAttr *attr)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _attributes.push_back(attr);
+    // DEBUGLOG_REPORT_FUNCTION;
+    _attributes.push_back(attr);
 }
 
 XMLNode *
 XMLNode::operator [] (int x)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _children[x];
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _children[x];
 }
 
 XMLNode *
 XMLNode::operator = (XMLNode &node)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _name = node._name;
-  _value = node._value;
-  _children = node._children;
-  _attributes = node._attributes;
-  return this;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _name = node._name;
+    _value = node._value;
+    _children = node._children;
+    _attributes = node._attributes;
+    return this;
 }
 
 XMLNode *
 XMLNode::operator = (XMLNode *node)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _name = node->_name;
-  _value = node->_value;
-  _children = node->_children;
-  _attributes = node->_attributes;
-  return this;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _name = node->_name;
+    _value = node->_value;
+    _children = node->_children;
+    _attributes = node->_attributes;
+    return this;
 }
 
 const xmlChar *
 XMLNode::nameGet(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _name;
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _name;
 }
 
 void
 XMLNode::nameSet(const xmlChar *name)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _name = name;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _name = name;
 }
 
 const xmlChar *
 XMLNode::valueGet(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _value;
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _value;
 }
 
 void
 XMLNode::valueSet(const xmlChar *val)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  _value = val;
+    // DEBUGLOG_REPORT_FUNCTION;
+    _value = val;
 }
 
 
 XMLNode::~XMLNode()
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  unsigned int i;
+    // DEBUGLOG_REPORT_FUNCTION;
+    unsigned int i;
   
-  for (i=0; i<_children.size(); i++) {
+    for (i=0; i<_children.size(); i++) {
 //     if (_children[i]->_name) {
 //       delete _children[i]->_name;
 //     }
 //     if (_children[i]->_value) {
 //       delete _children[i]->_value;
 //     }
-    delete _children[i];
-  }
+        delete _children[i];
+    }
 
-  for (i=0; i<_attributes.size(); i++) {
-    //     if (_attributes[i]->_name) {
+    for (i=0; i<_attributes.size(); i++) {
+        //     if (_attributes[i]->_name) {
 //       delete _attributes[i]->_name;
 //     }
 //     if (_attributes[i]->_value) {
 //       delete _attributes[i]->_value;
 //     }
-    delete _attributes[i];
-  }
+        delete _attributes[i];
+    }
 
-  _children.clear();
-  _attributes.clear();
+    _children.clear();
+    _attributes.clear();
 }
 
 int
 XMLNode::childrenSize(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _children.size();  
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _children.size();  
 }
 
 bool
 XMLNode::hasContent(void)
 {
-  return (_value > 0) ? true : false;
+    return (_value > 0) ? true : false;
 }
 
 bool
 XMLNode::hasChildren(void)
 {
-  return (_children.size() > 0) ? true : false;
+    return (_children.size() > 0) ? true : false;
 }
 
 bool
 XMLNode::hasAttributes(void)
 {
-  return (_attributes.size() > 0) ? true : false;
+    return (_attributes.size() > 0) ? true : false;
 }
 
 int
 XMLNode::attributesSize(void)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _attributes.size();
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _attributes.size();
 }
 
 // XML Constructor
 XML::XML()
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 }
 
 // Parse the ASCII XML string into memory
 XML::XML(string xml_in)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  parseXML(xml_in);
+    // DEBUGLOG_REPORT_FUNCTION;
+    parseXML(xml_in);
 }
 
 XML::XML(struct node *childNode)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 }
 
 XML::~XML()
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 }
 
 XMLNode*
 XML::extractNode(xmlNodePtr node, bool mem)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  xmlAttrPtr attr;
-  xmlNodePtr childnode;
-  xmlChar *ptr = NULL;
-  XMLNode *element, *child;
-  int len;
+    // DEBUGLOG_REPORT_FUNCTION;
+    xmlAttrPtr attr;
+    xmlNodePtr childnode;
+    xmlChar *ptr = NULL;
+    XMLNode *element, *child;
+    int len;
 
-  element = new XMLNode;
-  memset(element, 0, sizeof (XMLNode));
+    element = new XMLNode;
+    memset(element, 0, sizeof (XMLNode));
             
-  //  dbglogfile << "\rCreated new element for " << (const char *)node->name 
<< " at " << element << endl;
+    //  dbglogfile << "\rCreated new element for " << (const char *)node->name 
<< " at " << element << endl;
 
-  dbglogfile << "extracting node " << (const char *)node->name << endl;
+    dbglogfile << "extracting node " << (const char *)node->name << endl;
 
-  // See if we have any Attributes (properties)
-  attr = node->properties;
-  while (attr != NULL) {
+    // See if we have any Attributes (properties)
+    attr = node->properties;
+    while (attr != NULL) {
 #if 0
-    dbglogfile << " extractNode " << (const char *)node->name
-               << " has property "
-               << (const char *)attr->name << " value is "
-               << (const char *)attr->children->content << endl;
+        dbglogfile << " extractNode " << (const char *)node->name
+                   << " has property "
+                   << (const char *)attr->name << " value is "
+                   << (const char *)attr->children->content << endl;
 #endif
-    XMLAttr *attrib = new XMLAttr;
-    memset(attrib, 0, sizeof (XMLAttr));
-    attrib->nameSet(xmlStrdup(attr->name));
-    attrib->valueSet(xmlStrdup(attr->children->content));
+        XMLAttr *attrib = new XMLAttr;
+        memset(attrib, 0, sizeof (XMLAttr));
+        attrib->nameSet(xmlStrdup(attr->name));
+        attrib->valueSet(xmlStrdup(attr->children->content));
 #if 0
-    dbglogfile << "\tPushing attribute " << (const char *)attr->name
-               << " for element "
-               << (const char *)node->name << " has value "
-               << (const char *)attr->children->content << endl;
+        dbglogfile << "\tPushing attribute " << (const char *)attr->name
+                   << " for element "
+                   << (const char *)node->name << " has value "
+                   << (const char *)attr->children->content << endl;
 #endif
-    element->attribAdd(attrib);
-    attr = attr->next;
-  }
-
-  element->nameSet(xmlStrdup(node->name));
-  if (node->children) {
-    //ptr = node->children->content;
-    ptr = xmlNodeGetContent(node->children);
-    if (ptr != NULL) {
-      if ((strchr((const char *)ptr, '\n') == 0) && (ptr[0] != 0))
-      {
-        if (node->children->content == NULL) {
-          //dbglogfile << "Node " << (const char *)node->name << " has no 
contents" << endl;
-        } else {
+        element->attribAdd(attrib);
+        attr = attr->next;
+    }
+
+    element->nameSet(xmlStrdup(node->name));
+    if (node->children) {
+        //ptr = node->children->content;
+        ptr = xmlNodeGetContent(node->children);
+        if (ptr != NULL) {
+            if ((strchr((const char *)ptr, '\n') == 0) && (ptr[0] != 0))
+                {
+                    if (node->children->content == NULL) {
+                        //dbglogfile << "Node " << (const char *)node->name << 
" has no contents" << endl;
+                    } else {
 #if 0
-          dbglogfile << "extractChildNode from text for " << (const char 
*)node->name
-                     << " has contents " << (const char *)ptr << endl;
+                        dbglogfile << "extractChildNode from text for " << 
(const char *)node->name
+                                   << " has contents " << (const char *)ptr << 
endl;
 #endif
-          element->valueSet(xmlStrdup(ptr));
+                        element->valueSet(xmlStrdup(ptr));
+                    }
+                }
+            xmlFree(ptr);
         }
-      }
-      xmlFree(ptr);
     }
-  }
 
-  // See if we have any data (content)
-  childnode = node->children;
+    // See if we have any data (content)
+    childnode = node->children;
 
-  while (childnode != NULL) {
-    if (childnode->type == XML_ELEMENT_NODE) {
-      //dbglogfile << "\t\t extracting node " << (const char *)childnode->name 
<< endl;
-      child = extractNode(childnode, mem);
-      //if (child->_value.get_type() != as_value::UNDEFINED) {
+    while (childnode != NULL) {
+        if (childnode->type == XML_ELEMENT_NODE) {
+            //dbglogfile << "\t\t extracting node " << (const char 
*)childnode->name << endl;
+            child = extractNode(childnode, mem);
+            //if (child->_value.get_type() != as_value::UNDEFINED) {
 #if 0
-      if (child->valueGet() != "") {
-        dbglogfile << "\tPushing childNode " << child->nameGet()
-                   << " value " << child->valueGet()
-                   <<  " on element "
-                   <<  element << endl;
-      } else {
-        dbglogfile << "\tPushing childNode " << child->nameGet().c_str()
-                    << endl;
-      }
+            if (child->valueGet() != "") {
+                dbglogfile << "\tPushing childNode " << child->nameGet()
+                           << " value " << child->valueGet()
+                           <<  " on element "
+                           <<  element << endl;
+            } else {
+                dbglogfile << "\tPushing childNode " << 
child->nameGet().c_str()
+                           << endl;
+            }
 #endif
-      element->childAdd(child);
+            element->childAdd(child);
+        }
+        childnode = childnode->next;
     }
-    childnode = childnode->next;
-  }
 
-  return element;
+    return element;
 }
 
 // Read in an XML document from the specified source
 bool
 XML::parseDoc(xmlDocPtr document, bool mem)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  XMLNode *top;
-  xmlNodePtr cur;
-  Msgs msg;
+    // DEBUGLOG_REPORT_FUNCTION;
+    XMLNode *top;
+    xmlNodePtr cur;
+    Msgs msg;
   
-  if (document == 0) {
-    dbglogfile << "ERROR: Can't load XML file!";
-    return false;
-  }
+    if (document == 0) {
+        dbglogfile << "ERROR: Can't load XML file!";
+        return false;
+    }
 
-  cur = xmlDocGetRootElement(document);
+    cur = xmlDocGetRootElement(document);
   
-  if (cur != NULL) {
-    top = extractNode(cur, mem);
-    //    msg.dump(top);
-    msg.process(top);
-    _nodes = top;
-    cur = cur->next;
-  }  
+    if (cur != NULL) {
+        top = extractNode(cur, mem);
+        //    msg.dump(top);
+        msg.process(top);
+        _nodes = top;
+        cur = cur->next;
+    }  
 
-  return true;
+    return true;
 }
 
 // This reads in an XML file from disk and parses into into a memory resident
@@ -387,61 +388,61 @@ XML::parseDoc(xmlDocPtr document, bool mem)
 bool
 XML::parseXML(string xml_in)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  bool          ret = true;
+    // DEBUGLOG_REPORT_FUNCTION;
+    bool          ret = true;
 
-  dbglogfile << "Parse XML from memory: " << xml_in.c_str() << endl;
+    dbglogfile << "Parse XML from memory: " << xml_in.c_str() << endl;
 
-  if (xml_in.size() == 0) {
-    dbglogfile << "ERROR: XML data is empty!" << endl;
-    return false;
-  }
+    if (xml_in.size() == 0) {
+        dbglogfile << "ERROR: XML data is empty!" << endl;
+        return false;
+    }
 
 #ifndef USE_DMALLOC
-  //dump_memory_stats(__FUNCTION__, __LINE__, "before xmlParseMemory");
+    //dump_memory_stats(__FUNCTION__, __LINE__, "before xmlParseMemory");
 #endif
 
 #ifdef USE_XMLREADER
-  XMLNode *node = 0;
-  xmlTextReaderPtr reader;
-
-  reader = xmlReaderForMemory(xml_in.c_str(), xml_in.size(), NULL, NULL, 0);
-  if (reader != NULL) {
-    ret = true;
-    while (ret) {
-      ret = xmlTextReaderRead(reader);
-      node = processNode(reader, node);
-    }
-    xmlFreeTextReader(reader);
-    if (ret != false) {
-      dbglogfile << "couldn't parse" << xml_in << endl;
-      return false;
+    XMLNode *node = 0;
+    xmlTextReaderPtr reader;
+
+    reader = xmlReaderForMemory(xml_in.c_str(), xml_in.size(), NULL, NULL, 0);
+    if (reader != NULL) {
+        ret = true;
+        while (ret) {
+            ret = xmlTextReaderRead(reader);
+            node = processNode(reader, node);
+        }
+        xmlFreeTextReader(reader);
+        if (ret != false) {
+            dbglogfile << "couldn't parse" << xml_in << endl;
+            return false;
+        }
+    } else {
+        dbglogfile << "Unable to open " << xml_in << endl;
+        return false;
     }
-  } else {
-    dbglogfile << "Unable to open " << xml_in << endl;
-    return false;
-  }
-  xmlCleanupParser();
-  return true;
+    xmlCleanupParser();
+    return true;
 #else
 #ifdef USE_DOM
-  xmlInitParser();
+    xmlInitParser();
   
-  _doc = xmlParseMemory(xml_in.c_str(), xml_in.size());
-  if (_doc == 0) {
-    dbglogfile << "ERROR: Can't parse XML data!" << endl;
-    return false;
-  }
-  ret = parseDoc(_doc, true);
-  xmlCleanupParser();
-  xmlFreeDoc(_doc);
-  xmlMemoryDump();
+    _doc = xmlParseMemory(xml_in.c_str(), xml_in.size());
+    if (_doc == 0) {
+        dbglogfile << "ERROR: Can't parse XML data!" << endl;
+        return false;
+    }
+    ret = parseDoc(_doc, true);
+    xmlCleanupParser();
+    xmlFreeDoc(_doc);
+    xmlMemoryDump();
 #endif
 #ifndef USE_DMALLOC
-  //dump_memory_stats(__FUNCTION__, __LINE__, "after xmlParseMemory");
+    //dump_memory_stats(__FUNCTION__, __LINE__, "after xmlParseMemory");
 #endif
 
-  return ret;
+    return ret;
 #endif
   
 }
@@ -463,12 +464,12 @@ XML::parseXML(string xml_in)
 // processNode:
 // 2 14 #text 0
 const char *tabs[] = {
-  "",
-  "\t",
-  "\t\t",
-  "\t\t\t",
-  "\t\t\t",
-  "\t\t\t\t",
+    "",
+    "\t",
+    "\t\t",
+    "\t\t\t",
+    "\t\t\t",
+    "\t\t\t\t",
 };
 
 #ifdef USE_XMLREADER
@@ -477,106 +478,106 @@ const char *tabs[] = {
 XMLNode*
 XML::processNode(xmlTextReaderPtr reader, XMLNode *node)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  // dbglogfile << " node is " << node << endl;
-  static XMLNode *parent[10];
-  xmlChar *name, *value;
-  int   depth;
-  XMLNode *element;
-  xmlReaderTypes type;
-
-  if (node == 0) {
-    memset(parent, 0, sizeof(XMLNode *));
-  }
-  type = (xmlReaderTypes)xmlTextReaderNodeType(reader);
-  depth = xmlTextReaderDepth(reader);
-  value = xmlTextReaderValue(reader);
-  name = xmlTextReaderName(reader);
+    // DEBUGLOG_REPORT_FUNCTION;
+    // dbglogfile << " node is " << node << endl;
+    static XMLNode *parent[10];
+    xmlChar *name, *value;
+    int   depth;
+    XMLNode *element;
+    xmlReaderTypes type;
+
+    if (node == 0) {
+        memset(parent, 0, sizeof(XMLNode *));
+    }
+    type = (xmlReaderTypes)xmlTextReaderNodeType(reader);
+    depth = xmlTextReaderDepth(reader);
+    value = xmlTextReaderValue(reader);
+    name = xmlTextReaderName(reader);
   
-  if (name == NULL)
-    name = xmlStrdup(BAD_CAST "--");
+    if (name == NULL)
+        name = xmlStrdup(BAD_CAST "--");
 
 #if 0
-  printf("%d %d %s %d\n",
-         depth,
-         (int)type,
-         name,
-         xmlTextReaderIsEmptyElement(reader));  
+    printf("%d %d %s %d\n",
+           depth,
+           (int)type,
+           name,
+           xmlTextReaderIsEmptyElement(reader));  
 #endif
 
   
-  //child = node->_children[0];
-  switch(xmlTextReaderNodeType(reader)) {
-  case XML_READER_TYPE_NONE:
-    break;
-  case XML_READER_TYPE_SIGNIFICANT_WHITESPACE: // This is an empty text node
-    //dbglogfile << "Whitespace at depth " << depth << endl;
-    break;
-  case XML_READER_TYPE_END_ELEMENT:
-     if (depth == 0) {          // This is the last node in the file
-       element = node;
-       break;
-     }
-     parent[depth]->_children.push_back(element);
-     //      dbglogfile << "Pushing element XXX on node "
-     //                 << node->_name << parent[depth]->_name << endl;
-     //       dbglogfile << "End element at depth %d is %s for parent %s 
%p\n", depth, name,
+    //child = node->_children[0];
+    switch(xmlTextReaderNodeType(reader)) {
+      case XML_READER_TYPE_NONE:
+          break;
+      case XML_READER_TYPE_SIGNIFICANT_WHITESPACE: // This is an empty text 
node
+          //dbglogfile << "Whitespace at depth " << depth << endl;
+          break;
+      case XML_READER_TYPE_END_ELEMENT:
+          if (depth == 0) {          // This is the last node in the file
+              element = node;
+              break;
+          }
+          parent[depth]->_children.push_back(element);
+          //      dbglogfile << "Pushing element XXX on node "
+          //                 << node->_name << parent[depth]->_name << endl;
+          //       dbglogfile << "End element at depth %d is %s for parent %s 
%p\n", depth, name,
 //               parent[depth]->_name, parent[depth]);
-     element = parent[depth];
-    break;
-  case XML_READER_TYPE_ELEMENT:
-    element = new XMLNode;
+          element = parent[depth];
+          break;
+      case XML_READER_TYPE_ELEMENT:
+          element = new XMLNode;
 //      dbglogfile << %sElement at depth %d is %s for node at %p\n", 
tabs[depth], depth, name, element);
-    element->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
-    memset(element->_name, 0, strlen(reinterpret_cast<const char *>(name))+1);
-    strcpy(element->_name, reinterpret_cast<const char *>(name));
-    if (node == 0) {
-      _nodes = element;
-      parent[0] = element;
-    } else {
-      parent[depth] = node;
-      parent[depth+1] = node;
-    }
-    //  xmlTextReaderAttributeCount(reader);
-    if (xmlTextReaderHasAttributes(reader)) {
-      // dbglogfile << Has Attributes!\n");
-      xmlTextReaderMoveToFirstAttribute(reader);
-      processNode(reader, element);
-      while(xmlTextReaderMoveToNextAttribute(reader)) {
-        processNode(reader, element);
-      }
-    }
-    break;
-  case XML_READER_TYPE_TEXT:
-    element = node;
+          element->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
+          memset(element->_name, 0, strlen(reinterpret_cast<const char 
*>(name))+1);
+          strcpy(element->_name, reinterpret_cast<const char *>(name));
+          if (node == 0) {
+              _nodes = element;
+              parent[0] = element;
+          } else {
+              parent[depth] = node;
+              parent[depth+1] = node;
+          }
+          //  xmlTextReaderAttributeCount(reader);
+          if (xmlTextReaderHasAttributes(reader)) {
+              // dbglogfile << Has Attributes!\n");
+              xmlTextReaderMoveToFirstAttribute(reader);
+              processNode(reader, element);
+              while(xmlTextReaderMoveToNextAttribute(reader)) {
+                  processNode(reader, element);
+              }
+          }
+          break;
+      case XML_READER_TYPE_TEXT:
+          element = node;
 //      dbglogfile << %sValue at depth %d is \"%s\" for node at %p\n", 
tabs[depth], depth, value, element);
-    element->_value = (char *)new char[strlen(reinterpret_cast<const char 
*>(value))+1];
-    memset(element->_value, 0, strlen(reinterpret_cast<const char 
*>(value))+1);
-    strcpy(element->_value, reinterpret_cast<const char *>(value));
-    break;
-  case XML_READER_TYPE_ATTRIBUTE:
-    element = node;
-    XMLAttr *attrib = new XMLAttr;
-    attrib->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
-    memset(attrib->_name, 0, strlen(reinterpret_cast<const char *>(name))+1);
-    strcpy(attrib->_name, reinterpret_cast<const char *>(name));
-    attrib->_value = (char *)new char[strlen(reinterpret_cast<const char 
*>(value))+1];
-    memset(attrib->_value, 0, strlen(reinterpret_cast<const char *>(value))+1);
-    strcpy(attrib->_value, reinterpret_cast<const char *>(value));
+          element->_value = (char *)new char[strlen(reinterpret_cast<const 
char *>(value))+1];
+          memset(element->_value, 0, strlen(reinterpret_cast<const char 
*>(value))+1);
+          strcpy(element->_value, reinterpret_cast<const char *>(value));
+          break;
+      case XML_READER_TYPE_ATTRIBUTE:
+          element = node;
+          XMLAttr *attrib = new XMLAttr;
+          attrib->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
+          memset(attrib->_name, 0, strlen(reinterpret_cast<const char 
*>(name))+1);
+          strcpy(attrib->_name, reinterpret_cast<const char *>(name));
+          attrib->_value = (char *)new char[strlen(reinterpret_cast<const char 
*>(value))+1];
+          memset(attrib->_value, 0, strlen(reinterpret_cast<const char 
*>(value))+1);
+          strcpy(attrib->_value, reinterpret_cast<const char *>(value));
 //     dbglogfile << %sPushing attribute %s, value \"%s\" for node %s\n", 
tabs[depth], name, value, element->_name);
-    element->_attributes.push_back(attrib);
-    break;
-  default:   // FIXME: why does this break GCC 3.3.3 but not 3.4.3 ?
-    log_error("Unsupported XML type %d\n!", type);
-    break;
-  };
-
-  xmlFree(name);
-  if (value != NULL) {
-    xmlFree(value);
-  }
-  //previous_depth = depth;
-  return element;
+          element->_attributes.push_back(attrib);
+          break;
+      default:   // FIXME: why does this break GCC 3.3.3 but not 3.4.3 ?
+          log_error("Unsupported XML type %d\n!", type);
+          break;
+    };
+
+    xmlFree(name);
+    if (value != NULL) {
+        xmlFree(value);
+    }
+    //previous_depth = depth;
+    return element;
 }
 #endif
 
@@ -585,47 +586,47 @@ XML::processNode(xmlTextReaderPtr reader, XMLNode *node)
 bool
 XML::load(const char *filespec)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  bool ret = true;
-  dbglogfile << "Load disk XML file: " << filespec << endl;
+    // DEBUGLOG_REPORT_FUNCTION;
+    bool ret = true;
+    dbglogfile << "Load disk XML file: " << filespec << endl;
   
-  //dbglogfile << %s: mem is %d\n", __FUNCTION__, mem);
+    //dbglogfile << %s: mem is %d\n", __FUNCTION__, mem);
 
 #ifdef USE_XMLREADER
-  XMLNode *node = 0;
-  xmlTextReaderPtr reader;  
+    XMLNode *node = 0;
+    xmlTextReaderPtr reader;  
   
-  reader = xmlNewTextReaderFilename(filespec);
-  if (reader != NULL) {
-    ret = true;
-    while (ret) {
-      ret = xmlTextReaderRead(reader);
-      node = processNode(reader, node);
-    }
-    xmlFreeTextReader(reader);
-    if (ret != false) {
-      dbglogfile << "couldn't parse" << filespec << endl;
-      return false;
+    reader = xmlNewTextReaderFilename(filespec);
+    if (reader != NULL) {
+        ret = true;
+        while (ret) {
+            ret = xmlTextReaderRead(reader);
+            node = processNode(reader, node);
+        }
+        xmlFreeTextReader(reader);
+        if (ret != false) {
+            dbglogfile << "couldn't parse" << filespec << endl;
+            return false;
+        }
+    } else {
+        dbglogfile << "ERROR: Unable to open %s\n" << filespec << endl;
+        return false;
     }
-  } else {
-    dbglogfile << "ERROR: Unable to open %s\n" << filespec << endl;
-      return false;
-  }
-  xmlCleanupParser();
-  return true;
+    xmlCleanupParser();
+    return true;
 #else
 #ifdef USE_DOM
-  xmlInitParser();
-  _doc = xmlParseFile(filespec);
-  if (_doc == 0) {
-    dbglogfile << "ERROR: Can't load XML file: " << filespec << endl;
-    return false;
-  }
-  ret = parseDoc(_doc, false);
-  xmlCleanupParser();
-  xmlFreeDoc(_doc);
-  xmlMemoryDump();
-  return true;
+    xmlInitParser();
+    _doc = xmlParseFile(filespec);
+    if (_doc == 0) {
+        dbglogfile << "ERROR: Can't load XML file: " << filespec << endl;
+        return false;
+    }
+    ret = parseDoc(_doc, false);
+    xmlCleanupParser();
+    xmlFreeDoc(_doc);
+    xmlMemoryDump();
+    return true;
 #else
 #error "You have to enable either a DOM or an xmlReader XML parser"
 #endif
@@ -634,38 +635,43 @@ XML::load(const char *filespec)
 
 XMLNode *
 XML::operator [] (int x) {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return _nodes.childGet(x);
+    // DEBUGLOG_REPORT_FUNCTION;
+    return _nodes.childGet(x);
 }
 
 bool
 XML::hasChildren(void)
 {
-  return (_nodes.childrenSize() > 0)? true : false;
+    return (_nodes.childrenSize() > 0)? true : false;
 }
 
 const xmlChar *
 XML::nodeNameGet(void)
 {
-  return _nodes.nameGet();
+    return _nodes.nameGet();
 }
 
 int
 XML::size(void)
 {
-  return _nodes.size();
+    return _nodes.size();
 }
 
 XML *
 XML::operator = (XMLNode *node)
 {
-  _nodes = node;    
-  return this;
+    _nodes = node;    
+    return this;
 }
 
 int
 memadjust(int x)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
-  return (x + (4 - x % 4));
+    // DEBUGLOG_REPORT_FUNCTION;
+    return (x + (4 - x % 4));
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/lib/xml.h b/lib/xml.h
index c9dc10a..af81fb8 100644
--- a/lib/xml.h
+++ b/lib/xml.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -110,3 +111,8 @@ private:
 int memadjust(int x);
 
 #endif // __XML_H__
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/sim/Makefile.am b/sim/Makefile.am
index 6b82510..9c18fc7 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -1,5 +1,6 @@
 # 
-# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010 Free Software 
Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 2008,        2009, 2010, 2011
+#      Free Software Foundation, Inc.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/sim/fakeuart.cc b/sim/fakeuart.cc
index c8f7d99..ad9ab75 100644
--- a/sim/fakeuart.cc
+++ b/sim/fakeuart.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//       Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -57,119 +58,119 @@ retcode_t
 //FakeUart::Open(string &filespec, ErrCond &Err)
 FakeUart::Open(ErrCond *Err)
 {
-  DEBUGLOG_REPORT_FUNCTION;
-
-  string filespec;
-  int i,j, flag;
-  int master = -1;
-  struct termios newtty, oldtty;
-  char *letterpart = "pqrstuvwxyzPQRST";
-  char *numberpart = "0123456789abcdef";
-
-  filespec = "/dev/ptmx";
-  dbglogfile << "Opening " << filespec << endl;
-  if (filespec.size() > 0) {
-    if ((master = open(filespec.c_str(), O_RDWR | O_NONBLOCK)) < 0) {
-      if (errno == ENOENT) {
-       cerr << "ERROR: no more pty's available";
-       return ERROR;
-      }
+    DEBUGLOG_REPORT_FUNCTION;
+
+    string filespec;
+    int i,j, flag;
+    int master = -1;
+    struct termios newtty, oldtty;
+    char *letterpart = "pqrstuvwxyzPQRST";
+    char *numberpart = "0123456789abcdef";
+
+    filespec = "/dev/ptmx";
+    dbglogfile << "Opening " << filespec << endl;
+    if (filespec.size() > 0) {
+        if ((master = open(filespec.c_str(), O_RDWR | O_NONBLOCK)) < 0) {
+            if (errno == ENOENT) {
+                cerr << "ERROR: no more pty's available";
+                return ERROR;
+            }
+        }
     }
-  }
 
-  // filespec = "/dev/pty??";
-  filespec = "/dev/ptmx";
+    // filespec = "/dev/pty??";
+    filespec = "/dev/ptmx";
   
-  // Search for a free pty
-  for(i=0; i<16 && master <= 0; i++) {
-    for(j=0; j<16 && master <= 0; j++) {
-      filespec[8] = letterpart[i];
-      filespec[9] = numberpart[j];
-      if ((master = open(filespec.c_str(), O_RDWR | O_NONBLOCK)) < 0) {
-       if (errno == ENOENT) {
-         cerr << "ERROR: no more pty's available";
-         return ERROR;
-       }
-      }
-    } // for j loop
-  } // for i loop
-
-  if ((master < 0) && (i == 16) && (j == 16)) {
-    // failed to found an available pty
-    cerr << "ERROR: couldn't open a pty";
-    return(ERROR);
-  }
+    // Search for a free pty
+    for(i=0; i<16 && master <= 0; i++) {
+        for(j=0; j<16 && master <= 0; j++) {
+            filespec[8] = letterpart[i];
+            filespec[9] = numberpart[j];
+            if ((master = open(filespec.c_str(), O_RDWR | O_NONBLOCK)) < 0) {
+                if (errno == ENOENT) {
+                    cerr << "ERROR: no more pty's available";
+                    return ERROR;
+                }
+            }
+        } // for j loop
+    } // for i loop
+
+    if ((master < 0) && (i == 16) && (j == 16)) {
+        // failed to found an available pty
+        cerr << "ERROR: couldn't open a pty";
+        return(ERROR);
+    }
 
-  state = OPEN;
+    state = OPEN;
   
-  // create the name of the slave pty
-  //filespec[5] = 't';
-  filespec = ptsname(master);
+    // create the name of the slave pty
+    //filespec[5] = 't';
+    filespec = ptsname(master);
 
-  dbglogfile << "Opened " << ptsname(master) << " with file descriptor " << 
master << endl;
+    dbglogfile << "Opened " << ptsname(master) << " with file descriptor " << 
master << endl;
 
-  grantpt(master);
-  unlockpt(master);
+    grantpt(master);
+    unlockpt(master);
 
-  uartfd = master;
-  uartStream = fdopen(uartfd, "w+");
+    uartfd = master;
+    uartStream = fdopen(uartfd, "w+");
 
-  tcgetattr(master, &oldtty);
-  newtty = oldtty;
-  newtty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
-  newtty.c_oflag &= ~OPOST;
-  newtty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
-  newtty.c_cflag &= ~(CSIZE|PARENB);
-  newtty.c_cflag |= CS8;
-  newtty.c_cc[VMIN] = 1;
-  newtty.c_cc[VTIME] = 1;
+    tcgetattr(master, &oldtty);
+    newtty = oldtty;
+    newtty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    newtty.c_oflag &= ~OPOST;
+    newtty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+    newtty.c_cflag &= ~(CSIZE|PARENB);
+    newtty.c_cflag |= CS8;
+    newtty.c_cc[VMIN] = 1;
+    newtty.c_cc[VTIME] = 1;
 
-  tcsetattr(master, TCSANOW, &newtty);
+    tcsetattr(master, TCSANOW, &newtty);
 
-  //  fcntl(master, F_SETFL, flag | O_NDELAY);
+    //  fcntl(master, F_SETFL, flag | O_NDELAY);
 
-  // return(master);
-  return SUCCESS;
+    // return(master);
+    return SUCCESS;
 }
 
 retcode_t
 FakeUart::Close(string &filespec, ErrCond &Err)
 {
-  DEBUGLOG_REPORT_FUNCTION;
+    DEBUGLOG_REPORT_FUNCTION;
 
-  if (state == OPEN)
-    close(uartfd);
+    if (state == OPEN)
+        close(uartfd);
   
-  uartfd = 0;
-  state = CLOSED;
-  return SUCCESS;
+    uartfd = 0;
+    state = CLOSED;
+    return SUCCESS;
 }
 
 int
 FakeUart::Read(unsigned char *buf, int nbytes, ErrCond &Err)
 {
-  // DEBUGLOG_REPORT_FUNCTION;
+    // DEBUGLOG_REPORT_FUNCTION;
 
-  return read (uartfd, buf, nbytes);
+    return read (uartfd, buf, nbytes);
 }
 
 int
 FakeUart::Write(unsigned char *buf, int nbytes, ErrCond &Err)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
-  write (uartfd, buf, nbytes);
+    write (uartfd, buf, nbytes);
 }
 
 #if 0
 int
 FakeUart::GetChar(char *buf, ErrCond &Err)
 {
-  //  DEBUGLOG_REPORT_FUNCTION;
+    //  DEBUGLOG_REPORT_FUNCTION;
 
-  read (uartfd, buf, 1);
+    read (uartfd, buf, 1);
   
-  return (int)*buf;
+    return (int)*buf;
 }
 
 ostream &operator<<(ostream &os, FakeUart &l) {
@@ -179,27 +180,27 @@ ostream &operator<<(ostream &os, FakeUart &l) {
 FakeUart&
 FakeUart::operator << (int x) {
 
-  dbglogfile << x;
+    dbglogfile << x;
 
-  if (state == OPEN)
-    write (uartfd, (char *)&x, sizeof(int)); 
+    if (state == OPEN)
+        write (uartfd, (char *)&x, sizeof(int)); 
 }
 
 FakeUart& 
 FakeUart::operator << (string &s) {
-  dbglogfile << s;
+    dbglogfile << s;
   
-  if (state == OPEN)
-    *this << s.c_str();
+    if (state == OPEN)
+        *this << s.c_str();
 }
 
 FakeUart& 
 FakeUart::operator << (const char *c) {
-  dbglogfile << c;
+    dbglogfile << c;
   
-  if (state == OPEN) {
-    write (uartfd, c, strlen(c));
-  }
+    if (state == OPEN) {
+        write (uartfd, c, strlen(c));
+    }
 }
 #endif
 
@@ -207,24 +208,29 @@ FakeUart::operator << (const char *c) {
 inline void
 FakeUart::SetName (string &newname)
 {
-  name = newname;
+    name = newname;
 }
 
 void 
 FakeUart::SetState (state_e s)
 {
-  state = s;
+    state = s;
 }
 
 FakeUart::state_e
 FakeUart::GetState (void)
 {
-  return state;
+    return state;
 }
 
 void 
 FakeUart::SendEOL (void)
 {
-  Putc('\r');
-  Putc('\n');  
+    Putc('\r');
+    Putc('\n');  
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/sim/osim.cc b/sim/osim.cc
index c5d9e1a..11d52ec 100644
--- a/sim/osim.cc
+++ b/sim/osim.cc
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -54,14 +55,15 @@ extern LogFile dbglogfile;
 retcode_t sim_mx(const char *filespec);
 retcode_t sim_fx(const char *filespec);
   
-main(int argc, char *argv[]) {
+main(int argc, char *argv[])
+{
     int c, i, ch, ret;
     char *filespec = 0;
     ErrCond Err;
     outback_type_t otype;
-
+    
     if (argc == 1) {
-      //usage(argv[0]);
+        //usage(argv[0]);
     }
 
     // Load the database config variable so they can be overridden by
@@ -123,69 +125,73 @@ main(int argc, char *argv[]) {
 
 }
 
-
 static void
 usage (const char *prog)
 {
-  cerr <<"This program implements a command line interface" << endl; 
-  cerr << "for an Outback Power Systems Device" << endl;
-  cerr << "Usage: " << prog << " [hvd]" << endl;
-  cerr << "\t-h\t\t\t\tHelp (this display)" << endl;
-  cerr << "\t-v\t\t\t\tVerbose mode" << endl;
-  cerr << "\t-d [filespec]\t\t\tSpecify Serial Port (default=/dev/ttyS0)" << 
endl;
-  cerr << "\t-t [t]\t\t\t\tSpecify Device Type (default=mx)" << endl;
-
-  exit (-1);
+    cerr <<"This program implements a command line interface" << endl; 
+    cerr << "for an Outback Power Systems Device" << endl;
+    cerr << "Usage: " << prog << " [hvd]" << endl;
+    cerr << "\t-h\t\t\t\tHelp (this display)" << endl;
+    cerr << "\t-v\t\t\t\tVerbose mode" << endl;
+    cerr << "\t-d [filespec]\t\t\tSpecify Serial Port (default=/dev/ttyS0)" << 
endl;
+    cerr << "\t-t [t]\t\t\t\tSpecify Device Type (default=mx)" << endl;
+    
+    exit (-1);
 }
 
 retcode_t
 sim_mx(const char *filespec)
 {
-  struct stat stats;
-  char *home;
-  string loadfile;
-  ErrCond Err;
-  string line, newline;
-  ifstream in;
-  FakeUart fu;
-  if (filespec == 0) {
-    return ERROR;
-  }
-
-  fu.Open(&Err);
-  
-  // Check the users home directory
-  home = getenv("HOME");
-  if (home) {
-    loadfile = home;
-    loadfile += "/.powerguru/mx60.data";
-  }
-
-  // See if it exists in the right place
-  dbglogfile << "Seeing if " << loadfile.c_str() << " exists." << endl;
-  if (stat(loadfile.c_str(), &stats) == 0) {
-    in.open(loadfile.c_str());
-    
-    if (!in) {
-      dbglogfile << "ERROR: Couldn't open file: " << filespec << endl;
-      return ERROR;
+    struct stat stats;
+    char *home;
+    string loadfile;
+    ErrCond Err;
+    string line, newline;
+    ifstream in;
+    FakeUart fu;
+    if (filespec == 0) {
+        return ERROR;
     }
     
-    // Read in each line and send it
-    while (getline(in, line)) {
-      newline = '*';
-      newline += line;
-      newline += '\n';
-      fu.Write((unsigned char *)newline.c_str(), newline.size(), Err);
-      // All outback products send their data at 1 second intervals
-      sleep(1);
+    fu.Open(&Err);
+    
+    // Check the users home directory
+    home = getenv("HOME");
+    if (home) {
+        loadfile = home;
+        loadfile += "/.powerguru/mx60.data";
     }
-  } 
-  in.close();
-  return ERROR;
+    
+    // See if it exists in the right place
+    dbglogfile << "Seeing if " << loadfile.c_str() << " exists." << endl;
+    if (stat(loadfile.c_str(), &stats) == 0) {
+        in.open(loadfile.c_str());
+        
+        if (!in) {
+            dbglogfile << "ERROR: Couldn't open file: " << filespec << endl;
+            return ERROR;
+        }
+        
+        // Read in each line and send it
+        while (getline(in, line)) {
+            newline = '*';
+            newline += line;
+            newline += '\n';
+            fu.Write((unsigned char *)newline.c_str(), newline.size(), Err);
+            // All outback products send their data at 1 second intervals
+            sleep(1);
+        }
+    } 
+    in.close();
+    return ERROR;
 }
 
 retcode_t
 sim_fx(const char *filespec)
 {
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/snmp/outback.c b/snmp/outback.c
index a96cd47..a053858 100644
--- a/snmp/outback.c
+++ b/snmp/outback.c
@@ -1165,3 +1165,8 @@ handle_outbackFXCommand(netsnmp_mib_handler *handler,
 
     return SNMP_ERR_NOERROR;
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/snmp/outback.h b/snmp/outback.h
index 28453b1..d57172e 100644
--- a/snmp/outback.h
+++ b/snmp/outback.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,9 +23,7 @@
 #ifndef OUTBACK_H
 #define OUTBACK_H
 
-/*
- * function declarations 
- */
+/* function declarations */
 void            init_outback(void);
 Netsnmp_Node_Handler handle_outbackMXAddress;
 Netsnmp_Node_Handler handle_outbackMXChargeAmps;
@@ -50,3 +49,8 @@ Netsnmp_Node_Handler handle_outbackFXWarningMode;
 Netsnmp_Node_Handler handle_outbackFXCommand;
 
 #endif                          /* OUTBACK_H */
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/snmp/powerguru.c b/snmp/powerguru.c
index 7e062eb..80a46c7 100644
--- a/snmp/powerguru.c
+++ b/snmp/powerguru.c
@@ -801,3 +801,8 @@ handle_powerGuruACSellAmps(netsnmp_mib_handler *handler,
 
     return SNMP_ERR_NOERROR;
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/snmp/powerguru.h b/snmp/powerguru.h
index 4497c18..20fc34e 100644
--- a/snmp/powerguru.h
+++ b/snmp/powerguru.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -71,3 +72,8 @@ Netsnmp_Node_Handler handle_powerGuruACSellAmps;
 
 #endif  /* cplusplus */
 #endif  /* POWERGURU_H */
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/snmp/xantrex.c b/snmp/xantrex.c
index b9c6eb1..422978b 100644
--- a/snmp/xantrex.c
+++ b/snmp/xantrex.c
@@ -16,3 +16,8 @@ init_xantrex(void)
     DEBUGMSGTL(("xantrex", "Initializing\n"));
 
 }
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:
diff --git a/snmp/xantrex.h b/snmp/xantrex.h
index dfef3e4..e319446 100644
--- a/snmp/xantrex.h
+++ b/snmp/xantrex.h
@@ -1,5 +1,6 @@
 // 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 
Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+//      Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,9 +23,12 @@
 #ifndef XANTREX_H
 #define XANTREX_H
 
-/*
- * function declarations 
- */
+/* function declarations */
 void            init_xantrex(void);
 
 #endif                          /* XANTREX_H */
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am          |    4 +-
 client/Makefile.am   |    3 +-
 client/cmd.cc        |  282 ++++---
 configure.ac         |   15 +-
 daemon/Makefile.am   |    3 +-
 daemon/main.cc       |  569 +++++++------
 lib/Makefile.am      |    3 +-
 lib/console.cc       |  148 ++--
 lib/console.h        |   94 ++-
 lib/database.h       |  103 ++--
 lib/err.cc           |   84 +-
 lib/err.h            |  136 ++--
 lib/gdb.h            |    8 +-
 lib/log.cc           |  206 +++---
 lib/log.h            |  132 ++--
 lib/menuitem.cc      |  420 +++++-----
 lib/menuitem.h       |  158 ++--
 lib/msgs.cc          | 2004 ++++++++++++++++++++++----------------------
 lib/msgs.h           |  282 ++++---
 lib/mysql.cc         |  288 ++++---
 lib/outbackpower.cc  | 1067 ++++++++++++------------
 lib/outbackpower.h   |  522 ++++++------
 lib/proc.cc          |   19 +-
 lib/proc.h           |    8 +-
 lib/rc.cc            |  170 ++--
 lib/rc.h             |   54 +-
 lib/sem.cc           |  123 ++--
 lib/sem.h            |   79 +-
 lib/serial.cc        |  651 +++++++-------
 lib/serial.h         |   13 +-
 lib/sharedlib.cc     |  233 +++---
 lib/sharedlib.h      |   24 +-
 lib/snmp.cc          |  242 +++---
 lib/snmp.h           |   55 +-
 lib/tcpip.cc         | 1307 ++++++++++++++--------------
 lib/tcpip.h          |  142 ++--
 lib/tcputil.cc       |  163 ++--
 lib/tcputil.h        |  148 ++--
 lib/thread.cc        |    8 +-
 lib/thread.h         |   23 +-
 lib/xantrex-trace.cc | 2327 +++++++++++++++++++++++++-------------------------
 lib/xantrex-trace.h  |    8 +-
 lib/xml.cc           |  664 ++++++++-------
 lib/xml.h            |    8 +-
 sim/Makefile.am      |    3 +-
 sim/fakeuart.cc      |  186 +++--
 sim/osim.cc          |  112 ++--
 snmp/outback.c       |    5 +
 snmp/outback.h       |   12 +-
 snmp/powerguru.c     |    5 +
 snmp/powerguru.h     |    8 +-
 snmp/xantrex.c       |    5 +
 snmp/xantrex.h       |   12 +-
 53 files changed, 6805 insertions(+), 6543 deletions(-)


hooks/post-receive
-- 
powerguru



reply via email to

[Prev in Thread] Current Thread [Next in Thread]