index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-04-05 00:48:36 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-04-05 00:49:30 -0500 |
commit | c5addd94e3a817504688e684bf62786df7faa3e7 (patch) | |
tree | 0f15c4c3ea66d617709e1f3408ea045a38463b1e /src | |
parent | 2f71d1dc0084f7ee44afb9766e81847974820420 (diff) | |
parent | 272e9b355b17ab663ac4a0d9515d381dcf6f03ec (diff) |
-rw-r--r-- | src/pacman/util.c | 18 |
diff --git a/src/pacman/util.c b/src/pacman/util.c index 51bb0526..c4773481 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -761,8 +761,9 @@ static int multiselect_parse(char *array, int count, char *response) char *ends = NULL; char *starts = strtok_r(str, " ", &saveptr); - if (starts == NULL) + if (starts == NULL) { break; + } strtrim(starts); int len = strlen(starts); if(len == 0) @@ -780,9 +781,9 @@ static int multiselect_parse(char *array, int count, char *response) if(len > 1) { /* check for range */ char *p; - if((p = strchr(starts+1, '-'))) { + if((p = strchr(starts + 1, '-'))) { *p = 0; - ends = p+1; + ends = p + 1; } } @@ -792,9 +793,11 @@ static int multiselect_parse(char *array, int count, char *response) if(!ends) { array[start-1] = include; } else { - if(parseindex(ends, &end, start, count) != 0) + int d; + if(parseindex(ends, &end, start, count) != 0) { return -1; - for(int d = start; d <= end; d++) { + } + for(d = start; d <= end; d++) { array[d-1] = include; } } @@ -897,6 +900,10 @@ static int question(short preset, char *fmt, va_list args) stream = stderr; } + /* ensure all text makes it to the screen before we prompt the user */ + fflush(stdout); + fflush(stderr); + vfprintf(stream, fmt, args); if(preset) { @@ -910,6 +917,7 @@ static int question(short preset, char *fmt, va_list args) return preset; } + fflush(stream); flush_term_input(); if(fgets(response, sizeof(response), stdin)) { |