=================================================================== RCS file: /cvs/mandoc/term_ps.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -p -r1.29 -r1.30 --- mandoc/term_ps.c 2010/07/04 19:42:25 1.29 +++ mandoc/term_ps.c 2010/07/04 19:57:26 1.30 @@ -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 * @@ -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;