diff options
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r-- | src/pacman/util.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c index a0829e64..8bf4ec14 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -34,6 +34,7 @@ #include <ctype.h> #include <dirent.h> #include <unistd.h> +#include <limits.h> #include <alpm.h> #include <alpm_list.h> @@ -162,12 +163,12 @@ void indentprint(const char *str, int indent) while(*p) { if(*p == ' ') { const char *next = NULL; - unsigned int len; + int len; p++; if(p == NULL || *p == ' ') continue; next = strchr(p, ' '); if(next == NULL) { - next = p + strlen(p); + next = p + mbstowcs(NULL, p, 0); } len = next - p; if(len > (getcols() - cidx - 1)) { @@ -283,13 +284,13 @@ void list_display(const char *title, const alpm_list_t *list) const alpm_list_t *i; int cols, len; - len = strlen(title); + len = mbstowcs(NULL, title, 0); printf("%s ", title); if(list) { for(i = list, cols = len; i; i = alpm_list_next(i)) { char *str = alpm_list_getdata(i); - int s = strlen(str) + 2; + int s = mbstowcs(NULL, str, 0) + 2; int maxcols = getcols(); if(s + cols >= maxcols) { int i; @@ -503,8 +504,6 @@ int pm_vfprintf(FILE *stream, pmloglevel_t level, const char *format, va_list ar /* print the message using va_arg list */ ret = vfprintf(stream, format, args); - /* TEMP HACK because libalpm strings don't have \n */ - fprintf(stream, "\n"); return(ret); } |