.B \-V
Produce verbose output, including all filesystem-specific commands
that are executed.
+.TP
+\fB\-?\fR, \fB\-\-help\fR
+Display help text and exit.
+.TP
+\fB\-\-version\fR
+Display version information and exit.
.SH FILESYSTEM SPECIFIC OPTIONS
.B Options which are not understood by fsck are passed to the filesystem-specific checker!
.PP
return status;
}
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] -- [fs-options] [<filesystem> ...]\n"),
program_invocation_short_name);
fputs(_(" -t <type> specify filesystem types to be checked;\n"
" <type> is allowed to be a comma-separated list\n"), out);
fputs(_(" -V explain what is being done\n"), out);
- fputs(_(" -? display this help and exit\n"), out);
+ fputs(USAGE_SEPARATOR, out);
+ fputs(_(" -?, --help display this help and exit\n"), out);
+ fputs(_(" --version output version information and exit\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("See the specific fsck.* commands for available fs-options."), out);
fprintf(out, USAGE_MAN_TAIL("fsck(8)"));
-
- exit(out == stderr ? FSCK_EX_USAGE : FSCK_EX_OK);
+ exit(FSCK_EX_OK);
}
static void signal_cancel(int sig __attribute__((__unused__)))
arg = argv[i];
if (!arg)
continue;
+
+ /* the only two longopts to satisfy UL standards */
+ if (!opts_for_fsck && !strcmp(arg, "--help"))
+ usage();
+ if (!opts_for_fsck && !strcmp(arg, "--version")) {
+ printf(UTIL_LINUX_VERSION);
+ exit(FSCK_EX_OK);
+ }
+
if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
if (num_devices >= MAX_DEVICES)
errx(FSCK_EX_ERROR, _("too many devices"));
case 't':
tmp = NULL;
if (fstype)
- usage(stderr);
+ errx(FSCK_EX_USAGE,
+ _("option '%s' may be specified only once"), "-t");
if (arg[j+1])
tmp = arg+j+1;
else if ((i+1) < argc)
tmp = argv[++i];
else
- usage(stderr);
+ errx(FSCK_EX_USAGE,
+ _("option '%s' requires an argument"), "-t");
fstype = xstrdup(tmp);
compile_fs_type(fstype, &fs_type_compiled);
goto next_arg;
opts_for_fsck++;
break;
case '?':
- usage(stdout);
+ usage();
break;
default:
options[++opt] = arg[j];