xbps-repo: fix the 'search' target to show a consistent output for inst/uninst pkgs.

Fixes issue #28.
This commit is contained in:
Juan RP 2012-08-02 14:37:15 +02:00
parent 3a247bd5cb
commit 68a0223c4e

View File

@ -129,21 +129,21 @@ show_pkg_namedesc(struct xbps_handle *xhp,
tmp[x] = '\0'; tmp[x] = '\0';
if (xbps_pkgdb_get_pkgd_by_pkgver(xhp, pkgver)) if (xbps_pkgdb_get_pkgd_by_pkgver(xhp, pkgver))
inststr = "[*] "; inststr = "[*]";
else else
inststr = "[ ] "; inststr = "[-]";
len = strlen(inststr) + strlen(tmp) + strlen(desc) + 1; len = strlen(inststr) + strlen(tmp) + strlen(desc) + 1;
if (len > rsd->maxcols) { if (len > rsd->maxcols) {
out = malloc(rsd->maxcols); out = malloc(rsd->maxcols);
assert(out); assert(out);
snprintf(out, rsd->maxcols-2, "%s%s %s", snprintf(out, rsd->maxcols-2, "%s %s %s",
inststr, tmp, desc); inststr, tmp, desc);
strncat(out, "...", rsd->maxcols); strncat(out, "...", rsd->maxcols);
printf("%s\n", out); printf("%s\n", out);
free(out); free(out);
} else { } else {
printf("%s%s %s\n", inststr, tmp, desc); printf("%s %s %s\n", inststr, tmp, desc);
} }
} }
} }