From a58600d0bd67c5f567a48d5b5331dc014ab8e5e0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 6 Jan 2023 16:07:34 +0100 Subject: [PATCH] mount: split and cleanup usage() * split usage() strings to message-per-line (like we use in others tools), it's better for maintenance * use fputs() rather than unnecessary printf() Signed-off-by: Karel Zak --- sys-utils/mount.c | 126 ++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 71 deletions(-) diff --git a/sys-utils/mount.c b/sys-utils/mount.c index 283998f3be..6590272c7d 100644 --- a/sys-utils/mount.c +++ b/sys-utils/mount.c @@ -478,8 +478,9 @@ static int has_remount_flag(struct libmnt_context *cxt) static void __attribute__((__noreturn__)) usage(void) { FILE *out = stdout; + fputs(USAGE_HEADER, out); - fprintf(out, _( + printf(_( " %1$s [-lhV]\n" " %1$s -a [options]\n" " %1$s [options] [--source] | [--target] \n" @@ -491,80 +492,63 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_("Mount a filesystem.\n"), out); fputs(USAGE_OPTIONS, out); - fprintf(out, _( - " -a, --all mount all filesystems mentioned in fstab\n" - " -c, --no-canonicalize don't canonicalize paths\n" - " -f, --fake dry run; skip the mount(2) syscall\n" - " -F, --fork fork off for each device (use with -a)\n" - " -T, --fstab alternative file to /etc/fstab\n")); - fprintf(out, _( - " -i, --internal-only don't call the mount. helpers\n")); - fprintf(out, _( - " -l, --show-labels show also filesystem labels\n")); - fprintf(out, _( - " -m, --mkdir[=] alias to '-o X-mount.mkdir[=]'\n")); - fprintf(out, _( - " -n, --no-mtab don't write to /etc/mtab\n")); - fprintf(out, _( - " --options-mode \n" - " what to do with options loaded from fstab\n" - " --options-source \n" - " mount options source\n" - " --options-source-force\n" - " force use of options from fstab/mtab\n")); - fprintf(out, _( - " --onlyonce check if filesystem is already mounted\n")); - fprintf(out, _( - " -o, --options comma-separated list of mount options\n" - " -O, --test-opts limit the set of filesystems (use with -a)\n" - " -r, --read-only mount the filesystem read-only (same as -o ro)\n" - " -t, --types limit the set of filesystem types\n")); - fprintf(out, _( - " --source explicitly specifies source (path, label, uuid)\n" - " --target explicitly specifies mountpoint\n")); - fprintf(out, _( - " --target-prefix \n" - " specifies path used for all mountpoints\n")); - fprintf(out, _( - " -v, --verbose say what is being done\n")); - fprintf(out, _( - " -w, --rw, --read-write mount the filesystem read-write (default)\n")); - fprintf(out, _( - " -N, --namespace perform mount in another namespace\n")); + fputs(_(" -a, --all mount all filesystems mentioned in fstab\n"), out); + fputs(_(" -c, --no-canonicalize don't canonicalize paths\n"), out); + fputs(_(" -f, --fake dry run; skip the mount(2) syscall\n"), out); + fputs(_(" -F, --fork fork off for each device (use with -a)\n"), out); + fputs(_(" -T, --fstab alternative file to /etc/fstab\n"), out); + fputs(_(" -i, --internal-only don't call the mount. helpers\n"), out); + fputs(_(" -l, --show-labels show also filesystem labels\n"), out); + fputs(_(" -m, --mkdir[=] alias to '-o X-mount.mkdir[=]'\n"), out); + fputs(_(" -n, --no-mtab don't write to /etc/mtab\n"), out); + fputs(_(" --options-mode \n" + " what to do with options loaded from fstab\n"), out); + fputs(_(" --options-source \n" + " mount options source\n"), out); + fputs(_(" --options-source-force\n" + " force use of options from fstab/mtab\n"), out); + fputs(_(" --onlyonce check if filesystem is already mounted\n"), out); + fputs(_(" -o, --options comma-separated list of mount options\n"), out); + fputs(_(" -O, --test-opts limit the set of filesystems (use with -a)\n"), out); + fputs(_(" -r, --read-only mount the filesystem read-only (same as -o ro)\n"), out); + fputs(_(" -t, --types limit the set of filesystem types\n"), out); + fputs(_(" --source explicitly specifies source (path, label, uuid)\n"), out); + fputs(_(" --target explicitly specifies mountpoint\n"), out); + fputs(_(" --target-prefix \n" + " specifies path used for all mountpoints\n"), out); + fputs(_(" -v, --verbose say what is being done\n"), out); + fputs(_(" -w, --rw, --read-write mount the filesystem read-write (default)\n"), out); + fputs(_(" -N, --namespace perform mount in another namespace\n"), out); fputs(USAGE_SEPARATOR, out); printf(USAGE_HELP_OPTIONS(25)); - fprintf(out, _( - "\nSource:\n" - " -L, --label