xbps-query: generate -o output from a single printf.

Else parts written by multiple threads can become mixed up.
This commit is contained in:
Christian Neukirchen
2016-01-20 13:41:13 +01:00
parent 0a5f86e772
commit 034d3591b3
2 changed files with 13 additions and 8 deletions

View File

@ -76,17 +76,19 @@ match_files_by_pattern(xbps_dictionary_t pkg_filesd,
xbps_dictionary_get_cstring_nocopy(obj, "target", &tgt);
if (ffd->rematch) {
if (regexec(&ffd->regex, filestr, 0, 0, 0) == 0) {
printf("%s: %s ", pkgver, filestr);
if (tgt)
printf("-> %s ", tgt);
printf("(%s)\n", typestr);
printf("%s: %s%s%s (%s)\n",
pkgver, filestr,
tgt ? " -> " : "",
tgt ? tgt : "",
typestr);
}
} else {
if ((fnmatch(ffd->pat, filestr, FNM_PERIOD)) == 0) {
printf("%s: %s ", pkgver, filestr);
if (tgt)
printf("-> %s ", tgt);
printf("(%s)\n", typestr);
printf("%s: %s%s%s (%s)\n",
pkgver, filestr,
tgt ? " -> " : "",
tgt ? tgt : "",
typestr);
}
}
}