From: nishi Date: Thu, 13 Jun 2024 06:12:43 +0000 (+0000) Subject: can .quit now X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=83aabd3e6e8f9647957d38b2bce1fe7587ab3421;p=dataworks.git can .quit now git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@295 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/RemoteClient/rcli.c b/RemoteClient/rcli.c index e254399..bfc990a 100644 --- a/RemoteClient/rcli.c +++ b/RemoteClient/rcli.c @@ -109,9 +109,34 @@ int main(int _argc, char** _argv) { } free(resp); } - if(ready){ + if(ready) { + char cbuf[2]; + cbuf[1] = 0; + char* str = malloc(1); + str[0] = 0; + printf(". "); + fflush(stdout); + while(true) { + int len = fread(cbuf, 1, 1, stdin); + if(len <= 0) break; + if(cbuf[0] == '\n') { + if(__dw_strcaseequ(str, ".quit")) { + break; + } + free(str); + str = malloc(1); + str[0] = 0; + printf(". "); + fflush(stdout); + } else if(cbuf[0] != '\r') { + char* tmp = str; + str = __dw_strcat(tmp, cbuf); + free(tmp); + } + } + free(str); writeline("QUIT"); - while(true){ + while(true) { char* resp = readline_sock(); if(resp == NULL) break; free(resp);