diff options
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/html.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/main.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.c | 12 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 22 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 22 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 35 | ||||
-rw-r--r-- | usr.bin/mandoc/roff.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/term_ps.c | 7 |
11 files changed, 98 insertions, 30 deletions
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile index 60705bd6822..d0ddeafbe87 100644 --- a/usr.bin/mandoc/Makefile +++ b/usr.bin/mandoc/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.44 2010/07/31 21:43:07 schwarze Exp $ +# $OpenBSD: Makefile,v 1.45 2010/09/27 21:25:28 schwarze Exp $ .include <bsd.own.mk> -VERSION=1.10.5 +VERSION=1.10.6 CFLAGS+=-DVERSION=\"${VERSION}\" CFLAGS+=-W -Wall -Wstrict-prototypes diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index d875fcebe6f..717664eb5c5 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.15 2010/08/20 00:53:35 schwarze Exp $ */ +/* $Id: html.c,v 1.16 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -112,7 +112,7 @@ ml_alloc(char *outopts, enum htmltype type) h = calloc(1, sizeof(struct html)); if (NULL == h) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } h->type = type; @@ -394,7 +394,7 @@ print_otag(struct html *h, enum htmltag tag, t = malloc(sizeof(struct tag)); if (NULL == t) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } t->tag = tag; t->next = h->tags.head; diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index ead36ef2987..8a219d31d45 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.47 2010/09/26 20:19:58 schwarze Exp $ */ +/* $Id: main.c,v 1.48 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -159,6 +159,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "missing font type", "line argument(s) will be lost", "body argument(s) will be lost", + "paragraph macro ignored", "generic fatal error", diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c index 8d0421f11bd..cd8707adc84 100644 --- a/usr.bin/mandoc/mandoc.c +++ b/usr.bin/mandoc/mandoc.c @@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.19 2010/09/13 22:04:01 schwarze Exp $ */ +/* $Id: mandoc.c,v 1.20 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -229,7 +229,7 @@ mandoc_calloc(size_t num, size_t size) ptr = calloc(num, size); if (NULL == ptr) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } return(ptr); @@ -244,7 +244,7 @@ mandoc_malloc(size_t size) ptr = malloc(size); if (NULL == ptr) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } return(ptr); @@ -258,7 +258,7 @@ mandoc_realloc(void *ptr, size_t size) ptr = realloc(ptr, size); if (NULL == ptr) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } return(ptr); @@ -273,7 +273,7 @@ mandoc_strdup(const char *ptr) p = strdup(ptr); if (NULL == p) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } return(p); @@ -369,7 +369,7 @@ mandoc_eos(const char *p, size_t sz, int enclosed) found = 1; break; default: - return(found && (!enclosed || isalnum(*q))); + return(found && (!enclosed || isalnum((unsigned char)*q))); } } diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index d9c9f8e05e1..79835c52e62 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.13 2010/09/26 20:19:58 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.14 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -99,6 +99,7 @@ enum mandocerr { MANDOCERR_FONTTYPE, /* missing font type */ MANDOCERR_ARGSLOST, /* line argument(s) will be lost */ MANDOCERR_BODYLOST, /* body argument(s) will be lost */ + MANDOCERR_IGNPAR, /* paragraph macro ignored */ MANDOCERR_FATAL, /* ===== end of fatal errors ===== */ diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 93ce8bdcd9e..ffaf2dfbd39 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.65 2010/08/20 00:53:35 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.66 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -687,11 +687,11 @@ mdoc_ptext(struct mdoc *m, int line, char *buf, int offs) return(0); /* - * Insert a `Pp' in the case of a blank line. Technically, + * Insert a `sp' in the case of a blank line. Technically, * blank lines aren't allowed, but enough manuals assume this * behaviour that we want to work around it. */ - if ( ! mdoc_elem_alloc(m, line, offs, MDOC_Pp, NULL)) + if ( ! mdoc_elem_alloc(m, line, offs, MDOC_sp, NULL)) return(0); m->next = MDOC_NEXT_SIBLING; diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 09d28a03704..fb4cf6677bd 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.32 2010/09/26 18:55:22 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.33 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -1312,6 +1312,26 @@ mdoc_bd_pre(MDOC_ARGS) for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(m, nn, h); + /* + * If the printed node flushes its own line, then we + * needn't do it here as well. This is hacky, but the + * notion of selective eoln whitespace is pretty dumb + * anyway, so don't sweat it. + */ + switch (nn->tok) { + case (MDOC_br): + /* FALLTHROUGH */ + case (MDOC_sp): + /* FALLTHROUGH */ + case (MDOC_Bl): + /* FALLTHROUGH */ + case (MDOC_Lp): + /* FALLTHROUGH */ + case (MDOC_Pp): + continue; + default: + break; + } if (nn->next && nn->next->line == nn->line) continue; print_text(h, "\n"); diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 1162e3fde96..a4956fb0c04 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.107 2010/09/26 18:55:22 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.108 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -1573,6 +1573,26 @@ termp_bd_pre(DECL_ARGS) for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(p, pair, m, nn); + /* + * If the printed node flushes its own line, then we + * needn't do it here as well. This is hacky, but the + * notion of selective eoln whitespace is pretty dumb + * anyway, so don't sweat it. + */ + switch (nn->tok) { + case (MDOC_br): + /* FALLTHROUGH */ + case (MDOC_sp): + /* FALLTHROUGH */ + case (MDOC_Bl): + /* FALLTHROUGH */ + case (MDOC_Lp): + /* FALLTHROUGH */ + case (MDOC_Pp): + continue; + default: + break; + } if (nn->next && nn->next->line == nn->line) continue; term_flushln(p); diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 6e92e5668ea..ef91057b64d 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.69 2010/09/20 19:48:21 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.70 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -96,6 +96,7 @@ static int pre_display(PRE_ARGS); static int pre_dt(PRE_ARGS); static int pre_it(PRE_ARGS); static int pre_os(PRE_ARGS); +static int pre_pp(PRE_ARGS); static int pre_rv(PRE_ARGS); static int pre_sh(PRE_ARGS); static int pre_ss(PRE_ARGS); @@ -125,8 +126,8 @@ static v_post posts_vt[] = { post_vt, NULL }; static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL }; static v_post posts_wtext[] = { ewarn_ge1, NULL }; static v_pre pres_an[] = { pre_an, NULL }; -static v_pre pres_bd[] = { pre_display, pre_bd, NULL }; -static v_pre pres_bl[] = { pre_bl, NULL }; +static v_pre pres_bd[] = { pre_display, pre_bd, pre_pp, NULL }; +static v_pre pres_bl[] = { pre_bl, pre_pp, NULL }; static v_pre pres_d1[] = { pre_display, NULL }; static v_pre pres_dd[] = { pre_dd, NULL }; static v_pre pres_dt[] = { pre_dt, NULL }; @@ -135,6 +136,7 @@ static v_pre pres_ex[] = { NULL, NULL }; static v_pre pres_fd[] = { NULL, NULL }; static v_pre pres_it[] = { pre_it, NULL }; static v_pre pres_os[] = { pre_os, NULL }; +static v_pre pres_pp[] = { pre_pp, NULL }; static v_pre pres_rv[] = { pre_rv, NULL }; static v_pre pres_sh[] = { pre_sh, NULL }; static v_pre pres_ss[] = { pre_ss, NULL }; @@ -146,7 +148,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { pres_os, NULL }, /* Os */ { pres_sh, posts_sh }, /* Sh */ { pres_ss, posts_ss }, /* Ss */ - { NULL, posts_notext }, /* Pp */ + { pres_pp, posts_notext }, /* Pp */ { pres_d1, posts_wline }, /* D1 */ { pres_d1, posts_wline }, /* Dl */ { pres_bd, posts_bd_bk }, /* Bd */ @@ -259,7 +261,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL }, /* Dx */ { NULL, posts_text }, /* %Q */ { NULL, posts_notext }, /* br */ - { NULL, posts_sp }, /* sp */ + { pres_pp, posts_sp }, /* sp */ { NULL, posts_text1 }, /* %U */ { NULL, NULL }, /* Ta */ }; @@ -1461,3 +1463,26 @@ post_sh_head(POST_ARGS) return(1); } + + +static int +pre_pp(PRE_ARGS) +{ + + if (NULL == mdoc->last) + return(1); + + /* Don't allow prior `Lp' or `Pp'. */ + + if (MDOC_Pp != mdoc->last->tok && MDOC_Lp != mdoc->last->tok) + return(1); + + if (MDOC_Bl == n->tok && n->data.Bl->comp) + return(1); + if (MDOC_Bd == n->tok && n->data.Bd->comp) + return(1); + + mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_IGNPAR); + mdoc_node_delete(mdoc, mdoc->last); + return(1); +} diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index af5eb60ce5f..3fe2033cb9c 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.12 2010/09/13 22:04:01 schwarze Exp $ */ +/* $Id: roff.c,v 1.13 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -51,7 +51,7 @@ enum rofft { ROFF_rm, ROFF_tr, ROFF_cblock, - ROFF_ccond, + ROFF_ccond, /* FIXME: remove this. */ ROFF_nr, ROFF_MAX }; @@ -732,7 +732,6 @@ roff_cond_sub(ROFF_ARGS) { enum rofft t; enum roffrule rr; - struct roffnode *l; ppos = pos; rr = r->last->rule; @@ -742,7 +741,6 @@ roff_cond_sub(ROFF_ARGS) * continue. */ - l = r->last; roffnode_cleanscope(r); if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) { @@ -783,6 +781,8 @@ roff_cond_text(ROFF_ARGS) * scope permits us to do so. */ + /* FIXME: use roff_ccond? */ + st = &(*bufp)[pos]; if (NULL == (ep = strstr(st, "\\}"))) { roffnode_cleanscope(r); diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c index 7c4a96a2056..371b31aa58b 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.12 2010/09/06 07:49:35 jsg Exp $ */ +/* $Id: term_ps.c,v 1.13 2010/09/27 21:25:28 schwarze Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -372,7 +372,7 @@ ps_growbuf(struct termp *p, size_t sz) if (NULL == p->engine.ps.psmarg) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } } @@ -583,6 +583,7 @@ ps_putchar(struct termp *p, char c) /* See ps_printf(). */ if ( ! (PS_MARGINS & p->engine.ps.flags)) { + /* LINTED */ putchar(c); p->engine.ps.pdfbytes++; return; @@ -609,7 +610,7 @@ pdf_obj(struct termp *p, size_t obj) p->engine.ps.pdfobjsz * sizeof(size_t)); if (NULL == p->engine.ps.pdfobjs) { perror(NULL); - exit(MANDOCLEVEL_SYSERR); + exit((int)MANDOCLEVEL_SYSERR); } } |