summaryrefslogtreecommitdiffstats
path: root/expac.c
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-11-20 20:29:44 -0500
committerDave Reisner <dreisner@archlinux.org>2014-11-20 20:31:56 -0500
commit0075c5b195400daa4f9cf76ef54902a74dbb166f (patch)
treea902aa2a68319e8d44395b5e4955fe193be83857 /expac.c
parentb65a4c4deea3d9b0965bd2421083b98213804768 (diff)
downloadexpac-0075c5b195400daa4f9cf76ef54902a74dbb166f.tar.xz
Properly support formatting of %!
Diffstat (limited to 'expac.c')
-rw-r--r--expac.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/expac.c b/expac.c
index 899881e..d57e8b6 100644
--- a/expac.c
+++ b/expac.c
@@ -409,7 +409,6 @@ static alpm_list_t *get_validation_method(alpm_pkg_t *pkg) {
static int print_pkg(alpm_pkg_t *pkg, const char *format) {
const char *f, *end;
- char fmt[64], buf[64];
int len, out = 0;
end = format + strlen(format);
@@ -417,6 +416,7 @@ static int print_pkg(alpm_pkg_t *pkg, const char *format) {
for (f = format; f < end; f++) {
len = 0;
if (*f == '%') {
+ char fmt[64];
len = strspn(f + 1 + len, printf_flags);
len += strspn(f + 1 + len, digits);
snprintf(fmt, len + 3, "%ss", f);
@@ -458,8 +458,8 @@ static int print_pkg(alpm_pkg_t *pkg, const char *format) {
out += printf(fmt, alpm_pkg_get_reason(pkg) ? "dependency" : "explicit");
break;
case '!': /* result number */
- snprintf(buf, sizeof(buf), "%d", opt_pkgcounter++);
- out += printf(fmt, buf);
+ fmt[strlen(fmt)-1] = 'd';
+ out += printf(fmt, opt_pkgcounter++);
break;
case 'g': /* base64 gpg sig */
out += printf(fmt, alpm_pkg_get_base64_sig(pkg));