diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-06-29 15:49:53 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-06-29 15:49:53 +0000 |
commit | 303d2b5bbdde6b19e2f5e03f096fc12920d87827 (patch) | |
tree | 69771c00dddb35836fc198afc5d3fc46da6f9c16 /usr.bin/mandoc/term_ps.c | |
parent | c9032a0974ac98a9d455f0e6d15dcd4bd6863507 (diff) |
sync to bsd.lv version 1.10.3:
* support -Tps -Opaper=a4 and -Opaper=letter
* lots of mandoc.1 manual improvements
Diffstat (limited to 'usr.bin/mandoc/term_ps.c')
-rw-r--r-- | usr.bin/mandoc/term_ps.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c index 3f134a46151..eb06b309c4f 100644 --- a/usr.bin/mandoc/term_ps.c +++ b/usr.bin/mandoc/term_ps.c @@ -1,4 +1,4 @@ -/* $Id: term_ps.c,v 1.4 2010/06/29 14:41:28 schwarze Exp $ */ +/* $Id: term_ps.c,v 1.5 2010/06/29 15:49:52 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -22,6 +22,7 @@ #include <assert.h> #include <stdarg.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -373,14 +374,17 @@ static void ps_setfont(struct termp *, enum termfont); void * -ps_alloc(void) +ps_alloc(char *outopts) { struct termp *p; size_t pagex, pagey, margin; + const char *toks[2]; + char *v; if (NULL == (p = term_alloc(TERMENC_ASCII))) return(NULL); + /* Default is USA letter. */ pagex = 612; pagey = 792; margin = 72; @@ -393,6 +397,24 @@ ps_alloc(void) p->endline = ps_endline; p->width = ps_width; + toks[0] = "paper"; + toks[1] = NULL; + + while (outopts && *outopts) + switch (getsubopt(&outopts, UNCONST(toks), &v)) { + case (0): + if (0 == strcasecmp(v, "a4")) { + pagex = 595; + pagey = 842; + } else if (0 == strcasecmp(v, "letter")) { + pagex = 612; + pagey = 792; + } + break; + default: + break; + } + assert(margin * 2 < pagex); assert(margin * 2 < pagey); |