From 9efa7ed46cf554edc4ccd748fdfa9cafe3097d9c Mon Sep 17 00:00:00 2001 From: nishi Date: Wed, 22 May 2024 02:04:58 +0000 Subject: [PATCH] add .clear git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@66 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- Client/main.c | 7 ++++++- Library/util.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Client/main.c b/Client/main.c index e733867..3eeb4b7 100644 --- a/Client/main.c +++ b/Client/main.c @@ -125,7 +125,7 @@ int main(int argc, char** argv) { strftime(mtimestr, 255, "%a %b %d %H:%M:%S %Z %Y", tm); printf("Opened the database (Version %d, Modified at %s).\n", dataworks_database_get_version(db), mtimestr); printf("\n"); - printf("Type a command (.help) for the help\n"); + printf("Type a command (.help) for the help.\n"); printf("\n"); int len = 0; char* buf = malloc(1); @@ -152,6 +152,8 @@ int main(int argc, char** argv) { printf("Shows the version of DataWorks.\n"); padleft(16, ".tables"); printf("Shows the table list.\n"); + padleft(16, ".clear"); + printf("Clears the console.\n"); } else if(__dw_strcaseequ(buf, ".tables")) { char** list = dataworks_database_get_table_list(db); if(list != NULL) { @@ -167,6 +169,9 @@ int main(int argc, char** argv) { } else { printf("Failed to get the list.\n"); } + } else if(__dw_strcaseequ(buf, ".clear")) { + printf("\x1b[2J\x1b[1;1H"); + fflush(stdout); } else { printf("Unknown dot-command.\n"); } diff --git a/Library/util.c b/Library/util.c index 04e33a8..554ea12 100644 --- a/Library/util.c +++ b/Library/util.c @@ -30,8 +30,8 @@ #include #include -#include #include +#include #ifdef __MINGW32__ #include #else -- 2.43.0