aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-01-21 21:53:47 +0000
committerJason Woodward2005-01-21 21:53:47 +0000
commitda13d214262162e4f8eb078165c53deb1d3fa28d (patch)
tree98a614285b932c8c274f563238d09d881826d17e /src
parente383a5740394c8c33972712da6213df5ab0ba7c2 (diff)
downloadslapt-get-da13d214262162e4f8eb078165c53deb1d3fa28d.tar.gz
if the actual number of suggestions that are not already present in the transaction is > 0, then print the suggestions header in the transaction report
Diffstat (limited to 'src')
-rw-r--r--src/transaction.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/transaction.c b/src/transaction.c
index f4cdacb..ca36a2c 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -61,22 +61,32 @@ int handle_transaction(const rc_config *global_config, transaction_t *tran){
/* show suggested pkgs */
if( tran->suggests->count > 0 ){
- unsigned int len = 0;
- printf(_("Suggested packages:\n"));
- printf(" ");
+ unsigned int len = 0,real_count = 0;
+
for(i = 0; i < tran->suggests->count; ++i){
/* don't show suggestion for something we already have in the transaction */
if( search_transaction(tran,tran->suggests->pkgs[i]) == 1 ) continue;
-
- if( len + strlen(tran->suggests->pkgs[i]) + 1 < MAX_LINE_LEN ){
- printf("%s ",tran->suggests->pkgs[i]);
- len += strlen(tran->suggests->pkgs[i]) + 1;
- }else{
- printf("\n %s ",tran->suggests->pkgs[i]);
- len = strlen(tran->suggests->pkgs[i]) + 3;
+ ++real_count;
+ }
+ if( real_count > 0 ){
+ printf(_("Suggested packages:\n"));
+ printf(" ");
+
+ for(i = 0; i < tran->suggests->count; ++i){
+ /* don't show suggestion for something we already have in the transaction */
+ if( search_transaction(tran,tran->suggests->pkgs[i]) == 1 ) continue;
+
+ if( len + strlen(tran->suggests->pkgs[i]) + 1 < MAX_LINE_LEN ){
+ printf("%s ",tran->suggests->pkgs[i]);
+ len += strlen(tran->suggests->pkgs[i]) + 1;
+ }else{
+ printf("\n %s ",tran->suggests->pkgs[i]);
+ len = strlen(tran->suggests->pkgs[i]) + 3;
+ }
}
+ printf("\n");
}
- printf("\n");
+
}
/* show pkgs to install */