]> Nishi Git Mirror - dataworks.git/commitdiff
add .clear
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 02:04:58 +0000 (02:04 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Wed, 22 May 2024 02:04:58 +0000 (02:04 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@66 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Client/main.c
Library/util.c

index e7338678f35b0338fe4def9bac06f8abd7345d20..3eeb4b70998517e5daddaedac1977183d4022a7f 100644 (file)
@@ -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");
                                }
index 04e33a800cd645710f13d7c978360aba56794d43..554ea12fc336f76f43839ac93c6cadbc67ef145e 100644 (file)
@@ -30,8 +30,8 @@
 
 #include <ctype.h>
 #include <stdbool.h>
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 #ifdef __MINGW32__
 #include <fileapi.h>
 #else