util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: util-linux@vger.kernel.org
Cc: Milan Broz <mbroz@redhat.com>
Subject: [PATCH 5/5] wdctl: support -o +<attr> for adding attribute to output fields.
Date: Thu, 26 Jul 2012 15:52:08 +0200	[thread overview]
Message-ID: <1343310728-16624-5-git-send-email-mbroz@redhat.com> (raw)
In-Reply-To: <1343310728-16624-1-git-send-email-mbroz@redhat.com>


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


  parent reply	other threads:[~2012-07-26 13:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 12:14 [PATCH] lsblk: support -o +<attr> for adding attribute to output fields Milan Broz
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 14:47     ` Karel Zak
2012-07-26 13:52   ` [PATCH 3/5] partx: " Milan Broz
2012-07-26 14:47     ` Karel Zak
2012-07-26 13:52   ` [PATCH 4/5] findmnt: " Milan Broz
2012-07-26 14:47     ` Karel Zak
2012-07-26 13:52   ` Milan Broz [this message]
2012-07-26 14:48     ` [PATCH 5/5] wdctl: " Karel Zak
2012-07-26 14:46   ` [PATCH 1/5] Add string_add_to_idarray() - parse and add to id list Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343310728-16624-5-git-send-email-mbroz@redhat.com \
    --to=mbroz@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).