summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-02-20 17:58:45 +0000
committerJason Woodward2005-02-20 17:58:45 +0000
commit678a60b86186172562d23dbf4e9d502a8a95eca7 (patch)
tree4977e0bf016a706680204c36d87ae3d5b4b09572 /src
parent04e3c042b2a8599fa9c799114ff7acd6b4d3d24d (diff)
downloadslapt-get-678a60b86186172562d23dbf4e9d502a8a95eca7.tar.gz
--search return installed packages as well
Diffstat (limited to 'src')
-rw-r--r--src/action.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/action.c b/src/action.c
index cb60cc5..830674a 100644
--- a/src/action.c
+++ b/src/action.c
@@ -289,15 +289,16 @@ void pkg_action_search(const char *pattern){
unsigned int i;
struct pkg_list *pkgs = NULL;
struct pkg_list *installed_pkgs = NULL;
- struct pkg_list *matches = NULL;
+ struct pkg_list *matches = NULL,*i_matches = NULL;
/* read in pkg data */
pkgs = get_available_pkgs();
installed_pkgs = get_installed_pkgs();
matches = search_pkg_list(pkgs,pattern);
+ i_matches = search_pkg_list(installed_pkgs,pattern);
- for(i = 0; i < matches->pkg_count; i++){
+ for(i = 0; i < matches->pkg_count; ++i){
char *short_description = gen_short_pkg_description(matches->pkgs[i]);
printf("%s %s [inst=%s]: %s\n",
@@ -313,7 +314,25 @@ void pkg_action_search(const char *pattern){
free(short_description);
}
+ for(i = 0; i < i_matches->pkg_count; ++i){
+ char *short_description = NULL;
+
+ if( get_exact_pkg(matches,i_matches->pkgs[i]->name,
+ i_matches->pkgs[i]->version) != NULL) continue;
+
+ short_description = gen_short_pkg_description(i_matches->pkgs[i]);
+
+ printf("%s %s [inst=%s]: %s\n",
+ i_matches->pkgs[i]->name,
+ i_matches->pkgs[i]->version,
+ _("yes"),
+ short_description
+ );
+ free(short_description);
+ }
+
free_pkg_list(matches);
+ free_pkg_list(i_matches);
free_pkg_list(pkgs);
free_pkg_list(installed_pkgs);