From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Make the generated man(7) code more portable by using .PD
Date: Sun, 18 Nov 2012 14:34:19 -0500 (EST) [thread overview]
Message-ID: <201211181934.qAIJYJhN022030@krisdoz.my.domain> (raw)
Log Message:
-----------
Make the generated man(7) code more portable by using .PD
instead of .sp -1v, which for example Solaris nroff handles poorly.
Problem report and patch by millert@,
with the print_word chunk tweaked by me.
Modified Files:
--------------
mdocml:
mdoc_man.c
Revision Data
-------------
Index: mdoc_man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.43 -r1.44
--- mdoc_man.c
+++ mdoc_man.c
@@ -253,6 +253,7 @@ static int outflags;
#define MMAN_Bk (1 << 7) /* word keep mode */
#define MMAN_An_split (1 << 8) /* author mode is "split" */
#define MMAN_An_nosplit (1 << 9) /* author mode is "nosplit" */
+#define MMAN_PD (1 << 10) /* inter-paragraph spacing disabled */
#define BL_STACK_MAX 32
@@ -304,8 +305,15 @@ print_word(const char *s)
* If we need a newline, print it now and start afresh.
*/
if (MMAN_PP & outflags) {
- if ( ! (MMAN_sp & outflags))
- printf("\n.sp -1v");
+ if (MMAN_sp & outflags) {
+ if (MMAN_PD & outflags) {
+ printf("\n.PD");
+ outflags &= ~MMAN_PD;
+ }
+ } else if ( ! (MMAN_PD & outflags)) {
+ printf("\n.PD 0");
+ outflags |= MMAN_PD;
+ }
printf("\n.PP\n");
} else if (MMAN_sp & outflags)
printf("\n.sp\n");
@@ -379,10 +387,16 @@ print_block(const char *s, int newflags)
{
outflags &= ~MMAN_PP;
- if (MMAN_sp & outflags)
+ if (MMAN_sp & outflags) {
outflags &= ~(MMAN_sp | MMAN_br);
- else
- print_line(".sp -1v", 0);
+ if (MMAN_PD & outflags) {
+ print_line(".PD", 0);
+ outflags &= ~MMAN_PD;
+ }
+ } else if (! (MMAN_PD & outflags)) {
+ print_line(".PD 0", 0);
+ outflags |= MMAN_PD;
+ }
outflags |= MMAN_nl;
print_word(s);
outflags |= newflags;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2012-11-18 19:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201211181934.qAIJYJhN022030@krisdoz.my.domain \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).