From 80237630af0b2241a8a756d7ed7d2be3f80cfec5 Mon Sep 17 00:00:00 2001
From: Nathan Jones <nathanj@insightbb.com>
Date: Fri, 1 Jun 2007 11:00:39 -0400
Subject: Change -z|--showsize flag to ShowSize pacman.conf option

Also cleaned up some duplicate printf lines related to the ShowSize option.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
---
 lib/libalpm/alpm.c   | 3 +++
 lib/libalpm/alpm.h   | 3 +++
 lib/libalpm/handle.c | 6 ++++++
 lib/libalpm/handle.h | 1 +
 4 files changed, 13 insertions(+)

(limited to 'lib')

diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index d0f87462..33270149 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -958,6 +958,9 @@ int SYMEXPORT alpm_parse_config(char *file, alpm_cb_db_register callback, const
 				} else if(strcmp(origkey, "UseColor") == 0 || strcmp(key, "USECOLOR") == 0) {
 					alpm_option_set_usecolor(1);
 					_alpm_log(PM_LOG_DEBUG, _("config: usecolor"));
+				} else if(strcmp(origkey, "ShowSize") == 0 || strcmp(key, "SHOWSIZE") == 0) {
+					alpm_option_set_showsize(1);
+					_alpm_log(PM_LOG_DEBUG, _("config: showsize"));
 				} else {
 					RET_ERR(PM_ERR_CONF_BAD_SYNTAX, -1);
 				}
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 4d551c8f..4c210562 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -147,6 +147,9 @@ void alpm_option_set_needles(alpm_list_t *needles);
 unsigned short alpm_option_get_usecolor();
 void alpm_option_set_usecolor(unsigned short usecolor);
 
+unsigned short alpm_option_get_showsize();
+void alpm_option_set_showsize(unsigned short showsize);
+
 pmdb_t *alpm_option_get_localdb();
 alpm_list_t *alpm_option_get_syncdbs();
 
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 7eb8dc36..9aa7cce1 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -140,6 +140,7 @@ const char *alpm_option_get_xfercommand() { return handle->xfercommand; }
 unsigned short alpm_option_get_nopassiveftp() { return handle->nopassiveftp; }
 unsigned short SYMEXPORT alpm_option_get_chomp() { return handle->chomp; }
 unsigned short alpm_option_get_usecolor() { return handle->use_color; }
+unsigned short SYMEXPORT alpm_option_get_showsize() { return handle->showsize; }
 
 pmdb_t SYMEXPORT *alpm_option_get_localdb() { return handle->db_local; }
 alpm_list_t SYMEXPORT *alpm_option_get_syncdbs()
@@ -308,4 +309,9 @@ void alpm_option_set_usecolor(unsigned short usecolor)
 	handle->use_color = usecolor;
 }
 
+void alpm_option_set_showsize(unsigned short showsize)
+{
+	handle->showsize = showsize;
+}
+
 /* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index b3311db6..884dfc57 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -66,6 +66,7 @@ typedef struct _pmhandle_t {
 	unsigned short nopassiveftp; /* Don't use PASV ftp connections */
 	unsigned short chomp;			/* I Love Candy! */
 	unsigned short use_color; /* enable colorful output */
+	unsigned short showsize;  /* Show individual package sizes */
 } pmhandle_t;
 
 extern pmhandle_t *handle;
-- 
cgit v1.2.3-70-g09d2