All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] mkfs.f2fs: add -h and --help
@ 2020-10-04 18:08 John A. Leuenhagen
  2020-10-09  1:02 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: John A. Leuenhagen @ 2020-10-04 18:08 UTC (permalink / raw)
  To: linux-f2fs-devel

These two arguments would simply print the usage message.

Signed-off-by: John A. Leuenhagen <john@zlima12.com>
---
 man/mkfs.f2fs.8         |  3 +++
 mkfs/f2fs_format_main.c | 12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/man/mkfs.f2fs.8 b/man/mkfs.f2fs.8
index e2aee76..7745177 100644
--- a/man/mkfs.f2fs.8
+++ b/man/mkfs.f2fs.8
@@ -256,6 +256,9 @@ Number of sectors. Default is determined by device size.
 .TP
 .BI \-V
 Print the version number and exit.
+.TP
+.BI \-h,\ \-\-help
+Print usage and exit.
 .SH AUTHOR
 This version of
 .B mkfs.f2fs
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index f2f0a80..b14d735 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -20,6 +20,7 @@
 #include <time.h>
 #include <uuid.h>
 #include <errno.h>
+#include <getopt.h>
 
 #include "config.h"
 #ifdef HAVE_LIBBLKID
@@ -125,12 +126,16 @@ static void add_default_options(void)
 
 static void f2fs_parse_options(int argc, char *argv[])
 {
-	static const char *option_string = "qa:c:C:d:e:E:g:il:mo:O:rR:s:S:z:t:T:U:Vfw:";
+	static const char *option_string = "qa:c:C:d:e:E:g:hil:mo:O:rR:s:S:z:t:T:U:Vfw:";
+	static const struct option long_opts[] = {
+		{ .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' },
+		{ .name = NULL, .has_arg = 0, .flag = NULL, .val = 0 }
+	};
 	int32_t option=0;
 	int val;
 	char *token;
 
-	while ((option = getopt(argc,argv,option_string)) != EOF) {
+	while ((option = getopt_long(argc,argv,option_string,long_opts,NULL)) != EOF) {
 		switch (option) {
 		case 'q':
 			c.dbg_lv = -1;
@@ -164,6 +169,9 @@ static void f2fs_parse_options(int argc, char *argv[])
 			if (!strcmp(optarg, "android"))
 				c.defset = CONF_ANDROID;
 			break;
+		case 'h':
+			mkfs_usage();
+			break;
 		case 'i':
 			c.large_nat_bitmap = 1;
 			break;
-- 
2.28.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] [PATCH] mkfs.f2fs: add -h and --help
  2020-10-04 18:08 [f2fs-dev] [PATCH] mkfs.f2fs: add -h and --help John A. Leuenhagen
@ 2020-10-09  1:02 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2020-10-09  1:02 UTC (permalink / raw)
  To: John A. Leuenhagen, linux-f2fs-devel

On 2020/10/5 2:08, John A. Leuenhagen wrote:
> These two arguments would simply print the usage message.
> 
> Signed-off-by: John A. Leuenhagen <john@zlima12.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-09  1:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 18:08 [f2fs-dev] [PATCH] mkfs.f2fs: add -h and --help John A. Leuenhagen
2020-10-09  1:02 ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.