aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2004-11-28 04:18:29 +0000
committerJason Woodward2004-11-28 04:18:29 +0000
commitaa8f390efb2c5de9749e71dd560df6c54d15f269 (patch)
treeb30fc2ad707ebc0e6a6f8644d3170fddf8b3c547
parent744c01c1ebed06e0db5974db548736d87170bff0 (diff)
downloadslapt-get-aa8f390efb2c5de9749e71dd560df6c54d15f269.tar.gz
rewrote pkg_action_search()
-rw-r--r--ChangeLog1
-rw-r--r--src/action.c34
2 files changed, 16 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index cdf1d8f..ed15c31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
0.9.9e Nov 27, 2004
+ * rewrote pkg_action_search()
* --show now shows installed pkgs, and their file list
* get_installed_pkgs() now parses out the packages description as well
* make --search show installed packages that aren't present in available
diff --git a/src/action.c b/src/action.c
index d1c5464..0bd46a9 100644
--- a/src/action.c
+++ b/src/action.c
@@ -261,33 +261,29 @@ void pkg_action_search(const char *pattern){
/* show installed packages in search */
for(i=0;i<imatches->pkg_count;i++){
- /* only if they didn't already show up from the available packages */
- if( get_exact_pkg(matches,imatches->pkgs[i]->name,imatches->pkgs[i]->version) == NULL ){
- char *short_description = gen_short_pkg_description(matches->pkgs[i]);
- printf("%s %s [inst=%s]: %s\n",
- imatches->pkgs[i]->name,
- imatches->pkgs[i]->version,
- _("yes"),
- short_description
- );
- free(short_description);
- }
+ char *short_description = gen_short_pkg_description(imatches->pkgs[i]);
+ printf("%s %s [inst=%s]: %s\n",
+ imatches->pkgs[i]->name,
+ imatches->pkgs[i]->version,
+ _("yes"),
+ short_description
+ );
+ free(short_description);
}
for(i = 0; i < matches->pkg_count; i++){
- int bool_installed = 0;
- char *short_description = gen_short_pkg_description(matches->pkgs[i]);
+ char *short_description = NULL;
- /* is it installed? */
- if( get_exact_pkg(installed_pkgs,matches->pkgs[i]->name,matches->pkgs[i]->version) != NULL )
- bool_installed = 1;
+ /* did we already show it in the installed loop? */
+ if( get_exact_pkg(imatches,matches->pkgs[i]->name,matches->pkgs[i]->version) != NULL )
+ continue;
+
+ short_description = gen_short_pkg_description(matches->pkgs[i]);
printf("%s %s [inst=%s]: %s\n",
matches->pkgs[i]->name,
matches->pkgs[i]->version,
- bool_installed == 1
- ? _("yes")
- : _("no"),
+ _("no"),
short_description
);
free(short_description);