From 1ff8e7f364a9f640ada7526384646d510ac29967 Mon Sep 17 00:00:00 2001
From: Dan McGee <dan@archlinux.org>
Date: Mon, 20 Aug 2007 16:34:43 -0400
Subject: Remove the non-user friendly --ask option

Signed-off-by: Dan McGee <dan@archlinux.org>
---
 src/pacman/callback.c | 123 ++++++++++++++------------------------------------
 src/pacman/conf.h     |   2 -
 src/pacman/pacman.c   |   3 --
 3 files changed, 35 insertions(+), 93 deletions(-)

(limited to 'src')

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 0e4ef11a..6d257133 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -255,118 +255,65 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
 
 	switch(event) {
 		case PM_TRANS_CONV_INSTALL_IGNOREPKG:
-			if(config->noask) {
-				if(config->ask & PM_TRANS_CONV_INSTALL_IGNOREPKG) {
-					*response = 1;
-				} else {
-					*response = 0;
-				}
-			} else if(data2) {
+			if(data2) {
 				/* TODO we take this route based on data2 being not null? WTF */
 				snprintf(str, LOG_STR_LEN, _(":: %s requires installing %s from IgnorePkg. Install anyway? [Y/n] "),
-				         alpm_pkg_get_name(data1),
-				         alpm_pkg_get_name(data2));
+						alpm_pkg_get_name(data1),
+						alpm_pkg_get_name(data2));
 				*response = yesno(str);
 			} else {
 				snprintf(str, LOG_STR_LEN, _(":: %s is in IgnorePkg. Install anyway? [Y/n] "),
-				         alpm_pkg_get_name(data1));
+						alpm_pkg_get_name(data1));
 				*response = yesno(str);
 			}
 			break;
 		case PM_TRANS_CONV_REMOVE_HOLDPKG:
-			if(config->noask) {
-				if(config->ask & PM_TRANS_CONV_REMOVE_HOLDPKG) {
-					*response = 1;
-				} else {
-					*response = 0;
-				}
-			} else {
-				snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
-				         alpm_pkg_get_name(data1));
-				*response = yesno(str);
-			}
+			snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
+					alpm_pkg_get_name(data1));
+			*response = yesno(str);
 			break;
 		case PM_TRANS_CONV_REPLACE_PKG:
-			if(config->noask) {
-				if(config->ask & PM_TRANS_CONV_REPLACE_PKG) {
-					*response = 1;
-				} else {
-					*response = 0;
-				}
-			} else {
-				snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
-				         alpm_pkg_get_name(data1),
-				         (char *)data3,
-				         alpm_pkg_get_name(data2));
-				*response = yesno(str);
-			}
+			snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
+					alpm_pkg_get_name(data1),
+					(char *)data3,
+					alpm_pkg_get_name(data2));
+			*response = yesno(str);
 			break;
 		case PM_TRANS_CONV_CONFLICT_PKG:
-			if(config->noask) {
-				if(config->ask & PM_TRANS_CONV_CONFLICT_PKG) {
-					*response = 1;
-				} else {
-					*response = 0;
-				}
-			} else {
-				snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
-				         (char *)data1,
-				         (char *)data2,
-				         (char *)data2);
-				*response = yesno(str);
-			}
+			snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
+					(char *)data1,
+					(char *)data2,
+					(char *)data2);
+			*response = yesno(str);
 			break;
 		case PM_TRANS_CONV_LOCAL_NEWER:
-			if(config->noask) {
-				if(config->ask & PM_TRANS_CONV_LOCAL_NEWER) {
-					*response = 1;
-				} else {
-					*response = 0;
-				}
+
+			if(!config->op_s_downloadonly) {
+				snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
+						alpm_pkg_get_name(data1),
+						alpm_pkg_get_version(data1));
+				*response = yesno(str);
 			} else {
-				if(!config->op_s_downloadonly) {
-					snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
-				         alpm_pkg_get_name(data1),
-				         alpm_pkg_get_version(data1));
-					*response = yesno(str);
-				} else {
-					*response = 1;
-				}
+				*response = 1;
 			}
 			break;
 		case PM_TRANS_CONV_LOCAL_UPTODATE:
-			if(config->noask) {
-				if(config->ask & PM_TRANS_CONV_LOCAL_UPTODATE) {
-					*response = 1;
-				} else {
-					*response = 0;
-				}
+			if(!config->op_s_downloadonly) {
+				snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "),
+						alpm_pkg_get_name(data1),
+						alpm_pkg_get_version(data1));
+				*response = yesno(str);
 			} else {
-				if(!config->op_s_downloadonly) {
-					snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "),
-				         alpm_pkg_get_name(data1),
-				         alpm_pkg_get_version(data1));
-					*response = yesno(str);
-				} else {
-					*response = 1;
-				}
+				*response = 1;
 			}
 			break;
 		case PM_TRANS_CONV_CORRUPTED_PKG:
-			if(config->noask) {
-				if(config->ask & PM_TRANS_CONV_CORRUPTED_PKG) {
-					*response = 1;
-				} else {
-					*response = 0;
-				}
+			if(!config->noconfirm) {
+				snprintf(str, LOG_STR_LEN, _(":: Archive %s is corrupted. Do you want to delete it? [Y/n] "),
+						(char *)data1);
+				*response = yesno(str);
 			} else {
-				if(!config->noconfirm) {
-					snprintf(str, LOG_STR_LEN, _(":: Archive %s is corrupted. Do you want to delete it? [Y/n] "),
-				         (char *)data1);
-					*response = yesno(str);
-				} else {
-					*response = 1;
-				}
+				*response = 1;
 			}
 			break;
 	}
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 85889d19..4283af7d 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -60,8 +60,6 @@ typedef struct __config_t {
 
 	unsigned short group;
 	pmtransflag_t flags;
-	unsigned short noask;
-	unsigned int ask;
 
 	/* conf file options */
 	unsigned short chomp; /* I Love Candy! */
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 74493986..54a962a8 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -141,7 +141,6 @@ static void usage(int op, char *myname)
 		}
 		printf(_("      --config <path>  set an alternate configuration file\n"));
 		printf(_("      --noconfirm      do not ask for any confirmation\n"));
-		printf(_("      --ask <number>   pre-specify answers for questions (see manpage)\n"));
 		printf(_("      --noprogressbar  do not show a progress bar when downloading files\n"));
 		printf(_("      --noscriptlet    do not execute the install scriptlet if one exists\n"));
 		printf(_("  -v, --verbose        be verbose\n"));
@@ -285,7 +284,6 @@ static int parseargs(int argc, char *argv[])
 		{"debug",      optional_argument, 0, 1003},
 		{"noprogressbar", no_argument,    0, 1004},
 		{"noscriptlet", no_argument,      0, 1005},
-		{"ask",        required_argument, 0, 1006},
 		{"cachedir",   required_argument, 0, 1007},
 		{"asdeps",     no_argument,       0, 1008},
 		{0, 0, 0, 0}
@@ -330,7 +328,6 @@ static int parseargs(int argc, char *argv[])
 				break;
 			case 1004: config->noprogressbar = 1; break;
 			case 1005: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break;
-			case 1006: config->noask = 1; config->ask = atoi(optarg); break;
 			case 1007:
 				if(alpm_option_add_cachedir(optarg) != 0) {
 					pm_printf(PM_LOG_ERROR, _("problem adding cachedir '%s' (%s)\n"),
-- 
cgit v1.2.3-54-g00ecf