Yep, that patch got garbled something fierce. Thunderbird is to blame. I
tried git send-email, but it was too complicated, so I'm just sending
the patch as an attachment. Nothing should get garbled this time.

On 2016-01-11 00:32, Eric Toombs wrote:
> That's a pretty good improvement, but there is also a long delay while
> pacman calculates dependencies for large upgrades. You might say that
> could be avoided by upgrading more frequently, but it is my style and
> the style of many others to opt for large monthly upgrades over small
> weekly or daily upgrades. I'll try formatting the patch again with git
> send-email.
>
> On 2015-12-14 12:12, Andrew Gregory wrote:
>> On 11/19/15 at 07:09am, Eric Toombs wrote:
>>> This switch rings the terminal bell when user input is required.
>>> Obviously, it has no effect if --noconfirm is also passed.
>>> ---
>> If your only interest in this is to get a notification when downloads
>> are done because you have a slow connection, wouldn't a small wrapper
>> script accomplish the same goal?
>>
>>  pacman -Sy && printf "\a" && pacman -Su
>>
>> This patch also appears to have some mangled whitespace.  Please use
>> `git send-email` to submit patches.
>>
>> apg

>From 298308f70b387559381b9450c8a11303ba5c06b5 Mon Sep 17 00:00:00 2001
From: Eric Toombs <[email protected]>
Date: Wed, 13 Jan 2016 11:33:30 -0500
Subject: [PATCH] Added the --bell switch

This switch rings the terminal bell when user input is required.
---
 doc/pacman.8.txt    |  3 +++
 src/pacman/conf.h   |  4 +++-
 src/pacman/pacman.c |  3 +++
 src/pacman/util.c   | 15 +++++++++------
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
index 514f559..72839e5 100644
--- a/doc/pacman.8.txt
+++ b/doc/pacman.8.txt
@@ -148,6 +148,9 @@ Options
 *\--arch* <arch>::
 	Specify an alternate architecture.
 
+ *\--bell*::
+	Sound the terminal bell when input is required.
+
 *\--cachedir* <dir>::
 	Specify an alternative package cache location (a typical default is
 	+{localstatedir}/cache/pacman/pkg+). Multiple cache directories can be
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 2aba8bf..6457c5d 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -55,6 +55,7 @@ typedef struct __config_t {
 	unsigned short checkspace;
 	unsigned short usesyslog;
 	unsigned short color;
+	unsigned short bell;
 	double deltaratio;
 	char *arch;
 	char *print_format;
@@ -201,7 +202,8 @@ enum {
 	OP_VERBOSE,
 	OP_DOWNLOADONLY,
 	OP_REFRESH,
-	OP_ASSUMEINSTALLED
+	OP_ASSUMEINSTALLED,
+	OP_BELL
 };
 
 /* clean method */
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index be52d1b..fb8a745 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -221,6 +221,7 @@ static void usage(int op, const char * const myname)
 		addlist(_("      --logfile <path> set an alternate log file\n"));
 		addlist(_("      --noconfirm      do not ask for any confirmation\n"));
 		addlist(_("      --confirm        always ask for confirmation\n"));
+		addlist(_("      --bell           sound the terminal bell when input is required\n"));
 	}
 	list = alpm_list_msort(list, alpm_list_count(list), options_cmp);
 	for(i = list; i; i = alpm_list_next(i)) {
@@ -433,6 +434,7 @@ static int parsearg_global(int opt)
 		case OP_CONFIRM:
 			config->noconfirm = 0;
 			break;
+		case OP_BELL: config->bell = 1; break;
 		case OP_DBPATH:
 		case 'b':
 			free(config->dbpath);
@@ -934,6 +936,7 @@ static int parseargs(int argc, char *argv[])
 		{"gpgdir",     required_argument, 0, OP_GPGDIR},
 		{"dbonly",     no_argument,       0, OP_DBONLY},
 		{"color",      required_argument, 0, OP_COLOR},
+		{"bell",       no_argument,       0, OP_BELL},
 		{0, 0, 0, 0}
 	};
 
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 48a3600..bcb08ab 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1396,13 +1396,14 @@ int multiselect_question(char *array, int count)
 		fprintf(stream, "\n");
 		fprintf(stream, _("Enter a selection (default=all)"));
 		fprintf(stream, ": ");
-		fflush(stream);
 
 		if(config->noconfirm) {
 			fprintf(stream, "\n");
 			break;
+		} else if(config->bell) {
+			fprintf(stream, "\a");
 		}
-
+		fflush(stream);
 		flush_term_input(fileno(stdin));
 
 		if(safe_fgets(response, response_len, stdin)) {
@@ -1463,13 +1464,14 @@ int select_question(int count)
 		fprintf(stream, "\n");
 		fprintf(stream, _("Enter a number (default=%d)"), preset);
 		fprintf(stream, ": ");
-		fflush(stream);
 
 		if(config->noconfirm) {
 			fprintf(stream, "\n");
 			break;
+		} else if(config->bell) {
+			fprintf(stream, "\a");
 		}
-
+		fflush(stream);
 		flush_term_input(fileno(stdin));
 
 		if(safe_fgets(response, sizeof(response), stdin)) {
@@ -1517,13 +1519,14 @@ static int question(short preset, const char *format, va_list args)
 	}
 
 	fputs(config->colstr.nocolor, stream);
-	fflush(stream);
 
 	if(config->noconfirm) {
 		fprintf(stream, "\n");
 		return preset;
+	} else if(config->bell) {
+		fprintf(stream, "\a");
 	}
-
+	fflush(stream);
 	flush_term_input(fd_in);
 
 	if(safe_fgets(response, sizeof(response), stdin)) {
-- 
2.7.0

Reply via email to