From 0ed3b6b1d07684b34439869b79aecc20f1a84e3e Mon Sep 17 00:00:00 2001 From: nishi Date: Thu, 20 Jun 2024 00:48:13 +0000 Subject: [PATCH] add -d option git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@390 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- Client/client.c | 6 +++++- Library/dataworks.c | 5 ++--- README.md | 2 ++ Server/hayes.c | 4 ++++ Server/tcpip.c | 4 ++++ Tool/docfmt.c | 4 ++-- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Client/client.c b/Client/client.c index 8e01db0..565debe 100644 --- a/Client/client.c +++ b/Client/client.c @@ -97,6 +97,9 @@ int main(int argc, char** argv) { } else if(option(argv[i], "f", "file")) { fprog = argv[i + 1]; i++; + } else if(option(argv[i], "d", "db")) { + i++; + fname = argv[i]; } else if(option(argv[i], "h", "help")) { printf("DataWorks version %s %s %s\n", dataworks_get_version(), dataworks_get_compile_date(), dataworks_get_platform()); printf("\n"); @@ -109,7 +112,8 @@ int main(int argc, char** argv) { printf("\t-NB --nobanner Do not show the banner on the startup\n"); printf("\t-NL --nolog Do not show the log\n"); printf("\t-q --quiet Same with -NC -NB -NL\n"); - printf("\t-f --file [path] Run the [path] as the script file\n"); + printf("\t-f --file [path] Run [path] as the script file\n"); + printf("\t-d --db [path] Force [path] as the database file\n"); return 0; } else { fprintf(stderr, "%s: %s: invalid option\n", argv[0], argv[i]); diff --git a/Library/dataworks.c b/Library/dataworks.c index deb6ed4..60a5f47 100644 --- a/Library/dataworks.c +++ b/Library/dataworks.c @@ -55,7 +55,6 @@ const char* dataworks_platform = "WatcomC/" #elif defined(__APPLE__) const char* dataworks_platform = "MacOSX/" #elif defined(__VBCC__) -#undef SUPPORTED const char* dataworks_platform = "VBCC/" #else #undef SUPPORTED @@ -63,9 +62,9 @@ const char* dataworks_platform = "Unknown/" #endif #ifdef __VBCC__ #ifdef AMIGA - "amiga (amiga)"; + "amiga (amiga)"; #else - "unknown (unknown)"; + "unknown (unknown)"; #endif ; #else diff --git a/README.md b/README.md index c414225..d80f872 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ DataWorks is a simple DBMS written in C. Works on amd64 10.0, and macppc 9.3. 5. Linux 6. MacOSX +7. Amiga Workbench/AmigaOS +8. OS/2 ## Server support 1. DOS with modem diff --git a/Server/hayes.c b/Server/hayes.c index fe4d58f..8e8c530 100644 --- a/Server/hayes.c +++ b/Server/hayes.c @@ -251,6 +251,9 @@ int server_init(void) { i++; authfile = argv[i]; auth = true; + } else if(option(argv[i], "d", "db")) { + i++; + db = dataworks_database_open(argv[i]); } else if(option(argv[i], "s", "signal")) { usr1sig = true; } else if(option(argv[i], "h", "help")) { @@ -262,6 +265,7 @@ int server_init(void) { printf("\t-f --fancy Enable the fancy manager ;)\n"); printf("\t-l --login [path] Specify the authentication file\n"); printf("\t-s --signal Send SIGUSR1 when ready\n"); + printf("\t-d --db [path] Force [path] as the database file\n"); exit(0); } else if(option(argv[i], "f", "fancy")) { fancy = true; diff --git a/Server/tcpip.c b/Server/tcpip.c index 26c9745..68b09b0 100644 --- a/Server/tcpip.c +++ b/Server/tcpip.c @@ -89,6 +89,9 @@ int server_init(void) { i++; authfile = argv[i]; auth = true; + } else if(option(argv[i], "d", "db")) { + i++; + db = dataworks_database_open(argv[i]); } else if(option(argv[i], "s", "signal")) { usr1sig = true; } else if(option(argv[i], "h", "help")) { @@ -99,6 +102,7 @@ int server_init(void) { printf("\t-p --port [port] Specify the port to be listened on\n"); printf("\t-l --login [path] Specify the authentication file\n"); printf("\t-s --signal Send SIGUSR1 when ready\n"); + printf("\t-d --db [path] Force [path] as the database file\n"); exit(0); } else { fprintf(stderr, "Invalid option: %s\n", argv[i]); diff --git a/Tool/docfmt.c b/Tool/docfmt.c index cfa16cd..02797b2 100644 --- a/Tool/docfmt.c +++ b/Tool/docfmt.c @@ -91,7 +91,7 @@ int process_doc(void) { } else if(strcmp(cmd, "\\list") == 0) { } else if(strcmp(cmd, "\\list+") == 0) { cincr++; - if(cincr >= MAX){ + if(cincr >= MAX) { free(str); free(full); fprintf(stderr, "List index stack overflow. Aborted\n"); @@ -99,7 +99,7 @@ int process_doc(void) { } } else if(strcmp(cmd, "\\list-") == 0) { cincr--; - if(cincr < 0){ + if(cincr < 0) { free(str); free(full); fprintf(stderr, "List index stack underflow. Aborted\n"); -- 2.43.0