diff --git a/system/dd/dd_main.c b/system/dd/dd_main.c index 74cec10eb..f08041836 100644 --- a/system/dd/dd_main.c +++ b/system/dd/dd_main.c @@ -309,6 +309,7 @@ int main(int argc, FAR char **argv) uint32_t sector = 0; int ret = ERROR; int i; + bool show_help = false; /* Initialize the dd structure */ @@ -379,6 +380,10 @@ int main(int argc, FAR char **argv) cur = next + 1; } } + else if (strcmp(argv[i], "--help") == 0) + { + show_help = true; + } else { print_usage(stderr); @@ -386,6 +391,14 @@ int main(int argc, FAR char **argv) } } + /* Help requested? Emit usage hints and exit. */ + + if (show_help) + { + print_usage(stdout); + return 0; + } + /* If verify enabled, infile and outfile are mandatory */ if ((dd.oflags & O_RDONLY) && (infile == NULL || outfile == NULL))