summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-04-18 08:47:38 +0000
committerChris Wilson <chris+github@qwirx.com>2014-04-18 08:47:38 +0000
commit8a653921349ccc9af5203749954efd795b62c5b6 (patch)
tree051cfab91ee31abf29ea64e3d57aa3246235f9c3 /bin
parent1ef44d9922592ca8486fbbb866e971c94666c747 (diff)
Make bbackupctl status display the human-readable daemon state name.
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupctl/bbackupctl.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/bin/bbackupctl/bbackupctl.cpp b/bin/bbackupctl/bbackupctl.cpp
index becb1fcf..e7b85fdc 100644
--- a/bin/bbackupctl/bbackupctl.cpp
+++ b/bin/bbackupctl/bbackupctl.cpp
@@ -19,6 +19,7 @@
#include "box_getopt.h"
#include "MainHelper.h"
+#include "BackupDaemon.h"
#include "BoxPortsAndFiles.h"
#include "BackupDaemonConfigVerify.h"
#include "Socket.h"
@@ -236,7 +237,21 @@ int main(int argc, const char *argv[])
}
else if (commandName == "status")
{
- BOX_NOTICE("state " << currentState);
+ std::string stateName;
+
+ #define STATE(x) case BackupDaemon::State_ ## x: stateName = #x; break;
+ switch (currentState)
+ {
+ STATE(Initialising);
+ STATE(Idle);
+ STATE(Connected);
+ STATE(Error);
+ STATE(StorageLimitExceeded);
+ default:
+ stateName = "unknown";
+ break;
+ }
+ BOX_NOTICE("state " << currentState << " " << stateName);
command = NoCommand;
}