From 8ccd45be3ade13b4bef748b7486a87b3d143afc1 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 9 Dec 2018 11:40:07 +0100 Subject: qsearch: avoid printing a trailing space, bug #672764 When --name-only is in effect, don't print the space separating the package and its description, for we won't print the latter. Bug: https://bugs.gentoo.org/672764 Signed-off-by: Fabian Groffen --- qsearch.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qsearch.c b/qsearch.c index 4fce4de1..b75a4f72 100644 --- a/qsearch.c +++ b/qsearch.c @@ -1,9 +1,10 @@ /* - * Copyright 2005-2018 Gentoo Foundation + * Copyright 2005-2018 Gentoo Authors * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2010 Ned Ludd - * Copyright 2005-2014 Mike Frysinger - + * Copyright 2018- Fabian Groffen - atom->PN, last) != 0) { strncpy(last, pcache->atom->PN, LAST_BUF_SIZE); if (search_all || rematch(search_me, (search_desc ? pcache->DESCRIPTION : ebuild), REG_EXTENDED | REG_ICASE) == 0) - printf("%s%s/%s%s%s %s\n", BOLD, pcache->atom->CATEGORY, BLUE, + printf("%s%s/%s%s%s%s%s\n", BOLD, pcache->atom->CATEGORY, BLUE, pcache->atom->PN, NORM, + (show_name_only ? "" : " "), (show_name_only ? "" : (show_homepage ? pcache->HOMEPAGE : pcache->DESCRIPTION))); } @@ -121,8 +123,9 @@ qsearch_ebuild_ebuild(int overlay_fd, const char *ebuild, const char *search_me, if (show_it) { const char *pkg = basename(p); - printf("%s%s/%s%s%s %s\n", + printf("%s%s/%s%s%s%s%s\n", BOLD, dirname(p), BLUE, pkg, NORM, + (show_name_only ? "" : " "), (show_name_only ? "" : q ? : "")); } -- cgit v1.2.3-65-gdbad