diff options
author | Milan Broz | 2012-07-26 15:52:05 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-26 16:37:03 +0200 |
commit | 43bca8278647ad5a3ae233da56fe1e87c086afe2 (patch) | |
tree | 4fa69b2c38618a784db215226b11e29844b87403 /misc-utils/lsblk.c | |
parent | lib/strutils: add string_add_to_idarray() - parse and add to id list (diff) | |
download | kernel-qcow2-util-linux-43bca8278647ad5a3ae233da56fe1e87c086afe2.tar.gz kernel-qcow2-util-linux-43bca8278647ad5a3ae233da56fe1e87c086afe2.tar.xz kernel-qcow2-util-linux-43bca8278647ad5a3ae233da56fe1e87c086afe2.zip |
lsblk: support -o +<attr> for adding attribute to output fields.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r-- | misc-utils/lsblk.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index cfd1d3b9e..1a0943b3e 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -1213,6 +1213,7 @@ int main(int argc, char *argv[]) struct lsblk _ls; int tt_flags = TT_FL_TREE; int i, c, status = EXIT_FAILURE; + char *outarg = NULL; static const struct option longopts[] = { { "all", 0, 0, 'a' }, @@ -1286,11 +1287,7 @@ int main(int argc, char *argv[]) tt_flags |= TT_FL_NOHEADINGS; break; case 'o': - ncolumns = string_to_idarray(optarg, - columns, ARRAY_SIZE(columns), - column_name_to_id); - if (ncolumns < 0) - return EXIT_FAILURE; + outarg = optarg; break; case 'P': tt_flags |= TT_FL_EXPORT; @@ -1356,6 +1353,10 @@ int main(int argc, char *argv[]) columns[ncolumns++] = COL_TARGET; } + if (outarg && string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns), + &ncolumns, column_name_to_id) < 0) + return EXIT_FAILURE; + if (nexcludes == 0 && nincludes == 0) excludes[nexcludes++] = 1; /* default: ignore RAM disks */ |