Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Namjae Jeon <linkinjeon@kernel.org>
To: linux-cifs@vger.kernel.org
Cc: hyc.lee@gmail.com, sfrench@samba.org, senozhatsky@chromium.org,
	smfrench@gmail.com, Namjae Jeon <linkinjeon@kernel.org>,
	David Howells <dhowells@redhat.com>
Subject: [PATCH] ksmbd-tools: add missing long option in adduser/addshare/control
Date: Thu,  2 Jun 2022 10:14:10 +0900	[thread overview]
Message-ID: <20220602011410.56202-1-linkinjeon@kernel.org> (raw)

Add missing long option in adduser/addshare/control.

Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 addshare/addshare.c | 11 ++++++++++-
 adduser/adduser.c   | 12 +++++++++++-
 control/control.c   |  9 ++++++++-
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/addshare/addshare.c b/addshare/addshare.c
index 4d25047..a8ba71a 100644
--- a/addshare/addshare.c
+++ b/addshare/addshare.c
@@ -54,6 +54,15 @@ static void usage(void)
 	exit(EXIT_FAILURE);
 }
 
+static const struct option opts[] = {
+	{"add-share",		required_argument,	NULL,	'a' },
+	{"del-share",		required_argument,	NULL,	'd' },
+	{"update-share",	required_argument,	NULL,	'u' },
+	{"options",		required_argument,	NULL,	'o' },
+	{"version",		no_argument,		NULL,	'V' },
+	{"verbose",		no_argument,		NULL,	'v' },
+};
+
 static void show_version(void)
 {
 	printf("ksmbd-tools version : %s\n", KSMBD_TOOLS_VERSION);
@@ -102,7 +111,7 @@ int main(int argc, char *argv[])
 	set_logger_app_name("ksmbd.addshare");
 
 	opterr = 0;
-	while ((c = getopt(argc, argv, "c:a:d:u:p:o:Vvh")) != EOF)
+	while ((c = getopt_long(argc, argv, "c:a:d:u:p:o:Vvh", opts, NULL)) != EOF)
 		switch (c) {
 		case 'a':
 			arg_name = g_ascii_strdown(optarg, strlen(optarg));
diff --git a/adduser/adduser.c b/adduser/adduser.c
index 88b12db..60a059d 100644
--- a/adduser/adduser.c
+++ b/adduser/adduser.c
@@ -50,6 +50,16 @@ static void usage(void)
 	exit(EXIT_FAILURE);
 }
 
+static const struct option opts[] = {
+	{"add-user",		required_argument,	NULL,	'a' },
+	{"del-user",		required_argument,	NULL,	'd' },
+	{"update-user",		required_argument,	NULL,	'u' },
+	{"password",		required_argument,	NULL,	'p' },
+	{"import-users",	required_argument,	NULL,	'i' },
+	{"version",		no_argument,		NULL,	'V' },
+	{"verbose",		no_argument,		NULL,	'v' },
+};
+
 static void show_version(void)
 {
 	printf("ksmbd-tools version : %s\n", KSMBD_TOOLS_VERSION);
@@ -102,7 +112,7 @@ int main(int argc, char *argv[])
 	set_logger_app_name("ksmbd.adduser");
 
 	opterr = 0;
-	while ((c = getopt(argc, argv, "c:i:a:d:u:p:Vvh")) != EOF)
+	while ((c = getopt_long(argc, argv, "c:i:a:d:u:p:Vvh", opts, NULL)) != EOF)
 		switch (c) {
 		case 'a':
 			arg_account = g_strdup(optarg);
diff --git a/control/control.c b/control/control.c
index 780a48a..3dc8c7e 100644
--- a/control/control.c
+++ b/control/control.c
@@ -23,6 +23,13 @@ static void usage(void)
 	exit(EXIT_FAILURE);
 }
 
+static const struct option opts[] = {
+	{"shutdown",		no_argument,		NULL,	's' },
+	{"debug",		required_argument,	NULL,	'd' },
+	{"ksmbd-version",	no_argument,		NULL,	'c' },
+	{"version",		no_argument,		NULL,	'V' },
+};
+
 static void show_version(void)
 {
 	printf("ksmbd-tools version : %s\n", KSMBD_TOOLS_VERSION);
@@ -101,7 +108,7 @@ int main(int argc, char *argv[])
 	}
 
 	opterr = 0;
-	while ((c = getopt(argc, argv, "sd:cVh")) != EOF)
+	while ((c = getopt_long(argc, argv, "sd:cVh", opts, NULL)) != EOF)
 		switch (c) {
 		case 's':
 			ret = ksmbd_control_shutdown();
-- 
2.25.1


             reply	other threads:[~2022-06-02  1:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  1:14 Namjae Jeon [this message]
2022-06-02  5:07 ` [PATCH] ksmbd-tools: add missing long option in adduser/addshare/control Hyunchul Lee
2022-06-02  5:20   ` Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220602011410.56202-1-linkinjeon@kernel.org \
    --to=linkinjeon@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=hyc.lee@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=sfrench@samba.org \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox