Browse Source

fixed building useriomanager

Denys 5 years ago
parent
commit
7e627bf406
4 changed files with 6 additions and 10 deletions
  1. 1 1
      cli/CMakeLists.txt
  2. 1 1
      cli/include/useriomanager.hpp
  3. 2 7
      cli/src/main.cpp
  4. 2 1
      cli/src/useriomanager.cpp

+ 1 - 1
cli/CMakeLists.txt

@@ -5,7 +5,7 @@ set (CMAKE_BUILD_TYPE debug)
 
 project(ccats-cli)
 
-add_executable(ccats-cli src/main.cpp src/iomanager.cpp src/machineiomanager.cpp)
+add_executable(ccats-cli src/main.cpp src/iomanager.cpp src/machineiomanager.cpp src/useriomanager.cpp)
 
 # use pkg-config to find readline as it doesnt provide cmake files
 find_package(PkgConfig REQUIRED)

+ 1 - 1
cli/include/useriomanager.hpp

@@ -3,7 +3,7 @@
 
 #include "iomanager.hpp"
 
-class UserIoManager : IoManager {
+class UserIoManager : public IoManager {
 
 public:
 	// UserIoManager(char *ipstring) : IoManager(ipstring) {};

+ 2 - 7
cli/src/main.cpp

@@ -1,4 +1,5 @@
 #include <machineiomanager.hpp>
+#include <useriomanager.hpp>
 
 #include <boost/program_options.hpp>
 #include <boost/asio.hpp>
@@ -12,8 +13,6 @@
 #define sizeofarr(a) (sizeof(a) / sizeof(a[0]))
 
 namespace bpo = boost::program_options;
-namespace bai = boost::asio;
-using bai::ip::tcp;
 
 typedef enum {
   CMD_HELP,
@@ -45,10 +44,6 @@ CMD commands[]{{CMD_HELP, "help", "show help"},
                {CMD_SETUP, "setup", "configure server at IP"},
                {CMD_LOG, "log", "show log from IP"}};
 
-/*  takes a string in str and checks if it is a valid command
-    returns the matching COMMANDTYPES or CMD_UNKNOWN
-    if isshort is nonzero, only the first character of str will be checked
-*/
 COMMANDTYPES getCommand(char *str, unsigned int isshort) {
   COMMANDTYPES ret = CMD_UNKNOWN;
   char temp[COMMANDLEN + 1] = {0};
@@ -125,7 +120,7 @@ int main(int argc, char **argv) {
   std::printf("ip %s machine mode is %d file is %s\n", argv[1], machine, file?file:"");
   //~ std::printf("read line %s\n", readline("fancprompt "));
   
-  ioman = new MachineIoManager(argv[1]);
+  ioman = new UserIoManager(argv[1]);
   // ‘MachineIoManager::MachineIoManager(char*&)’
   if(ioman->connect()) {
 	  ioman->run();

+ 2 - 1
cli/src/useriomanager.cpp

@@ -4,6 +4,7 @@
 #include <jsoncpp/json/json.h>
 
 #include <readline/readline.h>
+#include <readline/history.h>
 
 
 void UserIoManager::run() {
@@ -31,7 +32,7 @@ void UserIoManager::run() {
 		if(!strcmp(line, "help")) {
         
             std::printf("ccats command line interface\n");
-            std::printf("available COMMANDs are:\n");
+            std::printf("available COMMANDs are:\n\n");
             std::printf("help   - shows this help\n");
             std::printf("status - asks the server for status\n");
             std::printf("close  - closes the connection to the server\n");