util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>, Petr Uzel <petr.uzel@suse.cz>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH 1/7] fdisk: stop buffering welcome message
Date: Sun, 27 May 2012 21:43:56 +0200	[thread overview]
Message-ID: <1338147836.22474.0.camel@offbook> (raw)

From: Davidlohr Bueso <dave@gnu.org>

Recently, commit 0a86755fe8af1da510d2eca43bdfcd70af098c19 directed the welcome message output from stderr to stdout breaking regression tests.
Correct this by flushing stdout and stop buffering the output - a trivial function is created as well.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 fdisk/fdisk.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 12706c2..084253d 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1984,6 +1984,15 @@ unknown_command(int c) {
 	printf(_("%c: unknown command\n"), c);
 }
 
+static void print_welcome(void)
+{
+	printf(_("Welcome to fdisk (%s).\n\n"
+		 "Changes will remain in memory only, until you decide to write them.\n"
+		 "Be careful before using the write command.\n\n"), PACKAGE_STRING);
+
+	fflush(stdout);
+}
+
 static void command_prompt(void)
 {
 	int c;
@@ -2211,9 +2220,7 @@ int main(int argc, char **argv)
 	else
 		usage(stderr);
 
-	printf(_("Welcome to fdisk (%s).\n\n"
-		"Changes will remain in memory only, until you decide to write them.\n"
-		"Be careful before using the write command.\n\n"), PACKAGE_STRING);
+	print_welcome();
 
 	gpt_warning(cxt->dev_path);
 	get_boot(0);
-- 
1.7.4.1





             reply	other threads:[~2012-05-27 19:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27 19:43 Davidlohr Bueso [this message]
2012-06-06  8:14 ` [PATCH 1/7] fdisk: stop buffering welcome message 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=1338147836.22474.0.camel@offbook \
    --to=dave@gnu.org \
    --cc=kzak@redhat.com \
    --cc=petr.uzel@suse.cz \
    --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).