From 600782853ad5317ee51423a03487abcf34efd166 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Tue, 18 Aug 2009 17:23:47 +0200 Subject: Quiet ShowSize with -Ss and -Qs This fixes FS#15923 PS : duplicated code ftw Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/query.c | 2 +- src/pacman/sync.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pacman') diff --git a/src/pacman/query.c b/src/pacman/query.c index 32752ffb..292cddfb 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -172,7 +172,7 @@ static int query_search(alpm_list_t *targets) } /* print the package size with the output if ShowSize option set */ - if(config->showsize) { + if(!config->quiet && config->showsize) { /* Convert byte size to MB */ double mbsize = (double)alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 7bfe454b..dc936219 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -308,7 +308,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) } /* print the package size with the output if ShowSize option set */ - if(config->showsize) { + if(!config->quiet && config->showsize) { /* Convert byte size to MB */ double mbsize = alpm_pkg_get_size(pkg) / (1024.0 * 1024.0); -- cgit v1.2.3-70-g09d2 From bba234a92ed9560bab1f1846870faa8303f98064 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Tue, 18 Aug 2009 16:56:19 +0200 Subject: query.c : return 1 when no package match For example, if no package is outdated, -Qu will return 1. This implements FS#15938 Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/query.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/pacman') diff --git a/src/pacman/query.c b/src/pacman/query.c index 292cddfb..a9717074 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -394,6 +394,7 @@ static int display(pmpkg_t *pkg) int pacman_query(alpm_list_t *targets) { int ret = 0; + int match = 0; alpm_list_t *i; pmpkg_t *pkg = NULL; @@ -436,8 +437,12 @@ int pacman_query(alpm_list_t *targets) if(value != 0) { ret = 1; } + match = 1; } } + if(!match) { + ret = 1; + } return(ret); } @@ -471,6 +476,7 @@ int pacman_query(alpm_list_t *targets) if(value != 0) { ret = 1; } + match = 1; } if(config->op_q_isfile) { @@ -479,6 +485,10 @@ int pacman_query(alpm_list_t *targets) } } + if(!match) { + ret = 1; + } + return(ret); } -- cgit v1.2.3-70-g09d2