From cca0bf6af037c9dc863f3f672db234855e7fd6d8 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 13 Mar 2024 20:36:43 +0800 Subject: [PATCH] fix: last modify information --- tools/shell/inc/shellAuto.h | 2 +- tools/shell/src/shellAuto.c | 17 ++++++++--------- tools/shell/src/shellEngine.c | 13 +++++++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tools/shell/inc/shellAuto.h b/tools/shell/inc/shellAuto.h index a4fca51ee7..bcf500fefc 100644 --- a/tools/shell/inc/shellAuto.h +++ b/tools/shell/inc/shellAuto.h @@ -39,7 +39,7 @@ void shellAutoExit(); void callbackAutoTab(char* sqlstr, TAOS* pSql, bool usedb); // introduction -void printfIntroduction(); +void printfIntroduction(bool community); // show enterprise AD at start or end void showAD(bool end); diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 5fdbbe1be7..c279b03b14 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -421,21 +421,20 @@ void printfIntroduction(bool community) { printf(" * [ Ctrl + K ] ...... clear the screen after the cursor *\n"); printf(" * [ Ctrl + U ] ...... clear the screen before the cursor *\n"); if(community) { - printf(" * ----------------------------------------------------------------------------- *\n"); - printf(" * You are using TDengine OSS. To experience more advanced TDengine features and *\n"); - printf(" * receive professional technical support, try TDengine Enterprise: *\n"); - printf(" * http://www.tdengine.com *\n"); + printf(" * ---------------------------------------------------------------------------------- *\n"); + printf(" * You are using TDengine OSS. To experience more advanced features and receive *\n"); + printf(" * professional technical support, try TDengine Enterprise or Cloud, *\n"); + printf(" * learn more at https://tdengine.com *\n"); } printf(" **************************************************************************************\n\n"); } // show enterprise AD void showAD(bool end) { - printf("\n"); - printf(" You are using TDengine OSS. To experience more advanced TDengine features and \n"); - printf(" receive professional technical support, try TDengine Enterprise: \n"); - printf(" http://www.tdengine.com \n"); - printf("\n"); + printf(" You are using TDengine OSS. To experience more advanced features and receive \n"); + printf(" professional technical support, try TDengine Enterprise or Cloud, \n"); + printf(" learn more at https://tdengine.com \n"); + printf(" \n"); } void showHelp() { diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 512f188fba..69625fe01f 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1150,7 +1150,7 @@ void shellSourceFile(const char *file) { taosCloseFile(&pFile); } -bool shellGetGrantInfo() { +bool shellGetGrantInfo(char* buf) { bool community = true; char sinfo[1024] = {0}; tstrncpy(sinfo, taos_get_server_info(shell.conn), sizeof(sinfo)); @@ -1198,10 +1198,10 @@ bool shellGetGrantInfo() { community = true; } else if (strcmp(expiretime, "unlimited") == 0) { community = false; - fprintf(stdout, "Server is Enterprise %s Edition, %s and will never expire.\r\n", serverVersion, sinfo); + fprintf(buf, "Server is Enterprise %s Edition, %s and will never expire.\r\n", serverVersion, sinfo); } else { community = false; - fprintf(stdout, "Server is Enterprise %s Edition, %s and will expire at %s.\r\n", serverVersion, sinfo, + fprintf(buf, "Server is Enterprise %s Edition, %s and will expire at %s.\r\n", serverVersion, sinfo, expiretime); } @@ -1368,7 +1368,8 @@ int32_t shellExecute() { #ifdef WEBSOCKET if (!shell.args.restful && !shell.args.cloud) { #endif -bool community = shellGetGrantInfo(); +char buf[512] = ""; +bool community = shellGetGrantInfo(buf); #ifndef WINDOWS printfIntroduction(community); #else @@ -1376,6 +1377,10 @@ bool community = shellGetGrantInfo(); showAD(false) } #endif +// printf version +if(!community) { + printf(buf); +} #ifdef WEBSOCKET }