public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 2/4] uuidd: set options to be mutually exclusive
Date: Sun, 25 May 2014 11:59:38 +0100	[thread overview]
Message-ID: <1401015580-27951-2-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1401015580-27951-1-git-send-email-kerolasa@iki.fi>

--pid     || --no-pid
--debug   || --quiet
--timeout || --socket-activation
--random  || --time

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/uuidd.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index 5730919..1f4a38b 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -37,6 +37,7 @@ extern int optind;
 #include "c.h"
 #include "closestream.h"
 #include "strutils.h"
+#include "optutils.h"
 
 #ifdef HAVE_LIBSYSTEMD
 # include <systemd/sd-daemon.h>
@@ -510,6 +511,14 @@ int main(int argc, char **argv)
 		{"help", no_argument, NULL, 'h'},
 		{NULL, 0, NULL, 0}
 	};
+	static const ul_excl_t excl[] = {
+		{ 'P', 'p' },
+		{ 'S', 'T' },
+		{ 'd', 'q' },
+		{ 'r', 't' },
+		{ 0 }
+	};
+	int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
 
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
@@ -519,6 +528,7 @@ int main(int argc, char **argv)
 	while ((c =
 		getopt_long(argc, argv, "p:s:T:krtn:PFSdqVh", longopts,
 			    NULL)) != -1) {
+		err_exclusive_options(c, longopts, excl, excl_st);
 		switch (c) {
 		case 'd':
 			uuidd_cxt.debug = 1;
@@ -576,9 +586,6 @@ int main(int argc, char **argv)
 		}
 	}
 
-	if (no_pid && pidfile_path_param && !uuidd_cxt.quiet)
-		warnx(_("Both --pid and --no-pid specified. Ignoring --no-pid."));
-
 	if (!no_pid && !pidfile_path_param)
 		pidfile_path = UUIDD_PIDFILE_PATH;
 	else if (pidfile_path_param)
-- 
1.9.3


  reply	other threads:[~2014-05-25 10:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-25 10:59 [PATCH 1/4] uuidd: ensure pid file is wrote when it is requested Sami Kerola
2014-05-25 10:59 ` Sami Kerola [this message]
2014-05-26  9:50   ` [PATCH 2/4] uuidd: set options to be mutually exclusive Karel Zak
2014-05-26 15:49     ` Sami Kerola
2014-05-25 10:59 ` [PATCH 3/4] uuidgen: use type definitions from uuid.h Sami Kerola
2014-05-25 10:59 ` [PATCH 4/4] uuidd: do not mix signed type and unsigned code Sami Kerola

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=1401015580-27951-2-git-send-email-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --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