mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
system/dd: implement "--help" parameter
Previously the usage hints were displayed only in case of errors. Signed-off-by: Lars Kruse <devel@sumpfralle.de>
This commit is contained in:
parent
db36c8c617
commit
df711238fe
1 changed files with 13 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue