From aa1948e46f6eab040953a5b6831dec83bb36f2b5 Mon Sep 17 00:00:00 2001 From: nishi Date: Fri, 7 Jun 2024 09:42:36 +0000 Subject: [PATCH] add help git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@177 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- PKGBUILD | 2 +- Server/hayes.c | 8 ++++++++ Server/server.c | 3 ++- Server/tcpip.c | 8 ++++++++ increment-PKGBUILD | 2 +- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index ccb2fbe..e33c89e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,7 +5,7 @@ pkgver='0.1.0' pkgdesc='Database System' arch=('i686' 'x86_64') license=('BSD') -pkgrel='6' +pkgrel='7' makedepends=('byacc') source=('dataworks::svn+http://sw.nishi.boats/svn/nishi-dataworks/trunk#revision=') sha256sums=('SKIP') diff --git a/Server/hayes.c b/Server/hayes.c index 200b127..56ea806 100644 --- a/Server/hayes.c +++ b/Server/hayes.c @@ -145,6 +145,14 @@ int server_init(void) { i++; authfile = argv[i]; auth = true; + } else if(option(argv[i], "h", "help")) { + printf("\n"); + printf("Usage: %s [options] database\n", argv[0]); + printf("You can use double-dash or slash for long-format flag, and single-dash or slash for short-foramt flag.\n"); + printf("Options:\n"); + printf("\t-p --port [comport] Specify the modem port\n"); + printf("\t-l --login [path] Specify the authentication file\n"); + exit(0); } else { fprintf(stderr, "Invalid option: %s\n", argv[i]); return 1; diff --git a/Server/server.c b/Server/server.c index 5249f38..d85f285 100644 --- a/Server/server.c +++ b/Server/server.c @@ -196,7 +196,8 @@ int main(int _argc, char** _argv) { if(has_pass) { int shift = i; struct auth_entry** old_entries = entries; - for(i = 0; old_entries[i] != NULL; i++); + for(i = 0; old_entries[i] != NULL; i++) + ; entries = malloc(sizeof(*entries) * (i + 2)); for(i = 0; old_entries[i] != NULL; i++) entries[i] = old_entries[i]; free(old_entries); diff --git a/Server/tcpip.c b/Server/tcpip.c index c11ef0b..edfd78a 100644 --- a/Server/tcpip.c +++ b/Server/tcpip.c @@ -71,6 +71,14 @@ int server_init(void) { i++; authfile = argv[i]; auth = true; + } else if(option(argv[i], "h", "help")) { + printf("\n"); + printf("Usage: %s [options] database\n", argv[0]); + printf("You can use double-dash or slash for long-format flag, and single-dash or slash for short-foramt flag.\n"); + printf("Options:\n"); + printf("\t-p --port [port] Specify the port to be listened on\n"); + printf("\t-l --login [path] Specify the authentication file\n"); + exit(0); } else { fprintf(stderr, "Invalid option: %s\n", argv[i]); return 1; diff --git a/increment-PKGBUILD b/increment-PKGBUILD index 7f8f011..45a4fb7 100644 --- a/increment-PKGBUILD +++ b/increment-PKGBUILD @@ -1 +1 @@ -7 +8 -- 2.43.0