These two arguments would simply print the usage message.
Signed-off-by: John A. Leuenhagen <[email protected]>
---
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel