From fbcc499ba884137ae5dfada760ab90be5776234c Mon Sep 17 00:00:00 2001 From: fancy Date: Sat, 16 May 2020 10:49:47 +0800 Subject: [PATCH] rename .h to .hpp --- cgattach.cpp | 2 +- cgnoproxy.cpp | 2 +- cgproxy.cpp | 10 +++++----- cgproxyd.cpp | 8 ++++---- cgroup_attach.h => cgroup_attach.hpp | 2 +- common.h => common.hpp | 4 ++-- config.h => config.hpp | 4 ++-- socket_client.h => socket_client.hpp | 2 +- socket_server.h => socket_server.hpp | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) rename cgroup_attach.h => cgroup_attach.hpp (99%) rename common.h => common.hpp (97%) rename config.h => config.hpp (98%) rename socket_client.h => socket_client.hpp (98%) rename socket_server.h => socket_server.hpp (99%) diff --git a/cgattach.cpp b/cgattach.cpp index ee5844e..55adad5 100644 --- a/cgattach.cpp +++ b/cgattach.cpp @@ -1,4 +1,4 @@ -#include "cgroup_attach.h" +#include "cgroup_attach.hpp" using namespace std; void print_usage() { fprintf(stdout, "usage: cgattach \n"); } diff --git a/cgnoproxy.cpp b/cgnoproxy.cpp index f41ee84..aca543d 100644 --- a/cgnoproxy.cpp +++ b/cgnoproxy.cpp @@ -1,5 +1,5 @@ #include -#include "socket_client.h" +#include "socket_client.hpp" using json = nlohmann::json; using namespace CGPROXY; diff --git a/cgproxy.cpp b/cgproxy.cpp index aba4ba2..867eee3 100644 --- a/cgproxy.cpp +++ b/cgproxy.cpp @@ -1,5 +1,5 @@ #include -#include "socket_client.h" +#include "socket_client.hpp" using json = nlohmann::json; using namespace CGPROXY; @@ -15,10 +15,10 @@ bool attach2cgproxy(){ int main(int argc, char *argv[]){ int shift=1; - // if (argc==1){ - // error("usage: cgproxy [--debug] \nexample: cgroxy curl -I https://www.google.com"); - // exit(EXIT_FAILURE); - // } + if (argc==1){ + error("usage: cgproxy [--debug] \nexample: cgroxy curl -I https://www.google.com"); + exit(EXIT_FAILURE); + } processArgs(argc,argv,shift); if (!attach2cgproxy()){ diff --git a/cgproxyd.cpp b/cgproxyd.cpp index 8664321..7c5a79e 100644 --- a/cgproxyd.cpp +++ b/cgproxyd.cpp @@ -1,5 +1,5 @@ -#include "common.h" -#include "socket_server.h" +#include "common.hpp" +#include "socket_server.hpp" #include #include #include @@ -9,8 +9,8 @@ #include #include #include -#include "config.h" -#include "cgroup_attach.h" +#include "config.hpp" +#include "cgroup_attach.hpp" using namespace std; using json = nlohmann::json; diff --git a/cgroup_attach.h b/cgroup_attach.hpp similarity index 99% rename from cgroup_attach.h rename to cgroup_attach.hpp index c1c94f4..06fdeb5 100644 --- a/cgroup_attach.h +++ b/cgroup_attach.hpp @@ -11,7 +11,7 @@ #include #include #include -#include "common.h" +#include "common.hpp" using namespace std; namespace CGPROXY::CGROUP{ diff --git a/common.h b/common.hpp similarity index 97% rename from common.h rename to common.hpp index 4a43ecd..f731194 100644 --- a/common.h +++ b/common.hpp @@ -31,8 +31,8 @@ #include using namespace std; -extern bool enable_debug=false; -extern bool print_help=false; +static bool enable_debug=false; +static bool print_help=false; #define error(...) {fprintf(stderr, __VA_ARGS__);fprintf(stderr, "\n");} #define debug(...) if (enable_debug) {fprintf(stdout, __VA_ARGS__);fprintf(stdout, "\n");} diff --git a/config.h b/config.hpp similarity index 98% rename from config.h rename to config.hpp index 824d787..53dbe20 100644 --- a/config.h +++ b/config.hpp @@ -1,7 +1,7 @@ #ifndef CONFIG_H #define CONFIG_H -#include "common.h" -#include "socket_server.h" +#include "common.hpp" +#include "socket_server.hpp" #include #include #include diff --git a/socket_client.h b/socket_client.hpp similarity index 98% rename from socket_client.h rename to socket_client.hpp index 143ff55..ce92128 100644 --- a/socket_client.h +++ b/socket_client.hpp @@ -9,7 +9,7 @@ #include #include #include -#include "common.h" +#include "common.hpp" using namespace std; diff --git a/socket_server.h b/socket_server.hpp similarity index 99% rename from socket_server.h rename to socket_server.hpp index 8e91086..f4e95d9 100644 --- a/socket_server.h +++ b/socket_server.hpp @@ -13,7 +13,7 @@ #include #include #include -#include "common.h" +#include "common.hpp" using namespace std; namespace fs = std::filesystem;