poldek: poldek/cli/desc.c - separeate required pkgs by colon (alte...
mis
mis at pld-linux.org
Mon Jul 9 22:51:28 CEST 2007
Author: mis Date: Mon Jul 9 20:51:28 2007 GMT
Module: poldek Tag: HEAD
---- Log message:
- separeate required pkgs by colon (alternatives looks ugly without sep)
- renamed "Reqpkgs" to "Required(pkgs)" and "RequiredBy" to "Required(by)"
---- Files affected:
poldek/poldek/cli:
desc.c (1.30 -> 1.31)
---- Diffs:
================================================================
Index: poldek/poldek/cli/desc.c
diff -u poldek/poldek/cli/desc.c:1.30 poldek/poldek/cli/desc.c:1.31
--- poldek/poldek/cli/desc.c:1.30 Thu Jul 5 20:01:32 2007
+++ poldek/poldek/cli/desc.c Mon Jul 9 22:51:23 2007
@@ -455,49 +455,48 @@
static void show_reqpkgs(struct cmdctx *cmdctx, struct pkg *pkg, int term_width)
{
- int i;
-
- if (pkg->reqpkgs && n_array_size(pkg->reqpkgs)) {
- int ncol = IDENT;
-
- cmdctx_printf_c(cmdctx, PRCOLOR_CYAN, "%-16s", "Reqpkgs:");
+ char *colon = ", ";
+ int i, ncol = IDENT;
+
+ if (pkg->reqpkgs == NULL || n_array_size(pkg->reqpkgs) == 0)
+ return;
+
+ cmdctx_printf_c(cmdctx, PRCOLOR_CYAN, "%-16s", "Required(pkgs):");
- for (i=0; i<n_array_size(pkg->reqpkgs); i++) {
- struct reqpkg *rp;
- char *p;
+ for (i=0; i<n_array_size(pkg->reqpkgs); i++) {
+ struct reqpkg *rp = n_array_nth(pkg->reqpkgs, i);
+ char *p;
+ p = rp->pkg->name;
- rp = n_array_nth(pkg->reqpkgs, i);
-
- p = rp->pkg->name;
- if (ncol + (int)strlen(p) >= term_width) {
- ncol = SUBIDENT;
- nlident(cmdctx, ncol);
- }
- ncol += cmdctx_printf(cmdctx, "%s", p);
+ if (ncol + (int)strlen(p) >= term_width) {
+ ncol = SUBIDENT;
+ nlident(cmdctx, ncol);
+ }
+ ncol += cmdctx_printf(cmdctx, "%s", p);
- if (rp->flags & REQPKG_MULTI) {
- int n = 0;
+ if (rp->flags & REQPKG_MULTI) {
+ int n = 0;
- ncol += cmdctx_printf(cmdctx, " | ");
+ ncol += cmdctx_printf(cmdctx, " | ");
- while (rp->adds[n]) {
- char *p = rp->adds[n++]->pkg->name;
- if (ncol + (int)strlen(p) >= term_width) {
- ncol = SUBIDENT;
- nlident(cmdctx, ncol);
- }
- ncol += cmdctx_printf(cmdctx, "%s", p);
- if (rp->adds[n] != NULL) {
- ncol += cmdctx_printf(cmdctx, " | ");
- }
+ while (rp->adds[n]) {
+ char *p = rp->adds[n++]->pkg->name;
+ if (ncol + (int)strlen(p) >= term_width) {
+ ncol = SUBIDENT;
+ nlident(cmdctx, ncol);
+ }
+ ncol += cmdctx_printf(cmdctx, "%s", p);
+ if (rp->adds[n] != NULL) {
+ ncol += cmdctx_printf(cmdctx, " | ");
}
}
- if (i + 1 < n_array_size(pkg->reqpkgs))
- ncol += cmdctx_printf(cmdctx, " ");
}
- cmdctx_printf(cmdctx, "\n");
+
+ if (i + 1 < n_array_size(pkg->reqpkgs))
+ ncol += cmdctx_printf(cmdctx, colon);
}
+ cmdctx_printf(cmdctx, "\n");
}
static
@@ -508,7 +507,7 @@
if (pkg->revreqpkgs && n_array_size(pkg->revreqpkgs)) {
int ncol = IDENT;
- cmdctx_printf_c(cmdctx, PRCOLOR_CYAN, "%-16s", "RequiredBy:");
+ cmdctx_printf_c(cmdctx, PRCOLOR_CYAN, "%-16s", "Required(by):");
for (i=0; i<n_array_size(pkg->revreqpkgs); i++) {
struct pkg *tmpkg;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/poldek/poldek/cli/desc.c?r1=1.30&r2=1.31&f=u
More information about the pld-cvs-commit
mailing list