diff options
author | Dan McGee <dan@archlinux.org> | 2012-01-23 12:19:51 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-01-23 12:20:52 -0600 |
commit | e50c4a8837cedf47c2fe1a2c6064b4dc03dc5b03 (patch) | |
tree | df2e33d95d02b17e5d720320c19e267893d68bdf /src/pacman/util.c | |
parent | b3612e9cc198f198b3806efa461bf6fc04dd4502 (diff) | |
parent | 825b4ff35aa676b139dc24bc651724b092f2fded (diff) |
Merge branch 'maint'
Conflicts:
lib/libalpm/diskspace.c
src/pacman/util.h
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r-- | src/pacman/util.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c index 467bedfe..27efdb0a 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1,7 +1,7 @@ /* * util.c * - * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org> + * Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@archlinux.org> * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> * * This program is free software; you can redistribute it and/or modify @@ -190,10 +190,10 @@ int rmrf(const char *path) return 1; } for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { - if(dp->d_ino) { - char name[PATH_MAX]; - sprintf(name, "%s/%s", path, dp->d_name); + if(dp->d_name) { if(strcmp(dp->d_name, "..") != 0 && strcmp(dp->d_name, ".") != 0) { + char name[PATH_MAX]; + snprintf(name, PATH_MAX, "%s/%s", path, dp->d_name); errflag += rmrf(name); } } @@ -310,19 +310,6 @@ void indentprint(const char *str, size_t indent) free(wcstr); } -/* Convert a string to uppercase - */ -char *strtoupper(char *str) -{ - char *ptr = str; - - while(*ptr) { - (*ptr) = (char)toupper((unsigned char)*ptr); - ptr++; - } - return str; -} - /* Trim whitespace and newlines from a string */ size_t strtrim(char *str) @@ -898,8 +885,12 @@ static void _display_targets(alpm_list_t *targets, int verbose) /* add up size of all removed packages */ rsize += alpm_pkg_get_isize(target->remove); } + } + + /* form data for both verbose and non-verbose display */ + for(i = targets; i; i = alpm_list_next(i)) { + pm_target_t *target = i->data; - /* form data for both verbose and non-verbose display */ rows = alpm_list_add(rows, create_verbose_row(target, show_dl_size)); if(target->install) { pm_asprintf(&str, "%s-%s", alpm_pkg_get_name(target->install), @@ -1430,6 +1421,12 @@ static int question(short preset, char *fmt, va_list args) return preset; } + /* if stdin is piped, response does not get printed out, and as a result + * a \n is missing, resulting in broken output (FS#27909) */ + if(!isatty(fileno(stdin))) { + fprintf(stream, "%s\n", response); + } + if(strcasecmp(response, _("Y")) == 0 || strcasecmp(response, _("YES")) == 0) { return 1; } else if(strcasecmp(response, _("N")) == 0 || strcasecmp(response, _("NO")) == 0) { |