@@ -165,6 +165,7 @@ const char * const cmd_rescue_zero_log_usage[] = {
"Clear the tree log. Usable if it's corrupted and prevents mount.",
"",
HELPINFO_EXTRA_DEV,
+ "-h Help",
NULL
};
@@ -179,10 +180,22 @@ int cmd_rescue_zero_log(int argc, char **argv)
if (set_extra_dev_from_arg(&argc, argv))
usage(cmd_rescue_zero_log_usage);
- if (check_argc_exact(argc, 2))
+ while (1) {
+ int c = getopt(argc, argv, "h");
+
+ if (c < 0)
+ break;
+ switch (c) {
+ case 'h':
+ default:
+ usage(cmd_rescue_zero_log_usage);
+ }
+ }
+
+ if (check_argc_exact(argc - optind, 1))
usage(cmd_rescue_zero_log_usage);
- devname = argv[1];
+ devname = argv[optind];
ret = check_mounted(devname);
if (ret < 0) {
fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret));
To make it unified with other two rescue command, which support --help option. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> --- cmds-rescue.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)