=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.80 retrieving revision 1.88 diff -u -p -r1.80 -r1.88 --- mandoc/main.c 2010/05/31 23:40:25 1.80 +++ mandoc/main.c 2010/06/12 11:41:50 1.88 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.80 2010/05/31 23:40:25 kristaps Exp $ */ +/* $Id: main.c,v 1.88 2010/06/12 11:41:50 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -65,7 +65,8 @@ enum outt { OUTT_TREE, OUTT_HTML, OUTT_XHTML, - OUTT_LINT + OUTT_LINT, + OUTT_PS }; struct curparse { @@ -97,7 +98,7 @@ struct curparse { static const char * const mandocerrs[MANDOCERR_MAX] = { "ok", "text should be uppercase", - "sections out of conentional order", + "sections out of conventional order", "section name repeats", "out of order prologue", "repeated prologue entry", @@ -108,9 +109,10 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "unterminated quoted string", "argument requires the width argument", "superfluous width argument", + "ignoring argument", "bad date argument", "bad width argument", - "unknown manual sction", + "unknown manual section", "section not in conventional manual section", "end of line whitespace", "scope open on exit", @@ -141,13 +143,14 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "macro requires body argument(s)", "macro requires argument(s)", "no title in document", + "missing list type", + "missing display type", "line argument(s) will be lost", "body argument(s) will be lost", "column syntax is inconsistent", "missing font type", - "missing display type", - "missing list type", "displays may not be nested", + "unsupported display type", "no scope to rewind: syntax violated", "scope broken, syntax violated", "line scope broken, syntax violated", @@ -395,7 +398,7 @@ read_whole_file(struct curparse *curp, struct buf *fb, *with_mmap = 1; fb->sz = (size_t)st.st_size; fb->buf = mmap(NULL, fb->sz, PROT_READ, - MAP_FILE, curp->fd, 0); + MAP_FILE|MAP_SHARED, curp->fd, 0); if (fb->buf != MAP_FAILED) return(1); } @@ -584,12 +587,26 @@ fdesc(struct curparse *curp) switch (curp->outtype) { case (OUTT_XHTML): curp->outdata = xhtml_alloc(curp->outopts); - curp->outman = html_man; - curp->outmdoc = html_mdoc; - curp->outfree = html_free; break; case (OUTT_HTML): curp->outdata = html_alloc(curp->outopts); + break; + case (OUTT_ASCII): + curp->outdata = ascii_alloc(curp->outopts); + curp->outfree = ascii_free; + break; + case (OUTT_PS): + curp->outdata = ps_alloc(); + curp->outfree = ps_free; + break; + default: + break; + } + + switch (curp->outtype) { + case (OUTT_HTML): + /* FALLTHROUGH */ + case (OUTT_XHTML): curp->outman = html_man; curp->outmdoc = html_mdoc; curp->outfree = html_free; @@ -598,14 +615,14 @@ fdesc(struct curparse *curp) curp->outman = tree_man; curp->outmdoc = tree_mdoc; break; - case (OUTT_LINT): - break; - default: - curp->outdata = ascii_alloc(80); + case (OUTT_ASCII): + /* FALLTHROUGH */ + case (OUTT_PS): curp->outman = terminal_man; curp->outmdoc = terminal_mdoc; - curp->outfree = terminal_free; break; + default: + break; } } @@ -729,6 +746,8 @@ toptions(struct curparse *curp, char *arg) curp->outtype = OUTT_HTML; else if (0 == strcmp(arg, "xhtml")) curp->outtype = OUTT_XHTML; + else if (0 == strcmp(arg, "ps")) + curp->outtype = OUTT_PS; else { fprintf(stderr, "%s: Bad argument\n", arg); return(0);