[PATCH 5/5] wdctl: support -o +<attr> for adding attribute to output fields.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Milan Broz <mbroz@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux