summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index 2e47070..62ca816 100644
--- a/src/search.c
+++ b/src/search.c
@@ -29,8 +29,16 @@ struct search_ctx {
struct apk_string_array *filter;
};
+static int unique_match(struct apk_package *pkg)
+{
+ if (pkg->state_int) return 0;
+ pkg->state_int = 1;
+ return 1;
+}
+
static void print_package_name(struct search_ctx *ctx, struct apk_package *pkg)
{
+ if (!unique_match(pkg)) return;
printf("%s", pkg->name->name);
if (apk_verbosity > 0)
printf("-" BLOB_FMT, BLOB_PRINTF(*pkg->version));
@@ -41,6 +49,7 @@ static void print_package_name(struct search_ctx *ctx, struct apk_package *pkg)
static void print_origin_name(struct search_ctx *ctx, struct apk_package *pkg)
{
+ if (!unique_match(pkg)) return;
if (pkg->origin != NULL)
printf(BLOB_FMT, BLOB_PRINTF(*pkg->origin));
else