summaryrefslogtreecommitdiffstats
path: root/usr.bin/printf
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-06-19 08:16:14 +0000
committertjr <tjr@FreeBSD.org>2002-06-19 08:16:14 +0000
commit95dac58041229913b9d0136f098b744eb1e8bea9 (patch)
tree5a1e8bb96c1414ca95c4262f17267781a7ea3690 /usr.bin/printf
parente03fb12529ca70bb4e2db076ad98cd3a2729c19a (diff)
downloadFreeBSD-src-95dac58041229913b9d0136f098b744eb1e8bea9.zip
FreeBSD-src-95dac58041229913b9d0136f098b744eb1e8bea9.tar.gz
Allow `%' to be written out with an octal escape (\45 or \045).
PR: 39116 Submitted by: Egil Brendsdal <egilb@ife.no> MFC after: 1 week
Diffstat (limited to 'usr.bin/printf')
-rw-r--r--usr.bin/printf/printf.c6
1 files changed, 5 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud