[pacman-dev] [PATCH] Remove trailing whitespaces in the output for -Qi/-Si
Laszlo Papp
djszapi2 at gmail.com
Sat Dec 12 10:27:06 EST 2009
---
src/pacman/util.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 115b367..e23d96d 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -446,8 +446,11 @@ void list_display(const char *title, const alpm_list_t *list)
for(i = list, cols = len; i; i = alpm_list_next(i)) {
char *str = alpm_list_getdata(i);
int s = string_length(str);
- /* two additional spaces are added to the length */
- s += 2;
+ /* two additional spaces are added to the length, if this is not the
+ * last element in the list */
+ if (alpm_list_next(i)) {
+ s += 2;
+ }
int maxcols = getcols();
if(s + cols > maxcols && maxcols > 0) {
int j;
@@ -457,7 +460,11 @@ void list_display(const char *title, const alpm_list_t *list)
printf(" ");
}
}
- printf("%s ", str);
+ if (alpm_list_next(i)) {
+ printf("%s ", str);
+ } else {
+ printf("%s", str);
+ }
cols += s;
}
printf("\n");
--
1.6.5.5
More information about the pacman-dev
mailing list