summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mandoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2012-05-28 13:00:52 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2012-05-28 13:00:52 +0000
commit08973cb4d1227bb54783bdeab50035c9a6bfbec0 (patch)
tree29302e4a7dce3f5a46a365d627f6e4d95bf18e20 /usr.bin/mandoc/mandoc.c
parent83c0700d2695f59ff8403c43a705f01176ecab53 (diff)
Implement the roff \z escape sequence, intended to output the next
character without advancing the cursor position; implement it to simply skip the next character, as it will usually be overwritten. With this change, the pod2man(1) preamble user-defined string \*:, intended to render as a diaeresis or umlaut diacritic above the preceding character, is rendered in a slightly less ugly way, though still not correctly. It was rendered as "z.." and is now rendered as ".". Given that the definition of \*: uses elaborate manual \h positioning, there is little chance for mandoc(1) to ever render it correctly, but at least we can refrain from printing out a spurious "z", and we can make the \z do something semi-reasonable for easier cases.
Diffstat (limited to 'usr.bin/mandoc/mandoc.c')
-rw-r--r--usr.bin/mandoc/mandoc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index 842cea4b3b2..2b21522948c 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,7 +1,7 @@
-/* $Id: mandoc.c,v 1.31 2011/11/17 11:58:11 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.32 2012/05/28 13:00:51 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -139,6 +139,16 @@ mandoc_escape(const char **end, const char **start, int *sz)
break;
/*
+ * The \z escape is supposed to output the following
+ * character without advancing the cursor position.
+ * Since we are mostly dealing with terminal mode,
+ * let us just skip the next character.
+ */
+ case ('z'):
+ (*end)++;
+ return(ESCAPE_SKIPCHAR);
+
+ /*
* Handle all triggers matching \X(xy, \Xx, and \X[xxxx], where
* 'X' is the trigger. These have opaque sub-strings.
*/