summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
authorMilan Broz2012-03-05 22:07:10 +0100
committerKarel Zak2012-03-08 16:19:57 +0100
commit5791238768d6a2ca46bb140cde70b1fcf200afff (patch)
tree9d2fd99c4f837eeab7b3d981a89affa917183eef /misc-utils/lsblk.c
parentwipefs: Fix mismatch if more -o options used. (diff)
downloadkernel-qcow2-util-linux-5791238768d6a2ca46bb140cde70b1fcf200afff.tar.gz
kernel-qcow2-util-linux-5791238768d6a2ca46bb140cde70b1fcf200afff.tar.xz
kernel-qcow2-util-linux-5791238768d6a2ca46bb140cde70b1fcf200afff.zip
lsblk: add --version switch
[kzak@redhat.com: - update usage() and man page] Signed-off-by: Milan Broz <mbroz@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 2eb2b7237..4709aaaae 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -1085,14 +1085,15 @@ static void __attribute__((__noreturn__)) help(FILE *out)
" -P, --pairs use key=\"value\" output format\n"
" -r, --raw use raw output format\n"
" -s, --inverse inverse dependencies\n"
- " -t, --topology output info about topology\n"));
+ " -t, --topology output info about topology\n"
+ " -V, --version output version information and exit\n"));
- fprintf(out, _("\nAvailable columns:\n"));
+ fprintf(out, _("\nAvailable columns (for --output):\n"));
for (i = 0; i < NCOLS; i++)
- fprintf(out, " %10s %s\n", infos[i].name, _(infos[i].help));
+ fprintf(out, " %11s %s\n", infos[i].name, _(infos[i].help));
- fprintf(out, _("\nFor more information see lsblk(8).\n"));
+ fprintf(out, USAGE_MAN_TAIL("lsblk(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}
@@ -1133,6 +1134,7 @@ int main(int argc, char *argv[])
{ "exclude", 1, 0, 'e' },
{ "topology", 0, 0, 't' },
{ "pairs", 0, 0, 'P' },
+ { "version", 0, 0, 'V' },
{ NULL, 0, 0, 0 },
};
@@ -1143,7 +1145,7 @@ int main(int argc, char *argv[])
lsblk = &_ls;
memset(lsblk, 0, sizeof(*lsblk));
- while((c = getopt_long(argc, argv, "abdDe:fhlnmo:Pirst", longopts, NULL)) != -1) {
+ while((c = getopt_long(argc, argv, "abdDe:fhlnmo:PirstV", longopts, NULL)) != -1) {
switch(c) {
case 'a':
lsblk->all_devices = 1;
@@ -1222,6 +1224,10 @@ int main(int argc, char *argv[])
columns[ncolumns++] = COL_SCHED;
columns[ncolumns++] = COL_RQ_SIZE;
break;
+ case 'V':
+ printf(_("%s from %s\n"), program_invocation_short_name,
+ PACKAGE_STRING);
+ return EXIT_SUCCESS;
default:
help(stderr);
}