summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mandoc/main.c8
-rw-r--r--usr.bin/mandoc/main.h4
-rw-r--r--usr.bin/mandoc/term_ascii.c16
3 files changed, 24 insertions, 4 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index a55cfaf0f39..d6d82c04467 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.115 2014/12/21 14:49:00 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.116 2014/12/31 16:50:54 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -412,7 +412,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)
@@ -597,6 +599,8 @@ passthrough(const char *file, int fd, int synopsis_only)
ssize_t nw;
int print;
+ fflush(stdout);
+
if ((stream = fdopen(fd, "r")) == NULL) {
close(fd);
syscall = "fdopen";
diff --git a/usr.bin/mandoc/main.h b/usr.bin/mandoc/main.h
index 1ce65e661e3..04e8b193486 100644
--- a/usr.bin/mandoc/main.h
+++ b/usr.bin/mandoc/main.h
@@ -1,6 +1,7 @@
-/* $OpenBSD: main.h,v 1.14 2014/12/01 08:05:02 schwarze Exp $ */
+/* $OpenBSD: main.h,v 1.15 2014/12/31 16:50:54 schwarze Exp $ */
/*
* 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 *, char *);
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 *);
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c
index 635c2e8ab3a..5f4d661839a 100644
--- a/usr.bin/mandoc/term_ascii.c
+++ b/usr.bin/mandoc/term_ascii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term_ascii.c,v 1.28 2014/12/19 17:10:42 schwarze Exp $ */
+/* $OpenBSD: term_ascii.c,v 1.29 2014/12/31 16:50:54 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -164,6 +164,20 @@ ascii_setwidth(struct termp *p, int iop, size_t width)
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)
{