[pacman-dev] [PATCH] pacman/util.c: flush output once for questions

Andrew Gregory andrew.gregory.8 at gmail.com
Tue Apr 2 19:53:44 EDT 2013


Convert a couple random tabs inside fprintf to spaces.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index 862c8e8..7b7dace 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1384,15 +1384,15 @@ int multiselect_question(char *array, int count)
 	*lastchar = 1;
 
 	while(1) {
 		memset(array, 1, count);
 
 		fprintf(stream, "\n");
 		fprintf(stream, _("Enter a selection (default=all)"));
-		fprintf(stream,	": ");
+		fprintf(stream, ": ");
 		fflush(stream);
 
 		if(config->noconfirm) {
 			fprintf(stream, "\n");
 			break;
 		}
 
@@ -1448,15 +1448,16 @@ int select_question(int count)
 		/* Use stderr so questions are always displayed when redirecting output */
 		stream = stderr;
 	}
 
 	while(1) {
 		fprintf(stream, "\n");
 		fprintf(stream, _("Enter a number (default=%d)"), preset);
-		fprintf(stream,	": ");
+		fprintf(stream, ": ");
+		fflush(stream);
 
 		if(config->noconfirm) {
 			fprintf(stream, "\n");
 			break;
 		}
 
 		flush_term_input(fileno(stdin));
@@ -1509,15 +1510,14 @@ static int question(short preset, const char *format, va_list args)
 	fflush(stream);
 
 	if(config->noconfirm) {
 		fprintf(stream, "\n");
 		return preset;
 	}
 
-	fflush(stream);
 	flush_term_input(fd_in);
 
 	if(fgets(response, sizeof(response), stdin)) {
 		size_t len = strtrim(response);
 		if(len == 0) {
 			return preset;
 		}
-- 
1.8.2



More information about the pacman-dev mailing list