diff options
author | tjr <tjr@FreeBSD.org> | 2002-06-19 08:18:37 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-06-19 08:18:37 +0000 |
commit | 2b21f1a948ddfc3597835e95b1709246d146b319 (patch) | |
tree | 6b80efc9400787e65e75c19cf775f369021dfa67 /usr.bin/printf/printf.c | |
parent | 95dac58041229913b9d0136f098b744eb1e8bea9 (diff) | |
download | FreeBSD-src-2b21f1a948ddfc3597835e95b1709246d146b319.zip FreeBSD-src-2b21f1a948ddfc3597835e95b1709246d146b319.tar.gz |
Allow format strings containing "%%" to be reused.
PR: 39116
Submitted by: Egil Brendsdal <egilb@ife.no>
MFC after: 1 week
Diffstat (limited to 'usr.bin/printf/printf.c')
-rw-r--r-- | usr.bin/printf/printf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index 90f363c..ad38200 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -173,8 +173,8 @@ next: for (start = fmt;; ++fmt) { if (*fmt == '%') { if (*++fmt != '%') break; - *fmt++ = '\0'; - (void)printf("%s", start); + (void)printf("%.*s", (int)(fmt - start), start); + fmt++; goto next; } } |