public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/display/display.c
Date: Wed, 23 Nov 2011 01:34:00 -0000	[thread overview]
Message-ID: <20111123013439.5790.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-11-23 01:34:38

Modified files:
	.              : WHATS_NEW 
	lib/display    : display.c 

Log message:
	Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
	
	(Note that in a future release we might make this stricter and insist
	on exactly 'y' or 'n'.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2195&r2=1.2196
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122

--- LVM2/WHATS_NEW	2011/11/21 12:44:38	1.2195
+++ LVM2/WHATS_NEW	2011/11/23 01:34:38	1.2196
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
   Replace the unit testing framework with CUnit (--enable-testing).
   Fix dmeventd snapshot monitoring when multiple extensions were involved.
   Don't ignore configure --mandir and --infodir.
--- LVM2/lib/display/display.c	2011/10/04 12:39:59	1.121
+++ LVM2/lib/display/display.c	2011/11/23 01:34:38	1.122
@@ -850,9 +850,10 @@
 	do {
 		if (c == '\n' || !c) {
 			va_start(ap, prompt);
-			vprintf(prompt, ap);
+			vfprintf(stderr, prompt, ap);
 			va_end(ap);
-			fflush(stdout);
+			fflush(stderr);
+			ret = 0;
 		}
 
 		if ((c = getchar()) == EOF) {
@@ -861,9 +862,14 @@
 		}
 
 		c = tolower(c);
-		if ((c == 'y') || (c == 'n'))
-			ret = c;
-	} while (!ret || c != '\n');
+		if ((c == 'y') || (c == 'n')) {
+			/* If both 'y' and 'n' given, begin again. */
+			if (ret && c != ret)
+				ret = -1;
+			else
+				ret = c;
+		}
+	} while (ret < 1 || c != '\n');
 
 	sigint_restore();
 


             reply	other threads:[~2011-11-23  1:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23  1:34 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-13 14:23 zkabelac
2009-11-03 10:50 zkabelac
2009-09-30 14:19 agk
2009-09-28 16:36 agk
2007-05-31 14:19 wysochanski
2004-05-28 12:47 agk

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=20111123013439.5790.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).