source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: When showing more than one formatted manual page, insert
@ 2014-12-31 16:53 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-12-31 16:53 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-31 16:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-31 16:53 mdocml: When showing more than one formatted manual page, insert schwarze

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).