summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1996-10-01 04:56:59 +0000
committerPeter Wemm <peter@FreeBSD.org>1996-10-01 04:56:59 +0000
commitd72f654c65891ad9a91e012d15e13e266c0238fb (patch)
tree0ca3158373cad424977be40a7fd42b15837e24a9
parent3e19bb822032f02a8ebb987b616c1abe0d469312 (diff)
Notes
-rw-r--r--usr.bin/printf/printf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
index d370d98270a17..90e8c45010028 100644
--- a/usr.bin/printf/printf.c
+++ b/usr.bin/printf/printf.c
@@ -58,15 +58,20 @@ static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93";
#endif
#define PF(f, func) { \
+ char *b = NULL; \
if (fieldwidth) \
if (precision) \
- (void)printf(f, fieldwidth, precision, func); \
+ (void)asprintf(&b, f, fieldwidth, precision, func); \
else \
- (void)printf(f, fieldwidth, func); \
+ (void)asprintf(&b, f, fieldwidth, func); \
else if (precision) \
- (void)printf(f, precision, func); \
+ (void)asprintf(&b, f, precision, func); \
else \
- (void)printf(f, func); \
+ (void)asprintf(&b, f, func); \
+ if (b) { \
+ (void)fputs(b, stdout); \
+ free(b); \
+ } \
}
static int asciicode __P((void));