From 6693ba26d594cdccc4b15bc6c9514f52965fb1fa Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 31 Dec 2014 16:52:39 +0000 Subject: When showing more than one formatted manual page, insert horizontal lines between pages. Suggested by Theo Buehler . 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. --- main.c | 8 ++++++-- main.h | 4 +++- term_ascii.c | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 2f062788..59d1b2d6 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.209 2014/12/21 14:49:28 schwarze Exp $ */ +/* $Id: main.c,v 1.210 2014/12/31 16:52:39 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze @@ -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) @@ -635,6 +637,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/main.h b/main.h index 147c22f5..9b04a781 100644 --- a/main.h +++ b/main.h @@ -1,6 +1,7 @@ -/* $Id: main.h,v 1.19 2014/12/01 08:05:52 schwarze Exp $ */ +/* $Id: main.h,v 1.20 2014/12/31 16:52:40 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons + * Copyright (c) 2014 Ingo Schwarze * * 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/term_ascii.c b/term_ascii.c index 5cc6304a..df191103 100644 --- a/term_ascii.c +++ b/term_ascii.c @@ -1,4 +1,4 @@ -/* $Id: term_ascii.c,v 1.41 2014/12/19 17:12:04 schwarze Exp $ */ +/* $Id: term_ascii.c,v 1.42 2014/12/31 16:52:40 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -174,6 +174,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) { -- cgit v1.2.3-56-ge451