source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: When showing more than one formatted manual page, insert
Date: Wed, 31 Dec 2014 11:53:10 -0500 (EST)	[thread overview]
Message-ID: <10412463885170170339.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
When showing more than one formatted manual page, insert horizontal lines
between pages.  Suggested by Theo Buehler <theo at math dot ethz dot ch>.
Even in UTF-8 output mode, do not use fancy line drawing characters such 
that you can easily use /^--- to skip to the next manual in your pager.

Modified Files:
--------------
    mdocml:
        main.c
        main.h
        term_ascii.c

Revision Data
-------------
Index: main.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lmain.h -Lmain.h -u -p -r1.19 -r1.20
--- main.h
+++ main.h
@@ -1,6 +1,7 @@
 /*	$Id$ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2014 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
@@ -45,6 +46,7 @@ void		 *locale_alloc(const struct mchars
 void		 *utf8_alloc(const struct mchars *, char *);
 void		 *ascii_alloc(const struct mchars *, char *);
 void		  ascii_free(void *);
+void		  ascii_sepline(void *);
 
 void		 *pdf_alloc(const struct mchars *, char *);
 void		 *ps_alloc(const struct mchars *, char *);
Index: term_ascii.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term_ascii.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -Lterm_ascii.c -Lterm_ascii.c -u -p -r1.41 -r1.42
--- term_ascii.c
+++ term_ascii.c
@@ -174,6 +174,20 @@ ascii_setwidth(struct termp *p, int iop,
 	p->rmargin = p->maxrmargin = p->defrmargin;
 }
 
+void
+ascii_sepline(void *arg)
+{
+	struct termp	*p;
+	size_t		 i;
+
+	p = (struct termp *)arg;
+	putchar('\n');
+	for (i = 0; i < p->defrmargin; i++)
+		putchar('-');
+	putchar('\n');
+	putchar('\n');
+}
+
 static size_t
 ascii_width(const struct termp *p, int c)
 {
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.209
retrieving revision 1.210
diff -Lmain.c -Lmain.c -u -p -r1.209 -r1.210
--- main.c
+++ main.c
@@ -447,7 +447,9 @@ main(int argc, char *argv[])
 
 		if (MANDOCLEVEL_OK != rc && curp.wstop)
 			break;
-		argc--;
+
+		if (--argc && curp.outtype <= OUTT_UTF8)
+			ascii_sepline(curp.outdata);
 	}
 
 	if (curp.outfree)
@@ -634,6 +636,8 @@ passthrough(const char *file, int fd, in
 	size_t		 len, off;
 	ssize_t		 nw;
 	int		 print;
+
+	fflush(stdout);
 
 	if ((stream = fdopen(fd, "r")) == NULL) {
 		close(fd);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2014-12-31 16:53 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=10412463885170170339.enqueue@fantadrom.bsd.lv \
    --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).