* [PATCH 2/5] lsblk: support -o +<attr> for adding attribute to output fields.
2012-07-26 13:52 ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Milan Broz
@ 2012-07-26 13:52 ` Milan Broz
2012-07-26 14:47 ` Karel Zak
2012-07-26 13:52 ` [PATCH 3/5] partx: " Milan Broz
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Milan Broz @ 2012-07-26 13:52 UTC (permalink / raw)
To: util-linux; +Cc: Milan Broz
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
misc-utils/lsblk.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index cb2b768..19c8edd 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;
enum {
EXCL_NONE,
@@ -1290,11 +1291,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':
exclusive_option(&excl_rlP, EXCL_PAIRS, "--{raw,list,pairs}");
@@ -1363,6 +1360,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 */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 3/5] partx: support -o +<attr> for adding attribute to output fields.
2012-07-26 13:52 ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Milan Broz
2012-07-26 13:52 ` [PATCH 2/5] lsblk: support -o +<attr> for adding attribute to output fields Milan Broz
@ 2012-07-26 13:52 ` Milan Broz
2012-07-26 14:47 ` Karel Zak
2012-07-26 13:52 ` [PATCH 4/5] findmnt: " Milan Broz
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Milan Broz @ 2012-07-26 13:52 UTC (permalink / raw)
To: util-linux; +Cc: Milan Broz
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
disk-utils/partx.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/disk-utils/partx.c b/disk-utils/partx.c
index 69c559d..8af33ab 100644
--- a/disk-utils/partx.c
+++ b/disk-utils/partx.c
@@ -643,6 +643,7 @@ int main(int argc, char **argv)
char *type = NULL;
char *device = NULL; /* pointer to argv[], ie: /dev/sda1 */
char *wholedisk = NULL; /* allocated, ie: /dev/sda */
+ char *outarg = NULL;
dev_t disk_devno = 0, part_devno = 0;
static const struct option long_opts[] = {
@@ -691,11 +692,7 @@ int main(int argc, char **argv)
errx(EXIT_FAILURE, _("failed to parse --nr <M-N> range"));
break;
case 'o':
- ncolumns = string_to_idarray(optarg,
- columns, ARRAY_SIZE(columns),
- column_name_to_id);
- if (ncolumns < 0)
- return EXIT_FAILURE;
+ outarg = optarg;
exclusive_option(&what, ACT_SHOW, ACT_ERROR);
break;
case 'P':
@@ -740,6 +737,11 @@ int main(int argc, char **argv)
columns[ncolumns++] = COL_UUID;
}
+ if (what == ACT_SHOW && outarg &&
+ string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns),
+ &ncolumns, column_name_to_id) < 0)
+ return EXIT_FAILURE;
+
/*
* Note that 'partx /dev/sda1' == 'partx /dev/sda1 /dev/sda'
* so assume that the device and/or disk are always the last
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 4/5] findmnt: support -o +<attr> for adding attribute to output fields.
2012-07-26 13:52 ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Milan Broz
2012-07-26 13:52 ` [PATCH 2/5] lsblk: support -o +<attr> for adding attribute to output fields Milan Broz
2012-07-26 13:52 ` [PATCH 3/5] partx: " Milan Broz
@ 2012-07-26 13:52 ` Milan Broz
2012-07-26 14:47 ` Karel Zak
2012-07-26 13:52 ` [PATCH 5/5] wdctl: " Milan Broz
2012-07-26 14:46 ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Karel Zak
4 siblings, 1 reply; 11+ messages in thread
From: Milan Broz @ 2012-07-26 13:52 UTC (permalink / raw)
To: util-linux; +Cc: Milan Broz
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
misc-utils/findmnt.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 6df2f06..482466b 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -1041,6 +1041,7 @@ int main(int argc, char *argv[])
int direction = MNT_ITER_FORWARD;
int i, c, rc = -1, timeout = -1;
int ntabfiles = 0, tabtype = 0;
+ char *outarg = NULL;
enum {
EXCL_NONE,
@@ -1150,11 +1151,7 @@ int main(int argc, char *argv[])
disable_columns_truncate();
break;
case 'o':
- ncolumns = string_to_idarray(optarg,
- columns, ARRAY_SIZE(columns),
- column_name_to_id);
- if (ncolumns < 0)
- exit(EXIT_FAILURE);
+ outarg = optarg;
break;
case 'O':
set_match(COL_OPTIONS, optarg);
@@ -1260,6 +1257,10 @@ int main(int argc, char *argv[])
columns[ncolumns++] = COL_OPTIONS;
}
+ if (outarg && string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns),
+ &ncolumns, column_name_to_id) < 0)
+ return EXIT_FAILURE;
+
if (!tabtype)
tabtype = TABTYPE_KERNEL;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 5/5] wdctl: support -o +<attr> for adding attribute to output fields.
2012-07-26 13:52 ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Milan Broz
` (2 preceding siblings ...)
2012-07-26 13:52 ` [PATCH 4/5] findmnt: " Milan Broz
@ 2012-07-26 13:52 ` Milan Broz
2012-07-26 14:48 ` Karel Zak
2012-07-26 14:46 ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Karel Zak
4 siblings, 1 reply; 11+ messages in thread
From: Milan Broz @ 2012-07-26 13:52 UTC (permalink / raw)
To: util-linux; +Cc: Milan Broz
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
sys-utils/wdctl.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c
index ebe55b4..6367130 100644
--- a/sys-utils/wdctl.c
+++ b/sys-utils/wdctl.c
@@ -381,6 +381,7 @@ int main(int argc, char *argv[])
int c, tt_flags = 0, res = EXIT_SUCCESS, count = 0;
char noflags = 0, noident = 0, notimeouts = 0, oneline = 0;
uint32_t wanted = 0;
+ char *outarg = NULL;
enum {
EXCL_NONE,
@@ -413,11 +414,7 @@ int main(int argc, char *argv[])
"d:f:hFnITo:OrVx", long_opts, NULL)) != -1) {
switch(c) {
case 'o':
- ncolumns = string_to_idarray(optarg,
- columns, ARRAY_SIZE(columns),
- column2id);
- if (ncolumns < 0)
- return EXIT_FAILURE;
+ outarg = optarg;
break;
case 'f':
exclusive_option(&excl_flag, EXCL_FLAGS, "--{flags,noflags}");
@@ -467,6 +464,10 @@ int main(int argc, char *argv[])
columns[ncolumns++] = COL_BSTATUS;
}
+ if (outarg && string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns),
+ &ncolumns, column2id) < 0)
+ return EXIT_FAILURE;
+
do {
int rc;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list.
2012-07-26 13:52 ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Milan Broz
` (3 preceding siblings ...)
2012-07-26 13:52 ` [PATCH 5/5] wdctl: " Milan Broz
@ 2012-07-26 14:46 ` Karel Zak
4 siblings, 0 replies; 11+ messages in thread
From: Karel Zak @ 2012-07-26 14:46 UTC (permalink / raw)
To: Milan Broz; +Cc: util-linux
On Thu, Jul 26, 2012 at 03:52:04PM +0200, Milan Broz wrote:
> include/strutils.h | 4 ++++
> lib/strutils.c | 26 ++++++++++++++++++++++++++
> 2 files changed, 30 insertions(+)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 11+ messages in thread