aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ps.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-04 19:57:26 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-04 19:57:26 +0000
commit6b214e8597e1e8ef4d319a8ebe1a3a4dffd9d105 (patch)
treecb357a3d68c468d636d84bbc2682303aec7c3821 /term_ps.c
parentd5bdc33567902da102d19ad27be8a9e87101020f (diff)
downloadmandoc-6b214e8597e1e8ef4d319a8ebe1a3a4dffd9d105.tar.gz
mandoc-6b214e8597e1e8ef4d319a8ebe1a3a4dffd9d105.tar.zst
mandoc-6b214e8597e1e8ef4d319a8ebe1a3a4dffd9d105.zip
Suppress printing blank eof pages in -Tps. Delay printing of Page:
until actual text is ready to be displayed.
Diffstat (limited to 'term_ps.c')
-rw-r--r--term_ps.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/term_ps.c b/term_ps.c
index c3515e62..5da5a450 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.29 2010/07/04 19:42:25 kristaps Exp $ */
+/* $Id: term_ps.c,v 1.30 2010/07/04 19:57:26 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -580,12 +580,14 @@ ps_end(struct termp *p)
* well as just one.
*/
- assert(0 == p->engine.ps.flags);
- assert('\0' == p->engine.ps.last);
- assert(p->engine.ps.psmarg && p->engine.ps.psmarg[0]);
- printf("%s", p->engine.ps.psmarg);
- p->engine.ps.pages++;
- printf("showpage\n");
+ if ( ! (PS_NEWPAGE & p->engine.ps.flags)) {
+ assert(0 == p->engine.ps.flags);
+ assert('\0' == p->engine.ps.last);
+ assert(p->engine.ps.psmarg && p->engine.ps.psmarg[0]);
+ printf("%s", p->engine.ps.psmarg);
+ p->engine.ps.pages++;
+ printf("showpage\n");
+ }
printf("%%%%Trailer\n");
printf("%%%%Pages: %zu\n", p->engine.ps.pages);
@@ -674,6 +676,11 @@ ps_pletter(struct termp *p, int c)
* now at the current cursor.
*/
+ if (PS_NEWPAGE & p->engine.ps.flags)
+ printf("%%%%Page: %zu %zu\n",
+ p->engine.ps.pages + 1,
+ p->engine.ps.pages + 1);
+
if ( ! (PS_INLINE & p->engine.ps.flags)) {
ps_printf(p, "%zu %zu moveto\n(",
AFM2PNT(p, p->engine.ps.pscol),
@@ -870,9 +877,6 @@ ps_endline(struct termp *p)
printf("%s", p->engine.ps.psmarg);
printf("showpage\n");
p->engine.ps.pages++;
- printf("%%%%Page: %zu %zu\n",
- p->engine.ps.pages + 1,
- p->engine.ps.pages + 1);
p->engine.ps.psrow = p->engine.ps.top;
assert( ! (PS_NEWPAGE & p->engine.ps.flags));
p->engine.ps.flags |= PS_NEWPAGE;