summaryrefslogtreecommitdiffstats
path: root/src/pacman/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-02-01 07:35:30 +0100
committerDan McGee <dan@archlinux.org>2007-02-01 07:35:30 +0100
commitcdaed9221d9614c4c43103d79f8b53b916d80d86 (patch)
tree4a96afbd93f1e52f8a3104979f95d3ba76acce79 /src/pacman/util.c
parent8c0a8ddc5bb6443358e1cbba8023b6e9dc786fca (diff)
downloadpacman-cdaed9221d9614c4c43103d79f8b53b916d80d86.tar.gz
pacman-cdaed9221d9614c4c43103d79f8b53b916d80d86.tar.xz
* Tried to clean up newline display a bit in the frontend.
* Removed useless buildstring function from util.h; replaced all calls of it with list_display. * Made list_display output 2 spaces instead of 1 between each item.
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r--src/pacman/util.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 01d0e65c..7cff41b7 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -194,32 +194,6 @@ void indentprint(const char *str, unsigned int indent)
}
}
-/* Condense a list of strings into one long (space-delimited) string
- */
-char *buildstring(alpm_list_t *strlist)
-{
- char *str;
- size_t size = 1;
- alpm_list_t *i;
-
- for(i = strlist; i; i = alpm_list_next(i)) {
- size += strlen(alpm_list_getdata(i)) + 1;
- }
- str = (char *)malloc(size);
- if(str == NULL) {
- ERR(NL, _("failed to allocate %d bytes\n"), size);
- }
- str[0] = '\0';
- for(i = strlist; i; i = alpm_list_next(i)) {
- strcat(str, alpm_list_getdata(i));
- strcat(str, " ");
- }
- /* shave off the last space */
- str[strlen(str)-1] = '\0';
-
- return(str);
-}
-
/* Convert a string to uppercase
*/
char *strtoupper(char *str)
@@ -265,17 +239,17 @@ void list_display(const char *title, alpm_list_t *list)
if(list) {
for(i = list, cols = len; i; i = alpm_list_next(i)) {
char *str = alpm_list_getdata(i);
- int s = strlen(str)+1;
+ int s = strlen(str) + 2;
unsigned int maxcols = getcols();
if(s + cols >= maxcols) {
int i;
cols = len;
printf("\n");
- for (i = 0; i < len+1; ++i) {
+ for (i = 0; i <= len; ++i) {
printf(" ");
}
}
- printf("%s ", str);
+ printf("%s ", str);
cols += s;
}
printf("\n");