From: nishi Date: Thu, 13 Jun 2024 05:54:45 +0000 (+0000) Subject: can get ATTR now X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=850dd11a935a819c2eb7a14a9ea9570c9422eb36;p=dataworks.git can get ATTR now git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@293 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/RemoteClient/rcli.c b/RemoteClient/rcli.c index ad5bd37..6ed5adb 100644 --- a/RemoteClient/rcli.c +++ b/RemoteClient/rcli.c @@ -30,8 +30,8 @@ #include #include -#include #include +#include #include #include @@ -63,7 +63,46 @@ int main(int _argc, char** _argv) { if(resp == NULL) { break; } - printf("!%s!\n", resp); + int i; + bool has_arg = false; + for(i = 0; resp[i] != 0; i++) { + if(resp[i] == ':') { + resp[i] = 0; + has_arg = true; + break; + } + } + char* arg = has_arg ? resp + i + 1 : NULL; + if(__dw_strcaseequ(resp, "READY")) { + printf("Connection is ready\n"); + } else if(__dw_strcaseequ(resp, "ATTR") && has_arg) { + int start = 0; + for(i = 0;; i++) { + if(arg[i] == ':' || arg[i] == 0) { + bool brk = arg[i] == 0; + arg[i] = 0; + int j; + char* curarg = arg + start; + for(j = 0; curarg[j] != 0; j++) { + if(curarg[j] == '=') { + curarg[j] = 0; + if(__dw_strcaseequ(curarg, "VER")) { + printf("Server version : "); + } else if(__dw_strcaseequ(curarg, "PLATFORM")) { + printf("Server Platform: "); + } else { + printf("%s: ", curarg); + } + fflush(stdout); + printf("%s\n", curarg + j + 1); + break; + } + } + start = i + 1; + if(brk) break; + } + } + } free(resp); } return 0; diff --git a/RemoteClient/tcpip.c b/RemoteClient/tcpip.c index b905f0d..0841439 100644 --- a/RemoteClient/tcpip.c +++ b/RemoteClient/tcpip.c @@ -63,12 +63,8 @@ int rcli_init(void) { return 0; } -void disconnect(int sock) { -} +void disconnect(int sock) {} -char* readline_sock(void) { - return NULL; -} +char* readline_sock(void) { return NULL; } -void writeline(const char* str) { -} +void writeline(const char* str) {}