From 3cf25f8f431d5abf0557a7c56c10399637613639 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 22 Aug 2011 16:16:59 -0400 Subject: allow alignment for %! token --- expac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'expac.c') diff --git a/expac.c b/expac.c index 9bf24f4..ad3792a 100644 --- a/expac.c +++ b/expac.c @@ -369,7 +369,7 @@ static int print_filelist(alpm_filelist_t *filelist) { static int print_pkg(alpm_pkg_t *pkg, const char *format) { const char *f, *end; - char fmt[32]; + char fmt[32], buf[32]; int len, out = 0; end = rawmemchr(format, '\0'); @@ -419,7 +419,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 */ - out += printf("%d", pkgcounter++); + snprintf(buf, 32, "%d", pkgcounter++); + out += printf(fmt, buf); break; case 'g': /* base64 gpg sig */ out += printf(fmt, alpm_pkg_get_base64_sig(pkg)); -- cgit v1.2.3-70-g09d2