소스 검색

remove old command code

Missingmew 5 년 전
부모
커밋
239f874743
5개의 변경된 파일0개의 추가작업 그리고 94개의 파일을 삭제
  1. 0 37
      cli/include/commands.h
  2. 0 51
      cli/src/commands.cpp
  3. 0 2
      cli/src/machineioman.cpp
  4. 0 2
      cli/src/main.cpp
  5. 0 2
      cli/src/userioman.cpp

+ 0 - 37
cli/include/commands.h

@@ -1,37 +0,0 @@
-#ifndef COMMANDS_H
-#define COMMANDS_H
-
-#include <cstring>
-#include <cctype>
-
-#define COMMANDLEN 10
-#define sizeofarr(a) (sizeof(a) / sizeof(a[0]))
-
-typedef enum {
-  CMD_HELP,
-  CMD_CONNECT,
-  CMD_DISCONNECT,
-  CMD_PUT,
-  CMD_REMOVE,
-  CMD_GET,
-  CMD_LIST,
-  CMD_STATUS,
-  CMD_SETUP,
-  CMD_LOG,
-  CMD_UNKNOWN
-} COMMANDID;
-
-typedef struct {
-  COMMANDID cmd;
-  const char *name;
-  const char *desc;
-} CMD;
-
-extern CMD commands[];
-
-COMMANDID getCmdIdFromString(const char *str);
-const char *getCmdStringFromId(COMMANDID id);
-// TODO
-void printCmds(void);
-
-#endif

+ 0 - 51
cli/src/commands.cpp

@@ -1,51 +0,0 @@
-#include "../include/commands.h"
-#include <cstdio>
-
-CMD commands[]{
-    {CMD_HELP, "help", "show help"},
-    {CMD_STATUS, "status", "query status of IP"},
-    {CMD_DISCONNECT, "disconnect", "disconnect from IP"},
-    {CMD_PUT, "put", "upload file to IP and add to queue"},
-    {CMD_GET, "get", "retrieve file from deamon"},
-    {CMD_LIST, "list", "list files that are downloadable from deamon"}
-
-    /* TODO
-    {CMD_REMOVE	, "remove", "remove file from IP and queue (stops xfer
-    if required)"},
-    {CMD_SETUP	, "setup", "configure server at IP"},
-    {CMD_LOG	, "log", "show log from IP"}
-    */
-};
-
-COMMANDID getCmdIdFromString(const char *str) {
-  COMMANDID ret = CMD_UNKNOWN;
-  char temp[COMMANDLEN + 1] = {0};
-  int len = COMMANDLEN;
-  if (std::strlen(str) > COMMANDLEN) {
-    return ret;
-  } else
-    len = std::strlen(str);
-  for (int i = 0; i < len; i++)
-    temp[i] = std::tolower(str[i]);
-
-  for (int i = 0; i < sizeofarr(commands); i++) {
-    if (!std::strncmp(temp, commands[i].name, COMMANDLEN))
-      ret = commands[i].cmd;
-  }
-  return ret;
-}
-
-const char *getCmdStringFromId(COMMANDID id) {
-  const char *ret = NULL;
-  for (int i = 0; i < sizeofarr(commands); i++) {
-    if (commands[i].cmd == id)
-      ret = commands[i].name;
-  }
-  return ret;
-}
-
-void printCmds(void) {
-  for (CMD command : commands) {
-    printf("%-12s - %s\n", command.name, command.desc);
-  }
-}

+ 0 - 2
cli/src/machineioman.cpp

@@ -1,6 +1,4 @@
 #include "../include/machineioman.h"
-#include "../include/base64.h"
-#include "../include/commands.h"
 
 #include <boost/algorithm/string.hpp>
 #include <fstream>

+ 0 - 2
cli/src/main.cpp

@@ -1,8 +1,6 @@
-#include "../include/commands.h"
 #include "../include/machineioman.h"
 #include "../include/userioman.h"
 
-#include <boost/asio.hpp>
 #include <boost/program_options.hpp>
 #include <iostream>
 #include <string>

+ 0 - 2
cli/src/userioman.cpp

@@ -1,6 +1,4 @@
 #include "../include/userioman.h"
-#include "../include/base64.h"
-#include "../include/commands.h"
 
 #include <boost/algorithm/string.hpp>
 #include <fstream>