From 95dac58041229913b9d0136f098b744eb1e8bea9 Mon Sep 17 00:00:00 2001 From: tjr Date: Wed, 19 Jun 2002 08:16:14 +0000 Subject: Allow `%' to be written out with an octal escape (\45 or \045). PR: 39116 Submitted by: Egil Brendsdal MFC after: 1 week --- usr.bin/printf/printf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.bin/printf') diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index e0d1591..90f363c 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -376,7 +376,11 @@ escape(fmt) value += *fmt - '0'; } --fmt; - *store = value; + if (value == '%') { + *store++ = '%'; + *store = '%'; + } else + *store = value; break; default: *store = *fmt; -- cgit v1.1