aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/printf
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2002-06-19 08:16:14 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2002-06-19 08:16:14 +0000
commit37fd459046a5f2eb572387c5bf3780520feef6a2 (patch)
tree5a1e8bb96c1414ca95c4262f17267781a7ea3690 /usr.bin/printf
parent7e949b63e41b11422f5e7fa44afb10a1a8c4ea05 (diff)
downloadsrc-37fd459046a5f2eb572387c5bf3780520feef6a2.tar.gz
src-37fd459046a5f2eb572387c5bf3780520feef6a2.zip
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
Notes
Notes: svn path=/head/; revision=98419
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 e0d1591b50c4..90f363cbc8aa 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;