From 8a653921349ccc9af5203749954efd795b62c5b6 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 18 Apr 2014 08:47:38 +0000 Subject: Make bbackupctl status display the human-readable daemon state name. --- bin/bbackupctl/bbackupctl.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'bin/bbackupctl') 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; } -- cgit v1.2.3