diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2006-03-13 20:34:47 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2006-03-13 20:34:47 +0000 |
commit | 039e6d9ee4ea4a327b5c2630bf94508de8c17d62 (patch) | |
tree | f17c98e38162750579634ca86d7432f778c39834 /src/pacman/util.c | |
parent | a08a9896c9f9bf18459002b1fdc4b4927897b035 (diff) |
- removed pacman.h
- removed unuseful extern declarations
- set pacman.c internal functions as static
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r-- | src/pacman/util.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c index a8ad0059..ef6c0f82 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -155,6 +155,32 @@ void indentprint(char *str, int indent) } } +/* Condense a list of strings into one long (space-delimited) string + */ +char *buildstring(list_t *strlist) +{ + char *str; + int size = 1; + list_t *lp; + + for(lp = strlist; lp; lp = lp->next) { + size += strlen(lp->data) + 1; + } + str = (char *)malloc(size); + if(str == NULL) { + ERR(NL, "failed to allocated %d bytes\n", size); + } + str[0] = '\0'; + for(lp = strlist; lp; lp = lp->next) { + strcat(str, lp->data); + strcat(str, " "); + } + /* shave off the last space */ + str[strlen(str)-1] = '\0'; + + return(str); +} + /* Convert a string to uppercase */ char *strtoupper(char *str) |