summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/apropos.c15
-rw-r--r--usr.bin/mandoc/arch.c5
-rw-r--r--usr.bin/mandoc/att.c5
-rw-r--r--usr.bin/mandoc/chars.c19
-rw-r--r--usr.bin/mandoc/chars.in4
-rw-r--r--usr.bin/mandoc/eqn.c65
-rw-r--r--usr.bin/mandoc/eqn_html.c14
-rw-r--r--usr.bin/mandoc/eqn_term.c9
-rw-r--r--usr.bin/mandoc/html.c126
-rw-r--r--usr.bin/mandoc/html.h14
-rw-r--r--usr.bin/mandoc/libman.h6
-rw-r--r--usr.bin/mandoc/libmandoc.h22
-rw-r--r--usr.bin/mandoc/libmdoc.h10
-rw-r--r--usr.bin/mandoc/libroff.h6
-rw-r--r--usr.bin/mandoc/main.c89
-rw-r--r--usr.bin/mandoc/main.h4
-rw-r--r--usr.bin/mandoc/man.c76
-rw-r--r--usr.bin/mandoc/man_hash.c7
-rw-r--r--usr.bin/mandoc/man_html.c71
-rw-r--r--usr.bin/mandoc/man_macro.c60
-rw-r--r--usr.bin/mandoc/man_term.c190
-rw-r--r--usr.bin/mandoc/man_validate.c90
-rw-r--r--usr.bin/mandoc/mandoc.c124
-rw-r--r--usr.bin/mandoc/mandoc.h12
-rw-r--r--usr.bin/mandoc/mandocdb.c133
-rw-r--r--usr.bin/mandoc/manpath.c7
-rw-r--r--usr.bin/mandoc/mansearch.c26
-rw-r--r--usr.bin/mandoc/mdoc.c157
-rw-r--r--usr.bin/mandoc/mdoc.h20
-rw-r--r--usr.bin/mandoc/mdoc_argv.c92
-rw-r--r--usr.bin/mandoc/mdoc_hash.c5
-rw-r--r--usr.bin/mandoc/mdoc_html.c490
-rw-r--r--usr.bin/mandoc/mdoc_macro.c283
-rw-r--r--usr.bin/mandoc/mdoc_man.c141
-rw-r--r--usr.bin/mandoc/mdoc_term.c533
-rw-r--r--usr.bin/mandoc/mdoc_validate.c494
-rw-r--r--usr.bin/mandoc/out.c53
-rw-r--r--usr.bin/mandoc/out.h6
-rw-r--r--usr.bin/mandoc/read.c99
-rw-r--r--usr.bin/mandoc/roff.c284
-rw-r--r--usr.bin/mandoc/st.in4
-rw-r--r--usr.bin/mandoc/tbl.c24
-rw-r--r--usr.bin/mandoc/tbl_data.c40
-rw-r--r--usr.bin/mandoc/tbl_html.c15
-rw-r--r--usr.bin/mandoc/tbl_layout.c99
-rw-r--r--usr.bin/mandoc/tbl_opts.c47
-rw-r--r--usr.bin/mandoc/tbl_term.c66
-rw-r--r--usr.bin/mandoc/term.c108
-rw-r--r--usr.bin/mandoc/term.h6
-rw-r--r--usr.bin/mandoc/term_ascii.c43
-rw-r--r--usr.bin/mandoc/term_ps.c164
-rw-r--r--usr.bin/mandoc/tree.c113
52 files changed, 2037 insertions, 2558 deletions
diff --git a/usr.bin/mandoc/apropos.c b/usr.bin/mandoc/apropos.c
index ea28fb277a2..618d3115a5b 100644
--- a/usr.bin/mandoc/apropos.c
+++ b/usr.bin/mandoc/apropos.c
@@ -1,4 +1,4 @@
-/* $Id: apropos.c,v 1.21 2014/04/11 15:45:39 schwarze Exp $ */
+/* $Id: apropos.c,v 1.22 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -28,6 +28,7 @@
#include "manpath.h"
#include "mansearch.h"
+
int
apropos(int argc, char *argv[])
{
@@ -60,22 +61,22 @@ apropos(int argc, char *argv[])
while (-1 != (ch = getopt(argc, argv, "C:M:m:O:S:s:")))
switch (ch) {
- case ('C'):
+ case 'C':
conf_file = optarg;
break;
- case ('M'):
+ case 'M':
defpaths = optarg;
break;
- case ('m'):
+ case 'm':
auxpaths = optarg;
break;
- case ('O'):
+ case 'O':
outkey = optarg;
break;
- case ('S'):
+ case 'S':
search.arch = optarg;
break;
- case ('s'):
+ case 's':
search.sec = optarg;
break;
default:
diff --git a/usr.bin/mandoc/arch.c b/usr.bin/mandoc/arch.c
index 5d4fedade99..95ef001ce00 100644
--- a/usr.bin/mandoc/arch.c
+++ b/usr.bin/mandoc/arch.c
@@ -1,4 +1,4 @@
-/* $Id: arch.c,v 1.7 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: arch.c,v 1.8 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -22,11 +22,12 @@
#define LINE(x, y) \
if (0 == strcmp(p, x)) return(y);
+
const char *
mdoc_a2arch(const char *p)
{
-#include "arch.in"
+#include "arch.in"
return(NULL);
}
diff --git a/usr.bin/mandoc/att.c b/usr.bin/mandoc/att.c
index fd96e56a160..1fde7497514 100644
--- a/usr.bin/mandoc/att.c
+++ b/usr.bin/mandoc/att.c
@@ -1,4 +1,4 @@
-/* $Id: att.c,v 1.7 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: att.c,v 1.8 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -22,11 +22,12 @@
#define LINE(x, y) \
if (0 == strcmp(p, x)) return(y);
+
const char *
mdoc_a2att(const char *p)
{
-#include "att.in"
+#include "att.in"
return(NULL);
}
diff --git a/usr.bin/mandoc/chars.c b/usr.bin/mandoc/chars.c
index 2102f13ed93..b82a57a38b5 100644
--- a/usr.bin/mandoc/chars.c
+++ b/usr.bin/mandoc/chars.c
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.27 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: chars.c,v 1.28 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -48,9 +48,10 @@ struct mchars {
struct ln **htab;
};
-static const struct ln *find(const struct mchars *,
+static const struct ln *find(const struct mchars *,
const char *, size_t);
+
void
mchars_free(struct mchars *arg)
{
@@ -107,18 +108,18 @@ mchars_spec2cp(const struct mchars *arg, const char *p, size_t sz)
char
mchars_num2char(const char *p, size_t sz)
{
- int i;
+ int i;
if ((i = mandoc_strntoi(p, sz, 10)) < 0)
return('\0');
- return(i > 0 && i < 256 && isprint(i) ?
- /* LINTED */ i : '\0');
+
+ return(i > 0 && i < 256 && isprint(i) ? i : '\0');
}
int
mchars_num2uc(const char *p, size_t sz)
{
- int i;
+ int i;
if ((i = mandoc_strntoi(p, sz, 16)) < 0)
return('\0');
@@ -127,7 +128,7 @@ mchars_num2uc(const char *p, size_t sz)
}
const char *
-mchars_spec2str(const struct mchars *arg,
+mchars_spec2str(const struct mchars *arg,
const char *p, size_t sz, size_t *rsz)
{
const struct ln *ln;
@@ -156,8 +157,8 @@ find(const struct mchars *tab, const char *p, size_t sz)
hash = (int)p[0] - PRINT_LO;
for (pp = tab->htab[hash]; pp; pp = pp->next)
- if (0 == strncmp(pp->code, p, sz) &&
- '\0' == pp->code[(int)sz])
+ if (0 == strncmp(pp->code, p, sz) &&
+ '\0' == pp->code[(int)sz])
return(pp);
return(NULL);
diff --git a/usr.bin/mandoc/chars.in b/usr.bin/mandoc/chars.in
index 27d29763e4b..d5511f1dff8 100644
--- a/usr.bin/mandoc/chars.in
+++ b/usr.bin/mandoc/chars.in
@@ -1,4 +1,4 @@
-/* $Id: chars.in,v 1.21 2014/03/05 23:14:37 schwarze Exp $ */
+/* $Id: chars.in,v 1.22 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -17,7 +17,7 @@
*/
/*
- * The ASCII translation tables.
+ * The ASCII translation tables.
*
* The left-hand side corresponds to the input sequence (\x, \(xx, \*(xx
* and so on) whose length is listed second element. The right-hand
diff --git a/usr.bin/mandoc/eqn.c b/usr.bin/mandoc/eqn.c
index 327f3fa0b92..305b629d138 100644
--- a/usr.bin/mandoc/eqn.c
+++ b/usr.bin/mandoc/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.6 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: eqn.c,v 1.7 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -134,12 +134,11 @@ struct eqnsym {
const char *sym;
};
-
static enum eqn_rest eqn_box(struct eqn_node *, struct eqn_box *);
-static struct eqn_box *eqn_box_alloc(struct eqn_node *,
+static struct eqn_box *eqn_box_alloc(struct eqn_node *,
struct eqn_box *);
static void eqn_box_free(struct eqn_box *);
-static struct eqn_def *eqn_def_find(struct eqn_node *,
+static struct eqn_def *eqn_def_find(struct eqn_node *,
const char *, size_t);
static int eqn_do_gfont(struct eqn_node *);
static int eqn_do_gsize(struct eqn_node *);
@@ -153,7 +152,7 @@ static enum eqn_rest eqn_list(struct eqn_node *, struct eqn_box *);
static enum eqn_rest eqn_matrix(struct eqn_node *, struct eqn_box *);
static const char *eqn_nexttok(struct eqn_node *, size_t *);
static const char *eqn_nextrawtok(struct eqn_node *, size_t *);
-static const char *eqn_next(struct eqn_node *,
+static const char *eqn_next(struct eqn_node *,
char, size_t *, int);
static void eqn_rewind(struct eqn_node *);
@@ -274,9 +273,9 @@ static const struct eqnsym eqnsyms[EQNSYM__MAX] = {
{ { ">=", 2 }, ">=" }, /* EQNSYM_moreequal */
};
-/* ARGSUSED */
+
enum rofferr
-eqn_read(struct eqn_node **epp, int ln,
+eqn_read(struct eqn_node **epp, int ln,
const char *p, int pos, int *offs)
{
size_t sz;
@@ -295,7 +294,7 @@ eqn_read(struct eqn_node **epp, int ln,
p += 3;
while (' ' == *p || '\t' == *p)
p++;
- if ('\0' == *p)
+ if ('\0' == *p)
return(er);
mandoc_msg(MANDOCERR_ARGSLOST, ep->parse, ln, pos, NULL);
return(er);
@@ -410,11 +409,11 @@ eqn_matrix(struct eqn_node *ep, struct eqn_box *last)
while (EQN_OK == (c = eqn_box(ep, bp)))
switch (bp->last->pile) {
- case (EQNPILE_LCOL):
+ case EQNPILE_LCOL:
/* FALLTHROUGH */
- case (EQNPILE_CCOL):
+ case EQNPILE_CCOL:
/* FALLTHROUGH */
- case (EQNPILE_RCOL):
+ case EQNPILE_RCOL:
continue;
default:
EQN_MSG(MANDOCERR_EQNSYNT, ep);
@@ -509,9 +508,8 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last)
for (i = 0; i < (int)EQN__MAX; i++) {
if ( ! EQNSTREQ(&eqnparts[i].str, start, sz))
continue;
- return((*eqnparts[i].fp)(ep) ?
- EQN_OK : EQN_ERR);
- }
+ return((*eqnparts[i].fp)(ep) ? EQN_OK : EQN_ERR);
+ }
if (STRNEQ(start, sz, "{", 1)) {
if (EQN_DESCOPE != (c = eqn_eqn(ep, last))) {
@@ -526,7 +524,7 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last)
return(EQN_OK);
EQN_MSG(MANDOCERR_EQNBADSCOPE, ep);
return(EQN_ERR);
- }
+ }
for (i = 0; i < (int)EQNPILE__MAX; i++) {
if ( ! EQNSTREQ(&eqnpiles[i], start, sz))
@@ -572,7 +570,7 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last)
if (NULL == last->last) {
EQN_MSG(MANDOCERR_EQNSYNT, ep);
return(EQN_ERR);
- }
+ }
last->last->pos = (enum eqn_post)i;
if (EQN_EOF == (c = eqn_box(ep, last))) {
EQN_MSG(MANDOCERR_EQNEOF, ep);
@@ -587,7 +585,7 @@ eqn_box(struct eqn_node *ep, struct eqn_box *last)
if (NULL == last->last) {
EQN_MSG(MANDOCERR_EQNSYNT, ep);
return(EQN_ERR);
- }
+ }
last->last->mark = (enum eqn_markt)i;
if (EQN_EOF == (c = eqn_box(ep, last))) {
EQN_MSG(MANDOCERR_EQNEOF, ep);
@@ -759,9 +757,9 @@ again:
if (q)
ep->cur++;
while (' ' == ep->data[(int)ep->cur] ||
- '\t' == ep->data[(int)ep->cur] ||
- '^' == ep->data[(int)ep->cur] ||
- '~' == ep->data[(int)ep->cur])
+ '\t' == ep->data[(int)ep->cur] ||
+ '^' == ep->data[(int)ep->cur] ||
+ '~' == ep->data[(int)ep->cur])
ep->cur++;
} else {
if (q)
@@ -787,8 +785,8 @@ again:
}
diff = def->valsz - *sz;
- memmove(start + *sz + diff, start + *sz,
- (strlen(start) - *sz) + 1);
+ memmove(start + *sz + diff, start + *sz,
+ (strlen(start) - *sz) + 1);
memcpy(start, def->val, def->valsz);
goto again;
}
@@ -849,8 +847,8 @@ eqn_do_define(struct eqn_node *ep)
return(0);
}
- /*
- * Search for a key that already exists.
+ /*
+ * Search for a key that already exists.
* Create a new key if none is found.
*/
@@ -862,15 +860,14 @@ eqn_do_define(struct eqn_node *ep)
if (i == (int)ep->defsz) {
ep->defsz++;
- ep->defs = mandoc_realloc
- (ep->defs, ep->defsz *
- sizeof(struct eqn_def));
+ ep->defs = mandoc_realloc(ep->defs,
+ ep->defsz * sizeof(struct eqn_def));
ep->defs[i].key = ep->defs[i].val = NULL;
}
ep->defs[i].keysz = sz;
- ep->defs[i].key = mandoc_realloc
- (ep->defs[i].key, sz + 1);
+ ep->defs[i].key = mandoc_realloc(
+ ep->defs[i].key, sz + 1);
memcpy(ep->defs[i].key, start, sz);
ep->defs[i].key[(int)sz] = '\0';
@@ -898,7 +895,7 @@ eqn_do_gfont(struct eqn_node *ep)
if (NULL == eqn_nextrawtok(ep, NULL)) {
EQN_MSG(MANDOCERR_EQNEOF, ep);
return(0);
- }
+ }
return(1);
}
@@ -911,7 +908,7 @@ eqn_do_gsize(struct eqn_node *ep)
if (NULL == (start = eqn_nextrawtok(ep, &sz))) {
EQN_MSG(MANDOCERR_EQNEOF, ep);
return(0);
- }
+ }
ep->gsize = mandoc_strntoi(start, sz, 10);
return(1);
}
@@ -937,9 +934,9 @@ eqn_def_find(struct eqn_node *ep, const char *key, size_t sz)
{
int i;
- for (i = 0; i < (int)ep->defsz; i++)
- if (ep->defs[i].keysz && STRNEQ(ep->defs[i].key,
- ep->defs[i].keysz, key, sz))
+ for (i = 0; i < (int)ep->defsz; i++)
+ if (ep->defs[i].keysz && STRNEQ(ep->defs[i].key,
+ ep->defs[i].keysz, key, sz))
return(&ep->defs[i]);
return(NULL);
diff --git a/usr.bin/mandoc/eqn_html.c b/usr.bin/mandoc/eqn_html.c
index 0ca6e4a8574..1944ed8953f 100644
--- a/usr.bin/mandoc/eqn_html.c
+++ b/usr.bin/mandoc/eqn_html.c
@@ -1,4 +1,4 @@
-/* $Id: eqn_html.c,v 1.1 2011/09/18 10:25:28 schwarze Exp $ */
+/* $Id: eqn_html.c,v 1.2 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,10 +14,6 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,9 +31,9 @@ static const enum htmltag fontmap[EQNFONT__MAX] = {
TAG_I /* EQNFONT_ITALIC */
};
-
static void eqn_box(struct html *, const struct eqn_box *);
+
void
print_eqn(struct html *p, const struct eqn *ep)
{
@@ -59,12 +55,12 @@ eqn_box(struct html *p, const struct eqn_box *bp)
{
struct tag *t;
- t = EQNFONT_NONE == bp->font ? NULL :
- print_otag(p, fontmap[(int)bp->font], 0, NULL);
+ t = EQNFONT_NONE == bp->font ? NULL :
+ print_otag(p, fontmap[(int)bp->font], 0, NULL);
if (bp->left)
print_text(p, bp->left);
-
+
if (bp->text)
print_text(p, bp->text);
diff --git a/usr.bin/mandoc/eqn_term.c b/usr.bin/mandoc/eqn_term.c
index 0f0d53f8fb1..6c0da205edf 100644
--- a/usr.bin/mandoc/eqn_term.c
+++ b/usr.bin/mandoc/eqn_term.c
@@ -1,4 +1,4 @@
-/* $Id: eqn_term.c,v 1.1 2011/09/18 10:25:28 schwarze Exp $ */
+/* $Id: eqn_term.c,v 1.2 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,10 +14,6 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -37,6 +33,7 @@ static const enum termfont fontmap[EQNFONT__MAX] = {
static void eqn_box(struct termp *, const struct eqn_box *);
+
void
term_eqn(struct termp *p, const struct eqn *ep)
{
@@ -68,7 +65,7 @@ eqn_box(struct termp *p, const struct eqn_box *bp)
term_word(p, ")");
if (bp->right)
term_word(p, bp->right);
- if (EQNFONT_NONE != bp->font)
+ if (EQNFONT_NONE != bp->font)
term_fontpop(p);
if (bp->next)
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index 976d18bf11e..c304b80b091 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.34 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: html.c,v 1.35 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -111,6 +111,7 @@ static void print_metaf(struct html *, enum mandoc_esc);
static void print_attr(struct html *, const char *, const char *);
static void *ml_alloc(char *, enum htmltype);
+
static void *
ml_alloc(char *outopts, enum htmltype type)
{
@@ -132,16 +133,16 @@ ml_alloc(char *outopts, enum htmltype type)
while (outopts && *outopts)
switch (getsubopt(&outopts, UNCONST(toks), &v)) {
- case (0):
+ case 0:
h->style = v;
break;
- case (1):
+ case 1:
h->base_man = v;
break;
- case (2):
+ case 2:
h->base_includes = v;
break;
- case (3):
+ case 3:
h->oflags |= HTML_FRAGMENT;
break;
default:
@@ -158,7 +159,6 @@ html_alloc(char *outopts)
return(ml_alloc(outopts, HTML_HTML_4_01_STRICT));
}
-
void *
xhtml_alloc(char *outopts)
{
@@ -166,7 +166,6 @@ xhtml_alloc(char *outopts)
return(ml_alloc(outopts, HTML_XHTML_1_0_STRICT));
}
-
void
html_free(void *p)
{
@@ -176,17 +175,16 @@ html_free(void *p)
h = (struct html *)p;
while ((tag = h->tags.head) != NULL) {
- h->tags.head = tag->next;
+ h->tags.head = tag->next;
free(tag);
}
-
+
if (h->symtab)
mchars_free(h->symtab);
free(h);
}
-
void
print_gen_head(struct html *h)
{
@@ -223,21 +221,21 @@ print_metaf(struct html *h, enum mandoc_esc deco)
enum htmlfont font;
switch (deco) {
- case (ESCAPE_FONTPREV):
+ case ESCAPE_FONTPREV:
font = h->metal;
break;
- case (ESCAPE_FONTITALIC):
+ case ESCAPE_FONTITALIC:
font = HTMLFONT_ITALIC;
break;
- case (ESCAPE_FONTBOLD):
+ case ESCAPE_FONTBOLD:
font = HTMLFONT_BOLD;
break;
- case (ESCAPE_FONTBI):
+ case ESCAPE_FONTBI:
font = HTMLFONT_BI;
break;
- case (ESCAPE_FONT):
+ case ESCAPE_FONT:
/* FALLTHROUGH */
- case (ESCAPE_FONTROMAN):
+ case ESCAPE_FONTROMAN:
font = HTMLFONT_NONE;
break;
default:
@@ -254,13 +252,13 @@ print_metaf(struct html *h, enum mandoc_esc deco)
h->metac = font;
switch (font) {
- case (HTMLFONT_ITALIC):
+ case HTMLFONT_ITALIC:
h->metaf = print_otag(h, TAG_I, 0, NULL);
break;
- case (HTMLFONT_BOLD):
+ case HTMLFONT_BOLD:
h->metaf = print_otag(h, TAG_B, 0, NULL);
break;
- case (HTMLFONT_BI):
+ case HTMLFONT_BI:
h->metaf = print_otag(h, TAG_B, 0, NULL);
print_otag(h, TAG_I, 0, NULL);
break;
@@ -299,19 +297,19 @@ html_strlen(const char *cp)
break;
cp++;
switch (mandoc_escape(&cp, NULL, NULL)) {
- case (ESCAPE_ERROR):
+ case ESCAPE_ERROR:
return(sz);
- case (ESCAPE_UNICODE):
+ case ESCAPE_UNICODE:
/* FALLTHROUGH */
- case (ESCAPE_NUMBERED):
+ case ESCAPE_NUMBERED:
/* FALLTHROUGH */
- case (ESCAPE_SPECIAL):
+ case ESCAPE_SPECIAL:
if (skip)
skip = 0;
else
sz++;
break;
- case (ESCAPE_SKIPCHAR):
+ case ESCAPE_SKIPCHAR:
skip = 1;
break;
default:
@@ -349,22 +347,22 @@ print_encode(struct html *h, const char *p, int norecurse)
break;
switch (*p++) {
- case ('<'):
+ case '<':
printf("&lt;");
continue;
- case ('>'):
+ case '>':
printf("&gt;");
continue;
- case ('&'):
+ case '&':
printf("&amp;");
continue;
- case (ASCII_NBRSP):
+ case ASCII_NBRSP:
putchar('-');
continue;
- case (ASCII_HYPH):
+ case ASCII_HYPH:
putchar('-');
/* FALLTHROUGH */
- case (ASCII_BREAK):
+ case ASCII_BREAK:
continue;
default:
break;
@@ -375,21 +373,21 @@ print_encode(struct html *h, const char *p, int norecurse)
break;
switch (esc) {
- case (ESCAPE_FONT):
+ case ESCAPE_FONT:
/* FALLTHROUGH */
- case (ESCAPE_FONTPREV):
+ case ESCAPE_FONTPREV:
/* FALLTHROUGH */
- case (ESCAPE_FONTBOLD):
+ case ESCAPE_FONTBOLD:
/* FALLTHROUGH */
- case (ESCAPE_FONTITALIC):
+ case ESCAPE_FONTITALIC:
/* FALLTHROUGH */
- case (ESCAPE_FONTBI):
+ case ESCAPE_FONTBI:
/* FALLTHROUGH */
- case (ESCAPE_FONTROMAN):
+ case ESCAPE_FONTROMAN:
if (0 == norecurse)
print_metaf(h, esc);
continue;
- case (ESCAPE_SKIPCHAR):
+ case ESCAPE_SKIPCHAR:
h->flags |= HTML_SKIPCHAR;
continue;
default:
@@ -402,25 +400,25 @@ print_encode(struct html *h, const char *p, int norecurse)
}
switch (esc) {
- case (ESCAPE_UNICODE):
+ case ESCAPE_UNICODE:
/* Skip passed "u" header. */
c = mchars_num2uc(seq + 1, len - 1);
if ('\0' != c)
printf("&#x%x;", c);
break;
- case (ESCAPE_NUMBERED):
+ case ESCAPE_NUMBERED:
c = mchars_num2char(seq, len);
if ('\0' != c)
putchar(c);
break;
- case (ESCAPE_SPECIAL):
+ case ESCAPE_SPECIAL:
c = mchars_spec2cp(h->symtab, seq, len);
if (c > 0)
printf("&#%d;", c);
else if (-1 == c && 1 == len)
putchar((int)*seq);
break;
- case (ESCAPE_NOSPACE):
+ case ESCAPE_NOSPACE:
if ('\0' == *p)
nospace = 1;
break;
@@ -432,7 +430,6 @@ print_encode(struct html *h, const char *p, int norecurse)
return(nospace);
}
-
static void
print_attr(struct html *h, const char *key, const char *val)
{
@@ -441,9 +438,8 @@ print_attr(struct html *h, const char *key, const char *val)
putchar('\"');
}
-
struct tag *
-print_otag(struct html *h, enum htmltag tag,
+print_otag(struct html *h, enum htmltag tag,
int sz, const struct htmlpair *p)
{
int i;
@@ -493,7 +489,7 @@ print_otag(struct html *h, enum htmltag tag,
if (HTML_AUTOCLOSE & htmltags[tag].flags)
switch (h->type) {
- case (HTML_XHTML_1_0_STRICT):
+ case HTML_XHTML_1_0_STRICT:
putchar('/');
break;
default:
@@ -510,16 +506,15 @@ print_otag(struct html *h, enum htmltag tag,
return(t);
}
-
static void
print_ctag(struct html *h, enum htmltag tag)
{
-
+
printf("</%s>", htmltags[tag].name);
if (HTML_CLRLINE & htmltags[tag].flags) {
h->flags |= HTML_NOSPACE;
putchar('\n');
- }
+ }
}
void
@@ -530,7 +525,7 @@ print_gen_decls(struct html *h)
const char *name;
switch (h->type) {
- case (HTML_HTML_4_01_STRICT):
+ case HTML_HTML_4_01_STRICT:
name = "HTML";
doctype = "-//W3C//DTD HTML 4.01//EN";
dtd = "http://www.w3.org/TR/html4/strict.dtd";
@@ -543,8 +538,8 @@ print_gen_decls(struct html *h)
break;
}
- printf("<!DOCTYPE %s PUBLIC \"%s\" \"%s\">\n",
- name, doctype, dtd);
+ printf("<!DOCTYPE %s PUBLIC \"%s\" \"%s\">\n",
+ name, doctype, dtd);
}
void
@@ -563,13 +558,13 @@ print_text(struct html *h, const char *word)
assert(NULL == h->metaf);
switch (h->metac) {
- case (HTMLFONT_ITALIC):
+ case HTMLFONT_ITALIC:
h->metaf = print_otag(h, TAG_I, 0, NULL);
break;
- case (HTMLFONT_BOLD):
+ case HTMLFONT_BOLD:
h->metaf = print_otag(h, TAG_B, 0, NULL);
break;
- case (HTMLFONT_BI):
+ case HTMLFONT_BI:
h->metaf = print_otag(h, TAG_B, 0, NULL);
print_otag(h, TAG_I, 0, NULL);
break;
@@ -592,14 +587,13 @@ print_text(struct html *h, const char *word)
h->flags &= ~HTML_IGNDELIM;
}
-
void
print_tagq(struct html *h, const struct tag *until)
{
struct tag *tag;
while ((tag = h->tags.head) != NULL) {
- /*
+ /*
* Remember to close out and nullify the current
* meta-font and table, if applicable.
*/
@@ -615,7 +609,6 @@ print_tagq(struct html *h, const struct tag *until)
}
}
-
void
print_stagq(struct html *h, const struct tag *suntil)
{
@@ -624,7 +617,7 @@ print_stagq(struct html *h, const struct tag *suntil)
while ((tag = h->tags.head) != NULL) {
if (suntil && tag == suntil)
return;
- /*
+ /*
* Remember to close out and nullify the current
* meta-font and table, if applicable.
*/
@@ -670,8 +663,8 @@ bufcat_fmt(struct html *h, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- (void)vsnprintf(h->buf + (int)h->buflen,
- BUFSIZ - h->buflen - 1, fmt, ap);
+ (void)vsnprintf(h->buf + (int)h->buflen,
+ BUFSIZ - h->buflen - 1, fmt, ap);
va_end(ap);
h->buflen = strlen(h->buf);
}
@@ -691,12 +684,12 @@ buffmt_includes(struct html *h, const char *name)
const char *p, *pp;
pp = h->base_includes;
-
+
bufinit(h);
while (NULL != (p = strchr(pp, '%'))) {
bufncat(h, pp, (size_t)(p - pp));
switch (*(p + 1)) {
- case('I'):
+ case'I':
bufcat(h, name);
break;
default:
@@ -710,21 +703,20 @@ buffmt_includes(struct html *h, const char *name)
}
void
-buffmt_man(struct html *h,
- const char *name, const char *sec)
+buffmt_man(struct html *h, const char *name, const char *sec)
{
const char *p, *pp;
pp = h->base_man;
-
+
bufinit(h);
while (NULL != (p = strchr(pp, '%'))) {
bufncat(h, pp, (size_t)(p - pp));
switch (*(p + 1)) {
- case('S'):
+ case 'S':
bufcat(h, sec ? sec : "1");
break;
- case('N'):
+ case 'N':
bufcat_fmt(h, "%s", name);
break;
default:
diff --git a/usr.bin/mandoc/html.h b/usr.bin/mandoc/html.h
index b796a384fdf..dfbfcc97de3 100644
--- a/usr.bin/mandoc/html.h
+++ b/usr.bin/mandoc/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.20 2013/08/08 20:07:24 schwarze Exp $ */
+/* $Id: html.h,v 1.21 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -105,7 +105,7 @@ struct htmlpair {
#define PAIR_STYLE_INIT(p, h) PAIR_INIT(p, ATTR_STYLE, (h)->buf)
#define PAIR_SUMMARY_INIT(p, v) PAIR_INIT(p, ATTR_SUMMARY, v)
-enum htmltype {
+enum htmltype {
HTML_HTML_4_01_STRICT,
HTML_XHTML_1_0_STRICT
};
@@ -127,7 +127,7 @@ struct html {
char *base_includes; /* base for include href */
char *style; /* style-sheet URI */
char buf[BUFSIZ]; /* see bufcat and friends */
- size_t buflen;
+ size_t buflen;
struct tag *metaf; /* current open font scope */
enum htmlfont metal; /* last used font */
enum htmlfont metac; /* current font mode */
@@ -138,7 +138,7 @@ struct html {
void print_gen_decls(struct html *);
void print_gen_head(struct html *);
-struct tag *print_otag(struct html *, enum htmltag,
+struct tag *print_otag(struct html *, enum htmltag,
int, const struct htmlpair *);
void print_tagq(struct html *, const struct tag *);
void print_stagq(struct html *, const struct tag *);
@@ -150,12 +150,12 @@ void print_eqn(struct html *, const struct eqn *);
void bufcat_fmt(struct html *, const char *, ...);
void bufcat(struct html *, const char *);
void bufcat_id(struct html *, const char *);
-void bufcat_style(struct html *,
+void bufcat_style(struct html *,
const char *, const char *);
-void bufcat_su(struct html *, const char *,
+void bufcat_su(struct html *, const char *,
const struct roffsu *);
void bufinit(struct html *);
-void buffmt_man(struct html *,
+void buffmt_man(struct html *,
const char *, const char *);
void buffmt_includes(struct html *, const char *);
diff --git a/usr.bin/mandoc/libman.h b/usr.bin/mandoc/libman.h
index 45a78bc344c..d7cc81536cc 100644
--- a/usr.bin/mandoc/libman.h
+++ b/usr.bin/mandoc/libman.h
@@ -1,4 +1,4 @@
-/* $Id: libman.h,v 1.33 2014/01/05 20:26:27 schwarze Exp $ */
+/* $Id: libman.h,v 1.34 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -78,8 +78,8 @@ enum mant man_hash_find(const char *);
int man_macroend(struct man *);
int man_valid_post(struct man *);
int man_valid_pre(struct man *, struct man_node *);
-int man_unscope(struct man *,
- const struct man_node *, enum mandocerr);
+int man_unscope(struct man *, const struct man_node *,
+ enum mandocerr);
__END_DECLS
diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h
index 72f908b2fe5..7d62e12c289 100644
--- a/usr.bin/mandoc/libmandoc.h
+++ b/usr.bin/mandoc/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.26 2014/03/19 21:50:59 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.27 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -36,9 +36,9 @@ struct roff;
struct mdoc;
struct man;
-void mandoc_msg(enum mandocerr, struct mparse *,
+void mandoc_msg(enum mandocerr, struct mparse *,
int, int, const char *);
-void mandoc_vmsg(enum mandocerr, struct mparse *,
+void mandoc_vmsg(enum mandocerr, struct mparse *,
int, int, const char *, ...);
char *mandoc_getarg(struct mparse *, char **, int, int *);
char *mandoc_normdate(struct mparse *, char *, int, int);
@@ -46,36 +46,36 @@ int mandoc_eos(const char *, size_t);
int mandoc_strntoi(const char *, size_t, int);
const char *mandoc_a2msec(const char*);
-void mdoc_free(struct mdoc *);
+void mdoc_free(struct mdoc *);
struct mdoc *mdoc_alloc(struct roff *, struct mparse *, char *, int);
void mdoc_reset(struct mdoc *);
-int mdoc_parseln(struct mdoc *, int, char *, int);
+int mdoc_parseln(struct mdoc *, int, char *, int);
int mdoc_endparse(struct mdoc *);
int mdoc_addspan(struct mdoc *, const struct tbl_span *);
int mdoc_addeqn(struct mdoc *, const struct eqn *);
-void man_free(struct man *);
+void man_free(struct man *);
struct man *man_alloc(struct roff *, struct mparse *, int);
void man_reset(struct man *);
-int man_parseln(struct man *, int, char *, int);
+int man_parseln(struct man *, int, char *, int);
int man_endparse(struct man *);
int man_addspan(struct man *, const struct tbl_span *);
int man_addeqn(struct man *, const struct eqn *);
-void roff_free(struct roff *);
+void roff_free(struct roff *);
struct roff *roff_alloc(struct mparse *, int);
void roff_reset(struct roff *);
-enum rofferr roff_parseln(struct roff *, int,
+enum rofferr roff_parseln(struct roff *, int,
char **, size_t *, int, int *);
void roff_endparse(struct roff *);
void roff_setreg(struct roff *, const char *, int, char sign);
int roff_getreg(const struct roff *, const char *);
char *roff_strdup(const struct roff *, const char *);
-int roff_getcontrol(const struct roff *,
+int roff_getcontrol(const struct roff *,
const char *, int *);
#if 0
char roff_eqndelim(const struct roff *);
-void roff_openeqn(struct roff *, const char *,
+void roff_openeqn(struct roff *, const char *,
int, int, const char *);
int roff_closeeqn(struct roff *);
#endif
diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h
index cd74739dfb8..698a22a860c 100644
--- a/usr.bin/mandoc/libmdoc.h
+++ b/usr.bin/mandoc/libmdoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmdoc.h,v 1.53 2014/01/05 20:26:27 schwarze Exp $ */
+/* $Id: libmdoc.h,v 1.54 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -109,12 +109,12 @@ __BEGIN_DECLS
#define mdoc_nmsg(mdoc, n, t) \
mandoc_msg((t), (mdoc)->parse, (n)->line, (n)->pos, NULL)
int mdoc_macro(MACRO_PROT_ARGS);
-int mdoc_word_alloc(struct mdoc *,
+int mdoc_word_alloc(struct mdoc *,
int, int, const char *);
void mdoc_word_append(struct mdoc *, const char *);
-int mdoc_elem_alloc(struct mdoc *, int, int,
+int mdoc_elem_alloc(struct mdoc *, int, int,
enum mdoct, struct mdoc_arg *);
-int mdoc_block_alloc(struct mdoc *, int, int,
+int mdoc_block_alloc(struct mdoc *, int, int,
enum mdoct, struct mdoc_arg *);
int mdoc_head_alloc(struct mdoc *, int, int, enum mdoct);
int mdoc_tail_alloc(struct mdoc *, int, int, enum mdoct);
@@ -137,7 +137,7 @@ enum margverr mdoc_argv(struct mdoc *, int, enum mdoct,
void mdoc_argv_free(struct mdoc_arg *);
enum margserr mdoc_args(struct mdoc *, int,
int *, char *, enum mdoct, char **);
-enum margserr mdoc_zargs(struct mdoc *, int,
+enum margserr mdoc_zargs(struct mdoc *, int,
int *, char *, char **);
int mdoc_macroend(struct mdoc *);
enum mdelim mdoc_isdelim(const char *);
diff --git a/usr.bin/mandoc/libroff.h b/usr.bin/mandoc/libroff.h
index 5c8bf39e3be..17c5f01ff90 100644
--- a/usr.bin/mandoc/libroff.h
+++ b/usr.bin/mandoc/libroff.h
@@ -1,4 +1,4 @@
-/* $Id: libroff.h,v 1.6 2013/05/31 21:37:08 schwarze Exp $ */
+/* $Id: libroff.h,v 1.7 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -66,7 +66,7 @@ struct tbl_node *tbl_alloc(int, int, struct mparse *);
void tbl_restart(int, int, struct tbl_node *);
void tbl_free(struct tbl_node *);
void tbl_reset(struct tbl_node *);
-enum rofferr tbl_read(struct tbl_node *, int, const char *, int);
+enum rofferr tbl_read(struct tbl_node *, int, const char *, int);
int tbl_option(struct tbl_node *, int, const char *);
int tbl_layout(struct tbl_node *, int, const char *);
int tbl_data(struct tbl_node *, int, const char *);
@@ -76,7 +76,7 @@ void tbl_end(struct tbl_node **);
struct eqn_node *eqn_alloc(const char *, int, int, struct mparse *);
enum rofferr eqn_end(struct eqn_node **);
void eqn_free(struct eqn_node *);
-enum rofferr eqn_read(struct eqn_node **, int,
+enum rofferr eqn_read(struct eqn_node **, int,
const char *, int, int *);
__END_DECLS
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index c5e59d29ad0..e62efcb5e18 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.89 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: main.c,v 1.90 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -51,9 +51,9 @@ struct curparse {
struct mparse *mp;
enum mandoclevel wlevel; /* ignore messages below this */
int wstop; /* stop after a file with a warning */
- enum outt outtype; /* which output to use */
+ enum outt outtype; /* which output to use */
out_mdoc outmdoc; /* mdoc output ptr */
- out_man outman; /* man output ptr */
+ out_man outman; /* man output ptr */
out_free outfree; /* free output ptr */
void *outdata; /* data for output */
char outopts[BUFSIZ]; /* buf of output opts */
@@ -65,7 +65,7 @@ int mandocdb(int, char**);
static int moptions(int *, char *);
static void mmsg(enum mandocerr, enum mandoclevel,
const char *, int, int, const char *);
-static void parse(struct curparse *, int,
+static void parse(struct curparse *, int,
const char *, enum mandoclevel *);
static int toptions(struct curparse *, char *);
static void usage(void) __attribute__((noreturn));
@@ -74,6 +74,7 @@ static int woptions(struct curparse *, char *);
static const char *progname;
+
int
main(int argc, char *argv[])
{
@@ -103,39 +104,39 @@ main(int argc, char *argv[])
curp.wlevel = MANDOCLEVEL_FATAL;
defos = NULL;
- /* LINTED */
while (-1 != (c = getopt(argc, argv, "I:m:O:T:VW:")))
switch (c) {
- case ('I'):
+ case 'I':
if (strncmp(optarg, "os=", 3)) {
- fprintf(stderr, "-I%s: Bad argument\n",
- optarg);
+ fprintf(stderr,
+ "-I%s: Bad argument\n", optarg);
return((int)MANDOCLEVEL_BADARG);
}
if (defos) {
- fprintf(stderr, "-I%s: Duplicate argument\n",
- optarg);
+ fprintf(stderr,
+ "-I%s: Duplicate argument\n",
+ optarg);
return((int)MANDOCLEVEL_BADARG);
}
defos = mandoc_strdup(optarg + 3);
break;
- case ('m'):
+ case 'm':
if ( ! moptions(&options, optarg))
return((int)MANDOCLEVEL_BADARG);
break;
- case ('O'):
+ case 'O':
(void)strlcat(curp.outopts, optarg, BUFSIZ);
(void)strlcat(curp.outopts, ",", BUFSIZ);
break;
- case ('T'):
+ case 'T':
if ( ! toptions(&curp, optarg))
return((int)MANDOCLEVEL_BADARG);
break;
- case ('W'):
+ case 'W':
if ( ! woptions(&curp, optarg))
return((int)MANDOCLEVEL_BADARG);
break;
- case ('V'):
+ case 'V':
version();
/* NOTREACHED */
default:
@@ -194,15 +195,15 @@ usage(void)
"[-Ooption] "
"[-Toutput] "
"[-Wlevel]\n"
- "\t [file ...]\n",
+ "\t [file ...]\n",
progname);
exit((int)MANDOCLEVEL_BADARG);
}
static void
-parse(struct curparse *curp, int fd,
- const char *file, enum mandoclevel *level)
+parse(struct curparse *curp, int fd, const char *file,
+ enum mandoclevel *level)
{
enum mandoclevel rc;
struct mdoc *mdoc;
@@ -232,31 +233,31 @@ parse(struct curparse *curp, int fd,
if ( ! (curp->outman && curp->outmdoc)) {
switch (curp->outtype) {
- case (OUTT_XHTML):
+ case OUTT_XHTML:
curp->outdata = xhtml_alloc(curp->outopts);
curp->outfree = html_free;
break;
- case (OUTT_HTML):
+ case OUTT_HTML:
curp->outdata = html_alloc(curp->outopts);
curp->outfree = html_free;
break;
- case (OUTT_UTF8):
+ case OUTT_UTF8:
curp->outdata = utf8_alloc(curp->outopts);
curp->outfree = ascii_free;
break;
- case (OUTT_LOCALE):
+ case OUTT_LOCALE:
curp->outdata = locale_alloc(curp->outopts);
curp->outfree = ascii_free;
break;
- case (OUTT_ASCII):
+ case OUTT_ASCII:
curp->outdata = ascii_alloc(curp->outopts);
curp->outfree = ascii_free;
break;
- case (OUTT_PDF):
+ case OUTT_PDF:
curp->outdata = pdf_alloc(curp->outopts);
curp->outfree = pspdf_free;
break;
- case (OUTT_PS):
+ case OUTT_PS:
curp->outdata = ps_alloc(curp->outopts);
curp->outfree = pspdf_free;
break;
@@ -265,29 +266,29 @@ parse(struct curparse *curp, int fd,
}
switch (curp->outtype) {
- case (OUTT_HTML):
+ case OUTT_HTML:
/* FALLTHROUGH */
- case (OUTT_XHTML):
+ case OUTT_XHTML:
curp->outman = html_man;
curp->outmdoc = html_mdoc;
break;
- case (OUTT_TREE):
+ case OUTT_TREE:
curp->outman = tree_man;
curp->outmdoc = tree_mdoc;
break;
- case (OUTT_MAN):
+ case OUTT_MAN:
curp->outmdoc = man_mdoc;
curp->outman = man_man;
break;
- case (OUTT_PDF):
+ case OUTT_PDF:
/* FALLTHROUGH */
- case (OUTT_ASCII):
+ case OUTT_ASCII:
/* FALLTHROUGH */
- case (OUTT_UTF8):
+ case OUTT_UTF8:
/* FALLTHROUGH */
- case (OUTT_LOCALE):
+ case OUTT_LOCALE:
/* FALLTHROUGH */
- case (OUTT_PS):
+ case OUTT_PS:
curp->outman = terminal_man;
curp->outmdoc = terminal_mdoc;
break;
@@ -368,7 +369,7 @@ static int
woptions(struct curparse *curp, char *arg)
{
char *v, *o;
- const char *toks[6];
+ const char *toks[6];
toks[0] = "stop";
toks[1] = "all";
@@ -380,18 +381,18 @@ woptions(struct curparse *curp, char *arg)
while (*arg) {
o = arg;
switch (getsubopt(&arg, UNCONST(toks), &v)) {
- case (0):
+ case 0:
curp->wstop = 1;
break;
- case (1):
+ case 1:
/* FALLTHROUGH */
- case (2):
+ case 2:
curp->wlevel = MANDOCLEVEL_WARNING;
break;
- case (3):
+ case 3:
curp->wlevel = MANDOCLEVEL_ERROR;
break;
- case (4):
+ case 4:
curp->wlevel = MANDOCLEVEL_FATAL;
break;
default:
@@ -404,14 +405,12 @@ woptions(struct curparse *curp, char *arg)
}
static void
-mmsg(enum mandocerr t, enum mandoclevel lvl,
+mmsg(enum mandocerr t, enum mandoclevel lvl,
const char *file, int line, int col, const char *msg)
{
- fprintf(stderr, "%s:%d:%d: %s: %s",
- file, line, col + 1,
- mparse_strlevel(lvl),
- mparse_strerror(t));
+ fprintf(stderr, "%s:%d:%d: %s: %s", file, line, col + 1,
+ mparse_strlevel(lvl), mparse_strerror(t));
if (msg)
fprintf(stderr, ": %s", msg);
diff --git a/usr.bin/mandoc/main.h b/usr.bin/mandoc/main.h
index f6be7534525..307a8fe2947 100644
--- a/usr.bin/mandoc/main.h
+++ b/usr.bin/mandoc/main.h
@@ -1,4 +1,4 @@
-/* $Id: main.h,v 1.10 2011/10/09 17:59:56 schwarze Exp $ */
+/* $Id: main.h,v 1.11 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -25,7 +25,7 @@ struct man;
#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
-/*
+/*
* Definitions for main.c-visible output device functions, e.g., -Thtml
* and -Tascii. Note that ascii_alloc() is named as such in
* anticipation of latin1_alloc() and so on, all of which map into the
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index a7b09d3b271..c85e04b6fb6 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.78 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: man.c,v 1.79 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -31,9 +31,9 @@
#include "libman.h"
#include "libmandoc.h"
-const char *const __man_macronames[MAN_MAX] = {
+const char *const __man_macronames[MAN_MAX] = {
"br", "TH", "SH", "SS",
- "TP", "LP", "PP", "P",
+ "TP", "LP", "PP", "P",
"IP", "HP", "SM", "SB",
"BI", "IB", "BR", "RB",
"R", "B", "I", "IR",
@@ -46,12 +46,12 @@ const char *const __man_macronames[MAN_MAX] = {
const char * const *man_macronames = __man_macronames;
-static struct man_node *man_node_alloc(struct man *, int, int,
+static struct man_node *man_node_alloc(struct man *, int, int,
enum man_type, enum mant);
-static int man_node_append(struct man *,
+static int man_node_append(struct man *,
struct man_node *);
static void man_node_free(struct man_node *);
-static void man_node_unlink(struct man *,
+static void man_node_unlink(struct man *,
struct man_node *);
static int man_ptext(struct man *, int, char *, int);
static int man_pmacro(struct man *, int, char *, int);
@@ -68,7 +68,6 @@ man_node(const struct man *man)
return(man->first);
}
-
const struct man_meta *
man_meta(const struct man *man)
{
@@ -77,7 +76,6 @@ man_meta(const struct man *man)
return(&man->meta);
}
-
void
man_reset(struct man *man)
{
@@ -86,7 +84,6 @@ man_reset(struct man *man)
man_alloc1(man);
}
-
void
man_free(struct man *man)
{
@@ -95,7 +92,6 @@ man_free(struct man *man)
free(man);
}
-
struct man *
man_alloc(struct roff *roff, struct mparse *parse, int quick)
{
@@ -112,7 +108,6 @@ man_alloc(struct roff *roff, struct mparse *parse, int quick)
return(p);
}
-
int
man_endparse(struct man *man)
{
@@ -124,7 +119,6 @@ man_endparse(struct man *man)
return(0);
}
-
int
man_parseln(struct man *man, int ln, char *buf, int offs)
{
@@ -134,11 +128,10 @@ man_parseln(struct man *man, int ln, char *buf, int offs)
assert( ! (MAN_HALT & man->flags));
return (roff_getcontrol(man->roff, buf, &offs) ?
- man_pmacro(man, ln, buf, offs) :
- man_ptext(man, ln, buf, offs));
+ man_pmacro(man, ln, buf, offs) :
+ man_ptext(man, ln, buf, offs));
}
-
static void
man_free1(struct man *man)
{
@@ -157,7 +150,6 @@ man_free1(struct man *man)
free(man->meta.msec);
}
-
static void
man_alloc1(struct man *man)
{
@@ -181,12 +173,12 @@ man_node_append(struct man *man, struct man_node *p)
assert(MAN_ROOT != p->type);
switch (man->next) {
- case (MAN_NEXT_SIBLING):
+ case MAN_NEXT_SIBLING:
man->last->next = p;
p->prev = man->last;
p->parent = man->last->parent;
break;
- case (MAN_NEXT_CHILD):
+ case MAN_NEXT_CHILD:
man->last->child = p;
p->parent = man->last;
break;
@@ -194,7 +186,7 @@ man_node_append(struct man *man, struct man_node *p)
abort();
/* NOTREACHED */
}
-
+
assert(p->parent);
p->parent->nchild++;
@@ -202,15 +194,15 @@ man_node_append(struct man *man, struct man_node *p)
return(0);
switch (p->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
assert(MAN_BLOCK == p->parent->type);
p->parent->head = p;
break;
- case (MAN_TAIL):
+ case MAN_TAIL:
assert(MAN_BLOCK == p->parent->type);
p->parent->tail = p;
break;
- case (MAN_BODY):
+ case MAN_BODY:
assert(MAN_BLOCK == p->parent->type);
p->parent->body = p;
break;
@@ -221,9 +213,9 @@ man_node_append(struct man *man, struct man_node *p)
man->last = p;
switch (p->type) {
- case (MAN_TBL):
+ case MAN_TBL:
/* FALLTHROUGH */
- case (MAN_TEXT):
+ case MAN_TEXT:
if ( ! man_valid_post(man))
return(0);
break;
@@ -234,9 +226,8 @@ man_node_append(struct man *man, struct man_node *p)
return(1);
}
-
static struct man_node *
-man_node_alloc(struct man *man, int line, int pos,
+man_node_alloc(struct man *man, int line, int pos,
enum man_type type, enum mant tok)
{
struct man_node *p;
@@ -253,7 +244,6 @@ man_node_alloc(struct man *man, int line, int pos,
return(p);
}
-
int
man_elem_alloc(struct man *man, int line, int pos, enum mant tok)
{
@@ -266,7 +256,6 @@ man_elem_alloc(struct man *man, int line, int pos, enum mant tok)
return(1);
}
-
int
man_tail_alloc(struct man *man, int line, int pos, enum mant tok)
{
@@ -279,7 +268,6 @@ man_tail_alloc(struct man *man, int line, int pos, enum mant tok)
return(1);
}
-
int
man_head_alloc(struct man *man, int line, int pos, enum mant tok)
{
@@ -292,7 +280,6 @@ man_head_alloc(struct man *man, int line, int pos, enum mant tok)
return(1);
}
-
int
man_body_alloc(struct man *man, int line, int pos, enum mant tok)
{
@@ -305,7 +292,6 @@ man_body_alloc(struct man *man, int line, int pos, enum mant tok)
return(1);
}
-
int
man_block_alloc(struct man *man, int line, int pos, enum mant tok)
{
@@ -333,7 +319,6 @@ man_word_alloc(struct man *man, int line, int pos, const char *word)
return(1);
}
-
/*
* Free all of the resources held by a node. This does NOT unlink a
* node from its context; for that, see man_node_unlink().
@@ -347,7 +332,6 @@ man_node_free(struct man_node *p)
free(p);
}
-
void
man_node_delete(struct man *man, struct man_node *p)
{
@@ -449,9 +433,9 @@ man_ptext(struct man *man, int line, char *buf, int offs)
return(1);
}
- /*
+ /*
* Warn if the last un-escaped character is whitespace. Then
- * strip away the remaining spaces (tabs stay!).
+ * strip away the remaining spaces (tabs stay!).
*/
i = (int)strlen(buf);
@@ -508,8 +492,8 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
*/
i = 0;
- while (i < 4 && '\0' != buf[offs] &&
- ' ' != buf[offs] && '\t' != buf[offs])
+ while (i < 4 && '\0' != buf[offs] && ' ' != buf[offs] &&
+ '\t' != buf[offs])
mac[i++] = buf[offs++];
mac[i] = '\0';
@@ -517,8 +501,8 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
tok = (i > 0 && i < 4) ? man_hash_find(mac) : MAN_MAX;
if (MAN_MAX == tok) {
- mandoc_vmsg(MANDOCERR_MACRO, man->parse, ln,
- ppos, "%s", buf + ppos - 1);
+ mandoc_vmsg(MANDOCERR_MACRO, man->parse, ln, ppos,
+ "%s", buf + ppos - 1);
return(1);
}
@@ -527,7 +511,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
while (buf[offs] && ' ' == buf[offs])
offs++;
- /*
+ /*
* Trailing whitespace. Note that tabs are allowed to be passed
* into the parser as "text", so we only warn about spaces here.
*/
@@ -535,7 +519,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
if ('\0' == buf[offs] && ' ' == buf[offs - 1])
man_pmsg(man, ln, offs - 1, MANDOCERR_EOLNSPACE);
- /*
+ /*
* Remove prior ELINE macro, as it's being clobbered by a new
* macro. Note that NSCOPED macros do not close out ELINE
* macros---they don't print text---so we let those slip by.
@@ -551,7 +535,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
if (MAN_NSCOPED & man_macros[n->tok].flags)
n = n->parent;
- mandoc_vmsg(MANDOCERR_LINESCOPE, man->parse, n->line,
+ mandoc_vmsg(MANDOCERR_LINESCOPE, man->parse, n->line,
n->pos, "%s breaks %s", man_macronames[tok],
man_macronames[n->tok]);
@@ -582,7 +566,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
assert(MAN_BLOCK == n->type);
assert(MAN_SCOPED & man_macros[n->tok].flags);
- mandoc_vmsg(MANDOCERR_LINESCOPE, man->parse, n->line,
+ mandoc_vmsg(MANDOCERR_LINESCOPE, man->parse, n->line,
n->pos, "%s breaks %s", man_macronames[tok],
man_macronames[n->tok]);
@@ -611,13 +595,13 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
strcmp(man->last->prev->child->string, "NAME"))
return(2);
- /*
+ /*
* We weren't in a block-line scope when entering the
* above-parsed macro, so return.
*/
if ( ! (MAN_BPLINE & man->flags)) {
- man->flags &= ~MAN_ILINE;
+ man->flags &= ~MAN_ILINE;
return(1);
}
man->flags &= ~MAN_BPLINE;
@@ -632,7 +616,7 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
return(1);
}
- /*
+ /*
* If we've opened a new next-line element scope, then return
* now, as the next line will close out the block scope.
*/
diff --git a/usr.bin/mandoc/man_hash.c b/usr.bin/mandoc/man_hash.c
index d0b83c8d7b9..68a4709817a 100644
--- a/usr.bin/mandoc/man_hash.c
+++ b/usr.bin/mandoc/man_hash.c
@@ -1,4 +1,4 @@
-/* $Id: man_hash.c,v 1.16 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: man_hash.c,v 1.17 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -44,6 +44,7 @@
*/
static unsigned char table[26 * HASH_DEPTH];
+
/*
* XXX - this hash has global scope, so if intended for use as a library
* with multiple callers, it will need re-invocation protection.
@@ -55,8 +56,7 @@ man_hash_init(void)
memset(table, UCHAR_MAX, sizeof(table));
- assert(/* LINTED */
- MAN_MAX < UCHAR_MAX);
+ assert(MAN_MAX < UCHAR_MAX);
for (i = 0; i < (int)MAN_MAX; i++) {
x = man_macronames[i][0];
@@ -75,7 +75,6 @@ man_hash_init(void)
}
}
-
enum mant
man_hash_find(const char *tmp)
{
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index e367e883b1b..979b0d54a0d 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.51 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: man_html.c,v 1.52 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -49,7 +49,7 @@ struct htmlman {
int (*post)(MAN_ARGS);
};
-static void print_bvspace(struct html *,
+static void print_bvspace(struct html *,
const struct man_node *);
static void print_man(MAN_ARGS);
static void print_man_head(MAN_ARGS);
@@ -86,7 +86,7 @@ static const struct htmlman mans[MAN_MAX] = {
{ man_PP_pre, NULL }, /* PP */
{ man_PP_pre, NULL }, /* P */
{ man_IP_pre, NULL }, /* IP */
- { man_HP_pre, NULL }, /* HP */
+ { man_HP_pre, NULL }, /* HP */
{ man_SM_pre, NULL }, /* SM */
{ man_SM_pre, NULL }, /* SB */
{ man_alt_pre, NULL }, /* BI */
@@ -118,6 +118,7 @@ static const struct htmlman mans[MAN_MAX] = {
{ man_ign_pre, NULL }, /* ll */
};
+
/*
* Printing leading vertical space before a block.
* This is used for the paragraph macros.
@@ -152,7 +153,7 @@ html_man(void *arg, const struct man *man)
}
static void
-print_man(MAN_ARGS)
+print_man(MAN_ARGS)
{
struct tag *t, *tt;
struct htmlpair tag;
@@ -167,15 +168,13 @@ print_man(MAN_ARGS)
print_tagq(h, tt);
print_otag(h, TAG_BODY, 0, NULL);
print_otag(h, TAG_DIV, 1, &tag);
- } else
+ } else
t = print_otag(h, TAG_DIV, 1, &tag);
print_man_nodelist(man, n, mh, h);
print_tagq(h, t);
}
-
-/* ARGSUSED */
static void
print_man_head(MAN_ARGS)
{
@@ -188,7 +187,6 @@ print_man_head(MAN_ARGS)
print_text(h, h->buf);
}
-
static void
print_man_nodelist(MAN_ARGS)
{
@@ -198,7 +196,6 @@ print_man_nodelist(MAN_ARGS)
print_man_nodelist(man, n->next, mh, h);
}
-
static void
print_man_node(MAN_ARGS)
{
@@ -209,10 +206,10 @@ print_man_node(MAN_ARGS)
t = h->tags.head;
switch (n->type) {
- case (MAN_ROOT):
+ case MAN_ROOT:
man_root_pre(man, n, mh, h);
break;
- case (MAN_TEXT):
+ case MAN_TEXT:
/*
* If we have a blank line, output a vertical space.
* If we have a space as the first character, break
@@ -230,10 +227,10 @@ print_man_node(MAN_ARGS)
print_text(h, n->string);
return;
- case (MAN_EQN):
+ case MAN_EQN:
print_eqn(h, n->eqn);
break;
- case (MAN_TBL):
+ case MAN_TBL:
/*
* This will take care of initialising all of the table
* state data for the first table, then tearing it down
@@ -242,7 +239,7 @@ print_man_node(MAN_ARGS)
print_tbl(h, n->span);
return;
default:
- /*
+ /*
* Close out scope of font prior to opening a macro
* scope.
*/
@@ -272,10 +269,10 @@ print_man_node(MAN_ARGS)
print_stagq(h, t);
switch (n->type) {
- case (MAN_ROOT):
+ case MAN_ROOT:
man_root_post(man, n, mh, h);
break;
- case (MAN_EQN):
+ case MAN_EQN:
break;
default:
if (mans[n->tok].post)
@@ -284,7 +281,6 @@ print_man_node(MAN_ARGS)
}
}
-
static int
a2width(const struct man_node *n, struct roffsu *su)
{
@@ -297,8 +293,6 @@ a2width(const struct man_node *n, struct roffsu *su)
return(0);
}
-
-/* ARGSUSED */
static void
man_root_pre(MAN_ARGS)
{
@@ -345,8 +339,6 @@ man_root_pre(MAN_ARGS)
print_tagq(h, t);
}
-
-/* ARGSUSED */
static void
man_root_post(MAN_ARGS)
{
@@ -380,7 +372,6 @@ man_root_post(MAN_ARGS)
}
-/* ARGSUSED */
static int
man_br_pre(MAN_ARGS)
{
@@ -407,7 +398,6 @@ man_br_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_SH_pre(MAN_ARGS)
{
@@ -425,7 +415,6 @@ man_SH_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_alt_pre(MAN_ARGS)
{
@@ -434,7 +423,7 @@ man_alt_pre(MAN_ARGS)
enum htmltag fp;
struct tag *t;
- if ((savelit = mh->fl & MANH_LITERAL))
+ if ((savelit = mh->fl & MANH_LITERAL))
print_otag(h, TAG_BR, 0, NULL);
mh->fl &= ~MANH_LITERAL;
@@ -442,22 +431,22 @@ man_alt_pre(MAN_ARGS)
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
t = NULL;
switch (n->tok) {
- case (MAN_BI):
+ case MAN_BI:
fp = i % 2 ? TAG_I : TAG_B;
break;
- case (MAN_IB):
+ case MAN_IB:
fp = i % 2 ? TAG_B : TAG_I;
break;
- case (MAN_RI):
+ case MAN_RI:
fp = i % 2 ? TAG_I : TAG_MAX;
break;
- case (MAN_IR):
+ case MAN_IR:
fp = i % 2 ? TAG_MAX : TAG_I;
break;
- case (MAN_BR):
+ case MAN_BR:
fp = i % 2 ? TAG_MAX : TAG_B;
break;
- case (MAN_RB):
+ case MAN_RB:
fp = i % 2 ? TAG_B : TAG_MAX;
break;
default:
@@ -483,18 +472,16 @@ man_alt_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_SM_pre(MAN_ARGS)
{
-
+
print_otag(h, TAG_SMALL, 0, NULL);
if (MAN_SB == n->tok)
print_otag(h, TAG_B, 0, NULL);
return(1);
}
-/* ARGSUSED */
static int
man_SS_pre(MAN_ARGS)
{
@@ -512,7 +499,6 @@ man_SS_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_PP_pre(MAN_ARGS)
{
@@ -525,13 +511,12 @@ man_PP_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_IP_pre(MAN_ARGS)
{
const struct man_node *nn;
- if (MAN_BODY == n->type) {
+ if (MAN_BODY == n->type) {
print_otag(h, TAG_DD, 0, NULL);
return(1);
} else if (MAN_HEAD != n->type) {
@@ -563,7 +548,6 @@ man_IP_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_HP_pre(MAN_ARGS)
{
@@ -592,7 +576,6 @@ man_HP_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_OP_pre(MAN_ARGS)
{
@@ -622,8 +605,6 @@ man_OP_pre(MAN_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
man_B_pre(MAN_ARGS)
{
@@ -632,16 +613,14 @@ man_B_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_I_pre(MAN_ARGS)
{
-
+
print_otag(h, TAG_I, 0, NULL);
return(1);
}
-/* ARGSUSED */
static int
man_literal_pre(MAN_ARGS)
{
@@ -655,7 +634,6 @@ man_literal_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_in_pre(MAN_ARGS)
{
@@ -664,7 +642,6 @@ man_in_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_ign_pre(MAN_ARGS)
{
@@ -672,7 +649,6 @@ man_ign_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_RS_pre(MAN_ARGS)
{
@@ -695,7 +671,6 @@ man_RS_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_UR_pre(MAN_ARGS)
{
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index 1e5ea5084c6..027b0618683 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.44 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: man_macro.c,v 1.45 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -36,16 +36,16 @@ static int blk_close(MACRO_PROT_ARGS);
static int blk_exp(MACRO_PROT_ARGS);
static int blk_imp(MACRO_PROT_ARGS);
static int in_line_eoln(MACRO_PROT_ARGS);
-static int man_args(struct man *, int,
+static int man_args(struct man *, int,
int *, char *, char **);
-static int rew_scope(enum man_type,
+static int rew_scope(enum man_type,
struct man *, enum mant);
-static enum rew rew_dohalt(enum mant, enum man_type,
+static enum rew rew_dohalt(enum mant, enum man_type,
const struct man_node *);
-static enum rew rew_block(enum mant, enum man_type,
+static enum rew rew_block(enum mant, enum man_type,
const struct man_node *);
-static void rew_warn(struct man *,
+static void rew_warn(struct man *,
struct man_node *, enum mandocerr);
const struct man_macro __man_macros[MAN_MAX] = {
@@ -111,13 +111,12 @@ rew_warn(struct man *man, struct man_node *n, enum mandocerr er)
man_nmsg(man, n, er);
}
-
/*
* Rewind scope. If a code "er" != MANDOCERR_MAX has been provided, it
* will be used if an explicit block scope is being closed out.
*/
int
-man_unscope(struct man *man, const struct man_node *to,
+man_unscope(struct man *man, const struct man_node *to,
enum mandocerr er)
{
struct man_node *n;
@@ -126,7 +125,6 @@ man_unscope(struct man *man, const struct man_node *to,
man->next = MAN_NEXT_SIBLING;
- /* LINTED */
while (man->last != to) {
/*
* Save the parent here, because we may delete the
@@ -149,24 +147,22 @@ man_unscope(struct man *man, const struct man_node *to,
return(1);
}
-
static enum rew
rew_block(enum mant ntok, enum man_type type, const struct man_node *n)
{
- if (MAN_BLOCK == type && ntok == n->parent->tok &&
- MAN_BODY == n->parent->type)
+ if (MAN_BLOCK == type && ntok == n->parent->tok &&
+ MAN_BODY == n->parent->type)
return(REW_REWIND);
return(ntok == n->tok ? REW_HALT : REW_NOHALT);
}
-
/*
* There are three scope levels: scoped to the root (all), scoped to the
* section (all less sections), and scoped to subsections (all less
* sections and subsections).
*/
-static enum rew
+static enum rew
rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n)
{
enum rew c;
@@ -193,20 +189,20 @@ rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n)
return(REW_REWIND);
}
- /*
+ /*
* Next follow the implicit scope-smashings as defined by man.7:
* section, sub-section, etc.
*/
switch (tok) {
- case (MAN_SH):
+ case MAN_SH:
break;
- case (MAN_SS):
+ case MAN_SS:
/* Rewind to a section, if a block. */
if (REW_NOHALT != (c = rew_block(MAN_SH, type, n)))
return(c);
break;
- case (MAN_RS):
+ case MAN_RS:
/* Preserve empty paragraphs before RS. */
if (0 == n->nchild && (MAN_P == n->tok ||
MAN_PP == n->tok || MAN_LP == n->tok))
@@ -234,7 +230,6 @@ rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n)
return(REW_NOHALT);
}
-
/*
* Rewinding entails ascending the parse tree until a coherent point,
* for example, the `SH' macro will close out any intervening `SS'
@@ -246,9 +241,8 @@ rew_scope(enum man_type type, struct man *man, enum mant tok)
struct man_node *n;
enum rew c;
- /* LINTED */
for (n = man->last; n; n = n->parent) {
- /*
+ /*
* Whether we should stop immediately (REW_HALT), stop
* and rewind until this point (REW_REWIND), or keep
* rewinding (REW_NOHALT).
@@ -260,7 +254,7 @@ rew_scope(enum man_type type, struct man *man, enum mant tok)
break;
}
- /*
+ /*
* Rewind until the current point. Warn if we're a roff
* instruction that's mowing over explicit scopes.
*/
@@ -273,18 +267,17 @@ rew_scope(enum man_type type, struct man *man, enum mant tok)
/*
* Close out a generic explicit macro.
*/
-/* ARGSUSED */
int
blk_close(MACRO_PROT_ARGS)
{
- enum mant ntok;
+ enum mant ntok;
const struct man_node *nn;
switch (tok) {
- case (MAN_RE):
+ case MAN_RE:
ntok = MAN_RS;
break;
- case (MAN_UE):
+ case MAN_UE:
ntok = MAN_UR;
break;
default:
@@ -300,14 +293,12 @@ blk_close(MACRO_PROT_ARGS)
man_pmsg(man, line, ppos, MANDOCERR_NOSCOPE);
if ( ! rew_scope(MAN_BLOCK, man, MAN_PP))
return(0);
- } else
+ } else
man_unscope(man, nn, MANDOCERR_MAX);
return(1);
}
-
-/* ARGSUSED */
int
blk_exp(MACRO_PROT_ARGS)
{
@@ -347,15 +338,12 @@ blk_exp(MACRO_PROT_ARGS)
return(man_body_alloc(man, line, ppos, tok));
}
-
-
/*
* Parse an implicit-block macro. These contain a MAN_HEAD and a
* MAN_BODY contained within a MAN_BLOCK. Rules for closing out other
* scopes, such as `SH' closing out an `SS', are defined in the rew
* routines.
*/
-/* ARGSUSED */
int
blk_imp(MACRO_PROT_ARGS)
{
@@ -407,8 +395,6 @@ blk_imp(MACRO_PROT_ARGS)
return(man_body_alloc(man, line, ppos, tok));
}
-
-/* ARGSUSED */
int
in_line_eoln(MACRO_PROT_ARGS)
{
@@ -448,7 +434,7 @@ in_line_eoln(MACRO_PROT_ARGS)
assert( ! (MAN_NSCOPED & man_macros[tok].flags));
man->flags |= MAN_ELINE;
return(1);
- }
+ }
/* Set ignorable context, if applicable. */
@@ -459,7 +445,7 @@ in_line_eoln(MACRO_PROT_ARGS)
assert(MAN_ROOT != man->last->type);
man->next = MAN_NEXT_SIBLING;
-
+
/*
* Rewind our element scope. Note that when TH is pruned, we'll
* be back at the root, so make sure that we don't clobber as
@@ -478,7 +464,7 @@ in_line_eoln(MACRO_PROT_ARGS)
assert(man->last);
/*
- * Same here regarding whether we're back at the root.
+ * Same here regarding whether we're back at the root.
*/
if (man->last->type != MAN_ROOT && ! man_valid_post(man))
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 4d39aa4469f..f23ceecde16 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.99 2014/04/08 07:13:01 schwarze Exp $ */
+/* $Id: man_term.c,v 1.100 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -41,7 +41,7 @@ struct mtermp {
int pardist; /* vert. space before par., unit: [v] */
};
-#define DECL_ARGS struct termp *p, \
+#define DECL_ARGS struct termp *p, \
struct mtermp *mt, \
const struct man_node *n, \
const struct man_meta *meta
@@ -60,7 +60,7 @@ static void print_man_nodelist(DECL_ARGS);
static void print_man_node(DECL_ARGS);
static void print_man_head(struct termp *, const void *);
static void print_man_foot(struct termp *, const void *);
-static void print_bvspace(struct termp *,
+static void print_bvspace(struct termp *,
const struct man_node *, int);
static int pre_B(DECL_ARGS);
@@ -101,7 +101,7 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_PP, NULL, 0 }, /* PP */
{ pre_PP, NULL, 0 }, /* P */
{ pre_IP, post_IP, 0 }, /* IP */
- { pre_HP, post_HP, 0 }, /* HP */
+ { pre_HP, post_HP, 0 }, /* HP */
{ NULL, NULL, 0 }, /* SM */
{ pre_B, NULL, 0 }, /* SB */
{ pre_alternate, NULL, 0 }, /* BI */
@@ -134,7 +134,6 @@ static const struct termact termacts[MAN_MAX] = {
};
-
void
terminal_man(void *arg, const struct man *man)
{
@@ -185,7 +184,6 @@ a2height(const struct termp *p, const char *cp)
return(term_vspan(p, &su));
}
-
static int
a2width(const struct termp *p, const char *cp)
{
@@ -224,7 +222,7 @@ print_bvspace(struct termp *p, const struct man_node *n, int pardist)
term_vspace(p);
}
-/* ARGSUSED */
+
static int
pre_ign(DECL_ARGS)
{
@@ -232,8 +230,6 @@ pre_ign(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_ll(DECL_ARGS)
{
@@ -242,8 +238,6 @@ pre_ll(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_I(DECL_ARGS)
{
@@ -252,8 +246,6 @@ pre_I(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
pre_literal(DECL_ARGS)
{
@@ -281,7 +273,6 @@ pre_literal(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_PD(DECL_ARGS)
{
@@ -296,7 +287,6 @@ pre_PD(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_alternate(DECL_ARGS)
{
@@ -305,27 +295,27 @@ pre_alternate(DECL_ARGS)
int savelit, i;
switch (n->tok) {
- case (MAN_RB):
+ case MAN_RB:
font[0] = TERMFONT_NONE;
font[1] = TERMFONT_BOLD;
break;
- case (MAN_RI):
+ case MAN_RI:
font[0] = TERMFONT_NONE;
font[1] = TERMFONT_UNDER;
break;
- case (MAN_BR):
+ case MAN_BR:
font[0] = TERMFONT_BOLD;
font[1] = TERMFONT_NONE;
break;
- case (MAN_BI):
+ case MAN_BI:
font[0] = TERMFONT_BOLD;
font[1] = TERMFONT_UNDER;
break;
- case (MAN_IR):
+ case MAN_IR:
font[0] = TERMFONT_UNDER;
font[1] = TERMFONT_NONE;
break;
- case (MAN_IB):
+ case MAN_IB:
font[0] = TERMFONT_UNDER;
font[1] = TERMFONT_BOLD;
break;
@@ -348,7 +338,6 @@ pre_alternate(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_B(DECL_ARGS)
{
@@ -357,7 +346,6 @@ pre_B(DECL_ARGS)
return(1);
}
-/* ARGSUSED */
static int
pre_OP(DECL_ARGS)
{
@@ -380,7 +368,6 @@ pre_OP(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_ft(DECL_ARGS)
{
@@ -393,26 +380,26 @@ pre_ft(DECL_ARGS)
cp = n->child->string;
switch (*cp) {
- case ('4'):
+ case '4':
/* FALLTHROUGH */
- case ('3'):
+ case '3':
/* FALLTHROUGH */
- case ('B'):
+ case 'B':
term_fontrepl(p, TERMFONT_BOLD);
break;
- case ('2'):
+ case '2':
/* FALLTHROUGH */
- case ('I'):
+ case 'I':
term_fontrepl(p, TERMFONT_UNDER);
break;
- case ('P'):
+ case 'P':
term_fontlast(p);
break;
- case ('1'):
+ case '1':
/* FALLTHROUGH */
- case ('C'):
+ case 'C':
/* FALLTHROUGH */
- case ('R'):
+ case 'R':
term_fontrepl(p, TERMFONT_NONE);
break;
default:
@@ -421,7 +408,6 @@ pre_ft(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_in(DECL_ARGS)
{
@@ -455,7 +441,7 @@ pre_in(DECL_ARGS)
p->offset -= p->offset > v ? v : p->offset;
else if (less > 0)
p->offset += v;
- else
+ else
p->offset = v;
/* Don't let this creep beyond the right margin. */
@@ -466,8 +452,6 @@ pre_in(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_sp(DECL_ARGS)
{
@@ -477,15 +461,15 @@ pre_sp(DECL_ARGS)
if ((NULL == n->prev && n->parent)) {
switch (n->parent->tok) {
- case (MAN_SH):
+ case MAN_SH:
/* FALLTHROUGH */
- case (MAN_SS):
+ case MAN_SS:
/* FALLTHROUGH */
- case (MAN_PP):
+ case MAN_PP:
/* FALLTHROUGH */
- case (MAN_LP):
+ case MAN_LP:
/* FALLTHROUGH */
- case (MAN_P):
+ case MAN_P:
/* FALLTHROUGH */
return(0);
default:
@@ -495,7 +479,7 @@ pre_sp(DECL_ARGS)
neg = 0;
switch (n->tok) {
- case (MAN_br):
+ case MAN_br:
len = 0;
break;
default:
@@ -523,8 +507,6 @@ pre_sp(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_HP(DECL_ARGS)
{
@@ -533,10 +515,10 @@ pre_HP(DECL_ARGS)
const struct man_node *nn;
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
print_bvspace(p, n, mt->pardist);
return(1);
- case (MAN_BODY):
+ case MAN_BODY:
break;
default:
return(0);
@@ -569,14 +551,12 @@ pre_HP(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
post_HP(DECL_ARGS)
{
switch (n->type) {
- case (MAN_BODY):
+ case MAN_BODY:
term_newln(p);
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
p->trailspace = 0;
@@ -588,14 +568,12 @@ post_HP(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
pre_PP(DECL_ARGS)
{
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
print_bvspace(p, n, mt->pardist);
break;
@@ -607,8 +585,6 @@ pre_PP(DECL_ARGS)
return(MAN_HEAD != n->type);
}
-
-/* ARGSUSED */
static int
pre_IP(DECL_ARGS)
{
@@ -617,14 +593,14 @@ pre_IP(DECL_ARGS)
int savelit, ival;
switch (n->type) {
- case (MAN_BODY):
+ case MAN_BODY:
p->flags |= TERMP_NOSPACE;
break;
- case (MAN_HEAD):
+ case MAN_HEAD:
p->flags |= TERMP_NOBREAK;
p->trailspace = 1;
break;
- case (MAN_BLOCK):
+ case MAN_BLOCK:
print_bvspace(p, n, mt->pardist);
/* FALLTHROUGH */
default:
@@ -641,7 +617,7 @@ pre_IP(DECL_ARGS)
len = (size_t)ival;
switch (n->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
/* Handle zero-width lengths. */
if (0 == len)
len = term_len(p, 1);
@@ -664,10 +640,10 @@ pre_IP(DECL_ARGS)
mt->fl |= MANT_LITERAL;
return(0);
- case (MAN_BODY):
+ case MAN_BODY:
p->offset = mt->offset + len;
p->rmargin = p->maxrmargin > p->offset ?
- p->maxrmargin : p->offset;
+ p->maxrmargin : p->offset;
break;
default:
break;
@@ -676,20 +652,18 @@ pre_IP(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
post_IP(DECL_ARGS)
{
switch (n->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
term_flushln(p);
p->flags &= ~TERMP_NOBREAK;
p->trailspace = 0;
p->rmargin = p->maxrmargin;
break;
- case (MAN_BODY):
+ case MAN_BODY:
term_newln(p);
p->offset = mt->offset;
break;
@@ -698,8 +672,6 @@ post_IP(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
pre_TP(DECL_ARGS)
{
@@ -708,14 +680,14 @@ pre_TP(DECL_ARGS)
int savelit, ival;
switch (n->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
p->flags |= TERMP_NOBREAK;
p->trailspace = 1;
break;
- case (MAN_BODY):
+ case MAN_BODY:
p->flags |= TERMP_NOSPACE;
break;
- case (MAN_BLOCK):
+ case MAN_BLOCK:
print_bvspace(p, n, mt->pardist);
/* FALLTHROUGH */
default:
@@ -733,7 +705,7 @@ pre_TP(DECL_ARGS)
len = (size_t)ival;
switch (n->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
/* Handle zero-length properly. */
if (0 == len)
len = term_len(p, 1);
@@ -760,10 +732,10 @@ pre_TP(DECL_ARGS)
mt->lmargin[mt->lmargincur] = (size_t)ival;
return(0);
- case (MAN_BODY):
+ case MAN_BODY:
p->offset = mt->offset + len;
p->rmargin = p->maxrmargin > p->offset ?
- p->maxrmargin : p->offset;
+ p->maxrmargin : p->offset;
p->trailspace = 0;
p->flags &= ~TERMP_NOBREAK;
break;
@@ -774,17 +746,15 @@ pre_TP(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
post_TP(DECL_ARGS)
{
switch (n->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
term_flushln(p);
break;
- case (MAN_BODY):
+ case MAN_BODY:
term_newln(p);
p->offset = mt->offset;
break;
@@ -793,15 +763,13 @@ post_TP(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
pre_SS(DECL_ARGS)
{
int i;
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
mt->fl &= ~MANT_LITERAL;
mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
mt->offset = term_len(p, p->defindent);
@@ -814,11 +782,11 @@ pre_SS(DECL_ARGS)
for (i = 0; i < mt->pardist; i++)
term_vspace(p);
break;
- case (MAN_HEAD):
+ case MAN_HEAD:
term_fontrepl(p, TERMFONT_BOLD);
p->offset = term_len(p, 3);
break;
- case (MAN_BODY):
+ case MAN_BODY:
p->offset = mt->offset;
break;
default:
@@ -828,17 +796,15 @@ pre_SS(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
post_SS(DECL_ARGS)
{
-
+
switch (n->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
term_newln(p);
break;
- case (MAN_BODY):
+ case MAN_BODY:
term_newln(p);
break;
default:
@@ -846,15 +812,13 @@ post_SS(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
pre_SH(DECL_ARGS)
{
int i;
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
mt->fl &= ~MANT_LITERAL;
mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
mt->offset = term_len(p, p->defindent);
@@ -868,11 +832,11 @@ pre_SH(DECL_ARGS)
for (i = 0; i < mt->pardist; i++)
term_vspace(p);
break;
- case (MAN_HEAD):
+ case MAN_HEAD:
term_fontrepl(p, TERMFONT_BOLD);
p->offset = 0;
break;
- case (MAN_BODY):
+ case MAN_BODY:
p->offset = mt->offset;
break;
default:
@@ -882,17 +846,15 @@ pre_SH(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
post_SH(DECL_ARGS)
{
-
+
switch (n->type) {
- case (MAN_HEAD):
+ case MAN_HEAD:
term_newln(p);
break;
- case (MAN_BODY):
+ case MAN_BODY:
term_newln(p);
break;
default:
@@ -900,7 +862,6 @@ post_SH(DECL_ARGS)
}
}
-/* ARGSUSED */
static int
pre_RS(DECL_ARGS)
{
@@ -908,10 +869,10 @@ pre_RS(DECL_ARGS)
size_t sz;
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
term_newln(p);
return(1);
- case (MAN_HEAD):
+ case MAN_HEAD:
return(0);
default:
break;
@@ -920,13 +881,13 @@ pre_RS(DECL_ARGS)
sz = term_len(p, p->defindent);
if (NULL != (n = n->parent->head->child))
- if ((ival = a2width(p, n->string)) >= 0)
+ if ((ival = a2width(p, n->string)) >= 0)
sz = (size_t)ival;
mt->offset += sz;
p->offset = mt->offset;
p->rmargin = p->maxrmargin > p->offset ?
- p->maxrmargin : p->offset;
+ p->maxrmargin : p->offset;
if (++mt->lmarginsz < MAXMARGINS)
mt->lmargincur = mt->lmarginsz;
@@ -935,7 +896,6 @@ pre_RS(DECL_ARGS)
return(1);
}
-/* ARGSUSED */
static void
post_RS(DECL_ARGS)
{
@@ -943,9 +903,9 @@ post_RS(DECL_ARGS)
size_t sz;
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
return;
- case (MAN_HEAD):
+ case MAN_HEAD:
return;
default:
term_newln(p);
@@ -954,8 +914,8 @@ post_RS(DECL_ARGS)
sz = term_len(p, p->defindent);
- if (NULL != (n = n->parent->head->child))
- if ((ival = a2width(p, n->string)) >= 0)
+ if (NULL != (n = n->parent->head->child))
+ if ((ival = a2width(p, n->string)) >= 0)
sz = (size_t)ival;
mt->offset = mt->offset < sz ? 0 : mt->offset - sz;
@@ -965,7 +925,6 @@ post_RS(DECL_ARGS)
mt->lmargincur = mt->lmarginsz;
}
-/* ARGSUSED */
static int
pre_UR(DECL_ARGS)
{
@@ -973,7 +932,6 @@ pre_UR(DECL_ARGS)
return (MAN_HEAD != n->type);
}
-/* ARGSUSED */
static void
post_UR(DECL_ARGS)
{
@@ -998,7 +956,7 @@ print_man_node(DECL_ARGS)
int c;
switch (n->type) {
- case(MAN_TEXT):
+ case MAN_TEXT:
/*
* If we have a blank line, output a vertical space.
* If we have a space as the first character, break
@@ -1013,15 +971,15 @@ print_man_node(DECL_ARGS)
term_word(p, n->string);
goto out;
- case (MAN_EQN):
+ case MAN_EQN:
term_eqn(p, n->eqn);
return;
- case (MAN_TBL):
+ case MAN_TBL:
/*
* Tables are preceded by a newline. Then process a
* table line, which will cause line termination,
*/
- if (TBL_SPAN_FIRST & n->span->flags)
+ if (TBL_SPAN_FIRST & n->span->flags)
term_newln(p);
term_tbl(p, n->span);
return;
@@ -1084,7 +1042,6 @@ print_man_nodelist(DECL_ARGS)
print_man_nodelist(p, mt, n->next, meta);
}
-
static void
print_man_foot(struct termp *p, const void *arg)
{
@@ -1152,7 +1109,6 @@ print_man_foot(struct termp *p, const void *arg)
term_flushln(p);
}
-
static void
print_man_head(struct termp *p, const void *arg)
{
@@ -1179,7 +1135,7 @@ print_man_head(struct termp *p, const void *arg)
p->trailspace = 1;
p->offset = 0;
p->rmargin = 2 * (titlen+1) + buflen < p->maxrmargin ?
- (p->maxrmargin -
+ (p->maxrmargin -
term_strlen(p, buf) + term_len(p, 1)) / 2 :
p->maxrmargin - buflen;
@@ -1212,7 +1168,7 @@ print_man_head(struct termp *p, const void *arg)
p->offset = 0;
p->rmargin = p->maxrmargin;
- /*
+ /*
* Groff prints three blank lines before the content.
* Do the same, except in the temporary, undocumented
* mode imitating mdoc(7) output.
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index d66e0e08136..ecb33703783 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.62 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.63 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -130,13 +130,13 @@ man_valid_pre(struct man *man, struct man_node *n)
v_check *cp;
switch (n->type) {
- case (MAN_TEXT):
+ case MAN_TEXT:
/* FALLTHROUGH */
- case (MAN_ROOT):
+ case MAN_ROOT:
/* FALLTHROUGH */
- case (MAN_EQN):
+ case MAN_EQN:
/* FALLTHROUGH */
- case (MAN_TBL):
+ case MAN_TBL:
return(1);
default:
break;
@@ -145,12 +145,11 @@ man_valid_pre(struct man *man, struct man_node *n)
if (NULL == (cp = man_valids[n->tok].pres))
return(1);
for ( ; *cp; cp++)
- if ( ! (*cp)(man, n))
+ if ( ! (*cp)(man, n))
return(0);
return(1);
}
-
int
man_valid_post(struct man *man)
{
@@ -161,14 +160,14 @@ man_valid_post(struct man *man)
man->last->flags |= MAN_VALID;
switch (man->last->type) {
- case (MAN_TEXT):
+ case MAN_TEXT:
check_text(man, man->last);
return(1);
- case (MAN_ROOT):
+ case MAN_ROOT:
return(check_root(man, man->last));
- case (MAN_EQN):
+ case MAN_EQN:
/* FALLTHROUGH */
- case (MAN_TBL):
+ case MAN_TBL:
return(1);
default:
break;
@@ -183,9 +182,8 @@ man_valid_post(struct man *man)
return(1);
}
-
static int
-check_root(CHKARGS)
+check_root(CHKARGS)
{
if (MAN_BLINE & man->flags)
@@ -207,7 +205,7 @@ check_root(CHKARGS)
* implication, date and section also aren't set).
*/
- man->meta.title = mandoc_strdup("unknown");
+ man->meta.title = mandoc_strdup("unknown");
man->meta.msec = mandoc_strdup("1");
man->meta.date = man->quick ? mandoc_strdup("") :
mandoc_normdate(man->parse, NULL, n->line, n->pos);
@@ -236,8 +234,8 @@ check_##name(CHKARGS) \
if (n->nchild ineq (x)) \
return(1); \
mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line, n->pos, \
- "line arguments %s %d (have %d)", \
- #ineq, (x), n->nchild); \
+ "line arguments %s %d (have %d)", \
+ #ineq, (x), n->nchild); \
return(1); \
}
@@ -270,27 +268,27 @@ post_ft(CHKARGS)
ok = 0;
cp = n->child->string;
switch (*cp) {
- case ('1'):
+ case '1':
/* FALLTHROUGH */
- case ('2'):
+ case '2':
/* FALLTHROUGH */
- case ('3'):
+ case '3':
/* FALLTHROUGH */
- case ('4'):
+ case '4':
/* FALLTHROUGH */
- case ('I'):
+ case 'I':
/* FALLTHROUGH */
- case ('P'):
+ case 'P':
/* FALLTHROUGH */
- case ('R'):
+ case 'R':
if ('\0' == cp[1])
ok = 1;
break;
- case ('B'):
+ case 'B':
if ('\0' == cp[1] || ('I' == cp[1] && '\0' == cp[2]))
ok = 1;
break;
- case ('C'):
+ case 'C':
if ('W' == cp[1] && '\0' == cp[2])
ok = 1;
break;
@@ -299,17 +297,14 @@ post_ft(CHKARGS)
}
if (0 == ok) {
- mandoc_vmsg
- (MANDOCERR_BADFONT, man->parse,
- n->line, n->pos, "%s", cp);
+ mandoc_vmsg(MANDOCERR_BADFONT, man->parse, n->line,
+ n->pos, "%s", cp);
*cp = '\0';
}
if (1 < n->nchild)
- mandoc_vmsg
- (MANDOCERR_ARGCOUNT, man->parse, n->line,
- n->pos, "want one child (have %d)",
- n->nchild);
+ mandoc_vmsg(MANDOCERR_ARGCOUNT, man->parse, n->line,
+ n->pos, "want one child (have %d)", n->nchild);
return(1);
}
@@ -327,7 +322,7 @@ static int
post_sec(CHKARGS)
{
- if ( ! (MAN_HEAD == n->type && 0 == n->nchild))
+ if ( ! (MAN_HEAD == n->type && 0 == n->nchild))
return(1);
man_nmsg(man, n, MANDOCERR_SYNTARGCOUNT);
@@ -339,27 +334,26 @@ check_part(CHKARGS)
{
if (MAN_BODY == n->type && 0 == n->nchild)
- mandoc_msg(MANDOCERR_ARGCWARN, man->parse, n->line,
- n->pos, "want children (have none)");
+ mandoc_msg(MANDOCERR_ARGCWARN, man->parse, n->line,
+ n->pos, "want children (have none)");
return(1);
}
-
static int
check_par(CHKARGS)
{
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
if (0 == n->body->nchild)
man_node_delete(man, n);
break;
- case (MAN_BODY):
+ case MAN_BODY:
if (0 == n->nchild)
man_nmsg(man, n, MANDOCERR_IGNPAR);
break;
- case (MAN_HEAD):
+ case MAN_HEAD:
if (n->nchild)
man_nmsg(man, n, MANDOCERR_ARGSLOST);
break;
@@ -375,11 +369,11 @@ post_IP(CHKARGS)
{
switch (n->type) {
- case (MAN_BLOCK):
+ case MAN_BLOCK:
if (0 == n->head->nchild && 0 == n->body->nchild)
man_node_delete(man, n);
break;
- case (MAN_BODY):
+ case MAN_BODY:
if (0 == n->parent->head->nchild && 0 == n->nchild)
man_nmsg(man, n, MANDOCERR_IGNPAR);
break;
@@ -401,7 +395,7 @@ post_TH(CHKARGS)
free(man->meta.date);
man->meta.title = man->meta.vol = man->meta.date =
- man->meta.msec = man->meta.source = NULL;
+ man->meta.msec = man->meta.source = NULL;
/* ->TITLE<- MSEC DATE SOURCE VOL */
@@ -409,8 +403,8 @@ post_TH(CHKARGS)
if (n && n->string) {
for (p = n->string; '\0' != *p; p++) {
/* Only warn about this once... */
- if (isalpha((unsigned char)*p) &&
- ! isupper((unsigned char)*p)) {
+ if (isalpha((unsigned char)*p) &&
+ ! isupper((unsigned char)*p)) {
man_nmsg(man, n, MANDOCERR_UPPERCASE);
break;
}
@@ -568,13 +562,13 @@ post_vs(CHKARGS)
return(1);
switch (n->parent->tok) {
- case (MAN_SH):
+ case MAN_SH:
/* FALLTHROUGH */
- case (MAN_SS):
+ case MAN_SS:
man_nmsg(man, n, MANDOCERR_IGNPAR);
/* FALLTHROUGH */
- case (MAN_MAX):
- /*
+ case MAN_MAX:
+ /*
* Don't warn about this because it occurs in pod2man
* and would cause considerable (unfixable) warnage.
*/
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index 627f64e6be9..d6ddc390317 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.47 2014/04/08 01:36:50 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.48 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -42,7 +42,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
const char *local_start;
int local_sz;
char term;
- enum mandoc_esc gly;
+ enum mandoc_esc gly;
/*
* When the caller doesn't provide return storage,
@@ -71,11 +71,11 @@ mandoc_escape(const char **end, const char **start, int *sz)
* these, but each eventually returns a substring of the glyph
* name.
*/
- case ('('):
+ case '(':
gly = ESCAPE_SPECIAL;
*sz = 2;
break;
- case ('['):
+ case '[':
gly = ESCAPE_SPECIAL;
/*
* Unicode escapes are defined in groff as \[uXXXX] to
@@ -87,7 +87,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
gly = ESCAPE_UNICODE;
term = ']';
break;
- case ('C'):
+ case 'C':
if ('\'' != **start)
return(ESCAPE_ERROR);
*start = ++*end;
@@ -101,50 +101,50 @@ mandoc_escape(const char **end, const char **start, int *sz)
/*
* Escapes taking no arguments at all.
*/
- case ('d'):
+ case 'd':
/* FALLTHROUGH */
- case ('u'):
+ case 'u':
return(ESCAPE_IGNORE);
/*
* The \z escape is supposed to output the following
- * character without advancing the cursor position.
+ * character without advancing the cursor position.
* Since we are mostly dealing with terminal mode,
* let us just skip the next character.
*/
- case ('z'):
+ case 'z':
return(ESCAPE_SKIPCHAR);
/*
* Handle all triggers matching \X(xy, \Xx, and \X[xxxx], where
* 'X' is the trigger. These have opaque sub-strings.
*/
- case ('F'):
+ case 'F':
/* FALLTHROUGH */
- case ('g'):
+ case 'g':
/* FALLTHROUGH */
- case ('k'):
+ case 'k':
/* FALLTHROUGH */
- case ('M'):
+ case 'M':
/* FALLTHROUGH */
- case ('m'):
+ case 'm':
/* FALLTHROUGH */
- case ('n'):
+ case 'n':
/* FALLTHROUGH */
- case ('V'):
+ case 'V':
/* FALLTHROUGH */
- case ('Y'):
+ case 'Y':
gly = ESCAPE_IGNORE;
/* FALLTHROUGH */
- case ('f'):
+ case 'f':
if (ESCAPE_ERROR == gly)
gly = ESCAPE_FONT;
switch (**start) {
- case ('('):
+ case '(':
*start = ++*end;
*sz = 2;
break;
- case ('['):
+ case '[':
*start = ++*end;
term = ']';
break;
@@ -159,19 +159,19 @@ mandoc_escape(const char **end, const char **start, int *sz)
* and 'Y' is any string. These have opaque sub-strings.
* The \B and \w escapes are handled in roff.c, roff_res().
*/
- case ('A'):
+ case 'A':
/* FALLTHROUGH */
- case ('b'):
+ case 'b':
/* FALLTHROUGH */
- case ('D'):
+ case 'D':
/* FALLTHROUGH */
- case ('o'):
+ case 'o':
/* FALLTHROUGH */
- case ('R'):
+ case 'R':
/* FALLTHROUGH */
- case ('X'):
+ case 'X':
/* FALLTHROUGH */
- case ('Z'):
+ case 'Z':
if ('\0' == **start)
return(ESCAPE_ERROR);
gly = ESCAPE_IGNORE;
@@ -183,19 +183,19 @@ mandoc_escape(const char **end, const char **start, int *sz)
* These escapes are of the form \X'N', where 'X' is the trigger
* and 'N' resolves to a numerical expression.
*/
- case ('h'):
+ case 'h':
/* FALLTHROUGH */
- case ('H'):
+ case 'H':
/* FALLTHROUGH */
- case ('L'):
+ case 'L':
/* FALLTHROUGH */
- case ('l'):
+ case 'l':
/* FALLTHROUGH */
- case ('S'):
+ case 'S':
/* FALLTHROUGH */
- case ('v'):
+ case 'v':
/* FALLTHROUGH */
- case ('x'):
+ case 'x':
if (strchr("\0 %&()*+-./0123456789:<=>", **start))
return(ESCAPE_ERROR);
gly = ESCAPE_IGNORE;
@@ -207,7 +207,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
* Special handling for the numbered character escape.
* XXX Do any other escapes need similar handling?
*/
- case ('N'):
+ case 'N':
if ('\0' == **start)
return(ESCAPE_ERROR);
(*end)++;
@@ -223,10 +223,10 @@ mandoc_escape(const char **end, const char **start, int *sz)
(*end)++;
return(ESCAPE_NUMBERED);
- /*
+ /*
* Sizes get a special category of their own.
*/
- case ('s'):
+ case 's':
gly = ESCAPE_IGNORE;
/* See +/- counts as a sign. */
@@ -234,15 +234,15 @@ mandoc_escape(const char **end, const char **start, int *sz)
(*end)++;
switch (**end) {
- case ('('):
+ case '(':
*start = ++*end;
*sz = 2;
break;
- case ('['):
+ case '[':
*start = ++*end;
term = ']';
break;
- case ('\''):
+ case '\'':
*start = ++*end;
term = '\'';
break;
@@ -274,9 +274,9 @@ mandoc_escape(const char **end, const char **start, int *sz)
if ('\0' != term) {
while (**end != term) {
switch (**end) {
- case ('\0'):
+ case '\0':
return(ESCAPE_ERROR);
- case ('\\'):
+ case '\\':
(*end)++;
if (ESCAPE_ERROR ==
mandoc_escape(end, NULL, NULL))
@@ -298,7 +298,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
/* Run post-processors. */
switch (gly) {
- case (ESCAPE_FONT):
+ case ESCAPE_FONT:
if (2 == *sz) {
if ('C' == **start) {
/*
@@ -316,27 +316,27 @@ mandoc_escape(const char **end, const char **start, int *sz)
break;
switch (**start) {
- case ('3'):
+ case '3':
/* FALLTHROUGH */
- case ('B'):
+ case 'B':
gly = ESCAPE_FONTBOLD;
break;
- case ('2'):
+ case '2':
/* FALLTHROUGH */
- case ('I'):
+ case 'I':
gly = ESCAPE_FONTITALIC;
break;
- case ('P'):
+ case 'P':
gly = ESCAPE_FONTPREV;
break;
- case ('1'):
+ case '1':
/* FALLTHROUGH */
- case ('R'):
+ case 'R':
gly = ESCAPE_FONTROMAN;
break;
}
break;
- case (ESCAPE_SPECIAL):
+ case ESCAPE_SPECIAL:
if (1 == *sz && 'c' == **start)
gly = ESCAPE_NOSPACE;
break;
@@ -368,7 +368,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
if ('"' == *start) {
quoted = 1;
start++;
- }
+ }
pairs = 0;
white = 0;
@@ -387,14 +387,14 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
* backslashes and backslash-t to literal tabs.
*/
switch (cp[1]) {
- case ('t'):
+ case 't':
cp[0] = '\t';
/* FALLTHROUGH */
- case ('\\'):
+ case '\\':
pairs++;
cp++;
break;
- case (' '):
+ case ' ':
/* Skip escaped blanks. */
if (0 == quoted)
cp++;
@@ -534,21 +534,21 @@ mandoc_eos(const char *p, size_t sz)
enclosed = found = 0;
for (q = p + (int)sz - 1; q >= p; q--) {
switch (*q) {
- case ('\"'):
+ case '\"':
/* FALLTHROUGH */
- case ('\''):
+ case '\'':
/* FALLTHROUGH */
- case (']'):
+ case ']':
/* FALLTHROUGH */
- case (')'):
+ case ')':
if (0 == found)
enclosed = 1;
break;
- case ('.'):
+ case '.':
/* FALLTHROUGH */
- case ('!'):
+ case '!':
/* FALLTHROUGH */
- case ('?'):
+ case '?':
found = 1;
break;
default:
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index d9b32241f2b..32907899a7f 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.63 2014/03/28 23:25:54 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.64 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -363,7 +363,7 @@ struct eqn_box {
/*
* An equation consists of a tree of expressions starting at a given
- * line and position.
+ * line and position.
*/
struct eqn {
char *name; /* identifier (or NULL) */
@@ -409,18 +409,18 @@ __BEGIN_DECLS
enum mandoc_esc mandoc_escape(const char **, const char **, int *);
struct mchars *mchars_alloc(void);
void mchars_free(struct mchars *);
-char mchars_num2char(const char *, size_t);
+char mchars_num2char(const char *, size_t);
int mchars_num2uc(const char *, size_t);
-int mchars_spec2cp(const struct mchars *,
+int mchars_spec2cp(const struct mchars *,
const char *, size_t);
-const char *mchars_spec2str(const struct mchars *,
+const char *mchars_spec2str(const struct mchars *,
const char *, size_t, size_t *);
struct mparse *mparse_alloc(int, enum mandoclevel, mandocmsg, char *);
void mparse_free(struct mparse *);
void mparse_keep(struct mparse *);
enum mandoclevel mparse_readfd(struct mparse *, int, const char *);
void mparse_reset(struct mparse *);
-void mparse_result(struct mparse *,
+void mparse_result(struct mparse *,
struct mdoc **, struct man **, char **);
const char *mparse_getkeep(const struct mparse *);
const char *mparse_strerror(enum mandocerr);
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 549b74d021a..4a75494348c 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.97 2014/04/19 02:55:44 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.98 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -172,12 +172,12 @@ static char tempfilename[32];
static char *progname;
static int nodb; /* no database changes */
static int mparse_options; /* abort the parse early */
-static int use_all; /* use all found files */
-static int debug; /* print what we're doing */
-static int warnings; /* warn about crap */
+static int use_all; /* use all found files */
+static int debug; /* print what we're doing */
+static int warnings; /* warn about crap */
static int write_utf8; /* write UTF-8 output; else ASCII */
static int exitcode; /* to be returned by main */
-static enum op op; /* operational mode */
+static enum op op; /* operational mode */
static char basedir[PATH_MAX]; /* current base directory */
static struct ohash mpages; /* table of distinct manual pages */
static struct ohash mlinks; /* table of directory entries */
@@ -312,6 +312,7 @@ static const struct mdoc_handler mdocs[MDOC_MAX] = {
{ NULL, 0 }, /* Ta */
};
+
int
mandocdb(int argc, char *argv[])
{
@@ -340,7 +341,7 @@ mandocdb(int argc, char *argv[])
++progname;
/*
- * We accept a few different invocations.
+ * We accept a few different invocations.
* The CHECKOP macro makes sure that invocation styles don't
* clobber each other.
*/
@@ -355,32 +356,32 @@ mandocdb(int argc, char *argv[])
while (-1 != (ch = getopt(argc, argv, "aC:Dd:npQT:tu:v")))
switch (ch) {
- case ('a'):
+ case 'a':
use_all = 1;
break;
- case ('C'):
+ case 'C':
CHECKOP(op, ch);
path_arg = optarg;
op = OP_CONFFILE;
break;
- case ('D'):
+ case 'D':
debug++;
break;
- case ('d'):
+ case 'd':
CHECKOP(op, ch);
path_arg = optarg;
op = OP_UPDATE;
break;
- case ('n'):
+ case 'n':
nodb = 1;
break;
- case ('p'):
+ case 'p':
warnings = 1;
break;
- case ('Q'):
+ case 'Q':
mparse_options |= MPARSE_QUICK;
break;
- case ('T'):
+ case 'T':
if (strcmp(optarg, "utf8")) {
fprintf(stderr, "-T%s: Unsupported "
"output format\n", optarg);
@@ -388,18 +389,18 @@ mandocdb(int argc, char *argv[])
}
write_utf8 = 1;
break;
- case ('t'):
+ case 't':
CHECKOP(op, ch);
dup2(STDOUT_FILENO, STDERR_FILENO);
op = OP_TEST;
nodb = warnings = 1;
break;
- case ('u'):
+ case 'u':
CHECKOP(op, ch);
path_arg = optarg;
op = OP_DELETE;
break;
- case ('v'):
+ case 'v':
/* Compatibility with espie@'s makewhatis. */
break;
default:
@@ -462,8 +463,8 @@ mandocdb(int argc, char *argv[])
* manpath_parse() wants to do it.
*/
if (argc > 0) {
- dirs.paths = mandoc_calloc
- (argc, sizeof(char *));
+ dirs.paths = mandoc_calloc(argc,
+ sizeof(char *));
dirs.sz = (size_t)argc;
for (i = 0; i < argc; i++)
dirs.paths[i] = mandoc_strdup(argv[i]);
@@ -530,7 +531,7 @@ usage:
" %s [-DnpQ] [-Tutf8] -d dir [file ...]\n"
" %s [-Dnp] -u dir [file ...]\n"
" %s [-Q] -t file ...\n",
- progname, progname, progname,
+ progname, progname, progname,
progname, progname);
return((int)MANDOCLEVEL_BADARG);
@@ -544,7 +545,7 @@ usage:
* If use_all has been specified, grok all files.
* If not, sanitise paths to the following:
*
- * [./]man*[/<arch>]/<name>.<section>
+ * [./]man*[/<arch>]/<name>.<section>
* or
* [./]cat<section>[/<arch>]/<name>.0
*
@@ -584,7 +585,7 @@ treescan(void)
* Symbolic links require various sanity checks,
* then get handled just like regular files.
*/
- case (FTS_SL):
+ case FTS_SL:
if (NULL == realpath(path, buf)) {
if (warnings)
say(path, "&realpath");
@@ -607,7 +608,7 @@ treescan(void)
* If we're a regular file, add an mlink by using the
* stored directory data and handling the filename.
*/
- case (FTS_F):
+ case FTS_F:
if (0 == strcmp(path, MANDOC_DB))
continue;
if ( ! use_all && ff->fts_level < 2) {
@@ -664,9 +665,9 @@ treescan(void)
mlink_add(mlink, ff->fts_statp);
continue;
- case (FTS_D):
+ case FTS_D:
/* FALLTHROUGH */
- case (FTS_DP):
+ case FTS_DP:
break;
default:
@@ -676,10 +677,10 @@ treescan(void)
}
switch (ff->fts_level) {
- case (0):
+ case 0:
/* Ignore the root directory. */
break;
- case (1):
+ case 1:
/*
* This might contain manX/ or catX/.
* Try to infer this from the name.
@@ -700,14 +701,14 @@ treescan(void)
dsec = NULL;
}
- if (NULL != dsec || use_all)
+ if (NULL != dsec || use_all)
break;
if (warnings)
say(path, "Unknown directory part");
fts_set(f, ff, FTS_SKIP);
break;
- case (2):
+ case 2:
/*
* Possibly our architecture.
* If we're descending, keep tabs on it.
@@ -739,7 +740,7 @@ treescan(void)
* Try to infer the manual section, architecture, and page name from the
* path, assuming it looks like
*
- * [./]man*[/<arch>]/<name>.<section>
+ * [./]man*[/<arch>]/<name>.<section>
* or
* [./]cat<section>[/<arch>]/<name>.0
*
@@ -976,7 +977,7 @@ mlinks_undupe(struct mpage *mpage)
*++bufp = '\0';
strlcat(buf, mlink->dsec, PATH_MAX);
if (NULL == ohash_find(&mlinks,
- ohash_qlookup(&mlinks, buf)))
+ ohash_qlookup(&mlinks, buf)))
goto nextlink;
if (warnings)
say(mlink->file, "Man source exists: %s", buf);
@@ -1105,14 +1106,14 @@ mpages_merge(struct mchars *mc, struct mparse *mp)
goto nextpage;
}
switch (child_pid = fork()) {
- case (-1):
+ case -1:
exitcode = (int)MANDOCLEVEL_SYSERR;
say(mpage->mlinks->file, "&fork gunzip");
child_pid = 0;
close(fd[1]);
close(fd[0]);
goto nextpage;
- case (0):
+ case 0:
close(fd[0]);
if (-1 == dup2(fd[1], STDOUT_FILENO)) {
say(mpage->mlinks->file,
@@ -1327,7 +1328,7 @@ parse_cat(struct mpage *mpage, int fd)
while (NULL != (line = fgetln(stream, &len)))
if ('\n' != *line && ' ' != *line)
break;
-
+
/*
* Read up until the next section into a buffer.
* Strip the leading and trailing newline from each read line,
@@ -1397,7 +1398,7 @@ parse_cat(struct mpage *mpage, int fd)
if (0 == len) {
memmove(line, line + 1, plen--);
continue;
- }
+ }
memmove(line - 1, line + 1, plen - len);
plen -= 2;
}
@@ -1461,11 +1462,11 @@ parse_man(struct mpage *mpage, const struct man_node *n)
body = n;
assert(body->parent);
if (NULL != (head = body->parent->head) &&
- 1 == head->nchild &&
- NULL != (head = (head->child)) &&
- MAN_TEXT == head->type &&
- 0 == strcmp(head->string, "NAME") &&
- NULL != body->child) {
+ 1 == head->nchild &&
+ NULL != (head = (head->child)) &&
+ MAN_TEXT == head->type &&
+ 0 == strcmp(head->string, "NAME") &&
+ NULL != body->child) {
/*
* Suck the entire NAME section into memory.
@@ -1479,7 +1480,7 @@ parse_man(struct mpage *mpage, const struct man_node *n)
if (NULL == title)
return;
- /*
+ /*
* Go through a special heuristic dance here.
* Conventionally, one or more manual names are
* comma-specified prior to a whitespace, then a
@@ -1561,15 +1562,15 @@ parse_mdoc(struct mpage *mpage, const struct mdoc_node *n)
assert(NULL != n);
for (n = n->child; NULL != n; n = n->next) {
switch (n->type) {
- case (MDOC_ELEM):
+ case MDOC_ELEM:
/* FALLTHROUGH */
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
/* FALLTHROUGH */
- case (MDOC_HEAD):
+ case MDOC_HEAD:
/* FALLTHROUGH */
- case (MDOC_BODY):
+ case MDOC_BODY:
/* FALLTHROUGH */
- case (MDOC_TAIL):
+ case MDOC_TAIL:
if (NULL != mdocs[n->tok].fp)
if (0 == (*mdocs[n->tok].fp)(mpage, n))
break;
@@ -1593,8 +1594,8 @@ parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_node *n)
size_t sz;
if (SEC_SYNOPSIS != n->sec ||
- NULL == (n = n->child) ||
- MDOC_TEXT != n->type)
+ NULL == (n = n->child) ||
+ MDOC_TEXT != n->type)
return(0);
/*
@@ -1637,11 +1638,11 @@ parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n)
if (NULL == (n = n->child) || MDOC_TEXT != n->type)
return(0);
- /*
+ /*
* Parse: .Fn "struct type *name" "char *arg".
- * First strip away pointer symbol.
+ * First strip away pointer symbol.
* Then store the function name, then type.
- * Finally, store the arguments.
+ * Finally, store the arguments.
*/
if (NULL == (cp = strrchr(n->string, ' ')))
@@ -1858,7 +1859,7 @@ render_key(struct mchars *mc, struct str *key)
if (strcspn(val, res) == bsz) {
key->rendered = key->key;
return;
- }
+ }
/* Pre-allocate by the length of the input */
@@ -1878,17 +1879,17 @@ render_key(struct mchars *mc, struct str *key)
}
switch (*val) {
- case (ASCII_HYPH):
+ case ASCII_HYPH:
buf[pos++] = '-';
val++;
continue;
- case ('\t'):
+ case '\t':
/* FALLTHROUGH */
- case (ASCII_NBRSP):
+ case ASCII_NBRSP:
buf[pos++] = ' ';
val++;
/* FALLTHROUGH */
- case (ASCII_BREAK):
+ case ASCII_BREAK:
continue;
default:
break;
@@ -1905,8 +1906,8 @@ render_key(struct mchars *mc, struct str *key)
* predefined character or special character.
*/
- esc = mandoc_escape
- ((const char **)&val, &seq, &len);
+ esc = mandoc_escape((const char **)&val,
+ &seq, &len);
if (ESCAPE_ERROR == esc)
break;
if (ESCAPE_SPECIAL != esc)
@@ -2117,11 +2118,11 @@ dbclose(int real)
}
switch (child = fork()) {
- case (-1):
+ case -1:
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&fork cmp");
return;
- case (0):
+ case 0:
execlp("cmp", "cmp", "-s",
tempfilename, MANDOC_DB, NULL);
say("", "&exec cmp");
@@ -2143,11 +2144,11 @@ dbclose(int real)
*strrchr(tempfilename, '/') = '\0';
switch (child = fork()) {
- case (-1):
+ case -1:
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&fork rm");
return;
- case (0):
+ case 0:
execlp("rm", "rm", "-rf", tempfilename, NULL);
say("", "&exec rm");
exit((int)MANDOCLEVEL_SYSERR);
@@ -2178,7 +2179,7 @@ dbopen(int real)
const char *sql;
int rc, ofl;
- if (nodb)
+ if (nodb)
return(1);
*tempfilename = '\0';
@@ -2198,7 +2199,7 @@ dbopen(int real)
remove(MANDOC_DB "~");
rc = sqlite3_open_v2(MANDOC_DB "~", &db, ofl, NULL);
- if (SQLITE_OK == rc)
+ if (SQLITE_OK == rc)
goto create_tables;
if (MPARSE_QUICK & mparse_options) {
exitcode = (int)MANDOCLEVEL_SYSERR;
@@ -2389,10 +2390,10 @@ say(const char *file, const char *format, ...)
use_errno = 1;
if (NULL != format) {
switch (*format) {
- case ('&'):
+ case '&':
format++;
break;
- case ('\0'):
+ case '\0':
format = NULL;
break;
default:
diff --git a/usr.bin/mandoc/manpath.c b/usr.bin/mandoc/manpath.c
index 30380347da8..05045ca749a 100644
--- a/usr.bin/mandoc/manpath.c
+++ b/usr.bin/mandoc/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.8 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: manpath.c,v 1.9 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -119,9 +119,8 @@ manpath_add(struct manpaths *dirs, const char *dir)
if (0 == strcmp(dirs->paths[i], dir))
return;
- dirs->paths = mandoc_realloc
- (dirs->paths,
- (dirs->sz + 1) * sizeof(char *));
+ dirs->paths = mandoc_realloc(dirs->paths,
+ (dirs->sz + 1) * sizeof(char *));
dirs->paths[dirs->sz++] = mandoc_strdup(cp);
}
diff --git a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c
index 2f9e6a7a69a..9141c4c691d 100644
--- a/usr.bin/mandoc/mansearch.c
+++ b/usr.bin/mandoc/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.23 2014/04/17 19:19:54 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.24 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -56,7 +56,7 @@ extern const char *const mansearch_keynames[];
} while (0)
struct expr {
- uint64_t bits; /* type-mask */
+ uint64_t bits; /* type-mask */
const char *substr; /* to search for, if applicable */
regex_t regexp; /* compiled regexp, if applicable */
int open; /* opening parentheses before */
@@ -79,7 +79,7 @@ static char *buildoutput(sqlite3 *, sqlite3_stmt *,
static void *hash_alloc(size_t, void *);
static void hash_free(void *, size_t, void *);
static void *hash_halloc(size_t, void *);
-static struct expr *exprcomp(const struct mansearch *,
+static struct expr *exprcomp(const struct mansearch *,
int, char *[]);
static void exprfree(struct expr *);
static struct expr *exprspec(struct expr *, uint64_t,
@@ -93,6 +93,7 @@ static void sql_regexp(sqlite3_context *context,
int argc, sqlite3_value **argv);
static char *sql_statement(const struct expr *);
+
int
mansearch_setup(int start)
{
@@ -227,11 +228,10 @@ mansearch(const struct mansearch *search,
} else if (-1 == chdir(paths->paths[i])) {
perror(paths->paths[i]);
continue;
- }
+ }
- c = sqlite3_open_v2
- (MANDOC_DB, &db,
- SQLITE_OPEN_READONLY, NULL);
+ c = sqlite3_open_v2(MANDOC_DB, &db,
+ SQLITE_OPEN_READONLY, NULL);
if (SQLITE_OK != c) {
perror(MANDOC_DB);
@@ -280,9 +280,9 @@ mansearch(const struct mansearch *search,
*/
while (SQLITE_ROW == (c = sqlite3_step(s))) {
pageid = sqlite3_column_int64(s, 2);
- idx = ohash_lookup_memory
- (&htab, (char *)&pageid,
- sizeof(uint64_t), (uint32_t)pageid);
+ idx = ohash_lookup_memory(&htab,
+ (char *)&pageid, sizeof(uint64_t),
+ (uint32_t)pageid);
if (NULL != ohash_find(&htab, idx))
continue;
@@ -301,7 +301,7 @@ mansearch(const struct mansearch *search,
sqlite3_finalize(s);
- c = sqlite3_prepare_v2(db,
+ c = sqlite3_prepare_v2(db,
"SELECT * FROM mlinks WHERE pageid=?"
" ORDER BY sec, arch, name",
-1, &s, NULL);
@@ -319,8 +319,8 @@ mansearch(const struct mansearch *search,
mp = ohash_next(&htab, &idx)) {
if (cur + 1 > maxres) {
maxres += 1024;
- *res = mandoc_realloc
- (*res, maxres * sizeof(struct manpage));
+ *res = mandoc_realloc(*res,
+ maxres * sizeof(struct manpage));
}
mpage = *res + cur;
mpage->form = mp->form;
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 3dcffdfa860..c2d654488cb 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.102 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.103 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -31,7 +31,7 @@
#include "libmdoc.h"
#include "libmandoc.h"
-const char *const __mdoc_macronames[MDOC_MAX] = {
+const char *const __mdoc_macronames[MDOC_MAX] = {
"Ap", "Dd", "Dt", "Os",
"Sh", "Ss", "Pp", "D1",
"Dl", "Bd", "Ed", "Bl",
@@ -42,11 +42,8 @@ const char *const __mdoc_macronames[MDOC_MAX] = {
"Ic", "In", "Li", "Nd",
"Nm", "Op", "Ot", "Pa",
"Rv", "St", "Va", "Vt",
- /* LINTED */
"Xr", "%A", "%B", "%D",
- /* LINTED */
"%I", "%J", "%N", "%O",
- /* LINTED */
"%P", "%R", "%T", "%V",
"Ac", "Ao", "Aq", "At",
"Bc", "Bf", "Bo", "Bq",
@@ -63,22 +60,19 @@ const char *const __mdoc_macronames[MDOC_MAX] = {
"Bk", "Ek", "Bt", "Hf",
"Fr", "Ud", "Lb", "Lp",
"Lk", "Mt", "Brq", "Bro",
- /* LINTED */
"Brc", "%C", "Es", "En",
- /* LINTED */
"Dx", "%Q", "br", "sp",
- /* LINTED */
"%U", "Ta", "ll",
};
-const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
+const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
"split", "nosplit", "ragged",
- "unfilled", "literal", "file",
- "offset", "bullet", "dash",
- "hyphen", "item", "enum",
- "tag", "diag", "hang",
- "ohang", "inset", "column",
- "width", "compact", "std",
+ "unfilled", "literal", "file",
+ "offset", "bullet", "dash",
+ "hyphen", "item", "enum",
+ "tag", "diag", "hang",
+ "ohang", "inset", "column",
+ "width", "compact", "std",
"filled", "words", "emphasis",
"symbolic", "nested", "centered"
};
@@ -87,13 +81,13 @@ const char * const *mdoc_macronames = __mdoc_macronames;
const char * const *mdoc_argnames = __mdoc_argnames;
static void mdoc_node_free(struct mdoc_node *);
-static void mdoc_node_unlink(struct mdoc *,
+static void mdoc_node_unlink(struct mdoc *,
struct mdoc_node *);
static void mdoc_free1(struct mdoc *);
static void mdoc_alloc1(struct mdoc *);
-static struct mdoc_node *node_alloc(struct mdoc *, int, int,
+static struct mdoc_node *node_alloc(struct mdoc *, int, int,
enum mdoct, enum mdoc_type);
-static int node_append(struct mdoc *,
+static int node_append(struct mdoc *,
struct mdoc_node *);
#if 0
static int mdoc_preptext(struct mdoc *, int, char *, int);
@@ -101,6 +95,7 @@ static int mdoc_preptext(struct mdoc *, int, char *, int);
static int mdoc_ptext(struct mdoc *, int, char *, int);
static int mdoc_pmacro(struct mdoc *, int, char *, int);
+
const struct mdoc_node *
mdoc_node(const struct mdoc *mdoc)
{
@@ -109,7 +104,6 @@ mdoc_node(const struct mdoc *mdoc)
return(mdoc->first);
}
-
const struct mdoc_meta *
mdoc_meta(const struct mdoc *mdoc)
{
@@ -118,7 +112,6 @@ mdoc_meta(const struct mdoc *mdoc)
return(&mdoc->meta);
}
-
/*
* Frees volatile resources (parse tree, meta-data, fields).
*/
@@ -144,7 +137,6 @@ mdoc_free1(struct mdoc *mdoc)
free(mdoc->meta.date);
}
-
/*
* Allocate all volatile resources (parse tree, meta-data, fields).
*/
@@ -162,7 +154,6 @@ mdoc_alloc1(struct mdoc *mdoc)
mdoc->next = MDOC_NEXT_CHILD;
}
-
/*
* Free up volatile resources (see mdoc_free1()) then re-initialises the
* data with mdoc_alloc1(). After invocation, parse data has been reset
@@ -177,7 +168,6 @@ mdoc_reset(struct mdoc *mdoc)
mdoc_alloc1(mdoc);
}
-
/*
* Completely free up all volatile and non-volatile parse resources.
* After invocation, the pointer is no longer usable.
@@ -190,9 +180,8 @@ mdoc_free(struct mdoc *mdoc)
free(mdoc);
}
-
/*
- * Allocate volatile and non-volatile parse resources.
+ * Allocate volatile and non-volatile parse resources.
*/
struct mdoc *
mdoc_alloc(struct roff *roff, struct mparse *parse,
@@ -212,7 +201,6 @@ mdoc_alloc(struct roff *roff, struct mparse *parse,
return(p);
}
-
/*
* Climb back up the parse tree, validating open scopes. Mostly calls
* through to macro_end() in macro.c.
@@ -276,7 +264,6 @@ mdoc_addspan(struct mdoc *mdoc, const struct tbl_span *sp)
return(1);
}
-
/*
* Main parse routine. Parses a single line -- really just hands off to
* the macro (mdoc_pmacro()) or text parser (mdoc_ptext()).
@@ -301,8 +288,8 @@ mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)
mdoc->flags &= ~MDOC_SYNOPSIS;
return(roff_getcontrol(mdoc->roff, buf, &offs) ?
- mdoc_pmacro(mdoc, ln, buf, offs) :
- mdoc_ptext(mdoc, ln, buf, offs));
+ mdoc_pmacro(mdoc, ln, buf, offs) :
+ mdoc_ptext(mdoc, ln, buf, offs));
}
int
@@ -312,16 +299,16 @@ mdoc_macro(MACRO_PROT_ARGS)
/* If we're in the body, deny prologue calls. */
- if (MDOC_PROLOGUE & mdoc_macros[tok].flags &&
- MDOC_PBODY & mdoc->flags) {
+ if (MDOC_PROLOGUE & mdoc_macros[tok].flags &&
+ MDOC_PBODY & mdoc->flags) {
mdoc_pmsg(mdoc, line, ppos, MANDOCERR_BADBODY);
return(1);
}
/* If we're in the prologue, deny "body" macros. */
- if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) &&
- ! (MDOC_PBODY & mdoc->flags)) {
+ if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) &&
+ ! (MDOC_PBODY & mdoc->flags)) {
mdoc_pmsg(mdoc, line, ppos, MANDOCERR_BADPROLOG);
if (NULL == mdoc->meta.msec)
mdoc->meta.msec = mandoc_strdup("1");
@@ -350,12 +337,12 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
assert(MDOC_ROOT != p->type);
switch (mdoc->next) {
- case (MDOC_NEXT_SIBLING):
+ case MDOC_NEXT_SIBLING:
mdoc->last->next = p;
p->prev = mdoc->last;
p->parent = mdoc->last->parent;
break;
- case (MDOC_NEXT_CHILD):
+ case MDOC_NEXT_CHILD:
mdoc->last->child = p;
p->parent = mdoc->last;
break;
@@ -372,13 +359,13 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
*/
switch (p->type) {
- case (MDOC_BODY):
+ case MDOC_BODY:
if (ENDBODY_NOT != p->end)
break;
/* FALLTHROUGH */
- case (MDOC_TAIL):
+ case MDOC_TAIL:
/* FALLTHROUGH */
- case (MDOC_HEAD):
+ case MDOC_HEAD:
p->norm = p->parent->norm;
break;
default:
@@ -389,15 +376,15 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
return(0);
switch (p->type) {
- case (MDOC_HEAD):
+ case MDOC_HEAD:
assert(MDOC_BLOCK == p->parent->type);
p->parent->head = p;
break;
- case (MDOC_TAIL):
+ case MDOC_TAIL:
assert(MDOC_BLOCK == p->parent->type);
p->parent->tail = p;
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
if (p->end)
break;
assert(MDOC_BLOCK == p->parent->type);
@@ -410,9 +397,9 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
mdoc->last = p;
switch (p->type) {
- case (MDOC_TBL):
+ case MDOC_TBL:
/* FALLTHROUGH */
- case (MDOC_TEXT):
+ case MDOC_TEXT:
if ( ! mdoc_valid_post(mdoc))
return(0);
break;
@@ -423,9 +410,8 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
return(1);
}
-
static struct mdoc_node *
-node_alloc(struct mdoc *mdoc, int line, int pos,
+node_alloc(struct mdoc *mdoc, int line, int pos,
enum mdoct tok, enum mdoc_type type)
{
struct mdoc_node *p;
@@ -451,7 +437,6 @@ node_alloc(struct mdoc *mdoc, int line, int pos,
return(p);
}
-
int
mdoc_tail_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
{
@@ -464,7 +449,6 @@ mdoc_tail_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
return(1);
}
-
int
mdoc_head_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
{
@@ -480,7 +464,6 @@ mdoc_head_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
return(1);
}
-
int
mdoc_body_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
{
@@ -493,7 +476,6 @@ mdoc_body_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok)
return(1);
}
-
int
mdoc_endbody_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok,
struct mdoc_node *body, enum mdoc_endbody end)
@@ -510,9 +492,8 @@ mdoc_endbody_alloc(struct mdoc *mdoc, int line, int pos, enum mdoct tok,
return(1);
}
-
int
-mdoc_block_alloc(struct mdoc *mdoc, int line, int pos,
+mdoc_block_alloc(struct mdoc *mdoc, int line, int pos,
enum mdoct tok, struct mdoc_arg *args)
{
struct mdoc_node *p;
@@ -523,13 +504,13 @@ mdoc_block_alloc(struct mdoc *mdoc, int line, int pos,
(args->refcnt)++;
switch (tok) {
- case (MDOC_Bd):
+ case MDOC_Bd:
/* FALLTHROUGH */
- case (MDOC_Bf):
+ case MDOC_Bf:
/* FALLTHROUGH */
- case (MDOC_Bl):
+ case MDOC_Bl:
/* FALLTHROUGH */
- case (MDOC_Rs):
+ case MDOC_Rs:
p->norm = mandoc_calloc(1, sizeof(union mdoc_data));
break;
default:
@@ -542,9 +523,8 @@ mdoc_block_alloc(struct mdoc *mdoc, int line, int pos,
return(1);
}
-
int
-mdoc_elem_alloc(struct mdoc *mdoc, int line, int pos,
+mdoc_elem_alloc(struct mdoc *mdoc, int line, int pos,
enum mdoct tok, struct mdoc_arg *args)
{
struct mdoc_node *p;
@@ -555,7 +535,7 @@ mdoc_elem_alloc(struct mdoc *mdoc, int line, int pos,
(args->refcnt)++;
switch (tok) {
- case (MDOC_An):
+ case MDOC_An:
p->norm = mandoc_calloc(1, sizeof(union mdoc_data));
break;
default:
@@ -611,7 +591,6 @@ mdoc_node_free(struct mdoc_node *p)
free(p);
}
-
static void
mdoc_node_unlink(struct mdoc *mdoc, struct mdoc_node *n)
{
@@ -649,7 +628,6 @@ mdoc_node_unlink(struct mdoc *mdoc, struct mdoc_node *n)
mdoc->first = NULL;
}
-
void
mdoc_node_delete(struct mdoc *mdoc, struct mdoc_node *p)
{
@@ -720,7 +698,7 @@ mdoc_preptext(struct mdoc *mdoc, int line, char *buf, int offs)
if ( ! mdoc_addeqn(mdoc, roff_eqn(mdoc->roff)))
return(0);
offs += (end - (buf + offs));
- }
+ }
return(1);
}
@@ -754,16 +732,16 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs)
*/
if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&
- LIST_column == n->norm->Bl.type) {
+ LIST_column == n->norm->Bl.type) {
/* `Bl' is open without any children. */
mdoc->flags |= MDOC_FREECOL;
return(mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf));
}
if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
- NULL != n->parent &&
- MDOC_Bl == n->parent->tok &&
- LIST_column == n->parent->norm->Bl.type) {
+ NULL != n->parent &&
+ MDOC_Bl == n->parent->tok &&
+ LIST_column == n->parent->norm->Bl.type) {
/* `Bl' has block-level `It' children. */
mdoc->flags |= MDOC_FREECOL;
return(mdoc_macro(mdoc, MDOC_It, line, offs, &offs, buf));
@@ -849,7 +827,6 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs)
return(1);
}
-
/*
* Parse a macro line, that is, a line beginning with the control
* character.
@@ -872,14 +849,14 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
sv = offs;
- /*
+ /*
* Copy the first word into a nil-terminated buffer.
* Stop copying when a tab, space, or eoln is encountered.
*/
i = 0;
- while (i < 4 && '\0' != buf[offs] &&
- ' ' != buf[offs] && '\t' != buf[offs])
+ while (i < 4 && '\0' != buf[offs] && ' ' != buf[offs] &&
+ '\t' != buf[offs])
mac[i++] = buf[offs++];
mac[i] = '\0';
@@ -887,8 +864,8 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
tok = (i > 1 || i < 4) ? mdoc_hash_find(mac) : MDOC_MAX;
if (MDOC_MAX == tok) {
- mandoc_vmsg(MANDOCERR_MACRO, mdoc->parse,
- ln, sv, "%s", buf + sv - 1);
+ mandoc_vmsg(MANDOCERR_MACRO, mdoc->parse,
+ ln, sv, "%s", buf + sv - 1);
return(1);
}
@@ -902,7 +879,7 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
while (buf[offs] && ' ' == buf[offs])
offs++;
- /*
+ /*
* Trailing whitespace. Note that tabs are allowed to be passed
* into the parser as "text", so we only warn about spaces here.
*/
@@ -916,7 +893,7 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
*/
if (NULL == mdoc->last || MDOC_It == tok || MDOC_El == tok) {
- if ( ! mdoc_macro(mdoc, tok, ln, sv, &offs, buf))
+ if ( ! mdoc_macro(mdoc, tok, ln, sv, &offs, buf))
goto err;
return(1);
}
@@ -930,7 +907,7 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
*/
if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&
- LIST_column == n->norm->Bl.type) {
+ LIST_column == n->norm->Bl.type) {
mdoc->flags |= MDOC_FREECOL;
if ( ! mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf))
goto err;
@@ -944,18 +921,18 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs)
*/
if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
- NULL != n->parent &&
- MDOC_Bl == n->parent->tok &&
- LIST_column == n->parent->norm->Bl.type) {
+ NULL != n->parent &&
+ MDOC_Bl == n->parent->tok &&
+ LIST_column == n->parent->norm->Bl.type) {
mdoc->flags |= MDOC_FREECOL;
- if ( ! mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf))
+ if ( ! mdoc_macro(mdoc, MDOC_It, ln, sv, &sv, buf))
goto err;
return(1);
}
/* Normal processing of a macro. */
- if ( ! mdoc_macro(mdoc, tok, ln, sv, &offs, buf))
+ if ( ! mdoc_macro(mdoc, tok, ln, sv, &offs, buf))
goto err;
/* In quick mode (for mandocdb), abort after the NAME section. */
@@ -981,27 +958,27 @@ mdoc_isdelim(const char *p)
if ('\0' == p[1])
switch (p[0]) {
- case('('):
+ case '(':
/* FALLTHROUGH */
- case('['):
+ case '[':
return(DELIM_OPEN);
- case('|'):
+ case '|':
return(DELIM_MIDDLE);
- case('.'):
+ case '.':
/* FALLTHROUGH */
- case(','):
+ case ',':
/* FALLTHROUGH */
- case(';'):
+ case ';':
/* FALLTHROUGH */
- case(':'):
+ case ':':
/* FALLTHROUGH */
- case('?'):
+ case '?':
/* FALLTHROUGH */
- case('!'):
+ case '!':
/* FALLTHROUGH */
- case(')'):
+ case ')':
/* FALLTHROUGH */
- case(']'):
+ case ']':
return(DELIM_CLOSE);
default:
return(DELIM_NONE);
diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h
index 0f04cf7b5bb..0f60cb4e47c 100644
--- a/usr.bin/mandoc/mdoc.h
+++ b/usr.bin/mandoc/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.52 2014/03/31 00:02:45 dlg Exp $ */
+/* $Id: mdoc.h,v 1.53 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -187,7 +187,7 @@ enum mdoc_type {
MDOC_ROOT
};
-/*
+/*
* Section (named/unnamed) of `Sh'. Note that these appear in the
* conventional order imposed by mdoc.7. In the case of SEC_NONE, no
* section has been invoked (this shouldn't happen). SEC_CUSTOM refers
@@ -216,7 +216,7 @@ enum mdoc_sec {
SEC_CAVEATS, /* CAVEATS */
SEC_BUGS, /* BUGS */
SEC_SECURITY, /* SECURITY */
- SEC_CUSTOM,
+ SEC_CUSTOM,
SEC__MAX
};
@@ -230,11 +230,11 @@ struct mdoc_meta {
char *name; /* leading `Nm' name */
};
-/*
- * An argument to a macro (multiple values = `-column xxx yyy').
+/*
+ * An argument to a macro (multiple values = `-column xxx yyy').
*/
struct mdoc_argv {
- enum mdocargt arg; /* type of argument */
+ enum mdocargt arg; /* type of argument */
int line;
int pos;
size_t sz; /* elements in "value" */
@@ -246,7 +246,7 @@ struct mdoc_argv {
* blocks have multiple instances of the same arguments spread across
* the HEAD, BODY, TAIL, and BLOCK node types.
*/
-struct mdoc_arg {
+struct mdoc_arg {
size_t argc;
struct mdoc_argv *argv;
unsigned int refcnt;
@@ -334,15 +334,15 @@ struct mdoc_rs {
* provided, etc.
*/
union mdoc_data {
- struct mdoc_an An;
+ struct mdoc_an An;
struct mdoc_bd Bd;
struct mdoc_bf Bf;
struct mdoc_bl Bl;
struct mdoc_rs Rs;
};
-/*
- * Single node in tree-linked AST.
+/*
+ * Single node in tree-linked AST.
*/
struct mdoc_node {
struct mdoc_node *parent; /* parent AST node */
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c
index 056c760aefe..cb9536daceb 100644
--- a/usr.bin/mandoc/mdoc_argv.c
+++ b/usr.bin/mandoc/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.48 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.49 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -29,7 +29,7 @@
#include "libmandoc.h"
#define MULTI_STEP 5 /* pre-allocate argument values */
-#define DELIMSZ 6 /* max possible size of a delimiter */
+#define DELIMSZ 6 /* max possible size of a delimiter */
enum argsflag {
ARGSFL_NONE = 0,
@@ -49,12 +49,12 @@ struct mdocarg {
};
static void argn_free(struct mdoc_arg *, int);
-static enum margserr args(struct mdoc *, int, int *,
+static enum margserr args(struct mdoc *, int, int *,
char *, enum argsflag, char **);
static int args_checkpunct(const char *, int);
-static int argv_multi(struct mdoc *, int,
+static int argv_multi(struct mdoc *, int,
struct mdoc_argv *, int *, char *);
-static int argv_single(struct mdoc *, int,
+static int argv_single(struct mdoc *, int,
struct mdoc_argv *, int *, char *);
static const enum argvflag argvflags[MDOC_ARG_MAX] = {
@@ -146,8 +146,8 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_NONE, NULL }, /* Dt */
{ ARGSFL_NONE, NULL }, /* Os */
{ ARGSFL_NONE, NULL }, /* Sh */
- { ARGSFL_NONE, NULL }, /* Ss */
- { ARGSFL_NONE, NULL }, /* Pp */
+ { ARGSFL_NONE, NULL }, /* Ss */
+ { ARGSFL_NONE, NULL }, /* Pp */
{ ARGSFL_DELIM, NULL }, /* D1 */
{ ARGSFL_DELIM, NULL }, /* Dl */
{ ARGSFL_NONE, args_Bd }, /* Bd */
@@ -155,32 +155,32 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_NONE, args_Bl }, /* Bl */
{ ARGSFL_NONE, NULL }, /* El */
{ ARGSFL_NONE, NULL }, /* It */
- { ARGSFL_DELIM, NULL }, /* Ad */
+ { ARGSFL_DELIM, NULL }, /* Ad */
{ ARGSFL_DELIM, args_An }, /* An */
{ ARGSFL_DELIM, NULL }, /* Ar */
{ ARGSFL_DELIM, NULL }, /* Cd */
{ ARGSFL_DELIM, NULL }, /* Cm */
- { ARGSFL_DELIM, NULL }, /* Dv */
- { ARGSFL_DELIM, NULL }, /* Er */
- { ARGSFL_DELIM, NULL }, /* Ev */
+ { ARGSFL_DELIM, NULL }, /* Dv */
+ { ARGSFL_DELIM, NULL }, /* Er */
+ { ARGSFL_DELIM, NULL }, /* Ev */
{ ARGSFL_NONE, args_Ex }, /* Ex */
- { ARGSFL_DELIM, NULL }, /* Fa */
- { ARGSFL_NONE, NULL }, /* Fd */
+ { ARGSFL_DELIM, NULL }, /* Fa */
+ { ARGSFL_NONE, NULL }, /* Fd */
{ ARGSFL_DELIM, NULL }, /* Fl */
- { ARGSFL_DELIM, NULL }, /* Fn */
- { ARGSFL_DELIM, NULL }, /* Ft */
- { ARGSFL_DELIM, NULL }, /* Ic */
- { ARGSFL_DELIM, NULL }, /* In */
+ { ARGSFL_DELIM, NULL }, /* Fn */
+ { ARGSFL_DELIM, NULL }, /* Ft */
+ { ARGSFL_DELIM, NULL }, /* Ic */
+ { ARGSFL_DELIM, NULL }, /* In */
{ ARGSFL_DELIM, NULL }, /* Li */
- { ARGSFL_NONE, NULL }, /* Nd */
- { ARGSFL_DELIM, NULL }, /* Nm */
+ { ARGSFL_NONE, NULL }, /* Nd */
+ { ARGSFL_DELIM, NULL }, /* Nm */
{ ARGSFL_DELIM, NULL }, /* Op */
{ ARGSFL_NONE, NULL }, /* Ot */
{ ARGSFL_DELIM, NULL }, /* Pa */
{ ARGSFL_NONE, args_Ex }, /* Rv */
- { ARGSFL_DELIM, NULL }, /* St */
+ { ARGSFL_DELIM, NULL }, /* St */
{ ARGSFL_DELIM, NULL }, /* Va */
- { ARGSFL_DELIM, NULL }, /* Vt */
+ { ARGSFL_DELIM, NULL }, /* Vt */
{ ARGSFL_DELIM, NULL }, /* Xr */
{ ARGSFL_NONE, NULL }, /* %A */
{ ARGSFL_NONE, NULL }, /* %B */
@@ -198,7 +198,7 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_DELIM, NULL }, /* Aq */
{ ARGSFL_DELIM, NULL }, /* At */
{ ARGSFL_DELIM, NULL }, /* Bc */
- { ARGSFL_NONE, args_Bf }, /* Bf */
+ { ARGSFL_NONE, args_Bf }, /* Bf */
{ ARGSFL_NONE, NULL }, /* Bo */
{ ARGSFL_DELIM, NULL }, /* Bq */
{ ARGSFL_DELIM, NULL }, /* Bsx */
@@ -209,7 +209,7 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_DELIM, NULL }, /* Dq */
{ ARGSFL_DELIM, NULL }, /* Ec */
{ ARGSFL_NONE, NULL }, /* Ef */
- { ARGSFL_DELIM, NULL }, /* Em */
+ { ARGSFL_DELIM, NULL }, /* Em */
{ ARGSFL_NONE, NULL }, /* Eo */
{ ARGSFL_DELIM, NULL }, /* Fx */
{ ARGSFL_DELIM, NULL }, /* Ms */
@@ -237,8 +237,8 @@ static const struct mdocarg mdocargs[MDOC_MAX] = {
{ ARGSFL_DELIM, NULL }, /* Ux */
{ ARGSFL_DELIM, NULL }, /* Xc */
{ ARGSFL_NONE, NULL }, /* Xo */
- { ARGSFL_NONE, NULL }, /* Fo */
- { ARGSFL_DELIM, NULL }, /* Fc */
+ { ARGSFL_NONE, NULL }, /* Fo */
+ { ARGSFL_DELIM, NULL }, /* Fc */
{ ARGSFL_NONE, NULL }, /* Oo */
{ ARGSFL_DELIM, NULL }, /* Oc */
{ ARGSFL_NONE, args_Bk }, /* Bk */
@@ -298,14 +298,14 @@ mdoc_argv(struct mdoc *mdoc, int line, enum mdoct tok,
if (' ' == buf[*pos] && '\\' != buf[*pos - 1])
break;
- /*
+ /*
* We want to nil-terminate the word to look it up (it's easier
* that way). But we may not have a flag, in which case we need
* to restore the line as-is. So keep around the stray byte,
* which we'll reset upon exiting (if necessary).
*/
- if ('\0' != (sv = buf[*pos]))
+ if ('\0' != (sv = buf[*pos]))
buf[(*pos)++] = '\0';
/*
@@ -324,7 +324,7 @@ mdoc_argv(struct mdoc *mdoc, int line, enum mdoct tok,
break;
if (MDOC_ARG_MAX == tmp.arg) {
- /*
+ /*
* The flag was not found.
* Restore saved zeroed byte and return as a word.
*/
@@ -339,15 +339,15 @@ mdoc_argv(struct mdoc *mdoc, int line, enum mdoct tok,
(*pos)++;
switch (argvflags[tmp.arg]) {
- case (ARGV_SINGLE):
+ case ARGV_SINGLE:
if ( ! argv_single(mdoc, line, &tmp, pos, buf))
return(ARGV_ERROR);
break;
- case (ARGV_MULTI):
+ case ARGV_MULTI:
if ( ! argv_multi(mdoc, line, &tmp, pos, buf))
return(ARGV_ERROR);
break;
- case (ARGV_NONE):
+ case ARGV_NONE:
break;
}
@@ -355,11 +355,11 @@ mdoc_argv(struct mdoc *mdoc, int line, enum mdoct tok,
arg = *v = mandoc_calloc(1, sizeof(struct mdoc_arg));
arg->argc++;
- arg->argv = mandoc_realloc
- (arg->argv, arg->argc * sizeof(struct mdoc_argv));
+ arg->argv = mandoc_realloc(arg->argv,
+ arg->argc * sizeof(struct mdoc_argv));
- memcpy(&arg->argv[(int)arg->argc - 1],
- &tmp, sizeof(struct mdoc_argv));
+ memcpy(&arg->argv[(int)arg->argc - 1], &tmp,
+ sizeof(struct mdoc_argv));
return(ARGV_ARG);
}
@@ -395,7 +395,7 @@ argn_free(struct mdoc_arg *p, int iarg)
arg = &p->argv[iarg];
if (arg->sz && arg->value) {
- for (j = (int)arg->sz - 1; j >= 0; j--)
+ for (j = (int)arg->sz - 1; j >= 0; j--)
free(arg->value[j]);
free(arg->value);
}
@@ -412,7 +412,7 @@ mdoc_zargs(struct mdoc *mdoc, int line, int *pos, char *buf, char **v)
}
enum margserr
-mdoc_args(struct mdoc *mdoc, int line, int *pos,
+mdoc_args(struct mdoc *mdoc, int line, int *pos,
char *buf, enum mdoct tok, char **v)
{
enum argsflag fl;
@@ -441,7 +441,7 @@ mdoc_args(struct mdoc *mdoc, int line, int *pos,
}
static enum margserr
-args(struct mdoc *mdoc, int line, int *pos,
+args(struct mdoc *mdoc, int line, int *pos,
char *buf, enum argsflag fl, char **v)
{
char *p, *pp;
@@ -482,7 +482,7 @@ args(struct mdoc *mdoc, int line, int *pos,
pp = NULL;
/* Scan ahead to unescaped `Ta'. */
- if ( ! (MDOC_PHRASELIT & mdoc->flags))
+ if ( ! (MDOC_PHRASELIT & mdoc->flags))
for (pp = *v; ; pp++) {
if (NULL == (pp = strstr(pp, "Ta")))
break;
@@ -495,7 +495,7 @@ args(struct mdoc *mdoc, int line, int *pos,
/* By default, assume a phrase. */
rc = ARGS_PHRASE;
- /*
+ /*
* Adjust new-buffer position to be beyond delimiter
* mark (e.g., Ta -> end + 2).
*/
@@ -596,7 +596,7 @@ args(struct mdoc *mdoc, int line, int *pos,
return(ARGS_WORD);
}
-/*
+/*
* Check if the string consists only of space-separated closing
* delimiters. This is a bit of a dance: the first must be a close
* delimiter, but it may be followed by middle delimiters. Arbitrary
@@ -625,7 +625,7 @@ args_checkpunct(const char *buf, int i)
i++;
/* Remaining must NOT be open/none. */
-
+
while (buf[i]) {
j = 0;
while (buf[i] && ' ' != buf[i] && j < DELIMSZ)
@@ -647,7 +647,7 @@ args_checkpunct(const char *buf, int i)
}
static int
-argv_multi(struct mdoc *mdoc, int line,
+argv_multi(struct mdoc *mdoc, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
enum margserr ac;
@@ -663,8 +663,8 @@ argv_multi(struct mdoc *mdoc, int line,
break;
if (0 == v->sz % MULTI_STEP)
- v->value = mandoc_realloc(v->value,
- (v->sz + MULTI_STEP) * sizeof(char *));
+ v->value = mandoc_realloc(v->value,
+ (v->sz + MULTI_STEP) * sizeof(char *));
v->value[(int)v->sz] = mandoc_strdup(p);
}
@@ -673,7 +673,7 @@ argv_multi(struct mdoc *mdoc, int line,
}
static int
-argv_single(struct mdoc *mdoc, int line,
+argv_single(struct mdoc *mdoc, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
enum margserr ac;
diff --git a/usr.bin/mandoc/mdoc_hash.c b/usr.bin/mandoc/mdoc_hash.c
index 5daf3bce99b..01a834f6447 100644
--- a/usr.bin/mandoc/mdoc_hash.c
+++ b/usr.bin/mandoc/mdoc_hash.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_hash.c,v 1.14 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: mdoc_hash.c,v 1.15 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -28,6 +28,7 @@
static unsigned char table[27 * 12];
+
/*
* XXX - this hash has global scope, so if intended for use as a library
* with multiple callers, it will need re-invocation protection.
@@ -72,7 +73,7 @@ mdoc_hash_find(const char *p)
major = 12 * (tolower((unsigned char)p[1]) - 97);
else if ('1' == p[1])
major = 12 * 26;
- else
+ else
return(MDOC_MAX);
if (p[2] && p[3])
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 2cb2677ab01..81ce865e688 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.70 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.71 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -49,7 +49,7 @@ static void print_mdoc(MDOC_ARGS);
static void print_mdoc_head(MDOC_ARGS);
static void print_mdoc_node(MDOC_ARGS);
static void print_mdoc_nodelist(MDOC_ARGS);
-static void synopsis_pre(struct html *,
+static void synopsis_pre(struct html *,
const struct mdoc_node *);
static void a2width(const char *, struct roffsu *);
@@ -123,8 +123,8 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{NULL, NULL}, /* Dt */
{NULL, NULL}, /* Os */
{mdoc_sh_pre, NULL }, /* Sh */
- {mdoc_ss_pre, NULL }, /* Ss */
- {mdoc_pp_pre, NULL}, /* Pp */
+ {mdoc_ss_pre, NULL }, /* Ss */
+ {mdoc_pp_pre, NULL}, /* Pp */
{mdoc_d1_pre, NULL}, /* D1 */
{mdoc_d1_pre, NULL}, /* Dl */
{mdoc_bd_pre, NULL}, /* Bd */
@@ -132,32 +132,32 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_bl_pre, NULL}, /* Bl */
{NULL, NULL}, /* El */
{mdoc_it_pre, NULL}, /* It */
- {mdoc_ad_pre, NULL}, /* Ad */
+ {mdoc_ad_pre, NULL}, /* Ad */
{mdoc_an_pre, NULL}, /* An */
{mdoc_ar_pre, NULL}, /* Ar */
{mdoc_cd_pre, NULL}, /* Cd */
{mdoc_fl_pre, NULL}, /* Cm */
- {mdoc_dv_pre, NULL}, /* Dv */
- {mdoc_er_pre, NULL}, /* Er */
- {mdoc_ev_pre, NULL}, /* Ev */
+ {mdoc_dv_pre, NULL}, /* Dv */
+ {mdoc_er_pre, NULL}, /* Er */
+ {mdoc_ev_pre, NULL}, /* Ev */
{mdoc_ex_pre, NULL}, /* Ex */
- {mdoc_fa_pre, NULL}, /* Fa */
- {mdoc_fd_pre, NULL}, /* Fd */
+ {mdoc_fa_pre, NULL}, /* Fa */
+ {mdoc_fd_pre, NULL}, /* Fd */
{mdoc_fl_pre, NULL}, /* Fl */
- {mdoc_fn_pre, NULL}, /* Fn */
- {mdoc_ft_pre, NULL}, /* Ft */
- {mdoc_ic_pre, NULL}, /* Ic */
- {mdoc_in_pre, NULL}, /* In */
+ {mdoc_fn_pre, NULL}, /* Fn */
+ {mdoc_ft_pre, NULL}, /* Ft */
+ {mdoc_ic_pre, NULL}, /* Ic */
+ {mdoc_in_pre, NULL}, /* In */
{mdoc_li_pre, NULL}, /* Li */
- {mdoc_nd_pre, NULL}, /* Nd */
- {mdoc_nm_pre, NULL}, /* Nm */
+ {mdoc_nd_pre, NULL}, /* Nd */
+ {mdoc_nm_pre, NULL}, /* Nm */
{mdoc_quote_pre, mdoc_quote_post}, /* Op */
{NULL, NULL}, /* Ot */
{mdoc_pa_pre, NULL}, /* Pa */
{mdoc_rv_pre, NULL}, /* Rv */
- {NULL, NULL}, /* St */
+ {NULL, NULL}, /* St */
{mdoc_va_pre, NULL}, /* Va */
- {mdoc_vt_pre, NULL}, /* Vt */
+ {mdoc_vt_pre, NULL}, /* Vt */
{mdoc_xr_pre, NULL}, /* Xr */
{mdoc__x_pre, mdoc__x_post}, /* %A */
{mdoc__x_pre, mdoc__x_post}, /* %B */
@@ -175,7 +175,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_quote_pre, mdoc_quote_post}, /* Aq */
{NULL, NULL}, /* At */
{NULL, NULL}, /* Bc */
- {mdoc_bf_pre, NULL}, /* Bf */
+ {mdoc_bf_pre, NULL}, /* Bf */
{mdoc_quote_pre, mdoc_quote_post}, /* Bo */
{mdoc_quote_pre, mdoc_quote_post}, /* Bq */
{mdoc_xx_pre, NULL}, /* Bsx */
@@ -186,7 +186,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_quote_pre, mdoc_quote_post}, /* Dq */
{NULL, NULL}, /* Ec */ /* FIXME: no space */
{NULL, NULL}, /* Ef */
- {mdoc_em_pre, NULL}, /* Em */
+ {mdoc_em_pre, NULL}, /* Em */
{mdoc_quote_pre, mdoc_quote_post}, /* Eo */
{mdoc_xx_pre, NULL}, /* Fx */
{mdoc_ms_pre, NULL}, /* Ms */
@@ -207,15 +207,15 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{NULL, NULL}, /* Sc */
{mdoc_quote_pre, mdoc_quote_post}, /* So */
{mdoc_quote_pre, mdoc_quote_post}, /* Sq */
- {mdoc_sm_pre, NULL}, /* Sm */
+ {mdoc_sm_pre, NULL}, /* Sm */
{mdoc_sx_pre, NULL}, /* Sx */
{mdoc_sy_pre, NULL}, /* Sy */
{NULL, NULL}, /* Tn */
{mdoc_xx_pre, NULL}, /* Ux */
{NULL, NULL}, /* Xc */
{NULL, NULL}, /* Xo */
- {mdoc_fo_pre, mdoc_fo_post}, /* Fo */
- {NULL, NULL}, /* Fc */
+ {mdoc_fo_pre, mdoc_fo_post}, /* Fo */
+ {NULL, NULL}, /* Fc */
{mdoc_quote_pre, mdoc_quote_post}, /* Oo */
{NULL, NULL}, /* Oc */
{mdoc_bk_pre, mdoc_bk_post}, /* Bk */
@@ -225,21 +225,21 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{NULL, NULL}, /* Fr */
{mdoc_ud_pre, NULL}, /* Ud */
{mdoc_lb_pre, NULL}, /* Lb */
- {mdoc_pp_pre, NULL}, /* Lp */
- {mdoc_lk_pre, NULL}, /* Lk */
- {mdoc_mt_pre, NULL}, /* Mt */
- {mdoc_quote_pre, mdoc_quote_post}, /* Brq */
- {mdoc_quote_pre, mdoc_quote_post}, /* Bro */
- {NULL, NULL}, /* Brc */
- {mdoc__x_pre, mdoc__x_post}, /* %C */
+ {mdoc_pp_pre, NULL}, /* Lp */
+ {mdoc_lk_pre, NULL}, /* Lk */
+ {mdoc_mt_pre, NULL}, /* Mt */
+ {mdoc_quote_pre, mdoc_quote_post}, /* Brq */
+ {mdoc_quote_pre, mdoc_quote_post}, /* Bro */
+ {NULL, NULL}, /* Brc */
+ {mdoc__x_pre, mdoc__x_post}, /* %C */
{NULL, NULL}, /* Es */ /* TODO */
{NULL, NULL}, /* En */ /* TODO */
- {mdoc_xx_pre, NULL}, /* Dx */
- {mdoc__x_pre, mdoc__x_post}, /* %Q */
+ {mdoc_xx_pre, NULL}, /* Dx */
+ {mdoc__x_pre, mdoc__x_post}, /* %Q */
{mdoc_sp_pre, NULL}, /* br */
- {mdoc_sp_pre, NULL}, /* sp */
- {mdoc__x_pre, mdoc__x_post}, /* %U */
- {NULL, NULL}, /* Ta */
+ {mdoc_sp_pre, NULL}, /* sp */
+ {mdoc__x_pre, mdoc__x_post}, /* %U */
+ {NULL, NULL}, /* Ta */
{mdoc_ll_pre, NULL}, /* ll */
};
@@ -258,16 +258,16 @@ static const char * const lists[LIST_MAX] = {
"list-tag"
};
+
void
html_mdoc(void *arg, const struct mdoc *mdoc)
{
print_mdoc(mdoc_meta(mdoc), mdoc_node(mdoc),
- (struct html *)arg);
+ (struct html *)arg);
putchar('\n');
}
-
/*
* Calculate the scaling unit passed in a `-width' argument. This uses
* either a native scaling unit (e.g., 1i, 2m) or the string length of
@@ -283,7 +283,6 @@ a2width(const char *p, struct roffsu *su)
}
}
-
/*
* See the same function in mdoc_term.c for documentation.
*/
@@ -294,27 +293,27 @@ synopsis_pre(struct html *h, const struct mdoc_node *n)
if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags))
return;
- if (n->prev->tok == n->tok &&
- MDOC_Fo != n->tok &&
- MDOC_Ft != n->tok &&
- MDOC_Fn != n->tok) {
+ if (n->prev->tok == n->tok &&
+ MDOC_Fo != n->tok &&
+ MDOC_Ft != n->tok &&
+ MDOC_Fn != n->tok) {
print_otag(h, TAG_BR, 0, NULL);
return;
}
switch (n->prev->tok) {
- case (MDOC_Fd):
+ case MDOC_Fd:
/* FALLTHROUGH */
- case (MDOC_Fn):
+ case MDOC_Fn:
/* FALLTHROUGH */
- case (MDOC_Fo):
+ case MDOC_Fo:
/* FALLTHROUGH */
- case (MDOC_In):
+ case MDOC_In:
/* FALLTHROUGH */
- case (MDOC_Vt):
+ case MDOC_Vt:
print_otag(h, TAG_P, 0, NULL);
break;
- case (MDOC_Ft):
+ case MDOC_Ft:
if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
print_otag(h, TAG_P, 0, NULL);
break;
@@ -326,7 +325,6 @@ synopsis_pre(struct html *h, const struct mdoc_node *n)
}
}
-
/*
* Calculate the scaling unit passed in an `-offset' argument. This
* uses either a native scaling unit (e.g., 1i, 2m), one of a set of
@@ -348,7 +346,6 @@ a2offs(const char *p, struct roffsu *su)
SCALE_HS_INIT(su, html_strlen(p));
}
-
static void
print_mdoc(MDOC_ARGS)
{
@@ -365,15 +362,13 @@ print_mdoc(MDOC_ARGS)
print_tagq(h, tt);
print_otag(h, TAG_BODY, 0, NULL);
print_otag(h, TAG_DIV, 1, &tag);
- } else
+ } else
t = print_otag(h, TAG_DIV, 1, &tag);
print_mdoc_nodelist(meta, n, h);
print_tagq(h, t);
}
-
-/* ARGSUSED */
static void
print_mdoc_head(MDOC_ARGS)
{
@@ -389,7 +384,6 @@ print_mdoc_head(MDOC_ARGS)
print_text(h, h->buf);
}
-
static void
print_mdoc_nodelist(MDOC_ARGS)
{
@@ -399,7 +393,6 @@ print_mdoc_nodelist(MDOC_ARGS)
print_mdoc_nodelist(meta, n->next, h);
}
-
static void
print_mdoc_node(MDOC_ARGS)
{
@@ -410,10 +403,10 @@ print_mdoc_node(MDOC_ARGS)
t = h->tags.head;
switch (n->type) {
- case (MDOC_ROOT):
+ case MDOC_ROOT:
child = mdoc_root_pre(meta, n, h);
break;
- case (MDOC_TEXT):
+ case MDOC_TEXT:
/* No tables in this mode... */
assert(NULL == h->tblt);
@@ -430,10 +423,10 @@ print_mdoc_node(MDOC_ARGS)
if (MDOC_DELIMO & n->flags)
h->flags |= HTML_NOSPACE;
return;
- case (MDOC_EQN):
+ case MDOC_EQN:
print_eqn(h, n->eqn);
break;
- case (MDOC_TBL):
+ case MDOC_TBL:
/*
* This will take care of initialising all of the table
* state data for the first table, then tearing it down
@@ -472,10 +465,10 @@ print_mdoc_node(MDOC_ARGS)
print_stagq(h, t);
switch (n->type) {
- case (MDOC_ROOT):
+ case MDOC_ROOT:
mdoc_root_post(meta, n, h);
break;
- case (MDOC_EQN):
+ case MDOC_EQN:
break;
default:
if (mdocs[n->tok].post && ENDBODY_NOT == n->end)
@@ -484,7 +477,6 @@ print_mdoc_node(MDOC_ARGS)
}
}
-/* ARGSUSED */
static void
mdoc_root_post(MDOC_ARGS)
{
@@ -515,8 +507,6 @@ mdoc_root_post(MDOC_ARGS)
print_tagq(h, t);
}
-
-/* ARGSUSED */
static int
mdoc_root_pre(MDOC_ARGS)
{
@@ -566,8 +556,6 @@ mdoc_root_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_sh_pre(MDOC_ARGS)
{
@@ -598,7 +586,6 @@ mdoc_sh_pre(MDOC_ARGS)
return(1);
}
-/* ARGSUSED */
static int
mdoc_ss_pre(MDOC_ARGS)
{
@@ -629,8 +616,6 @@ mdoc_ss_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_fl_pre(MDOC_ARGS)
{
@@ -654,8 +639,6 @@ mdoc_fl_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_nd_pre(MDOC_ARGS)
{
@@ -672,7 +655,6 @@ mdoc_nd_pre(MDOC_ARGS)
return(1);
}
-
static int
mdoc_nm_pre(MDOC_ARGS)
{
@@ -681,19 +663,19 @@ mdoc_nm_pre(MDOC_ARGS)
int len;
switch (n->type) {
- case (MDOC_ELEM):
+ case MDOC_ELEM:
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "name");
print_otag(h, TAG_B, 1, &tag);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
- case (MDOC_HEAD):
+ case MDOC_HEAD:
print_otag(h, TAG_TD, 0, NULL);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
- case (MDOC_BODY):
+ case MDOC_BODY:
print_otag(h, TAG_TD, 0, NULL);
return(1);
default:
@@ -722,8 +704,6 @@ mdoc_nm_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_xr_pre(MDOC_ARGS)
{
@@ -735,9 +715,9 @@ mdoc_xr_pre(MDOC_ARGS)
PAIR_CLASS_INIT(&tag[0], "link-man");
if (h->base_man) {
- buffmt_man(h, n->child->string,
- n->child->next ?
- n->child->next->string : NULL);
+ buffmt_man(h, n->child->string,
+ n->child->next ?
+ n->child->next->string : NULL);
PAIR_HREF_INIT(&tag[1], h->buf);
print_otag(h, TAG_A, 2, tag);
} else
@@ -758,8 +738,6 @@ mdoc_xr_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_ns_pre(MDOC_ARGS)
{
@@ -769,8 +747,6 @@ mdoc_ns_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ar_pre(MDOC_ARGS)
{
@@ -781,8 +757,6 @@ mdoc_ar_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_xx_pre(MDOC_ARGS)
{
@@ -791,22 +765,22 @@ mdoc_xx_pre(MDOC_ARGS)
int flags;
switch (n->tok) {
- case (MDOC_Bsx):
+ case MDOC_Bsx:
pp = "BSD/OS";
break;
- case (MDOC_Dx):
+ case MDOC_Dx:
pp = "DragonFly";
break;
- case (MDOC_Fx):
+ case MDOC_Fx:
pp = "FreeBSD";
break;
- case (MDOC_Nx):
+ case MDOC_Nx:
pp = "NetBSD";
break;
- case (MDOC_Ox):
+ case MDOC_Ox:
pp = "OpenBSD";
break;
- case (MDOC_Ux):
+ case MDOC_Ux:
pp = "UNIX";
break;
default:
@@ -826,8 +800,6 @@ mdoc_xx_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_bx_pre(MDOC_ARGS)
{
@@ -855,7 +827,6 @@ mdoc_bx_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_it_pre(MDOC_ARGS)
{
@@ -879,25 +850,25 @@ mdoc_it_pre(MDOC_ARGS)
if (MDOC_HEAD == n->type) {
switch (type) {
- case(LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case(LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case(LIST_item):
+ case LIST_item:
/* FALLTHROUGH */
- case(LIST_hyphen):
+ case LIST_hyphen:
/* FALLTHROUGH */
- case(LIST_enum):
+ case LIST_enum:
return(0);
- case(LIST_diag):
+ case LIST_diag:
/* FALLTHROUGH */
- case(LIST_hang):
+ case LIST_hang:
/* FALLTHROUGH */
- case(LIST_inset):
+ case LIST_inset:
/* FALLTHROUGH */
- case(LIST_ohang):
+ case LIST_ohang:
/* FALLTHROUGH */
- case(LIST_tag):
+ case LIST_tag:
SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
bufcat_su(h, "margin-top", &su);
PAIR_STYLE_INIT(&tag[1], h);
@@ -907,36 +878,36 @@ mdoc_it_pre(MDOC_ARGS)
PAIR_CLASS_INIT(&tag[0], "diag");
print_otag(h, TAG_B, 1, tag);
break;
- case(LIST_column):
+ case LIST_column:
break;
default:
break;
}
} else if (MDOC_BODY == n->type) {
switch (type) {
- case(LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case(LIST_hyphen):
+ case LIST_hyphen:
/* FALLTHROUGH */
- case(LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case(LIST_enum):
+ case LIST_enum:
/* FALLTHROUGH */
- case(LIST_item):
+ case LIST_item:
SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
bufcat_su(h, "margin-top", &su);
PAIR_STYLE_INIT(&tag[1], h);
print_otag(h, TAG_LI, 2, tag);
break;
- case(LIST_diag):
+ case LIST_diag:
/* FALLTHROUGH */
- case(LIST_hang):
+ case LIST_hang:
/* FALLTHROUGH */
- case(LIST_inset):
+ case LIST_inset:
/* FALLTHROUGH */
- case(LIST_ohang):
+ case LIST_ohang:
/* FALLTHROUGH */
- case(LIST_tag):
+ case LIST_tag:
if (NULL == bl->norm->Bl.width) {
print_otag(h, TAG_DD, 1, tag);
break;
@@ -946,7 +917,7 @@ mdoc_it_pre(MDOC_ARGS)
PAIR_STYLE_INIT(&tag[1], h);
print_otag(h, TAG_DD, 2, tag);
break;
- case(LIST_column):
+ case LIST_column:
SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
bufcat_su(h, "margin-top", &su);
PAIR_STYLE_INIT(&tag[1], h);
@@ -957,7 +928,7 @@ mdoc_it_pre(MDOC_ARGS)
}
} else {
switch (type) {
- case (LIST_column):
+ case LIST_column:
print_otag(h, TAG_TR, 1, tag);
break;
default:
@@ -968,7 +939,6 @@ mdoc_it_pre(MDOC_ARGS)
return(1);
}
-/* ARGSUSED */
static int
mdoc_bl_pre(MDOC_ARGS)
{
@@ -1027,30 +997,30 @@ mdoc_bl_pre(MDOC_ARGS)
}
switch (n->norm->Bl.type) {
- case(LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case(LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case(LIST_hyphen):
+ case LIST_hyphen:
/* FALLTHROUGH */
- case(LIST_item):
+ case LIST_item:
print_otag(h, TAG_UL, 2, tag);
break;
- case(LIST_enum):
+ case LIST_enum:
print_otag(h, TAG_OL, 2, tag);
break;
- case(LIST_diag):
+ case LIST_diag:
/* FALLTHROUGH */
- case(LIST_hang):
+ case LIST_hang:
/* FALLTHROUGH */
- case(LIST_inset):
+ case LIST_inset:
/* FALLTHROUGH */
- case(LIST_ohang):
+ case LIST_ohang:
/* FALLTHROUGH */
- case(LIST_tag):
+ case LIST_tag:
print_otag(h, TAG_DL, 2, tag);
break;
- case(LIST_column):
+ case LIST_column:
print_otag(h, TAG_TABLE, 2, tag);
break;
default:
@@ -1061,7 +1031,6 @@ mdoc_bl_pre(MDOC_ARGS)
return(1);
}
-/* ARGSUSED */
static int
mdoc_ex_pre(MDOC_ARGS)
{
@@ -1098,12 +1067,10 @@ mdoc_ex_pre(MDOC_ARGS)
else
print_text(h, "utility exits");
- print_text(h, "0 on success, and >0 if an error occurs.");
+ print_text(h, "0 on success, and >0 if an error occurs.");
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_em_pre(MDOC_ARGS)
{
@@ -1114,8 +1081,6 @@ mdoc_em_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_d1_pre(MDOC_ARGS)
{
@@ -1140,13 +1105,11 @@ mdoc_d1_pre(MDOC_ARGS)
if (MDOC_Dl == n->tok) {
PAIR_CLASS_INIT(&tag[0], "lit");
print_otag(h, TAG_CODE, 1, tag);
- }
+ }
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_sx_pre(MDOC_ARGS)
{
@@ -1169,13 +1132,11 @@ mdoc_sx_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_bd_pre(MDOC_ARGS)
{
- struct htmlpair tag[2];
- int comp, sv;
+ struct htmlpair tag[2];
+ int comp, sv;
const struct mdoc_node *nn;
struct roffsu su;
@@ -1200,13 +1161,13 @@ mdoc_bd_pre(MDOC_ARGS)
SCALE_HS_INIT(&su, 0);
if (n->norm->Bd.offs)
a2offs(n->norm->Bd.offs, &su);
-
+
bufinit(h);
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag[0], h);
- if (DISP_unfilled != n->norm->Bd.type &&
- DISP_literal != n->norm->Bd.type) {
+ if (DISP_unfilled != n->norm->Bd.type &&
+ DISP_literal != n->norm->Bd.type) {
PAIR_CLASS_INIT(&tag[1], "display");
print_otag(h, TAG_DIV, 2, tag);
return(1);
@@ -1229,21 +1190,21 @@ mdoc_bd_pre(MDOC_ARGS)
* anyway, so don't sweat it.
*/
switch (nn->tok) {
- case (MDOC_Sm):
+ case MDOC_Sm:
/* FALLTHROUGH */
- case (MDOC_br):
+ case MDOC_br:
/* FALLTHROUGH */
- case (MDOC_sp):
+ case MDOC_sp:
/* FALLTHROUGH */
- case (MDOC_Bl):
+ case MDOC_Bl:
/* FALLTHROUGH */
- case (MDOC_D1):
+ case MDOC_D1:
/* FALLTHROUGH */
- case (MDOC_Dl):
+ case MDOC_Dl:
/* FALLTHROUGH */
- case (MDOC_Lp):
+ case MDOC_Lp:
/* FALLTHROUGH */
- case (MDOC_Pp):
+ case MDOC_Pp:
continue;
default:
break;
@@ -1262,8 +1223,6 @@ mdoc_bd_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_pa_pre(MDOC_ARGS)
{
@@ -1274,8 +1233,6 @@ mdoc_pa_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ad_pre(MDOC_ARGS)
{
@@ -1286,8 +1243,6 @@ mdoc_ad_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_an_pre(MDOC_ARGS)
{
@@ -1300,8 +1255,6 @@ mdoc_an_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_cd_pre(MDOC_ARGS)
{
@@ -1313,8 +1266,6 @@ mdoc_cd_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_dv_pre(MDOC_ARGS)
{
@@ -1325,8 +1276,6 @@ mdoc_dv_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ev_pre(MDOC_ARGS)
{
@@ -1337,8 +1286,6 @@ mdoc_ev_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_er_pre(MDOC_ARGS)
{
@@ -1349,8 +1296,6 @@ mdoc_er_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_fa_pre(MDOC_ARGS)
{
@@ -1382,8 +1327,6 @@ mdoc_fa_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_fd_pre(MDOC_ARGS)
{
@@ -1412,21 +1355,21 @@ mdoc_fd_pre(MDOC_ARGS)
if (NULL != (n = n->next)) {
assert(MDOC_TEXT == n->type);
- strlcpy(buf, '<' == *n->string || '"' == *n->string ?
- n->string + 1 : n->string, BUFSIZ);
+ strlcpy(buf, '<' == *n->string || '"' == *n->string ?
+ n->string + 1 : n->string, BUFSIZ);
sz = strlen(buf);
if (sz && ('>' == buf[sz - 1] || '"' == buf[sz - 1]))
buf[sz - 1] = '\0';
PAIR_CLASS_INIT(&tag[0], "link-includes");
-
+
i = 1;
if (h->base_includes) {
buffmt_includes(h, buf);
PAIR_HREF_INIT(&tag[i], h->buf);
i++;
- }
+ }
t = print_otag(h, TAG_A, i, tag);
print_text(h, n->string);
@@ -1443,8 +1386,6 @@ mdoc_fd_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_vt_pre(MDOC_ARGS)
{
@@ -1463,8 +1404,6 @@ mdoc_vt_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ft_pre(MDOC_ARGS)
{
@@ -1476,8 +1415,6 @@ mdoc_ft_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_fn_pre(MDOC_ARGS)
{
@@ -1498,7 +1435,7 @@ mdoc_fn_pre(MDOC_ARGS)
if (NULL != ep) {
PAIR_CLASS_INIT(&tag[0], "ftype");
t = print_otag(h, TAG_I, 1, tag);
-
+
while (ep) {
sz = MIN((int)(ep - sp), BUFSIZ - 1);
(void)memcpy(nbuf, sp, (size_t)sz);
@@ -1570,15 +1507,13 @@ mdoc_fn_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_sm_pre(MDOC_ARGS)
{
assert(n->child && MDOC_TEXT == n->child->type);
if (0 == strcmp("on", n->child->string)) {
- /*
+ /*
* FIXME: no p->col to check. Thus, if we have
* .Bd -literal
* .Sm off
@@ -1596,7 +1531,6 @@ mdoc_sm_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_ll_pre(MDOC_ARGS)
{
@@ -1604,7 +1538,6 @@ mdoc_ll_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_pp_pre(MDOC_ARGS)
{
@@ -1613,7 +1546,6 @@ mdoc_pp_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_sp_pre(MDOC_ARGS)
{
@@ -1641,7 +1573,6 @@ mdoc_sp_pre(MDOC_ARGS)
}
-/* ARGSUSED */
static int
mdoc_lk_pre(MDOC_ARGS)
{
@@ -1666,8 +1597,6 @@ mdoc_lk_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_mt_pre(MDOC_ARGS)
{
@@ -1688,12 +1617,10 @@ mdoc_mt_pre(MDOC_ARGS)
print_text(h, n->string);
print_tagq(h, t);
}
-
+
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_fo_pre(MDOC_ARGS)
{
@@ -1722,8 +1649,6 @@ mdoc_fo_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
mdoc_fo_post(MDOC_ARGS)
{
@@ -1736,8 +1661,6 @@ mdoc_fo_post(MDOC_ARGS)
print_text(h, ";");
}
-
-/* ARGSUSED */
static int
mdoc_in_pre(MDOC_ARGS)
{
@@ -1773,7 +1696,7 @@ mdoc_in_pre(MDOC_ARGS)
buffmt_includes(h, n->string);
PAIR_HREF_INIT(&tag[i], h->buf);
i++;
- }
+ }
t = print_otag(h, TAG_A, i, tag);
print_text(h, n->string);
@@ -1793,8 +1716,6 @@ mdoc_in_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_ic_pre(MDOC_ARGS)
{
@@ -1805,8 +1726,6 @@ mdoc_ic_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_rv_pre(MDOC_ARGS)
{
@@ -1846,19 +1765,17 @@ mdoc_rv_pre(MDOC_ARGS)
else
print_text(h, "function returns");
- print_text(h, "the value 0 if successful; otherwise the value "
- "-1 is returned and the global variable");
+ print_text(h, "the value 0 if successful; otherwise the "
+ "value -1 is returned and the global variable");
PAIR_CLASS_INIT(&tag, "var");
t = print_otag(h, TAG_B, 1, &tag);
print_text(h, "errno");
print_tagq(h, t);
- print_text(h, "is set to indicate the error.");
+ print_text(h, "is set to indicate the error.");
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_va_pre(MDOC_ARGS)
{
@@ -1869,20 +1786,16 @@ mdoc_va_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ap_pre(MDOC_ARGS)
{
-
+
h->flags |= HTML_NOSPACE;
print_text(h, "\\(aq");
h->flags |= HTML_NOSPACE;
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_bf_pre(MDOC_ARGS)
{
@@ -1894,18 +1807,18 @@ mdoc_bf_pre(MDOC_ARGS)
else if (MDOC_BODY != n->type)
return(1);
- if (FONT_Em == n->norm->Bf.font)
+ if (FONT_Em == n->norm->Bf.font)
PAIR_CLASS_INIT(&tag[0], "emph");
- else if (FONT_Sy == n->norm->Bf.font)
+ else if (FONT_Sy == n->norm->Bf.font)
PAIR_CLASS_INIT(&tag[0], "symb");
- else if (FONT_Li == n->norm->Bf.font)
+ else if (FONT_Li == n->norm->Bf.font)
PAIR_CLASS_INIT(&tag[0], "lit");
else
PAIR_CLASS_INIT(&tag[0], "none");
- /*
+ /*
* We want this to be inline-formatted, but needs to be div to
- * accept block children.
+ * accept block children.
*/
bufinit(h);
bufcat_style(h, "display", "inline");
@@ -1917,8 +1830,6 @@ mdoc_bf_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ms_pre(MDOC_ARGS)
{
@@ -1929,8 +1840,6 @@ mdoc_ms_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_igndelim_pre(MDOC_ARGS)
{
@@ -1939,8 +1848,6 @@ mdoc_igndelim_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc_pf_post(MDOC_ARGS)
{
@@ -1948,8 +1855,6 @@ mdoc_pf_post(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
}
-
-/* ARGSUSED */
static int
mdoc_rs_pre(MDOC_ARGS)
{
@@ -1966,9 +1871,6 @@ mdoc_rs_pre(MDOC_ARGS)
return(1);
}
-
-
-/* ARGSUSED */
static int
mdoc_li_pre(MDOC_ARGS)
{
@@ -1979,8 +1881,6 @@ mdoc_li_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_sy_pre(MDOC_ARGS)
{
@@ -1991,8 +1891,6 @@ mdoc_sy_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_bt_pre(MDOC_ARGS)
{
@@ -2001,8 +1899,6 @@ mdoc_bt_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_ud_pre(MDOC_ARGS)
{
@@ -2011,8 +1907,6 @@ mdoc_ud_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_lb_pre(MDOC_ARGS)
{
@@ -2026,8 +1920,6 @@ mdoc_lb_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc__x_pre(MDOC_ARGS)
{
@@ -2037,52 +1929,52 @@ mdoc__x_pre(MDOC_ARGS)
t = TAG_SPAN;
switch (n->tok) {
- case(MDOC__A):
+ case MDOC__A:
PAIR_CLASS_INIT(&tag[0], "ref-auth");
if (n->prev && MDOC__A == n->prev->tok)
if (NULL == n->next || MDOC__A != n->next->tok)
print_text(h, "and");
break;
- case(MDOC__B):
+ case MDOC__B:
PAIR_CLASS_INIT(&tag[0], "ref-book");
t = TAG_I;
break;
- case(MDOC__C):
+ case MDOC__C:
PAIR_CLASS_INIT(&tag[0], "ref-city");
break;
- case(MDOC__D):
+ case MDOC__D:
PAIR_CLASS_INIT(&tag[0], "ref-date");
break;
- case(MDOC__I):
+ case MDOC__I:
PAIR_CLASS_INIT(&tag[0], "ref-issue");
t = TAG_I;
break;
- case(MDOC__J):
+ case MDOC__J:
PAIR_CLASS_INIT(&tag[0], "ref-jrnl");
t = TAG_I;
break;
- case(MDOC__N):
+ case MDOC__N:
PAIR_CLASS_INIT(&tag[0], "ref-num");
break;
- case(MDOC__O):
+ case MDOC__O:
PAIR_CLASS_INIT(&tag[0], "ref-opt");
break;
- case(MDOC__P):
+ case MDOC__P:
PAIR_CLASS_INIT(&tag[0], "ref-page");
break;
- case(MDOC__Q):
+ case MDOC__Q:
PAIR_CLASS_INIT(&tag[0], "ref-corp");
break;
- case(MDOC__R):
+ case MDOC__R:
PAIR_CLASS_INIT(&tag[0], "ref-rep");
break;
- case(MDOC__T):
+ case MDOC__T:
PAIR_CLASS_INIT(&tag[0], "ref-title");
break;
- case(MDOC__U):
+ case MDOC__U:
PAIR_CLASS_INIT(&tag[0], "link-ref");
break;
- case(MDOC__V):
+ case MDOC__V:
PAIR_CLASS_INIT(&tag[0], "ref-vol");
break;
default:
@@ -2101,8 +1993,6 @@ mdoc__x_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc__x_post(MDOC_ARGS)
{
@@ -2121,18 +2011,16 @@ mdoc__x_post(MDOC_ARGS)
print_text(h, n->next ? "," : ".");
}
-
-/* ARGSUSED */
static int
mdoc_bk_pre(MDOC_ARGS)
{
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
return(0);
- case (MDOC_BODY):
+ case MDOC_BODY:
if (n->parent->args || 0 == n->prev->nchild)
h->flags |= HTML_PREKEEP;
break;
@@ -2144,8 +2032,6 @@ mdoc_bk_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc_bk_post(MDOC_ARGS)
{
@@ -2154,8 +2040,6 @@ mdoc_bk_post(MDOC_ARGS)
h->flags &= ~(HTML_KEEP | HTML_PREKEEP);
}
-
-/* ARGSUSED */
static int
mdoc_quote_pre(MDOC_ARGS)
{
@@ -2165,54 +2049,54 @@ mdoc_quote_pre(MDOC_ARGS)
return(1);
switch (n->tok) {
- case (MDOC_Ao):
+ case MDOC_Ao:
/* FALLTHROUGH */
- case (MDOC_Aq):
+ case MDOC_Aq:
print_text(h, "\\(la");
break;
- case (MDOC_Bro):
+ case MDOC_Bro:
/* FALLTHROUGH */
- case (MDOC_Brq):
+ case MDOC_Brq:
print_text(h, "\\(lC");
break;
- case (MDOC_Bo):
+ case MDOC_Bo:
/* FALLTHROUGH */
- case (MDOC_Bq):
+ case MDOC_Bq:
print_text(h, "\\(lB");
break;
- case (MDOC_Oo):
+ case MDOC_Oo:
/* FALLTHROUGH */
- case (MDOC_Op):
+ case MDOC_Op:
print_text(h, "\\(lB");
h->flags |= HTML_NOSPACE;
PAIR_CLASS_INIT(&tag, "opt");
print_otag(h, TAG_SPAN, 1, &tag);
break;
- case (MDOC_Eo):
+ case MDOC_Eo:
break;
- case (MDOC_Do):
+ case MDOC_Do:
/* FALLTHROUGH */
- case (MDOC_Dq):
+ case MDOC_Dq:
/* FALLTHROUGH */
- case (MDOC_Qo):
+ case MDOC_Qo:
/* FALLTHROUGH */
- case (MDOC_Qq):
+ case MDOC_Qq:
print_text(h, "\\(lq");
break;
- case (MDOC_Po):
+ case MDOC_Po:
/* FALLTHROUGH */
- case (MDOC_Pq):
+ case MDOC_Pq:
print_text(h, "(");
break;
- case (MDOC_Ql):
+ case MDOC_Ql:
print_text(h, "\\(oq");
h->flags |= HTML_NOSPACE;
PAIR_CLASS_INIT(&tag, "lit");
print_otag(h, TAG_CODE, 1, &tag);
break;
- case (MDOC_So):
+ case MDOC_So:
/* FALLTHROUGH */
- case (MDOC_Sq):
+ case MDOC_Sq:
print_text(h, "\\(oq");
break;
default:
@@ -2224,8 +2108,6 @@ mdoc_quote_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc_quote_post(MDOC_ARGS)
{
@@ -2236,46 +2118,46 @@ mdoc_quote_post(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
switch (n->tok) {
- case (MDOC_Ao):
+ case MDOC_Ao:
/* FALLTHROUGH */
- case (MDOC_Aq):
+ case MDOC_Aq:
print_text(h, "\\(ra");
break;
- case (MDOC_Bro):
+ case MDOC_Bro:
/* FALLTHROUGH */
- case (MDOC_Brq):
+ case MDOC_Brq:
print_text(h, "\\(rC");
break;
- case (MDOC_Oo):
+ case MDOC_Oo:
/* FALLTHROUGH */
- case (MDOC_Op):
+ case MDOC_Op:
/* FALLTHROUGH */
- case (MDOC_Bo):
+ case MDOC_Bo:
/* FALLTHROUGH */
- case (MDOC_Bq):
+ case MDOC_Bq:
print_text(h, "\\(rB");
break;
- case (MDOC_Eo):
+ case MDOC_Eo:
break;
- case (MDOC_Qo):
+ case MDOC_Qo:
/* FALLTHROUGH */
- case (MDOC_Qq):
+ case MDOC_Qq:
/* FALLTHROUGH */
- case (MDOC_Do):
+ case MDOC_Do:
/* FALLTHROUGH */
- case (MDOC_Dq):
+ case MDOC_Dq:
print_text(h, "\\(rq");
break;
- case (MDOC_Po):
+ case MDOC_Po:
/* FALLTHROUGH */
- case (MDOC_Pq):
+ case MDOC_Pq:
print_text(h, ")");
break;
- case (MDOC_Ql):
+ case MDOC_Ql:
/* FALLTHROUGH */
- case (MDOC_So):
+ case MDOC_So:
/* FALLTHROUGH */
- case (MDOC_Sq):
+ case MDOC_Sq:
print_text(h, "\\(cq");
break;
default:
@@ -2283,5 +2165,3 @@ mdoc_quote_post(MDOC_ARGS)
/* NOTREACHED */
}
}
-
-
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index d72689db4ed..f83a7502f43 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.87 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.88 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -36,33 +36,33 @@ enum rew { /* see rew_dohalt() */
REWIND_ERROR
};
-static int blk_full(MACRO_PROT_ARGS);
-static int blk_exp_close(MACRO_PROT_ARGS);
-static int blk_part_exp(MACRO_PROT_ARGS);
-static int blk_part_imp(MACRO_PROT_ARGS);
-static int ctx_synopsis(MACRO_PROT_ARGS);
-static int in_line_eoln(MACRO_PROT_ARGS);
-static int in_line_argn(MACRO_PROT_ARGS);
-static int in_line(MACRO_PROT_ARGS);
-static int obsolete(MACRO_PROT_ARGS);
-static int phrase_ta(MACRO_PROT_ARGS);
+static int blk_full(MACRO_PROT_ARGS);
+static int blk_exp_close(MACRO_PROT_ARGS);
+static int blk_part_exp(MACRO_PROT_ARGS);
+static int blk_part_imp(MACRO_PROT_ARGS);
+static int ctx_synopsis(MACRO_PROT_ARGS);
+static int in_line_eoln(MACRO_PROT_ARGS);
+static int in_line_argn(MACRO_PROT_ARGS);
+static int in_line(MACRO_PROT_ARGS);
+static int obsolete(MACRO_PROT_ARGS);
+static int phrase_ta(MACRO_PROT_ARGS);
static int dword(struct mdoc *, int, int, const char *,
enum mdelim, int);
-static int append_delims(struct mdoc *,
+static int append_delims(struct mdoc *,
int, int *, char *);
static enum mdoct lookup(enum mdoct, const char *);
static enum mdoct lookup_raw(const char *);
static int make_pending(struct mdoc_node *, enum mdoct,
struct mdoc *, int, int);
-static int phrase(struct mdoc *, int, int, char *);
-static enum mdoct rew_alt(enum mdoct);
-static enum rew rew_dohalt(enum mdoct, enum mdoc_type,
+static int phrase(struct mdoc *, int, int, char *);
+static enum mdoct rew_alt(enum mdoct);
+static enum rew rew_dohalt(enum mdoct, enum mdoc_type,
const struct mdoc_node *);
-static int rew_elem(struct mdoc *, enum mdoct);
-static int rew_last(struct mdoc *,
+static int rew_elem(struct mdoc *, enum mdoct);
+static int rew_last(struct mdoc *,
const struct mdoc_node *);
-static int rew_sub(enum mdoc_type, struct mdoc *,
+static int rew_sub(enum mdoc_type, struct mdoc *,
enum mdoct, int, int);
const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
@@ -226,7 +226,7 @@ mdoc_macroend(struct mdoc *mdoc)
/* Scan for open explicit scopes. */
n = MDOC_VALID & mdoc->last->flags ?
- mdoc->last->parent : mdoc->last;
+ mdoc->last->parent : mdoc->last;
for ( ; n; n = n->parent)
if (MDOC_BLOCK == n->type &&
@@ -238,7 +238,6 @@ mdoc_macroend(struct mdoc *mdoc)
return(rew_last(mdoc, mdoc->first));
}
-
/*
* Look up a macro from within a subsequent context.
*/
@@ -251,7 +250,6 @@ lookup(enum mdoct from, const char *p)
return(lookup_raw(p));
}
-
/*
* Lookup a macro following the initial line macro.
*/
@@ -267,7 +265,6 @@ lookup_raw(const char *p)
return(MDOC_MAX);
}
-
static int
rew_last(struct mdoc *mdoc, const struct mdoc_node *to)
{
@@ -276,7 +273,7 @@ rew_last(struct mdoc *mdoc, const struct mdoc_node *to)
assert(to);
mdoc->next = MDOC_NEXT_SIBLING;
- /* LINTED */
+
while (mdoc->last != to) {
/*
* Save the parent here, because we may delete the
@@ -296,7 +293,6 @@ rew_last(struct mdoc *mdoc, const struct mdoc_node *to)
return(mdoc_valid_post(mdoc));
}
-
/*
* For a block closing macro, return the corresponding opening one.
* Otherwise, return the macro itself.
@@ -305,37 +301,37 @@ static enum mdoct
rew_alt(enum mdoct tok)
{
switch (tok) {
- case (MDOC_Ac):
+ case MDOC_Ac:
return(MDOC_Ao);
- case (MDOC_Bc):
+ case MDOC_Bc:
return(MDOC_Bo);
- case (MDOC_Brc):
+ case MDOC_Brc:
return(MDOC_Bro);
- case (MDOC_Dc):
+ case MDOC_Dc:
return(MDOC_Do);
- case (MDOC_Ec):
+ case MDOC_Ec:
return(MDOC_Eo);
- case (MDOC_Ed):
+ case MDOC_Ed:
return(MDOC_Bd);
- case (MDOC_Ef):
+ case MDOC_Ef:
return(MDOC_Bf);
- case (MDOC_Ek):
+ case MDOC_Ek:
return(MDOC_Bk);
- case (MDOC_El):
+ case MDOC_El:
return(MDOC_Bl);
- case (MDOC_Fc):
+ case MDOC_Fc:
return(MDOC_Fo);
- case (MDOC_Oc):
+ case MDOC_Oc:
return(MDOC_Oo);
- case (MDOC_Pc):
+ case MDOC_Pc:
return(MDOC_Po);
- case (MDOC_Qc):
+ case MDOC_Qc:
return(MDOC_Qo);
- case (MDOC_Re):
+ case MDOC_Re:
return(MDOC_Rs);
- case (MDOC_Sc):
+ case MDOC_Sc:
return(MDOC_So);
- case (MDOC_Xc):
+ case MDOC_Xc:
return(MDOC_Xo);
default:
return(tok);
@@ -343,7 +339,6 @@ rew_alt(enum mdoct tok)
/* NOTREACHED */
}
-
/*
* Rewinding to tok, how do we have to handle *p?
* REWIND_NONE: *p would delimit tok, but no tok scope is open
@@ -355,7 +350,7 @@ rew_alt(enum mdoct tok)
* REWIND_ERROR: No tok block is open at all.
*/
static enum rew
-rew_dohalt(enum mdoct tok, enum mdoc_type type,
+rew_dohalt(enum mdoct tok, enum mdoc_type type,
const struct mdoc_node *p)
{
@@ -371,7 +366,7 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
REWIND_ERROR : REWIND_NONE);
/*
- * When starting to rewind, skip plain text
+ * When starting to rewind, skip plain text
* and nodes that have already been rewound.
*/
if (MDOC_TEXT == p->type || MDOC_VALID & p->flags)
@@ -395,14 +390,14 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
/*
* Blocks delimited by our target token get REWIND_MORE.
- * Blocks delimiting our target token get REWIND_NONE.
+ * Blocks delimiting our target token get REWIND_NONE.
*/
switch (tok) {
- case (MDOC_Bl):
+ case MDOC_Bl:
if (MDOC_It == p->tok)
return(REWIND_MORE);
break;
- case (MDOC_It):
+ case MDOC_It:
if (MDOC_BODY == p->type && MDOC_Bl == p->tok)
return(REWIND_NONE);
break;
@@ -412,19 +407,19 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
* This is an incomplete and extremely ugly workaround,
* required to let the OpenBSD tree build.
*/
- case (MDOC_Oo):
+ case MDOC_Oo:
if (MDOC_Op == p->tok)
return(REWIND_MORE);
break;
- case (MDOC_Nm):
+ case MDOC_Nm:
return(REWIND_NONE);
- case (MDOC_Nd):
+ case MDOC_Nd:
/* FALLTHROUGH */
- case (MDOC_Ss):
+ case MDOC_Ss:
if (MDOC_BODY == p->type && MDOC_Sh == p->tok)
return(REWIND_NONE);
/* FALLTHROUGH */
- case (MDOC_Sh):
+ case MDOC_Sh:
if (MDOC_Nd == p->tok || MDOC_Ss == p->tok ||
MDOC_Sh == p->tok)
return(REWIND_MORE);
@@ -453,7 +448,6 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
REWIND_FORCE : REWIND_LATER);
}
-
static int
rew_elem(struct mdoc *mdoc, enum mdoct tok)
{
@@ -468,7 +462,6 @@ rew_elem(struct mdoc *mdoc, enum mdoct tok)
return(rew_last(mdoc, n));
}
-
/*
* We are trying to close a block identified by tok,
* but the child block *broken is still open.
@@ -533,8 +526,8 @@ make_pending(struct mdoc_node *broken, enum mdoct tok,
}
broken->pending = breaker;
mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, ppos,
- "%s breaks %s", mdoc_macronames[tok],
- mdoc_macronames[broken->tok]);
+ "%s breaks %s", mdoc_macronames[tok],
+ mdoc_macronames[broken->tok]);
return(1);
}
@@ -545,9 +538,8 @@ make_pending(struct mdoc_node *broken, enum mdoct tok,
return(0);
}
-
static int
-rew_sub(enum mdoc_type t, struct mdoc *mdoc,
+rew_sub(enum mdoc_type t, struct mdoc *mdoc,
enum mdoct tok, int line, int ppos)
{
struct mdoc_node *n;
@@ -555,30 +547,30 @@ rew_sub(enum mdoc_type t, struct mdoc *mdoc,
n = mdoc->last;
while (n) {
switch (rew_dohalt(tok, t, n)) {
- case (REWIND_NONE):
+ case REWIND_NONE:
return(1);
- case (REWIND_THIS):
+ case REWIND_THIS:
n->lastline = line -
(MDOC_NEWLINE & mdoc->flags &&
! (MDOC_EXPLICIT & mdoc_macros[tok].flags));
break;
- case (REWIND_FORCE):
- mandoc_vmsg(MANDOCERR_SCOPEBROKEN, mdoc->parse,
- line, ppos, "%s breaks %s",
- mdoc_macronames[tok],
- mdoc_macronames[n->tok]);
+ case REWIND_FORCE:
+ mandoc_vmsg(MANDOCERR_SCOPEBROKEN, mdoc->parse,
+ line, ppos, "%s breaks %s",
+ mdoc_macronames[tok],
+ mdoc_macronames[n->tok]);
/* FALLTHROUGH */
- case (REWIND_MORE):
+ case REWIND_MORE:
n->lastline = line -
(MDOC_NEWLINE & mdoc->flags ? 1 : 0);
n = n->parent;
continue;
- case (REWIND_LATER):
+ case REWIND_LATER:
if (make_pending(n, tok, mdoc, line, ppos) ||
MDOC_BLOCK != t)
return(1);
/* FALLTHROUGH */
- case (REWIND_ERROR):
+ case REWIND_ERROR:
mdoc_pmsg(mdoc, line, ppos, MANDOCERR_NOSCOPE);
return(1);
}
@@ -612,7 +604,7 @@ static int
dword(struct mdoc *mdoc, int line, int col, const char *p,
enum mdelim d, int may_append)
{
-
+
if (DELIM_MAX == d)
d = mdoc_isdelim(p);
@@ -641,8 +633,8 @@ dword(struct mdoc *mdoc, int line, int col, const char *p,
*/
else if (DELIM_CLOSE == d && mdoc->last->prev &&
- mdoc->last->prev->tok != MDOC_No &&
- mdoc->last->parent->tok != MDOC_Fd)
+ mdoc->last->prev->tok != MDOC_No &&
+ mdoc->last->parent->tok != MDOC_Fd)
mdoc->last->flags |= MDOC_DELIMC;
return(1);
@@ -687,9 +679,8 @@ append_delims(struct mdoc *mdoc, int line, int *pos, char *buf)
return(1);
}
-
/*
- * Close out block partial/full explicit.
+ * Close out block partial/full explicit.
*/
static int
blk_exp_close(MACRO_PROT_ARGS)
@@ -698,7 +689,7 @@ blk_exp_close(MACRO_PROT_ARGS)
struct mdoc_node *later; /* A sub-block starting later. */
struct mdoc_node *n; /* For searching backwards. */
- int j, lastarg, maxargs, flushed, nl;
+ int j, lastarg, maxargs, flushed, nl;
enum margserr ac;
enum mdoct atok, ntok;
char *p;
@@ -706,10 +697,10 @@ blk_exp_close(MACRO_PROT_ARGS)
nl = MDOC_NEWLINE & mdoc->flags;
switch (tok) {
- case (MDOC_Ec):
+ case MDOC_Ec:
maxargs = 1;
break;
- case (MDOC_Ek):
+ case MDOC_Ek:
mdoc->flags &= ~MDOC_KEEP;
default:
maxargs = 0;
@@ -746,7 +737,7 @@ blk_exp_close(MACRO_PROT_ARGS)
if (NULL == later)
break;
- /*
+ /*
* When there is a pending sub block,
* postpone closing out the current block
* until the rew_sub() closing out the sub-block.
@@ -777,7 +768,7 @@ blk_exp_close(MACRO_PROT_ARGS)
if ( ! (MDOC_CALLABLE & mdoc_macros[tok].flags)) {
/* FIXME: do this in validate */
- if (buf[*pos])
+ if (buf[*pos])
mdoc_pmsg(mdoc, line, ppos, MANDOCERR_ARGSLOST);
if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
@@ -788,7 +779,7 @@ blk_exp_close(MACRO_PROT_ARGS)
if ( ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
return(0);
- if (NULL == later && maxargs > 0)
+ if (NULL == later && maxargs > 0)
if ( ! mdoc_tail_alloc(mdoc, line, ppos, rew_alt(tok)))
return(0);
@@ -840,7 +831,6 @@ blk_exp_close(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
static int
in_line(MACRO_PROT_ARGS)
{
@@ -860,17 +850,17 @@ in_line(MACRO_PROT_ARGS)
*/
switch (tok) {
- case (MDOC_An):
+ case MDOC_An:
/* FALLTHROUGH */
- case (MDOC_Ar):
+ case MDOC_Ar:
/* FALLTHROUGH */
- case (MDOC_Fl):
+ case MDOC_Fl:
/* FALLTHROUGH */
- case (MDOC_Mt):
+ case MDOC_Mt:
/* FALLTHROUGH */
- case (MDOC_Nm):
+ case MDOC_Nm:
/* FALLTHROUGH */
- case (MDOC_Pa):
+ case MDOC_Pa:
nc = 1;
break;
default:
@@ -885,7 +875,7 @@ in_line(MACRO_PROT_ARGS)
if (ARGV_WORD == av) {
*pos = la;
break;
- }
+ }
if (ARGV_EOLN == av)
break;
if (ARGV_ARG == av)
@@ -908,7 +898,7 @@ in_line(MACRO_PROT_ARGS)
ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);
- /*
+ /*
* In this case, we've located a submacro and must
* execute it. Close out scope, if open. If no
* elements have been generated, either create one (nc)
@@ -919,15 +909,15 @@ in_line(MACRO_PROT_ARGS)
if (scope && ! rew_elem(mdoc, tok))
return(0);
if (nc && 0 == cnt) {
- if ( ! mdoc_elem_alloc(mdoc, line,
- ppos, tok, arg))
+ if ( ! mdoc_elem_alloc(mdoc,
+ line, ppos, tok, arg))
return(0);
if ( ! rew_last(mdoc, mdoc->last))
return(0);
} else if ( ! nc && 0 == cnt) {
mdoc_argv_free(arg);
mdoc_pmsg(mdoc, line, ppos,
- MANDOCERR_MACROEMPTY);
+ MANDOCERR_MACROEMPTY);
}
if ( ! mdoc_macro(mdoc, ntok, line, la, pos, buf))
@@ -935,12 +925,12 @@ in_line(MACRO_PROT_ARGS)
if ( ! nl)
return(1);
return(append_delims(mdoc, line, pos, buf));
- }
+ }
- /*
+ /*
* Non-quote-enclosed punctuation. Set up our scope, if
* a word; rewind the scope, if a delimiter; then append
- * the word.
+ * the word.
*/
d = ARGS_QWORD == ac ? DELIM_NONE : mdoc_isdelim(p);
@@ -954,13 +944,13 @@ in_line(MACRO_PROT_ARGS)
* this once per invocation. There may be more
* of these (all of them?).
*/
- if (0 == cnt && (nc || MDOC_Li == tok) &&
- DELIM_CLOSE == d && ! scope) {
- if ( ! mdoc_elem_alloc(mdoc, line,
- ppos, tok, arg))
+ if (0 == cnt && (nc || MDOC_Li == tok) &&
+ DELIM_CLOSE == d && ! scope) {
+ if ( ! mdoc_elem_alloc(mdoc,
+ line, ppos, tok, arg))
return(0);
- if (MDOC_Ar == tok || MDOC_Li == tok ||
- MDOC_Fl == tok)
+ if (MDOC_Ar == tok || MDOC_Li == tok ||
+ MDOC_Fl == tok)
cnt++;
scope = 1;
}
@@ -1020,7 +1010,6 @@ in_line(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
static int
blk_full(MACRO_PROT_ARGS)
{
@@ -1062,7 +1051,7 @@ blk_full(MACRO_PROT_ARGS)
if (ARGV_WORD == av) {
*pos = la;
break;
- }
+ }
if (ARGV_EOLN == av)
break;
@@ -1083,8 +1072,8 @@ blk_full(MACRO_PROT_ARGS)
* parsed, even though `It' macros in general are parsed.
*/
nparsed = MDOC_It == tok &&
- MDOC_Bl == mdoc->last->parent->tok &&
- LIST_diag == mdoc->last->parent->norm->Bl.type;
+ MDOC_Bl == mdoc->last->parent->tok &&
+ LIST_diag == mdoc->last->parent->norm->Bl.type;
/*
* The `Nd' macro has all arguments in its body: it's a hybrid
@@ -1137,17 +1126,17 @@ blk_full(MACRO_PROT_ARGS)
break;
}
- /*
+ /*
* Emit leading punctuation (i.e., punctuation before
* the MDOC_HEAD) for non-phrase types.
*/
- if (NULL == head &&
- ARGS_PEND != ac &&
- ARGS_PHRASE != ac &&
- ARGS_PPHRASE != ac &&
- ARGS_QWORD != ac &&
- DELIM_OPEN == mdoc_isdelim(p)) {
+ if (NULL == head &&
+ ARGS_PEND != ac &&
+ ARGS_PHRASE != ac &&
+ ARGS_PPHRASE != ac &&
+ ARGS_QWORD != ac &&
+ DELIM_OPEN == mdoc_isdelim(p)) {
if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0))
return(0);
continue;
@@ -1161,9 +1150,9 @@ blk_full(MACRO_PROT_ARGS)
head = mdoc->last;
}
- if (ARGS_PHRASE == ac ||
- ARGS_PEND == ac ||
- ARGS_PPHRASE == ac) {
+ if (ARGS_PHRASE == ac ||
+ ARGS_PEND == ac ||
+ ARGS_PPHRASE == ac) {
/*
* If we haven't opened a body yet, rewind the
* head; if we have, rewind that instead.
@@ -1172,7 +1161,7 @@ blk_full(MACRO_PROT_ARGS)
mtt = body ? MDOC_BODY : MDOC_HEAD;
if ( ! rew_sub(mtt, mdoc, tok, line, ppos))
return(0);
-
+
/* Then allocate our body context. */
if ( ! mdoc_body_alloc(mdoc, line, ppos, tok))
@@ -1197,8 +1186,8 @@ blk_full(MACRO_PROT_ARGS)
continue;
}
- ntok = nparsed || ARGS_QWORD == ac ?
- MDOC_MAX : lookup(tok, p);
+ ntok = nparsed || ARGS_QWORD == ac ?
+ MDOC_MAX : lookup(tok, p);
if (MDOC_MAX == ntok) {
if ( ! dword(mdoc, line, la, p, DELIM_MAX,
@@ -1217,7 +1206,7 @@ blk_full(MACRO_PROT_ARGS)
return(0);
head = mdoc->last;
}
-
+
if (nl && ! append_delims(mdoc, line, pos, buf))
return(0);
@@ -1233,9 +1222,9 @@ blk_full(MACRO_PROT_ARGS)
* sub-block.
*/
for (n = mdoc->last; n && n != head; n = n->parent) {
- if (MDOC_BLOCK == n->type &&
- MDOC_EXPLICIT & mdoc_macros[n->tok].flags &&
- ! (MDOC_VALID & n->flags)) {
+ if (MDOC_BLOCK == n->type &&
+ MDOC_EXPLICIT & mdoc_macros[n->tok].flags &&
+ ! (MDOC_VALID & n->flags)) {
n->pending = head;
return(1);
}
@@ -1261,7 +1250,6 @@ out:
return(1);
}
-
static int
blk_part_imp(MACRO_PROT_ARGS)
{
@@ -1312,7 +1300,7 @@ blk_part_imp(MACRO_PROT_ARGS)
break;
if (NULL == body && ARGS_QWORD != ac &&
- DELIM_OPEN == mdoc_isdelim(p)) {
+ DELIM_OPEN == mdoc_isdelim(p)) {
if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0))
return(0);
continue;
@@ -1352,7 +1340,7 @@ blk_part_imp(MACRO_PROT_ARGS)
* until the rew_sub() call closing out the sub-block.
*/
for (n = mdoc->last; n && n != body && n != blk->parent;
- n = n->parent) {
+ n = n->parent) {
if (MDOC_BLOCK == n->type &&
MDOC_EXPLICIT & mdoc_macros[n->tok].flags &&
! (MDOC_VALID & n->flags)) {
@@ -1364,15 +1352,15 @@ blk_part_imp(MACRO_PROT_ARGS)
}
}
- /*
+ /*
* If we can't rewind to our body, then our scope has already
* been closed by another macro (like `Oc' closing `Op'). This
* is ugly behaviour nodding its head to OpenBSD's overwhelming
* crufty use of `Op' breakage.
*/
if (n != body)
- mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line, ppos,
- "%s broken", mdoc_macronames[tok]);
+ mandoc_vmsg(MANDOCERR_SCOPENEST, mdoc->parse, line,
+ ppos, "%s broken", mdoc_macronames[tok]);
if (n && ! rew_sub(MDOC_BODY, mdoc, tok, line, ppos))
return(0);
@@ -1397,7 +1385,6 @@ blk_part_imp(MACRO_PROT_ARGS)
return(1);
}
-
static int
blk_part_exp(MACRO_PROT_ARGS)
{
@@ -1417,7 +1404,7 @@ blk_part_exp(MACRO_PROT_ARGS)
*/
if ( ! mdoc_block_alloc(mdoc, line, ppos, tok, NULL))
- return(0);
+ return(0);
for (head = body = NULL; ; ) {
la = *pos;
@@ -1433,7 +1420,7 @@ blk_part_exp(MACRO_PROT_ARGS)
/* Flush out leading punctuation. */
if (NULL == head && ARGS_QWORD != ac &&
- DELIM_OPEN == mdoc_isdelim(p)) {
+ DELIM_OPEN == mdoc_isdelim(p)) {
assert(NULL == body);
if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0))
return(0);
@@ -1505,8 +1492,6 @@ blk_part_exp(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
-/* ARGSUSED */
static int
in_line_argn(MACRO_PROT_ARGS)
{
@@ -1528,18 +1513,18 @@ in_line_argn(MACRO_PROT_ARGS)
*/
switch (tok) {
- case (MDOC_Ap):
+ case MDOC_Ap:
/* FALLTHROUGH */
- case (MDOC_No):
+ case MDOC_No:
/* FALLTHROUGH */
- case (MDOC_Ns):
+ case MDOC_Ns:
/* FALLTHROUGH */
- case (MDOC_Ux):
+ case MDOC_Ux:
maxargs = 0;
break;
- case (MDOC_Bx):
+ case MDOC_Bx:
/* FALLTHROUGH */
- case (MDOC_Xr):
+ case MDOC_Xr:
maxargs = 2;
break;
default:
@@ -1554,7 +1539,7 @@ in_line_argn(MACRO_PROT_ARGS)
if (ARGV_WORD == av) {
*pos = la;
break;
- }
+ }
if (ARGV_EOLN == av)
break;
@@ -1576,9 +1561,9 @@ in_line_argn(MACRO_PROT_ARGS)
if (ARGS_EOLN == ac)
break;
- if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
- ARGS_QWORD != ac && 0 == j &&
- DELIM_OPEN == mdoc_isdelim(p)) {
+ if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
+ ARGS_QWORD != ac && 0 == j &&
+ DELIM_OPEN == mdoc_isdelim(p)) {
if ( ! dword(mdoc, line, la, p, DELIM_OPEN, 0))
return(0);
continue;
@@ -1605,9 +1590,9 @@ in_line_argn(MACRO_PROT_ARGS)
}
if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
- ARGS_QWORD != ac &&
- ! flushed &&
- DELIM_NONE != mdoc_isdelim(p)) {
+ ARGS_QWORD != ac &&
+ ! flushed &&
+ DELIM_NONE != mdoc_isdelim(p)) {
if ( ! rew_elem(mdoc, tok))
return(0);
flushed = 1;
@@ -1631,7 +1616,6 @@ in_line_argn(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
static int
in_line_eoln(MACRO_PROT_ARGS)
{
@@ -1657,7 +1641,7 @@ in_line_eoln(MACRO_PROT_ARGS)
*pos = la;
break;
}
- if (ARGV_EOLN == av)
+ if (ARGV_EOLN == av)
break;
if (ARGV_ARG == av)
continue;
@@ -1701,8 +1685,6 @@ in_line_eoln(MACRO_PROT_ARGS)
return(rew_elem(mdoc, tok));
}
-
-/* ARGSUSED */
static int
ctx_synopsis(MACRO_PROT_ARGS)
{
@@ -1729,8 +1711,6 @@ ctx_synopsis(MACRO_PROT_ARGS)
return(blk_part_imp(mdoc, tok, line, ppos, pos, buf));
}
-
-/* ARGSUSED */
static int
obsolete(MACRO_PROT_ARGS)
{
@@ -1739,7 +1719,6 @@ obsolete(MACRO_PROT_ARGS)
return(1);
}
-
/*
* Phrases occur within `Bl -column' entries, separated by `Ta' or tabs.
* They're unusual because they're basically free-form text until a
@@ -1779,8 +1758,6 @@ phrase(struct mdoc *mdoc, int line, int ppos, char *buf)
return(1);
}
-
-/* ARGSUSED */
static int
phrase_ta(MACRO_PROT_ARGS)
{
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 64c58253935..979926a5371 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.60 2014/03/30 19:47:32 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.61 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -270,6 +270,7 @@ static struct {
size_t size;
} fontqueue;
+
static void
font_push(char newfont)
{
@@ -277,7 +278,7 @@ font_push(char newfont)
if (fontqueue.head + fontqueue.size <= ++fontqueue.tail) {
fontqueue.size += 8;
fontqueue.head = mandoc_realloc(fontqueue.head,
- fontqueue.size);
+ fontqueue.size);
}
*fontqueue.tail = newfont;
print_word("");
@@ -303,7 +304,7 @@ print_word(const char *s)
{
if ((MMAN_PP | MMAN_sp | MMAN_br | MMAN_nl) & outflags) {
- /*
+ /*
* If we need a newline, print it now and start afresh.
*/
if (MMAN_PP & outflags) {
@@ -358,16 +359,16 @@ print_word(const char *s)
for ( ; *s; s++) {
switch (*s) {
- case (ASCII_NBRSP):
+ case ASCII_NBRSP:
printf("\\ ");
break;
- case (ASCII_HYPH):
+ case ASCII_HYPH:
putchar('-');
break;
- case (ASCII_BREAK):
+ case ASCII_BREAK:
printf("\\:");
break;
- case (' '):
+ case ' ':
if (MMAN_nbrword & outflags) {
printf("\\ ");
break;
@@ -486,7 +487,7 @@ print_width(const char *v, const struct mdoc_node *child, size_t defsz)
/* XXX Rough estimation, might have multiple parts. */
chsz = (NULL != child && MDOC_TEXT == child->type) ?
- strlen(child->string) : 0;
+ strlen(child->string) : 0;
/* Maybe we are inside an enclosing list? */
mid_it();
@@ -544,8 +545,8 @@ man_mdoc(void *arg, const struct mdoc *mdoc)
n = mdoc_node(mdoc);
printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n",
- meta->title, meta->msec, meta->date,
- meta->os, meta->vol);
+ meta->title, meta->msec, meta->date,
+ meta->os, meta->vol);
/* Disable hyphenation and if nroff, disable justification. */
printf(".nh\n.if n .ad l");
@@ -583,8 +584,8 @@ print_node(DECL_ARGS)
* Make sure that we don't happen to start with a
* control character at the start of a line.
*/
- if (MMAN_nl & outflags && ('.' == *n->string ||
- '\'' == *n->string)) {
+ if (MMAN_nl & outflags &&
+ ('.' == *n->string || '\'' == *n->string)) {
print_word("");
printf("\\&");
outflags &= ~MMAN_spc;
@@ -601,7 +602,7 @@ print_node(DECL_ARGS)
do_sub = (*act->pre)(meta, n);
}
- /*
+ /*
* Conditionally run all child nodes.
* Note that this iterates over children instead of using
* recursion. This prevents unnecessary depth in the stack.
@@ -693,8 +694,8 @@ static int
pre__t(DECL_ARGS)
{
- if (n->parent && MDOC_Rs == n->parent->tok &&
- n->parent->norm->Rs.quote_T) {
+ if (n->parent && MDOC_Rs == n->parent->tok &&
+ n->parent->norm->Rs.quote_T) {
print_word("");
putchar('\"');
outflags &= ~MMAN_spc;
@@ -707,8 +708,8 @@ static void
post__t(DECL_ARGS)
{
- if (n->parent && MDOC_Rs == n->parent->tok &&
- n->parent->norm->Rs.quote_T) {
+ if (n->parent && MDOC_Rs == n->parent->tok &&
+ n->parent->norm->Rs.quote_T) {
outflags &= ~MMAN_spc;
print_word("");
putchar('\"');
@@ -760,26 +761,26 @@ pre_syn(const struct mdoc_node *n)
return;
if (n->prev->tok == n->tok &&
- MDOC_Ft != n->tok &&
- MDOC_Fo != n->tok &&
- MDOC_Fn != n->tok) {
+ MDOC_Ft != n->tok &&
+ MDOC_Fo != n->tok &&
+ MDOC_Fn != n->tok) {
outflags |= MMAN_br;
return;
}
switch (n->prev->tok) {
- case (MDOC_Fd):
+ case MDOC_Fd:
/* FALLTHROUGH */
- case (MDOC_Fn):
+ case MDOC_Fn:
/* FALLTHROUGH */
- case (MDOC_Fo):
+ case MDOC_Fo:
/* FALLTHROUGH */
- case (MDOC_In):
+ case MDOC_In:
/* FALLTHROUGH */
- case (MDOC_Vt):
+ case MDOC_Vt:
outflags |= MMAN_sp;
break;
- case (MDOC_Ft):
+ case MDOC_Ft:
if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
outflags |= MMAN_sp;
break;
@@ -796,11 +797,11 @@ pre_an(DECL_ARGS)
{
switch (n->norm->An.auth) {
- case (AUTH_split):
+ case AUTH_split:
outflags &= ~MMAN_An_nosplit;
outflags |= MMAN_An_split;
return(0);
- case (AUTH_nosplit):
+ case AUTH_nosplit:
outflags &= ~MMAN_An_split;
outflags |= MMAN_An_nosplit;
return(0);
@@ -859,18 +860,18 @@ pre_bf(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
return(1);
- case (MDOC_BODY):
+ case MDOC_BODY:
break;
default:
return(0);
}
switch (n->norm->Bf.font) {
- case (FONT_Em):
+ case FONT_Em:
font_push('I');
break;
- case (FONT_Sy):
+ case FONT_Sy:
font_push('B');
break;
default:
@@ -893,9 +894,9 @@ pre_bk(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
return(1);
- case (MDOC_BODY):
+ case MDOC_BODY:
outflags |= MMAN_Bk;
return(1);
default:
@@ -927,10 +928,10 @@ pre_bl(DECL_ARGS)
}
switch (n->norm->Bl.type) {
- case (LIST_enum):
+ case LIST_enum:
n->norm->Bl.count = 0;
return(1);
- case (LIST_column):
+ case LIST_column:
break;
default:
return(1);
@@ -949,10 +950,10 @@ post_bl(DECL_ARGS)
{
switch (n->norm->Bl.type) {
- case (LIST_column):
+ case LIST_column:
print_line(".TE", 0);
break;
- case (LIST_enum):
+ case LIST_enum:
n->norm->Bl.count = 0;
break;
default:
@@ -1147,15 +1148,15 @@ pre_fo(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
pre_syn(n);
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
if (MDOC_SYNPRETTY & n->flags)
print_block(".HP 4n", MMAN_nl);
font_push('B');
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
outflags &= ~MMAN_spc;
print_word("(");
outflags &= ~MMAN_spc;
@@ -1171,10 +1172,10 @@ post_fo(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_HEAD):
+ case MDOC_HEAD:
font_pop();
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
post_fn(meta, n);
break;
default:
@@ -1230,7 +1231,7 @@ pre_it(DECL_ARGS)
const struct mdoc_node *bln;
switch (n->type) {
- case (MDOC_HEAD):
+ case MDOC_HEAD:
outflags |= MMAN_PP | MMAN_nl;
bln = n->parent->parent;
if (0 == bln->norm->Bl.comp ||
@@ -1239,24 +1240,24 @@ pre_it(DECL_ARGS)
outflags |= MMAN_sp;
outflags &= ~MMAN_br;
switch (bln->norm->Bl.type) {
- case (LIST_item):
+ case LIST_item:
return(0);
- case (LIST_inset):
+ case LIST_inset:
/* FALLTHROUGH */
- case (LIST_diag):
+ case LIST_diag:
/* FALLTHROUGH */
- case (LIST_ohang):
+ case LIST_ohang:
if (bln->norm->Bl.type == LIST_diag)
print_line(".B \"", 0);
else
print_line(".R \"", 0);
outflags &= ~MMAN_spc;
return(1);
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
print_width(bln->norm->Bl.width, NULL, 0);
TPremain = 0;
outflags |= MMAN_nl;
@@ -1267,17 +1268,17 @@ pre_it(DECL_ARGS)
print_word("-");
font_pop();
break;
- case (LIST_enum):
+ case LIST_enum:
print_width(bln->norm->Bl.width, NULL, 0);
TPremain = 0;
outflags |= MMAN_nl;
print_count(&bln->norm->Bl.count);
break;
- case (LIST_hang):
+ case LIST_hang:
print_width(bln->norm->Bl.width, n->child, 6);
TPremain = 0;
break;
- case (LIST_tag):
+ case LIST_tag:
print_width(bln->norm->Bl.width, n->child, 0);
putchar('\n');
outflags &= ~MMAN_spc;
@@ -1326,32 +1327,32 @@ post_it(DECL_ARGS)
bln = n->parent->parent;
switch (n->type) {
- case (MDOC_HEAD):
+ case MDOC_HEAD:
switch (bln->norm->Bl.type) {
- case (LIST_diag):
+ case LIST_diag:
outflags &= ~MMAN_spc;
print_word("\\ ");
break;
- case (LIST_ohang):
+ case LIST_ohang:
outflags |= MMAN_br;
break;
default:
break;
}
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
switch (bln->norm->Bl.type) {
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
/* FALLTHROUGH */
- case (LIST_enum):
+ case LIST_enum:
/* FALLTHROUGH */
- case (LIST_hang):
+ case LIST_hang:
/* FALLTHROUGH */
- case (LIST_tag):
+ case LIST_tag:
assert(Bl_stack_len);
Bl_stack[--Bl_stack_len] = 0;
@@ -1365,7 +1366,7 @@ post_it(DECL_ARGS)
Bl_stack_post[Bl_stack_len] = 0;
}
break;
- case (LIST_column):
+ case LIST_column:
if (NULL != n->next) {
putchar('\t');
outflags &= ~MMAN_spc;
@@ -1460,12 +1461,12 @@ post_nm(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
outflags &= ~MMAN_Bk;
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
/* FALLTHROUGH */
- case (MDOC_ELEM):
+ case MDOC_ELEM:
font_pop();
break;
default:
@@ -1563,10 +1564,10 @@ pre_vt(DECL_ARGS)
if (MDOC_SYNPRETTY & n->flags) {
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
pre_syn(n);
return(1);
- case (MDOC_BODY):
+ case MDOC_BODY:
break;
default:
return(0);
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 804e4c86de3..8be99fff9bd 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.165 2014/04/08 07:13:01 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.166 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -38,7 +38,7 @@ struct termpair {
#define DECL_ARGS struct termp *p, \
struct termpair *pair, \
- const struct mdoc_meta *meta, \
+ const struct mdoc_meta *meta, \
struct mdoc_node *n
struct termact {
@@ -53,11 +53,11 @@ static size_t a2offs(const struct termp *, const char *);
static void print_bvspace(struct termp *,
const struct mdoc_node *,
const struct mdoc_node *);
-static void print_mdoc_node(DECL_ARGS);
+static void print_mdoc_node(DECL_ARGS);
static void print_mdoc_nodelist(DECL_ARGS);
static void print_mdoc_head(struct termp *, const void *);
static void print_mdoc_foot(struct termp *, const void *);
-static void synopsis_pre(struct termp *,
+static void synopsis_pre(struct termp *,
const struct mdoc_node *);
static void termp____post(DECL_ARGS);
@@ -124,8 +124,8 @@ static const struct termact termacts[MDOC_MAX] = {
{ NULL, NULL }, /* Dt */
{ NULL, NULL }, /* Os */
{ termp_sh_pre, termp_sh_post }, /* Sh */
- { termp_ss_pre, termp_ss_post }, /* Ss */
- { termp_sp_pre, NULL }, /* Pp */
+ { termp_ss_pre, termp_ss_post }, /* Ss */
+ { termp_sp_pre, NULL }, /* Pp */
{ termp_d1_pre, termp_bl_post }, /* D1 */
{ termp_d1_pre, termp_bl_post }, /* Dl */
{ termp_bd_pre, termp_bd_post }, /* Bd */
@@ -133,30 +133,30 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_bl_pre, termp_bl_post }, /* Bl */
{ NULL, NULL }, /* El */
{ termp_it_pre, termp_it_post }, /* It */
- { termp_under_pre, NULL }, /* Ad */
+ { termp_under_pre, NULL }, /* Ad */
{ termp_an_pre, termp_an_post }, /* An */
{ termp_under_pre, NULL }, /* Ar */
{ termp_cd_pre, NULL }, /* Cd */
{ termp_bold_pre, NULL }, /* Cm */
- { NULL, NULL }, /* Dv */
- { NULL, NULL }, /* Er */
- { NULL, NULL }, /* Ev */
+ { NULL, NULL }, /* Dv */
+ { NULL, NULL }, /* Er */
+ { NULL, NULL }, /* Ev */
{ termp_ex_pre, NULL }, /* Ex */
- { termp_fa_pre, NULL }, /* Fa */
- { termp_fd_pre, termp_fd_post }, /* Fd */
+ { termp_fa_pre, NULL }, /* Fa */
+ { termp_fd_pre, termp_fd_post }, /* Fd */
{ termp_fl_pre, NULL }, /* Fl */
- { termp_fn_pre, NULL }, /* Fn */
- { termp_ft_pre, NULL }, /* Ft */
- { termp_bold_pre, NULL }, /* Ic */
- { termp_in_pre, termp_in_post }, /* In */
+ { termp_fn_pre, NULL }, /* Fn */
+ { termp_ft_pre, NULL }, /* Ft */
+ { termp_bold_pre, NULL }, /* Ic */
+ { termp_in_pre, termp_in_post }, /* In */
{ termp_li_pre, NULL }, /* Li */
- { termp_nd_pre, NULL }, /* Nd */
- { termp_nm_pre, termp_nm_post }, /* Nm */
+ { termp_nd_pre, NULL }, /* Nd */
+ { termp_nm_pre, termp_nm_post }, /* Nm */
{ termp_quote_pre, termp_quote_post }, /* Op */
{ NULL, NULL }, /* Ot */
{ termp_under_pre, NULL }, /* Pa */
{ termp_rv_pre, NULL }, /* Rv */
- { NULL, NULL }, /* St */
+ { NULL, NULL }, /* St */
{ termp_under_pre, NULL }, /* Va */
{ termp_vt_pre, NULL }, /* Vt */
{ termp_xr_pre, NULL }, /* Xr */
@@ -176,7 +176,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_quote_pre, termp_quote_post }, /* Aq */
{ NULL, NULL }, /* At */
{ NULL, NULL }, /* Bc */
- { termp_bf_pre, NULL }, /* Bf */
+ { termp_bf_pre, NULL }, /* Bf */
{ termp_quote_pre, termp_quote_post }, /* Bo */
{ termp_quote_pre, termp_quote_post }, /* Bq */
{ termp_xx_pre, NULL }, /* Bsx */
@@ -187,7 +187,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_quote_pre, termp_quote_post }, /* Dq */
{ NULL, NULL }, /* Ec */ /* FIXME: no space */
{ NULL, NULL }, /* Ef */
- { termp_under_pre, NULL }, /* Em */
+ { termp_under_pre, NULL }, /* Em */
{ termp_quote_pre, termp_quote_post }, /* Eo */
{ termp_xx_pre, NULL }, /* Fx */
{ termp_bold_pre, NULL }, /* Ms */
@@ -215,8 +215,8 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_xx_pre, NULL }, /* Ux */
{ NULL, NULL }, /* Xc */
{ NULL, NULL }, /* Xo */
- { termp_fo_pre, termp_fo_post }, /* Fo */
- { NULL, NULL }, /* Fc */
+ { termp_fo_pre, termp_fo_post }, /* Fo */
+ { NULL, NULL }, /* Fc */
{ termp_quote_pre, termp_quote_post }, /* Oo */
{ NULL, NULL }, /* Oc */
{ termp_bk_pre, termp_bk_post }, /* Bk */
@@ -226,21 +226,21 @@ static const struct termact termacts[MDOC_MAX] = {
{ NULL, NULL }, /* Fr */
{ termp_ud_pre, NULL }, /* Ud */
{ NULL, termp_lb_post }, /* Lb */
- { termp_sp_pre, NULL }, /* Lp */
- { termp_lk_pre, NULL }, /* Lk */
- { termp_under_pre, NULL }, /* Mt */
- { termp_quote_pre, termp_quote_post }, /* Brq */
- { termp_quote_pre, termp_quote_post }, /* Bro */
- { NULL, NULL }, /* Brc */
- { NULL, termp____post }, /* %C */
+ { termp_sp_pre, NULL }, /* Lp */
+ { termp_lk_pre, NULL }, /* Lk */
+ { termp_under_pre, NULL }, /* Mt */
+ { termp_quote_pre, termp_quote_post }, /* Brq */
+ { termp_quote_pre, termp_quote_post }, /* Bro */
+ { NULL, NULL }, /* Brc */
+ { NULL, termp____post }, /* %C */
{ NULL, NULL }, /* Es */ /* TODO */
{ NULL, NULL }, /* En */ /* TODO */
- { termp_xx_pre, NULL }, /* Dx */
- { NULL, termp____post }, /* %Q */
+ { termp_xx_pre, NULL }, /* Dx */
+ { NULL, termp____post }, /* %Q */
{ termp_sp_pre, NULL }, /* br */
- { termp_sp_pre, NULL }, /* sp */
- { NULL, termp____post }, /* %U */
- { NULL, NULL }, /* Ta */
+ { termp_sp_pre, NULL }, /* sp */
+ { NULL, termp____post }, /* %U */
+ { NULL, NULL }, /* Ta */
{ termp_ll_pre, NULL }, /* ll */
};
@@ -275,7 +275,6 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
term_end(p);
}
-
static void
print_mdoc_nodelist(DECL_ARGS)
{
@@ -285,8 +284,6 @@ print_mdoc_nodelist(DECL_ARGS)
print_mdoc_nodelist(p, pair, meta, n->next);
}
-
-/* ARGSUSED */
static void
print_mdoc_node(DECL_ARGS)
{
@@ -321,7 +318,7 @@ print_mdoc_node(DECL_ARGS)
*/
switch (n->type) {
- case (MDOC_TEXT):
+ case MDOC_TEXT:
if (' ' == *n->string && MDOC_LINE & n->flags)
term_newln(p);
if (MDOC_DELIMC & n->flags)
@@ -330,10 +327,10 @@ print_mdoc_node(DECL_ARGS)
if (MDOC_DELIMO & n->flags)
p->flags |= TERMP_NOSPACE;
break;
- case (MDOC_EQN):
+ case MDOC_EQN:
term_eqn(p, n->eqn);
break;
- case (MDOC_TBL):
+ case MDOC_TBL:
term_tbl(p, n->span);
break;
default:
@@ -350,11 +347,11 @@ print_mdoc_node(DECL_ARGS)
(ENDBODY_NOT == n->end ? n : n->pending)->prev_font);
switch (n->type) {
- case (MDOC_TEXT):
+ case MDOC_TEXT:
break;
- case (MDOC_TBL):
+ case MDOC_TBL:
break;
- case (MDOC_EQN):
+ case MDOC_EQN:
break;
default:
if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags)
@@ -388,7 +385,6 @@ print_mdoc_node(DECL_ARGS)
}
}
-
static void
print_mdoc_foot(struct termp *p, const void *arg)
{
@@ -398,7 +394,7 @@ print_mdoc_foot(struct termp *p, const void *arg)
term_fontrepl(p, TERMFONT_NONE);
- /*
+ /*
* Output the footer in new-groff style, that is, three columns
* with the middle being the manual date and flanking columns
* being the operating system:
@@ -409,8 +405,8 @@ print_mdoc_foot(struct termp *p, const void *arg)
term_vspace(p);
p->offset = 0;
- p->rmargin = (p->maxrmargin -
- term_strlen(p, meta->date) + term_len(p, 1)) / 2;
+ p->rmargin = (p->maxrmargin -
+ term_strlen(p, meta->date) + term_len(p, 1)) / 2;
p->trailspace = 1;
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
@@ -438,7 +434,6 @@ print_mdoc_foot(struct termp *p, const void *arg)
p->flags = 0;
}
-
static void
print_mdoc_head(struct termp *p, const void *arg)
{
@@ -511,7 +506,6 @@ print_mdoc_head(struct termp *p, const void *arg)
p->rmargin = p->maxrmargin;
}
-
static size_t
a2height(const struct termp *p, const char *v)
{
@@ -525,7 +519,6 @@ a2height(const struct termp *p, const char *v)
return(term_vspan(p, &su));
}
-
static size_t
a2width(const struct termp *p, const char *v)
{
@@ -538,7 +531,6 @@ a2width(const struct termp *p, const char *v)
return(term_hspan(p, &su));
}
-
static size_t
a2offs(const struct termp *p, const char *v)
{
@@ -558,16 +550,15 @@ a2offs(const struct termp *p, const char *v)
return(term_hspan(p, &su));
}
-
/*
* Determine how much space to print out before block elements of `It'
* (and thus `Bl') and `Bd'. And then go ahead and print that space,
* too.
*/
static void
-print_bvspace(struct termp *p,
- const struct mdoc_node *bl,
- const struct mdoc_node *n)
+print_bvspace(struct termp *p,
+ const struct mdoc_node *bl,
+ const struct mdoc_node *n)
{
const struct mdoc_node *nn;
@@ -613,7 +604,6 @@ print_bvspace(struct termp *p,
}
-/* ARGSUSED */
static int
termp_ll_pre(DECL_ARGS)
{
@@ -622,15 +612,13 @@ termp_ll_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_it_pre(DECL_ARGS)
{
const struct mdoc_node *bl, *nn;
- char buf[7];
- int i;
- size_t width, offset, ncols, dcol;
+ char buf[7];
+ int i;
+ size_t width, offset, ncols, dcol;
enum mdoc_list type;
if (MDOC_BLOCK == n->type) {
@@ -641,7 +629,7 @@ termp_it_pre(DECL_ARGS)
bl = n->parent->parent->parent;
type = bl->norm->Bl.type;
- /*
+ /*
* First calculate width and offset. This is pretty easy unless
* we're a -column list, in which case all prior columns must
* be accounted for.
@@ -653,7 +641,7 @@ termp_it_pre(DECL_ARGS)
offset = a2offs(p, bl->norm->Bl.offs);
switch (type) {
- case (LIST_column):
+ case LIST_column:
if (MDOC_HEAD == n->type)
break;
@@ -667,21 +655,19 @@ termp_it_pre(DECL_ARGS)
* - For more than 5 columns, add only one column.
*/
ncols = bl->norm->Bl.ncols;
-
- /* LINTED */
- dcol = ncols < 5 ? term_len(p, 4) :
- ncols == 5 ? term_len(p, 3) : term_len(p, 1);
+ dcol = ncols < 5 ? term_len(p, 4) :
+ ncols == 5 ? term_len(p, 3) : term_len(p, 1);
/*
* Calculate the offset by applying all prior MDOC_BODY,
* so we stop at the MDOC_HEAD (NULL == nn->prev).
*/
- for (i = 0, nn = n->prev;
- nn->prev && i < (int)ncols;
- nn = nn->prev, i++)
- offset += dcol + a2width
- (p, bl->norm->Bl.cols[i]);
+ for (i = 0, nn = n->prev;
+ nn->prev && i < (int)ncols;
+ nn = nn->prev, i++)
+ offset += dcol + a2width(p,
+ bl->norm->Bl.cols[i]);
/*
* When exceeding the declared number of columns, leave
@@ -702,7 +688,7 @@ termp_it_pre(DECL_ARGS)
if (NULL == bl->norm->Bl.width)
break;
- /*
+ /*
* Note: buffer the width by 2, which is groff's magic
* number for buffering single arguments. See the above
* handling for column for how this changes.
@@ -712,30 +698,30 @@ termp_it_pre(DECL_ARGS)
break;
}
- /*
+ /*
* List-type can override the width in the case of fixed-head
* values (bullet, dash/hyphen, enum). Tags need a non-zero
* offset.
*/
switch (type) {
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
/* FALLTHROUGH */
- case (LIST_enum):
+ case LIST_enum:
if (width < term_len(p, 2))
width = term_len(p, 2);
break;
- case (LIST_hang):
+ case LIST_hang:
if (0 == width)
width = term_len(p, 8);
break;
- case (LIST_column):
+ case LIST_column:
/* FALLTHROUGH */
- case (LIST_tag):
+ case LIST_tag:
if (0 == width)
width = term_len(p, 10);
break;
@@ -743,7 +729,7 @@ termp_it_pre(DECL_ARGS)
break;
}
- /*
+ /*
* Whitespace control. Inset bodies need an initial space,
* while diagonal bodies need two.
*/
@@ -751,12 +737,12 @@ termp_it_pre(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
switch (type) {
- case (LIST_diag):
+ case LIST_diag:
if (MDOC_BODY == n->type)
term_word(p, "\\ \\ ");
break;
- case (LIST_inset):
- if (MDOC_BODY == n->type)
+ case LIST_inset:
+ if (MDOC_BODY == n->type)
term_word(p, "\\ ");
break;
default:
@@ -766,7 +752,7 @@ termp_it_pre(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
switch (type) {
- case (LIST_diag):
+ case LIST_diag:
if (MDOC_HEAD == n->type)
term_fontpush(p, TERMFONT_BOLD);
break;
@@ -782,7 +768,7 @@ termp_it_pre(DECL_ARGS)
*/
switch (type) {
- case (LIST_enum):
+ case LIST_enum:
/*
* Weird special case.
* Very narrow enum lists actually hang.
@@ -790,17 +776,17 @@ termp_it_pre(DECL_ARGS)
if (width == term_len(p, 2))
p->flags |= TERMP_HANG;
/* FALLTHROUGH */
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
if (MDOC_HEAD != n->type)
break;
p->flags |= TERMP_NOBREAK;
p->trailspace = 1;
break;
- case (LIST_hang):
+ case LIST_hang:
if (MDOC_HEAD != n->type)
break;
@@ -810,15 +796,15 @@ termp_it_pre(DECL_ARGS)
* the "overstep" effect in term_flushln() and treat
* this as a `-ohang' list instead.
*/
- if (n->next->child &&
- (MDOC_Bl == n->next->child->tok ||
- MDOC_Bd == n->next->child->tok))
+ if (n->next->child &&
+ (MDOC_Bl == n->next->child->tok ||
+ MDOC_Bd == n->next->child->tok))
break;
p->flags |= TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG;
p->trailspace = 1;
break;
- case (LIST_tag):
+ case LIST_tag:
if (MDOC_HEAD != n->type)
break;
@@ -828,7 +814,7 @@ termp_it_pre(DECL_ARGS)
if (NULL == n->next || NULL == n->next->child)
p->flags |= TERMP_DANGLE;
break;
- case (LIST_column):
+ case LIST_column:
if (MDOC_HEAD == n->type)
break;
@@ -841,7 +827,7 @@ termp_it_pre(DECL_ARGS)
}
break;
- case (LIST_diag):
+ case LIST_diag:
if (MDOC_HEAD != n->type)
break;
p->flags |= TERMP_NOBREAK | TERMP_BRIND;
@@ -851,7 +837,7 @@ termp_it_pre(DECL_ARGS)
break;
}
- /*
+ /*
* Margin control. Set-head-width lists have their right
* margins shortened. The body for these lists has the offset
* necessarily lengthened. Everybody gets the offset.
@@ -860,26 +846,26 @@ termp_it_pre(DECL_ARGS)
p->offset += offset;
switch (type) {
- case (LIST_hang):
+ case LIST_hang:
/*
* Same stipulation as above, regarding `-hang'. We
* don't want to recalculate rmargin and offsets when
* using `Bd' or `Bl' within `-hang' overstep lists.
*/
if (MDOC_HEAD == n->type && n->next->child &&
- (MDOC_Bl == n->next->child->tok ||
- MDOC_Bd == n->next->child->tok))
+ (MDOC_Bl == n->next->child->tok ||
+ MDOC_Bd == n->next->child->tok))
break;
/* FALLTHROUGH */
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_enum):
+ case LIST_enum:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
/* FALLTHROUGH */
- case (LIST_tag):
+ case LIST_tag:
assert(width);
if (MDOC_HEAD == n->type)
p->rmargin = p->offset + width;
@@ -889,10 +875,10 @@ termp_it_pre(DECL_ARGS)
p->rmargin = p->offset;
}
break;
- case (LIST_column):
+ case LIST_column:
assert(width);
p->rmargin = p->offset + width;
- /*
+ /*
* XXX - this behaviour is not documented: the
* right-most column is filled to the right margin.
*/
@@ -905,53 +891,53 @@ termp_it_pre(DECL_ARGS)
break;
}
- /*
+ /*
* The dash, hyphen, bullet and enum lists all have a special
- * HEAD character (temporarily bold, in some cases).
+ * HEAD character (temporarily bold, in some cases).
*/
if (MDOC_HEAD == n->type)
switch (type) {
- case (LIST_bullet):
+ case LIST_bullet:
term_fontpush(p, TERMFONT_BOLD);
term_word(p, "\\[bu]");
term_fontpop(p);
break;
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
term_fontpush(p, TERMFONT_BOLD);
term_word(p, "\\(hy");
term_fontpop(p);
break;
- case (LIST_enum):
+ case LIST_enum:
(pair->ppair->ppair->count)++;
- snprintf(buf, sizeof(buf), "%d.",
- pair->ppair->ppair->count);
+ snprintf(buf, sizeof(buf), "%d.",
+ pair->ppair->ppair->count);
term_word(p, buf);
break;
default:
break;
}
- /*
+ /*
* If we're not going to process our children, indicate so here.
*/
switch (type) {
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_item):
+ case LIST_item:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
/* FALLTHROUGH */
- case (LIST_enum):
+ case LIST_enum:
if (MDOC_HEAD == n->type)
return(0);
break;
- case (LIST_column):
+ case LIST_column:
if (MDOC_HEAD == n->type)
return(0);
break;
@@ -962,8 +948,6 @@ termp_it_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_it_post(DECL_ARGS)
{
@@ -975,15 +959,15 @@ termp_it_post(DECL_ARGS)
type = n->parent->parent->parent->norm->Bl.type;
switch (type) {
- case (LIST_item):
+ case LIST_item:
/* FALLTHROUGH */
- case (LIST_diag):
+ case LIST_diag:
/* FALLTHROUGH */
- case (LIST_inset):
+ case LIST_inset:
if (MDOC_BODY == n->type)
term_newln(p);
break;
- case (LIST_column):
+ case LIST_column:
if (MDOC_BODY == n->type)
term_flushln(p);
break;
@@ -992,7 +976,7 @@ termp_it_post(DECL_ARGS)
break;
}
- /*
+ /*
* Now that our output is flushed, we can reset our tags. Since
* only `It' sets these flags, we're free to assume that nobody
* has munged them in the meanwhile.
@@ -1003,8 +987,6 @@ termp_it_post(DECL_ARGS)
p->trailspace = 0;
}
-
-/* ARGSUSED */
static int
termp_nm_pre(DECL_ARGS)
{
@@ -1057,8 +1039,6 @@ termp_nm_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_nm_post(DECL_ARGS)
{
@@ -1073,8 +1053,6 @@ termp_nm_post(DECL_ARGS)
term_flushln(p);
}
-
-/* ARGSUSED */
static int
termp_fl_pre(DECL_ARGS)
{
@@ -1090,8 +1068,6 @@ termp_fl_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp__a_pre(DECL_ARGS)
{
@@ -1103,8 +1079,6 @@ termp__a_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_an_pre(DECL_ARGS)
{
@@ -1120,7 +1094,7 @@ termp_an_pre(DECL_ARGS)
* with other macros/text, are split. -split, in this case,
* will override the condition of the implied first -nosplit.
*/
-
+
if (n->sec == SEC_AUTHORS) {
if ( ! (TERMP_ANPREC & p->flags)) {
if (TERMP_SPLIT & p->flags)
@@ -1139,8 +1113,6 @@ termp_an_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_an_post(DECL_ARGS)
{
@@ -1161,8 +1133,6 @@ termp_an_post(DECL_ARGS)
}
-
-/* ARGSUSED */
static int
termp_ns_pre(DECL_ARGS)
{
@@ -1172,8 +1142,6 @@ termp_ns_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_rs_pre(DECL_ARGS)
{
@@ -1185,8 +1153,6 @@ termp_rs_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_rv_pre(DECL_ARGS)
{
@@ -1218,21 +1184,19 @@ termp_rv_pre(DECL_ARGS)
else
term_word(p, "function returns");
- term_word(p, "the value 0 if successful; otherwise the value "
- "-1 is returned and the global variable");
+ term_word(p, "the value 0 if successful; otherwise the "
+ "value -1 is returned and the global variable");
term_fontpush(p, TERMFONT_UNDER);
term_word(p, "errno");
term_fontpop(p);
- term_word(p, "is set to indicate the error.");
+ term_word(p, "is set to indicate the error.");
p->flags |= TERMP_SENTENCE;
return(0);
}
-
-/* ARGSUSED */
static int
termp_ex_pre(DECL_ARGS)
{
@@ -1261,14 +1225,12 @@ termp_ex_pre(DECL_ARGS)
else
term_word(p, "utility exits");
- term_word(p, "0 on success, and >0 if an error occurs.");
+ term_word(p, "0 on success, and >0 if an error occurs.");
p->flags |= TERMP_SENTENCE;
return(0);
}
-
-/* ARGSUSED */
static int
termp_nd_pre(DECL_ARGS)
{
@@ -1284,8 +1246,6 @@ termp_nd_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_bl_pre(DECL_ARGS)
{
@@ -1293,8 +1253,6 @@ termp_bl_pre(DECL_ARGS)
return(MDOC_HEAD != n->type);
}
-
-/* ARGSUSED */
static void
termp_bl_post(DECL_ARGS)
{
@@ -1303,7 +1261,6 @@ termp_bl_post(DECL_ARGS)
term_newln(p);
}
-/* ARGSUSED */
static int
termp_xr_pre(DECL_ARGS)
{
@@ -1314,7 +1271,7 @@ termp_xr_pre(DECL_ARGS)
assert(MDOC_TEXT == n->type);
term_word(p, n->string);
- if (NULL == (n = n->next))
+ if (NULL == (n = n->next))
return(0);
p->flags |= TERMP_NOSPACE;
@@ -1338,7 +1295,7 @@ termp_xr_pre(DECL_ARGS)
static void
synopsis_pre(struct termp *p, const struct mdoc_node *n)
{
- /*
+ /*
* Obviously, if we're not in a SYNOPSIS or no prior macros
* exist, do nothing.
*/
@@ -1350,10 +1307,10 @@ synopsis_pre(struct termp *p, const struct mdoc_node *n)
* newline and return. UNLESS we're `Fo', `Fn', `Fn', in which
* case we soldier on.
*/
- if (n->prev->tok == n->tok &&
- MDOC_Ft != n->tok &&
- MDOC_Fo != n->tok &&
- MDOC_Fn != n->tok) {
+ if (n->prev->tok == n->tok &&
+ MDOC_Ft != n->tok &&
+ MDOC_Fo != n->tok &&
+ MDOC_Fn != n->tok) {
term_newln(p);
return;
}
@@ -1364,18 +1321,18 @@ synopsis_pre(struct termp *p, const struct mdoc_node *n)
* vertical space, else only newline and move on.
*/
switch (n->prev->tok) {
- case (MDOC_Fd):
+ case MDOC_Fd:
/* FALLTHROUGH */
- case (MDOC_Fn):
+ case MDOC_Fn:
/* FALLTHROUGH */
- case (MDOC_Fo):
+ case MDOC_Fo:
/* FALLTHROUGH */
- case (MDOC_In):
+ case MDOC_In:
/* FALLTHROUGH */
- case (MDOC_Vt):
+ case MDOC_Vt:
term_vspace(p);
break;
- case (MDOC_Ft):
+ case MDOC_Ft:
if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
term_vspace(p);
break;
@@ -1387,7 +1344,6 @@ synopsis_pre(struct termp *p, const struct mdoc_node *n)
}
}
-
static int
termp_vt_pre(DECL_ARGS)
{
@@ -1404,8 +1360,6 @@ termp_vt_pre(DECL_ARGS)
return(termp_under_pre(p, pair, meta, n));
}
-
-/* ARGSUSED */
static int
termp_bold_pre(DECL_ARGS)
{
@@ -1414,8 +1368,6 @@ termp_bold_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_fd_pre(DECL_ARGS)
{
@@ -1424,8 +1376,6 @@ termp_fd_pre(DECL_ARGS)
return(termp_bold_pre(p, pair, meta, n));
}
-
-/* ARGSUSED */
static void
termp_fd_post(DECL_ARGS)
{
@@ -1433,8 +1383,6 @@ termp_fd_post(DECL_ARGS)
term_newln(p);
}
-
-/* ARGSUSED */
static int
termp_sh_pre(DECL_ARGS)
{
@@ -1442,16 +1390,16 @@ termp_sh_pre(DECL_ARGS)
/* No vspace between consecutive `Sh' calls. */
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
if (n->prev && MDOC_Sh == n->prev->tok)
if (NULL == n->prev->body->child)
break;
term_vspace(p);
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
term_fontpush(p, TERMFONT_BOLD);
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
p->offset = term_len(p, p->defindent);
if (SEC_AUTHORS == n->sec)
p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT);
@@ -1462,17 +1410,15 @@ termp_sh_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_sh_post(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_HEAD):
+ case MDOC_HEAD:
term_newln(p);
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
term_newln(p);
p->offset = 0;
break;
@@ -1481,8 +1427,6 @@ termp_sh_post(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
termp_bt_pre(DECL_ARGS)
{
@@ -1492,8 +1436,6 @@ termp_bt_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
termp_lb_post(DECL_ARGS)
{
@@ -1502,8 +1444,6 @@ termp_lb_post(DECL_ARGS)
term_newln(p);
}
-
-/* ARGSUSED */
static int
termp_ud_pre(DECL_ARGS)
{
@@ -1513,8 +1453,6 @@ termp_ud_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_d1_pre(DECL_ARGS)
{
@@ -1526,8 +1464,6 @@ termp_d1_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_ft_pre(DECL_ARGS)
{
@@ -1538,8 +1474,6 @@ termp_ft_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_fn_pre(DECL_ARGS)
{
@@ -1601,8 +1535,6 @@ termp_fn_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_fa_pre(DECL_ARGS)
{
@@ -1628,8 +1560,6 @@ termp_fa_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_bd_pre(DECL_ARGS)
{
@@ -1652,9 +1582,9 @@ termp_bd_pre(DECL_ARGS)
* for macro lines, a newline is appended to the line. Blank
* lines are allowed.
*/
-
- if (DISP_literal != n->norm->Bd.type &&
- DISP_unfilled != n->norm->Bd.type)
+
+ if (DISP_literal != n->norm->Bd.type &&
+ DISP_unfilled != n->norm->Bd.type)
return(1);
tabwidth = p->tabwidth;
@@ -1674,21 +1604,21 @@ termp_bd_pre(DECL_ARGS)
* anyway, so don't sweat it.
*/
switch (nn->tok) {
- case (MDOC_Sm):
+ case MDOC_Sm:
/* FALLTHROUGH */
- case (MDOC_br):
+ case MDOC_br:
/* FALLTHROUGH */
- case (MDOC_sp):
+ case MDOC_sp:
/* FALLTHROUGH */
- case (MDOC_Bl):
+ case MDOC_Bl:
/* FALLTHROUGH */
- case (MDOC_D1):
+ case MDOC_D1:
/* FALLTHROUGH */
- case (MDOC_Dl):
+ case MDOC_Dl:
/* FALLTHROUGH */
- case (MDOC_Lp):
+ case MDOC_Lp:
/* FALLTHROUGH */
- case (MDOC_Pp):
+ case MDOC_Pp:
continue;
default:
break;
@@ -1705,21 +1635,19 @@ termp_bd_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
termp_bd_post(DECL_ARGS)
{
size_t rm, rmax;
- if (MDOC_BODY != n->type)
+ if (MDOC_BODY != n->type)
return;
rm = p->rmargin;
rmax = p->maxrmargin;
- if (DISP_literal == n->norm->Bd.type ||
- DISP_unfilled == n->norm->Bd.type)
+ if (DISP_literal == n->norm->Bd.type ||
+ DISP_unfilled == n->norm->Bd.type)
p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
p->flags |= TERMP_NOSPACE;
@@ -1729,8 +1657,6 @@ termp_bd_post(DECL_ARGS)
p->maxrmargin = rmax;
}
-
-/* ARGSUSED */
static int
termp_bx_pre(DECL_ARGS)
{
@@ -1754,8 +1680,6 @@ termp_bx_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_xx_pre(DECL_ARGS)
{
@@ -1764,22 +1688,22 @@ termp_xx_pre(DECL_ARGS)
pp = NULL;
switch (n->tok) {
- case (MDOC_Bsx):
+ case MDOC_Bsx:
pp = "BSD/OS";
break;
- case (MDOC_Dx):
+ case MDOC_Dx:
pp = "DragonFly";
break;
- case (MDOC_Fx):
+ case MDOC_Fx:
pp = "FreeBSD";
break;
- case (MDOC_Nx):
+ case MDOC_Nx:
pp = "NetBSD";
break;
- case (MDOC_Ox):
+ case MDOC_Ox:
pp = "OpenBSD";
break;
- case (MDOC_Ux):
+ case MDOC_Ux:
pp = "UNIX";
break;
default:
@@ -1797,8 +1721,6 @@ termp_xx_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
termp_pf_post(DECL_ARGS)
{
@@ -1806,19 +1728,17 @@ termp_pf_post(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
}
-
-/* ARGSUSED */
static int
termp_ss_pre(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
term_newln(p);
if (n->prev)
term_vspace(p);
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
term_fontpush(p, TERMFONT_BOLD);
p->offset = term_len(p, (p->defindent+1)/2);
break;
@@ -1829,8 +1749,6 @@ termp_ss_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_ss_post(DECL_ARGS)
{
@@ -1839,8 +1757,6 @@ termp_ss_post(DECL_ARGS)
term_newln(p);
}
-
-/* ARGSUSED */
static int
termp_cd_pre(DECL_ARGS)
{
@@ -1850,8 +1766,6 @@ termp_cd_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_in_pre(DECL_ARGS)
{
@@ -1871,8 +1785,6 @@ termp_in_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_in_post(DECL_ARGS)
{
@@ -1887,18 +1799,16 @@ termp_in_post(DECL_ARGS)
term_fontpop(p);
}
-
-/* ARGSUSED */
static int
termp_sp_pre(DECL_ARGS)
{
size_t i, len;
switch (n->tok) {
- case (MDOC_sp):
+ case MDOC_sp:
len = n->child ? a2height(p, n->child->string) : 1;
break;
- case (MDOC_br):
+ case MDOC_br:
len = 0;
break;
default:
@@ -1914,8 +1824,6 @@ termp_sp_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_quote_pre(DECL_ARGS)
{
@@ -1924,49 +1832,49 @@ termp_quote_pre(DECL_ARGS)
return(1);
switch (n->tok) {
- case (MDOC_Ao):
+ case MDOC_Ao:
/* FALLTHROUGH */
- case (MDOC_Aq):
+ case MDOC_Aq:
term_word(p, "<");
break;
- case (MDOC_Bro):
+ case MDOC_Bro:
/* FALLTHROUGH */
- case (MDOC_Brq):
+ case MDOC_Brq:
term_word(p, "{");
break;
- case (MDOC_Oo):
+ case MDOC_Oo:
/* FALLTHROUGH */
- case (MDOC_Op):
+ case MDOC_Op:
/* FALLTHROUGH */
- case (MDOC_Bo):
+ case MDOC_Bo:
/* FALLTHROUGH */
- case (MDOC_Bq):
+ case MDOC_Bq:
term_word(p, "[");
break;
- case (MDOC_Do):
+ case MDOC_Do:
/* FALLTHROUGH */
- case (MDOC_Dq):
+ case MDOC_Dq:
term_word(p, "\\(lq");
break;
- case (MDOC_Eo):
+ case MDOC_Eo:
break;
- case (MDOC_Po):
+ case MDOC_Po:
/* FALLTHROUGH */
- case (MDOC_Pq):
+ case MDOC_Pq:
term_word(p, "(");
break;
- case (MDOC__T):
+ case MDOC__T:
/* FALLTHROUGH */
- case (MDOC_Qo):
+ case MDOC_Qo:
/* FALLTHROUGH */
- case (MDOC_Qq):
+ case MDOC_Qq:
term_word(p, "\"");
break;
- case (MDOC_Ql):
+ case MDOC_Ql:
/* FALLTHROUGH */
- case (MDOC_So):
+ case MDOC_So:
/* FALLTHROUGH */
- case (MDOC_Sq):
+ case MDOC_Sq:
term_word(p, "\\(oq");
break;
default:
@@ -1978,8 +1886,6 @@ termp_quote_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_quote_post(DECL_ARGS)
{
@@ -1990,49 +1896,49 @@ termp_quote_post(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
switch (n->tok) {
- case (MDOC_Ao):
+ case MDOC_Ao:
/* FALLTHROUGH */
- case (MDOC_Aq):
+ case MDOC_Aq:
term_word(p, ">");
break;
- case (MDOC_Bro):
+ case MDOC_Bro:
/* FALLTHROUGH */
- case (MDOC_Brq):
+ case MDOC_Brq:
term_word(p, "}");
break;
- case (MDOC_Oo):
+ case MDOC_Oo:
/* FALLTHROUGH */
- case (MDOC_Op):
+ case MDOC_Op:
/* FALLTHROUGH */
- case (MDOC_Bo):
+ case MDOC_Bo:
/* FALLTHROUGH */
- case (MDOC_Bq):
+ case MDOC_Bq:
term_word(p, "]");
break;
- case (MDOC_Do):
+ case MDOC_Do:
/* FALLTHROUGH */
- case (MDOC_Dq):
+ case MDOC_Dq:
term_word(p, "\\(rq");
break;
- case (MDOC_Eo):
+ case MDOC_Eo:
break;
- case (MDOC_Po):
+ case MDOC_Po:
/* FALLTHROUGH */
- case (MDOC_Pq):
+ case MDOC_Pq:
term_word(p, ")");
break;
- case (MDOC__T):
+ case MDOC__T:
/* FALLTHROUGH */
- case (MDOC_Qo):
+ case MDOC_Qo:
/* FALLTHROUGH */
- case (MDOC_Qq):
+ case MDOC_Qq:
term_word(p, "\"");
break;
- case (MDOC_Ql):
+ case MDOC_Ql:
/* FALLTHROUGH */
- case (MDOC_So):
+ case MDOC_So:
/* FALLTHROUGH */
- case (MDOC_Sq):
+ case MDOC_Sq:
term_word(p, "\\(cq");
break;
default:
@@ -2041,8 +1947,6 @@ termp_quote_post(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
termp_fo_pre(DECL_ARGS)
{
@@ -2085,13 +1989,11 @@ termp_fo_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
termp_fo_post(DECL_ARGS)
{
- if (MDOC_BODY != n->type)
+ if (MDOC_BODY != n->type)
return;
p->flags |= TERMP_NOSPACE;
@@ -2104,8 +2006,6 @@ termp_fo_post(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
termp_bf_pre(DECL_ARGS)
{
@@ -2115,18 +2015,16 @@ termp_bf_pre(DECL_ARGS)
else if (MDOC_BODY != n->type)
return(1);
- if (FONT_Em == n->norm->Bf.font)
+ if (FONT_Em == n->norm->Bf.font)
term_fontpush(p, TERMFONT_UNDER);
- else if (FONT_Sy == n->norm->Bf.font)
+ else if (FONT_Sy == n->norm->Bf.font)
term_fontpush(p, TERMFONT_BOLD);
- else
+ else
term_fontpush(p, TERMFONT_NONE);
return(1);
}
-
-/* ARGSUSED */
static int
termp_sm_pre(DECL_ARGS)
{
@@ -2142,8 +2040,6 @@ termp_sm_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_ap_pre(DECL_ARGS)
{
@@ -2154,8 +2050,6 @@ termp_ap_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp____post(DECL_ARGS)
{
@@ -2183,8 +2077,6 @@ termp____post(DECL_ARGS)
term_word(p, ",");
}
-
-/* ARGSUSED */
static int
termp_li_pre(DECL_ARGS)
{
@@ -2193,8 +2085,6 @@ termp_li_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_lk_pre(DECL_ARGS)
{
@@ -2221,18 +2111,16 @@ termp_lk_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_bk_pre(DECL_ARGS)
{
switch (n->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
return(0);
- case (MDOC_BODY):
+ case MDOC_BODY:
if (n->parent->args || 0 == n->prev->nchild)
p->flags |= TERMP_PREKEEP;
break;
@@ -2244,8 +2132,6 @@ termp_bk_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_bk_post(DECL_ARGS)
{
@@ -2254,7 +2140,6 @@ termp_bk_post(DECL_ARGS)
p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
}
-/* ARGSUSED */
static void
termp__t_post(DECL_ARGS)
{
@@ -2264,13 +2149,12 @@ termp__t_post(DECL_ARGS)
* us instead of underlining us (for disambiguation).
*/
if (n->parent && MDOC_Rs == n->parent->tok &&
- n->parent->norm->Rs.quote_T)
+ n->parent->norm->Rs.quote_T)
termp_quote_post(p, pair, meta, n);
termp____post(p, pair, meta, n);
}
-/* ARGSUSED */
static int
termp__t_pre(DECL_ARGS)
{
@@ -2280,14 +2164,13 @@ termp__t_pre(DECL_ARGS)
* us instead of underlining us (for disambiguation).
*/
if (n->parent && MDOC_Rs == n->parent->tok &&
- n->parent->norm->Rs.quote_T)
+ n->parent->norm->Rs.quote_T)
return(termp_quote_pre(p, pair, meta, n));
term_fontpush(p, TERMFONT_UNDER);
return(1);
}
-/* ARGSUSED */
static int
termp_under_pre(DECL_ARGS)
{
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index f507a5f9065..ec1c12ba317 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.127 2014/04/15 00:41:02 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.128 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -62,11 +62,11 @@ struct valids {
v_post *post;
};
-static int check_count(struct mdoc *, enum mdoc_type,
+static int check_count(struct mdoc *, enum mdoc_type,
enum check_lvl, enum check_ineq, int);
static int check_parent(PRE_ARGS, enum mdoct, enum mdoc_type);
static void check_text(struct mdoc *, int, int, char *);
-static void check_argv(struct mdoc *,
+static void check_argv(struct mdoc *,
struct mdoc_node *, struct mdoc_argv *);
static void check_args(struct mdoc *, struct mdoc_node *);
static enum mdoc_sec a2sec(const char *);
@@ -182,32 +182,32 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ pres_dd, posts_dd }, /* Dd */
{ pres_dt, posts_dt }, /* Dt */
{ pres_os, posts_os }, /* Os */
- { pres_sh, posts_sh }, /* Sh */
- { pres_ss, posts_ss }, /* Ss */
- { pres_pp, posts_pp }, /* Pp */
+ { pres_sh, posts_sh }, /* Sh */
+ { pres_ss, posts_ss }, /* Ss */
+ { pres_pp, posts_pp }, /* Pp */
{ pres_d1, posts_d1 }, /* D1 */
{ pres_dl, posts_dl }, /* Dl */
{ pres_bd, posts_bd }, /* Bd */
{ NULL, NULL }, /* Ed */
- { pres_bl, posts_bl }, /* Bl */
+ { pres_bl, posts_bl }, /* Bl */
{ NULL, NULL }, /* El */
{ pres_it, posts_it }, /* It */
- { NULL, NULL }, /* Ad */
- { pres_an, posts_an }, /* An */
+ { NULL, NULL }, /* Ad */
+ { pres_an, posts_an }, /* An */
{ NULL, posts_defaults }, /* Ar */
- { NULL, NULL }, /* Cd */
+ { NULL, NULL }, /* Cd */
{ NULL, NULL }, /* Cm */
- { NULL, NULL }, /* Dv */
- { NULL, NULL }, /* Er */
- { NULL, NULL }, /* Ev */
- { pres_std, posts_std }, /* Ex */
- { NULL, NULL }, /* Fa */
+ { NULL, NULL }, /* Dv */
+ { NULL, NULL }, /* Er */
+ { NULL, NULL }, /* Ev */
+ { pres_std, posts_std }, /* Ex */
+ { NULL, NULL }, /* Fa */
{ NULL, posts_text }, /* Fd */
{ NULL, NULL }, /* Fl */
- { NULL, NULL }, /* Fn */
- { NULL, NULL }, /* Ft */
- { NULL, NULL }, /* Ic */
- { NULL, posts_text1 }, /* In */
+ { NULL, NULL }, /* Fn */
+ { NULL, NULL }, /* Ft */
+ { NULL, NULL }, /* Ic */
+ { NULL, posts_text1 }, /* In */
{ NULL, posts_defaults }, /* Li */
{ NULL, posts_nd }, /* Nd */
{ NULL, posts_nm }, /* Nm */
@@ -215,10 +215,10 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Ot */
{ NULL, posts_defaults }, /* Pa */
{ pres_std, posts_std }, /* Rv */
- { NULL, posts_st }, /* St */
+ { NULL, posts_st }, /* St */
{ NULL, NULL }, /* Va */
- { NULL, posts_vt }, /* Vt */
- { NULL, posts_text }, /* Xr */
+ { NULL, posts_vt }, /* Vt */
+ { NULL, posts_text }, /* Xr */
{ NULL, posts_text }, /* %A */
{ NULL, posts_hyphtext }, /* %B */ /* FIXME: can be used outside Rs/Re. */
{ NULL, posts_text }, /* %D */
@@ -233,7 +233,7 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Ac */
{ NULL, NULL }, /* Ao */
{ NULL, NULL }, /* Aq */
- { NULL, posts_at }, /* At */
+ { NULL, posts_at }, /* At */
{ NULL, NULL }, /* Bc */
{ NULL, posts_bf }, /* Bf */
{ NULL, NULL }, /* Bo */
@@ -245,11 +245,11 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Do */
{ NULL, NULL }, /* Dq */
{ NULL, NULL }, /* Ec */
- { NULL, NULL }, /* Ef */
- { NULL, NULL }, /* Em */
+ { NULL, NULL }, /* Ef */
+ { NULL, NULL }, /* Em */
{ NULL, NULL }, /* Eo */
{ NULL, NULL }, /* Fx */
- { NULL, NULL }, /* Ms */
+ { NULL, NULL }, /* Ms */
{ NULL, posts_notext }, /* No */
{ NULL, posts_ns }, /* Ns */
{ NULL, NULL }, /* Nx */
@@ -267,15 +267,15 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Sc */
{ NULL, NULL }, /* So */
{ NULL, NULL }, /* Sq */
- { NULL, posts_bool }, /* Sm */
+ { NULL, posts_bool }, /* Sm */
{ NULL, posts_hyph }, /* Sx */
{ NULL, NULL }, /* Sy */
{ NULL, NULL }, /* Tn */
{ NULL, NULL }, /* Ux */
{ NULL, NULL }, /* Xc */
{ NULL, NULL }, /* Xo */
- { NULL, posts_fo }, /* Fo */
- { NULL, NULL }, /* Fc */
+ { NULL, posts_fo }, /* Fo */
+ { NULL, NULL }, /* Fc */
{ NULL, NULL }, /* Oo */
{ NULL, NULL }, /* Oc */
{ NULL, posts_bk }, /* Bk */
@@ -285,12 +285,12 @@ static const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Fr */
{ NULL, posts_eoln }, /* Ud */
{ NULL, posts_lb }, /* Lb */
- { pres_pp, posts_pp }, /* Lp */
- { NULL, NULL }, /* Lk */
- { NULL, posts_defaults }, /* Mt */
- { NULL, NULL }, /* Brq */
- { NULL, NULL }, /* Bro */
- { NULL, NULL }, /* Brc */
+ { pres_pp, posts_pp }, /* Lp */
+ { NULL, NULL }, /* Lk */
+ { NULL, posts_defaults }, /* Mt */
+ { NULL, NULL }, /* Brq */
+ { NULL, NULL }, /* Bro */
+ { NULL, NULL }, /* Brc */
{ NULL, posts_text }, /* %C */
{ NULL, NULL }, /* Es */
{ NULL, NULL }, /* En */
@@ -348,6 +348,7 @@ static const char * const secnames[SEC__MAX] = {
NULL
};
+
int
mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
{
@@ -356,17 +357,17 @@ mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
char *tp;
switch (n->type) {
- case (MDOC_TEXT):
+ case MDOC_TEXT:
tp = n->string;
line = n->line;
pos = n->pos;
check_text(mdoc, line, pos, tp);
/* FALLTHROUGH */
- case (MDOC_TBL):
+ case MDOC_TBL:
/* FALLTHROUGH */
- case (MDOC_EQN):
+ case MDOC_EQN:
/* FALLTHROUGH */
- case (MDOC_ROOT):
+ case MDOC_ROOT:
return(1);
default:
break;
@@ -377,12 +378,11 @@ mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
if (NULL == mdoc_valids[n->tok].pre)
return(1);
for (p = mdoc_valids[n->tok].pre; *p; p++)
- if ( ! (*p)(mdoc, n))
+ if ( ! (*p)(mdoc, n))
return(0);
return(1);
}
-
int
mdoc_valid_post(struct mdoc *mdoc)
{
@@ -393,13 +393,13 @@ mdoc_valid_post(struct mdoc *mdoc)
mdoc->last->flags |= MDOC_VALID;
switch (mdoc->last->type) {
- case (MDOC_TEXT):
+ case MDOC_TEXT:
/* FALLTHROUGH */
- case (MDOC_EQN):
+ case MDOC_EQN:
/* FALLTHROUGH */
- case (MDOC_TBL):
+ case MDOC_TBL:
return(1);
- case (MDOC_ROOT):
+ case MDOC_ROOT:
return(post_root(mdoc));
default:
break;
@@ -408,14 +408,14 @@ mdoc_valid_post(struct mdoc *mdoc)
if (NULL == mdoc_valids[mdoc->last->tok].post)
return(1);
for (p = mdoc_valids[mdoc->last->tok].post; *p; p++)
- if ( ! (*p)(mdoc))
+ if ( ! (*p)(mdoc))
return(0);
return(1);
}
static int
-check_count(struct mdoc *mdoc, enum mdoc_type type,
+check_count(struct mdoc *mdoc, enum mdoc_type type,
enum check_lvl lvl, enum check_ineq ineq, int val)
{
const char *p;
@@ -423,19 +423,19 @@ check_count(struct mdoc *mdoc, enum mdoc_type type,
if (mdoc->last->type != type)
return(1);
-
+
switch (ineq) {
- case (CHECK_LT):
+ case CHECK_LT:
p = "less than ";
if (mdoc->last->nchild < val)
return(1);
break;
- case (CHECK_GT):
+ case CHECK_GT:
p = "more than ";
if (mdoc->last->nchild > val)
return(1);
break;
- case (CHECK_EQ):
+ case CHECK_EQ:
p = "";
if (val == mdoc->last->nchild)
return(1);
@@ -446,9 +446,9 @@ check_count(struct mdoc *mdoc, enum mdoc_type type,
}
t = lvl == CHECK_WARN ? MANDOCERR_ARGCWARN : MANDOCERR_ARGCOUNT;
- mandoc_vmsg(t, mdoc->parse, mdoc->last->line, mdoc->last->pos,
- "want %s%d children (have %d)",
- p, val, mdoc->last->nchild);
+ mandoc_vmsg(t, mdoc->parse, mdoc->last->line,
+ mdoc->last->pos, "want %s%d children (have %d)",
+ p, val, mdoc->last->nchild);
return(1);
}
@@ -562,9 +562,9 @@ check_parent(PRE_ARGS, enum mdoct tok, enum mdoc_type t)
(t == n->parent->type))
return(1);
- mandoc_vmsg(MANDOCERR_SYNTCHILD, mdoc->parse, n->line,
- n->pos, "want parent %s", MDOC_ROOT == t ?
- "<root>" : mdoc_macronames[tok]);
+ mandoc_vmsg(MANDOCERR_SYNTCHILD, mdoc->parse,
+ n->line, n->pos, "want parent %s",
+ MDOC_ROOT == t ? "<root>" : mdoc_macronames[tok]);
return(0);
}
@@ -577,7 +577,7 @@ pre_display(PRE_ARGS)
if (MDOC_BLOCK != n->type)
return(1);
- for (node = mdoc->last->parent; node; node = node->parent)
+ for (node = mdoc->last->parent; node; node = node->parent)
if (MDOC_BLOCK == node->type)
if (MDOC_Bd == node->tok)
break;
@@ -588,7 +588,6 @@ pre_display(PRE_ARGS)
return(1);
}
-
static int
pre_bl(PRE_ARGS)
{
@@ -610,58 +609,57 @@ pre_bl(PRE_ARGS)
return(1);
}
- /*
+ /*
* First figure out which kind of list to use: bind ourselves to
* the first mentioned list type and warn about any remaining
* ones. If we find no list type, we default to LIST_item.
*/
- /* LINTED */
for (i = 0; n->args && i < (int)n->args->argc; i++) {
lt = LIST__NONE;
dup = comp = 0;
width = offs = NULL;
switch (n->args->argv[i].arg) {
/* Set list types. */
- case (MDOC_Bullet):
+ case MDOC_Bullet:
lt = LIST_bullet;
break;
- case (MDOC_Dash):
+ case MDOC_Dash:
lt = LIST_dash;
break;
- case (MDOC_Enum):
+ case MDOC_Enum:
lt = LIST_enum;
break;
- case (MDOC_Hyphen):
+ case MDOC_Hyphen:
lt = LIST_hyphen;
break;
- case (MDOC_Item):
+ case MDOC_Item:
lt = LIST_item;
break;
- case (MDOC_Tag):
+ case MDOC_Tag:
lt = LIST_tag;
break;
- case (MDOC_Diag):
+ case MDOC_Diag:
lt = LIST_diag;
break;
- case (MDOC_Hang):
+ case MDOC_Hang:
lt = LIST_hang;
break;
- case (MDOC_Ohang):
+ case MDOC_Ohang:
lt = LIST_ohang;
break;
- case (MDOC_Inset):
+ case MDOC_Inset:
lt = LIST_inset;
break;
- case (MDOC_Column):
+ case MDOC_Column:
lt = LIST_column;
break;
/* Set list arguments. */
- case (MDOC_Compact):
+ case MDOC_Compact:
dup = n->norm->Bl.comp;
comp = 1;
break;
- case (MDOC_Width):
+ case MDOC_Width:
/* NB: this can be empty! */
if (n->args->argv[i].sz) {
width = n->args->argv[i].value[0];
@@ -670,7 +668,7 @@ pre_bl(PRE_ARGS)
}
mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV);
break;
- case (MDOC_Offset):
+ case MDOC_Offset:
/* NB: this can be empty! */
if (n->args->argv[i].sz) {
offs = n->args->argv[i].value[0];
@@ -706,19 +704,19 @@ pre_bl(PRE_ARGS)
n->norm->Bl.type = lt;
/* Set column information, too. */
if (LIST_column == lt) {
- n->norm->Bl.ncols =
- n->args->argv[i].sz;
+ n->norm->Bl.ncols =
+ n->args->argv[i].sz;
n->norm->Bl.cols = (void *)
- n->args->argv[i].value;
+ n->args->argv[i].value;
}
}
/* The list type should come first. */
if (n->norm->Bl.type == LIST__NONE)
- if (n->norm->Bl.width ||
- n->norm->Bl.offs ||
- n->norm->Bl.comp)
+ if (n->norm->Bl.width ||
+ n->norm->Bl.offs ||
+ n->norm->Bl.comp)
mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST);
continue;
@@ -731,7 +729,7 @@ pre_bl(PRE_ARGS)
n->norm->Bl.type = LIST_item;
}
- /*
+ /*
* Validate the width field. Some list types don't need width
* types and should be warned about them. Others should have it
* and must also be warned. Yet others have a default and need
@@ -739,31 +737,31 @@ pre_bl(PRE_ARGS)
*/
switch (n->norm->Bl.type) {
- case (LIST_tag):
+ case LIST_tag:
if (NULL == n->norm->Bl.width)
mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG);
break;
- case (LIST_column):
+ case LIST_column:
/* FALLTHROUGH */
- case (LIST_diag):
+ case LIST_diag:
/* FALLTHROUGH */
- case (LIST_ohang):
+ case LIST_ohang:
/* FALLTHROUGH */
- case (LIST_inset):
+ case LIST_inset:
/* FALLTHROUGH */
- case (LIST_item):
+ case LIST_item:
if (n->norm->Bl.width)
mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV);
break;
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
if (NULL == n->norm->Bl.width)
n->norm->Bl.width = "2n";
break;
- case (LIST_enum):
+ case LIST_enum:
if (NULL == n->norm->Bl.width)
n->norm->Bl.width = "3n";
break;
@@ -774,12 +772,11 @@ pre_bl(PRE_ARGS)
return(1);
}
-
static int
pre_bd(PRE_ARGS)
{
int i, dup, comp;
- enum mdoc_disp dt;
+ enum mdoc_disp dt;
const char *offs;
struct mdoc_node *np;
@@ -796,32 +793,31 @@ pre_bd(PRE_ARGS)
return(1);
}
- /* LINTED */
for (i = 0; n->args && i < (int)n->args->argc; i++) {
dt = DISP__NONE;
dup = comp = 0;
offs = NULL;
switch (n->args->argv[i].arg) {
- case (MDOC_Centred):
+ case MDOC_Centred:
dt = DISP_centred;
break;
- case (MDOC_Ragged):
+ case MDOC_Ragged:
dt = DISP_ragged;
break;
- case (MDOC_Unfilled):
+ case MDOC_Unfilled:
dt = DISP_unfilled;
break;
- case (MDOC_Filled):
+ case MDOC_Filled:
dt = DISP_filled;
break;
- case (MDOC_Literal):
+ case MDOC_Literal:
dt = DISP_literal;
break;
- case (MDOC_File):
+ case MDOC_File:
mdoc_nmsg(mdoc, n, MANDOCERR_BADDISP);
return(0);
- case (MDOC_Offset):
+ case MDOC_Offset:
/* NB: this can be empty! */
if (n->args->argv[i].sz) {
offs = n->args->argv[i].value[0];
@@ -830,7 +826,7 @@ pre_bd(PRE_ARGS)
}
mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV);
break;
- case (MDOC_Compact):
+ case MDOC_Compact:
comp = 1;
dup = n->norm->Bd.comp;
break;
@@ -870,7 +866,6 @@ pre_bd(PRE_ARGS)
return(1);
}
-
static int
pre_ss(PRE_ARGS)
{
@@ -880,7 +875,6 @@ pre_ss(PRE_ARGS)
return(check_parent(mdoc, n, MDOC_Sh, MDOC_BODY));
}
-
static int
pre_sh(PRE_ARGS)
{
@@ -890,7 +884,6 @@ pre_sh(PRE_ARGS)
return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT));
}
-
static int
pre_it(PRE_ARGS)
{
@@ -901,7 +894,6 @@ pre_it(PRE_ARGS)
return(check_parent(mdoc, n, MDOC_Bl, MDOC_BODY));
}
-
static int
pre_an(PRE_ARGS)
{
@@ -909,10 +901,10 @@ pre_an(PRE_ARGS)
if (NULL == n->args)
return(1);
-
+
for (i = 1; i < (int)n->args->argc; i++)
- mdoc_pmsg(mdoc, n->args->argv[i].line,
- n->args->argv[i].pos, MANDOCERR_IGNARGV);
+ mdoc_pmsg(mdoc, n->args->argv[i].line,
+ n->args->argv[i].pos, MANDOCERR_IGNARGV);
if (MDOC_Split == n->args->argv[0].arg)
n->norm->An.auth = AUTH_split;
@@ -975,7 +967,6 @@ pre_dd(PRE_ARGS)
return(1);
}
-
static int
post_bf(POST_ARGS)
{
@@ -993,7 +984,7 @@ post_bf(POST_ARGS)
np = mdoc->last->pending->parent->head;
} else if (MDOC_BLOCK != mdoc->last->type) {
np = mdoc->last->parent->head;
- } else
+ } else
np = mdoc->last->head;
assert(np);
@@ -1006,9 +997,9 @@ post_bf(POST_ARGS)
assert(MDOC_BLOCK == np->parent->type);
assert(MDOC_Bf == np->parent->tok);
- /*
+ /*
* Cannot have both argument and parameter.
- * If neither is specified, let it through with a warning.
+ * If neither is specified, let it through with a warning.
*/
if (np->parent->args && np->child) {
@@ -1020,7 +1011,7 @@ post_bf(POST_ARGS)
}
/* Extract argument into data. */
-
+
if (np->parent->args) {
arg = np->parent->args->argv[0].arg;
if (MDOC_Emphasis == arg)
@@ -1042,7 +1033,7 @@ post_bf(POST_ARGS)
np->norm->Bf.font = FONT_Li;
else if (0 == strcmp(np->child->string, "Sy"))
np->norm->Bf.font = FONT_Sy;
- else
+ else
mdoc_nmsg(mdoc, np, MANDOCERR_FONTTYPE);
return(1);
@@ -1072,11 +1063,11 @@ post_lb(POST_ARGS)
/* If not, use "library ``xxxx''. */
- sz = strlen(mdoc->last->child->string) +
- 2 + strlen("\\(lqlibrary\\(rq");
+ sz = strlen(mdoc->last->child->string) + 2 +
+ strlen("\\(lqlibrary\\(rq");
buf = mandoc_malloc(sz);
- snprintf(buf, sz, "library \\(lq%s\\(rq",
- mdoc->last->child->string);
+ snprintf(buf, sz, "library \\(lq%s\\(rq",
+ mdoc->last->child->string);
free(mdoc->last->child->string);
mdoc->last->child->string = buf;
return(1);
@@ -1091,7 +1082,6 @@ post_eoln(POST_ARGS)
return(1);
}
-
static int
post_vt(POST_ARGS)
{
@@ -1107,15 +1097,14 @@ post_vt(POST_ARGS)
if (MDOC_BODY != mdoc->last->type)
return(1);
-
+
for (n = mdoc->last->child; n; n = n->next)
- if (MDOC_TEXT != n->type)
+ if (MDOC_TEXT != n->type)
mdoc_nmsg(mdoc, n, MANDOCERR_CHILD);
return(1);
}
-
static int
post_nm(POST_ARGS)
{
@@ -1135,7 +1124,7 @@ post_nm(POST_ARGS)
static int
post_literal(POST_ARGS)
{
-
+
/*
* The `Dl' (note "el" not "one") and `Bd' macros unset the
* MDOC_LITERAL flag as they leave. Note that `Bd' only sets
@@ -1162,37 +1151,37 @@ post_defaults(POST_ARGS)
if (mdoc->last->child)
return(1);
-
+
nn = mdoc->last;
mdoc->next = MDOC_NEXT_CHILD;
switch (nn->tok) {
- case (MDOC_Ar):
+ case MDOC_Ar:
if ( ! mdoc_word_alloc(mdoc, nn->line, nn->pos, "file"))
return(0);
if ( ! mdoc_word_alloc(mdoc, nn->line, nn->pos, "..."))
return(0);
break;
- case (MDOC_At):
+ case MDOC_At:
if ( ! mdoc_word_alloc(mdoc, nn->line, nn->pos, "AT&T"))
return(0);
if ( ! mdoc_word_alloc(mdoc, nn->line, nn->pos, "UNIX"))
return(0);
break;
- case (MDOC_Li):
+ case MDOC_Li:
if ( ! mdoc_word_alloc(mdoc, nn->line, nn->pos, ""))
return(0);
break;
- case (MDOC_Pa):
+ case MDOC_Pa:
/* FALLTHROUGH */
- case (MDOC_Mt):
+ case MDOC_Mt:
if ( ! mdoc_word_alloc(mdoc, nn->line, nn->pos, "~"))
return(0);
break;
default:
abort();
/* NOTREACHED */
- }
+ }
mdoc->last = nn;
return(1);
@@ -1210,7 +1199,7 @@ post_at(POST_ARGS)
* key exist, use that instead of the child; if it doesn't,
* prefix "AT&T UNIX " to the existing data.
*/
-
+
if (NULL == mdoc->last->child)
return(1);
@@ -1250,7 +1239,6 @@ post_an(POST_ARGS)
return(1);
}
-
static int
post_it(POST_ARGS)
{
@@ -1271,37 +1259,37 @@ post_it(POST_ARGS)
}
switch (lt) {
- case (LIST_tag):
+ case LIST_tag:
if (mdoc->last->head->child)
break;
/* FIXME: give this a dummy value. */
mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS);
break;
- case (LIST_hang):
+ case LIST_hang:
/* FALLTHROUGH */
- case (LIST_ohang):
+ case LIST_ohang:
/* FALLTHROUGH */
- case (LIST_inset):
+ case LIST_inset:
/* FALLTHROUGH */
- case (LIST_diag):
+ case LIST_diag:
if (NULL == mdoc->last->head->child)
mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS);
break;
- case (LIST_bullet):
+ case LIST_bullet:
/* FALLTHROUGH */
- case (LIST_dash):
+ case LIST_dash:
/* FALLTHROUGH */
- case (LIST_enum):
+ case LIST_enum:
/* FALLTHROUGH */
- case (LIST_hyphen):
+ case LIST_hyphen:
if (NULL == mdoc->last->body->child)
mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY);
/* FALLTHROUGH */
- case (LIST_item):
+ case LIST_item:
if (mdoc->last->head->child)
mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST);
break;
- case (LIST_column):
+ case LIST_column:
cols = (int)n->norm->Bl.ncols;
assert(NULL == mdoc->last->head->child);
@@ -1320,9 +1308,9 @@ post_it(POST_ARGS)
else
er = MANDOCERR_SYNTARGCOUNT;
- mandoc_vmsg(er, mdoc->parse, mdoc->last->line,
- mdoc->last->pos,
- "columns == %d (have %d)", cols, i);
+ mandoc_vmsg(er, mdoc->parse,
+ mdoc->last->line, mdoc->last->pos,
+ "columns == %d (have %d)", cols, i);
return(MANDOCERR_ARGCOUNT == er);
default:
break;
@@ -1332,7 +1320,7 @@ post_it(POST_ARGS)
}
static int
-post_bl_block(POST_ARGS)
+post_bl_block(POST_ARGS)
{
struct mdoc_node *n, *ni, *nc;
@@ -1346,8 +1334,8 @@ post_bl_block(POST_ARGS)
n = mdoc->last;
- if (LIST_tag == n->norm->Bl.type &&
- NULL == n->norm->Bl.width) {
+ if (LIST_tag == n->norm->Bl.type &&
+ NULL == n->norm->Bl.width) {
if ( ! post_bl_block_tag(mdoc))
return(0);
assert(n->norm->Bl.width);
@@ -1363,11 +1351,11 @@ post_bl_block(POST_ARGS)
nc = ni->body->last;
while (NULL != nc) {
switch (nc->tok) {
- case (MDOC_Pp):
+ case MDOC_Pp:
/* FALLTHROUGH */
- case (MDOC_Lp):
+ case MDOC_Lp:
/* FALLTHROUGH */
- case (MDOC_br):
+ case MDOC_br:
break;
default:
nc = NULL;
@@ -1422,7 +1410,7 @@ post_bl_block_width(POST_ARGS)
assert(n->args);
- for (i = 0; i < (int)n->args->argc; i++)
+ for (i = 0; i < (int)n->args->argc; i++)
if (MDOC_Width == n->args->argv[i].arg)
break;
@@ -1474,7 +1462,7 @@ post_bl_block_tag(POST_ARGS)
sz = ssz;
break;
- }
+ }
/* Defaults to ten ens. */
@@ -1488,8 +1476,8 @@ post_bl_block_tag(POST_ARGS)
assert(n->args);
i = (int)(n->args->argc)++;
- n->args->argv = mandoc_realloc(n->args->argv,
- n->args->argc * sizeof(struct mdoc_argv));
+ n->args->argv = mandoc_realloc(n->args->argv,
+ n->args->argc * sizeof(struct mdoc_argv));
n->args->argv[i].arg = MDOC_Width;
n->args->argv[i].line = n->line;
@@ -1503,9 +1491,8 @@ post_bl_block_tag(POST_ARGS)
return(1);
}
-
static int
-post_bl_head(POST_ARGS)
+post_bl_head(POST_ARGS)
{
struct mdoc_node *np, *nn, *nnp;
int i, j;
@@ -1522,7 +1509,7 @@ post_bl_head(POST_ARGS)
/* First, disallow both types and allow normal-form. */
- /*
+ /*
* TODO: technically, we can accept both and just merge the two
* lists, but I'll leave that for another day.
*/
@@ -1536,7 +1523,7 @@ post_bl_head(POST_ARGS)
np = mdoc->last->parent;
assert(np->args);
- for (j = 0; j < (int)np->args->argc; j++)
+ for (j = 0; j < (int)np->args->argc; j++)
if (MDOC_Column == np->args->argv[j].arg)
break;
@@ -1550,8 +1537,8 @@ post_bl_head(POST_ARGS)
*/
np->args->argv[j].sz = (size_t)mdoc->last->nchild;
- np->args->argv[j].value = mandoc_malloc
- ((size_t)mdoc->last->nchild * sizeof(char *));
+ np->args->argv[j].value = mandoc_malloc(
+ (size_t)mdoc->last->nchild * sizeof(char *));
mdoc->last->norm->Bl.ncols = np->args->argv[j].sz;
mdoc->last->norm->Bl.cols = (void *)np->args->argv[j].value;
@@ -1579,11 +1566,11 @@ post_bl(POST_ARGS)
nbody = mdoc->last;
switch (nbody->type) {
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
return(post_bl_block(mdoc));
- case (MDOC_HEAD):
+ case MDOC_HEAD:
return(post_bl_head(mdoc));
- case (MDOC_BODY):
+ case MDOC_BODY:
break;
default:
return(1);
@@ -1688,14 +1675,14 @@ post_root(POST_ARGS)
n = mdoc->first;
assert(n);
-
+
/* Check that we begin with a proper `Sh'. */
if (NULL == n->child) {
erc++;
mdoc_nmsg(mdoc, n, MANDOCERR_NODOCBODY);
- } else if (MDOC_BLOCK != n->child->type ||
- MDOC_Sh != n->child->tok) {
+ } else if (MDOC_BLOCK != n->child->type ||
+ MDOC_Sh != n->child->tok) {
erc++;
/* Can this be lifted? See rxdebug.1 for example. */
mdoc_nmsg(mdoc, n, MANDOCERR_NODOCBODY);
@@ -1736,10 +1723,10 @@ post_rs(POST_ARGS)
int i, j;
switch (mdoc->last->type) {
- case (MDOC_HEAD):
+ case MDOC_HEAD:
check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_EQ, 0);
return(1);
- case (MDOC_BODY):
+ case MDOC_BODY:
if (mdoc->last->child)
break;
check_count(mdoc, MDOC_BODY, CHECK_WARN, CHECK_GT, 0);
@@ -1793,13 +1780,13 @@ post_rs(POST_ARGS)
if (rsord[i] == nn->tok)
break;
- /*
+ /*
* Remove `nn' from the chain. This somewhat
* repeats mdoc_node_unlink(), but since we're
* just re-ordering, there's no need for the
* full unlink process.
*/
-
+
if (NULL != (next = nn->next))
next->prev = nn->prev;
@@ -1808,7 +1795,7 @@ post_rs(POST_ARGS)
nn->prev = nn->next = NULL;
- /*
+ /*
* Scan back until we reach a node that's
* ordered before `nn'.
*/
@@ -1857,15 +1844,15 @@ post_hyph(POST_ARGS)
n = mdoc->last;
switch (n->type) {
- case (MDOC_HEAD):
+ case MDOC_HEAD:
if (MDOC_Sh == n->tok || MDOC_Ss == n->tok)
break;
return(1);
- case (MDOC_BODY):
+ case MDOC_BODY:
if (MDOC_D1 == n->tok || MDOC_Nd == n->tok)
break;
return(1);
- case (MDOC_ELEM):
+ case MDOC_ELEM:
break;
default:
return(1);
@@ -2021,19 +2008,19 @@ post_sh_head(POST_ARGS)
assert(mdoc->meta.msec);
switch (sec) {
- case (SEC_ERRORS):
+ case SEC_ERRORS:
if (*mdoc->meta.msec == '4')
break;
/* FALLTHROUGH */
- case (SEC_RETURN_VALUES):
+ case SEC_RETURN_VALUES:
/* FALLTHROUGH */
- case (SEC_LIBRARY):
+ case SEC_LIBRARY:
if (*mdoc->meta.msec == '2')
break;
if (*mdoc->meta.msec == '3')
break;
/* FALLTHROUGH */
- case (SEC_CONTEXT):
+ case SEC_CONTEXT:
if (*mdoc->meta.msec == '9')
break;
mandoc_msg(MANDOCERR_SECMSEC, mdoc->parse,
@@ -2079,7 +2066,7 @@ pre_par(PRE_ARGS)
if (MDOC_ELEM != n->type && MDOC_BLOCK != n->type)
return(1);
- /*
+ /*
* Don't allow prior `Lp' or `Pp' prior to a paragraph-type
* block: `Lp', `Pp', or non-compact `Bd' or `Bl'.
*/
@@ -2139,10 +2126,10 @@ pre_literal(PRE_ARGS)
*/
switch (n->tok) {
- case (MDOC_Dl):
+ case MDOC_Dl:
mdoc->flags |= MDOC_LITERAL;
break;
- case (MDOC_Bd):
+ case MDOC_Bd:
if (DISP_literal == n->norm->Bd.type)
mdoc->flags |= MDOC_LITERAL;
if (DISP_unfilled == n->norm->Bd.type)
@@ -2152,7 +2139,7 @@ pre_literal(PRE_ARGS)
abort();
/* NOTREACHED */
}
-
+
return(1);
}
@@ -2209,7 +2196,7 @@ post_dt(POST_ARGS)
if (toupper((unsigned char)*p) == *p)
continue;
- /*
+ /*
* FIXME: don't be lazy: have this make all
* characters be uppercase and just warn once.
*/
@@ -2217,8 +2204,8 @@ post_dt(POST_ARGS)
break;
}
- /* Handles: `.Dt'
- * --> title = unknown, volume = local, msec = 0, arch = NULL
+ /* Handles: `.Dt'
+ * title = unknown, volume = local, msec = 0, arch = NULL
*/
if (NULL == (nn = n->child)) {
@@ -2230,12 +2217,12 @@ post_dt(POST_ARGS)
return(1);
}
- /* Handles: `.Dt TITLE'
- * --> title = TITLE, volume = local, msec = 0, arch = NULL
+ /* Handles: `.Dt TITLE'
+ * title = TITLE, volume = local, msec = 0, arch = NULL
*/
- mdoc->meta.title = mandoc_strdup
- ('\0' == nn->string[0] ? "UNKNOWN" : nn->string);
+ mdoc->meta.title = mandoc_strdup(
+ '\0' == nn->string[0] ? "UNKNOWN" : nn->string);
if (NULL == (nn = nn->next)) {
/* FIXME: warn about missing msec. */
@@ -2246,10 +2233,10 @@ post_dt(POST_ARGS)
}
/* Handles: `.Dt TITLE SEC'
- * --> title = TITLE, volume = SEC is msec ?
- * format(msec) : SEC,
- * msec = SEC is msec ? atoi(msec) : 0,
- * arch = NULL
+ * title = TITLE,
+ * volume = SEC is msec ? format(msec) : SEC,
+ * msec = SEC is msec ? atoi(msec) : 0,
+ * arch = NULL
*/
cp = mandoc_a2msec(nn->string);
@@ -2260,16 +2247,16 @@ post_dt(POST_ARGS)
mdoc_nmsg(mdoc, n, MANDOCERR_BADMSEC);
mdoc->meta.vol = mandoc_strdup(nn->string);
mdoc->meta.msec = mandoc_strdup(nn->string);
- }
+ }
if (NULL == (nn = nn->next))
return(1);
/* Handles: `.Dt TITLE SEC VOL'
- * --> title = TITLE, volume = VOL is vol ?
- * format(VOL) :
- * VOL is arch ? format(arch) :
- * VOL
+ * title = TITLE,
+ * volume = VOL is vol ? format(VOL) :
+ * VOL is arch ? format(arch) :
+ * VOL
*/
cp = mdoc_a2vol(nn->string);
@@ -2282,9 +2269,9 @@ post_dt(POST_ARGS)
mdoc_nmsg(mdoc, nn, MANDOCERR_BADVOLARCH);
free(mdoc->meta.vol);
mdoc->meta.vol = mandoc_strdup(nn->string);
- } else
+ } else
mdoc->meta.arch = mandoc_strdup(cp);
- }
+ }
/* Ignore any subsequent parameters... */
/* FIXME: warn about subsequent parameters. */
@@ -2313,7 +2300,7 @@ post_bx(POST_ARGS)
{
struct mdoc_node *n;
- /*
+ /*
* Make `Bx's second argument always start with an uppercase
* letter. Groff checks if it's an "accepted" term, but we just
* uppercase blindly.
@@ -2321,8 +2308,7 @@ post_bx(POST_ARGS)
n = mdoc->last->child;
if (n && NULL != (n = n->next))
- *n->string = (char)toupper
- ((unsigned char)*n->string);
+ *n->string = (char)toupper((unsigned char)*n->string);
return(1);
}
@@ -2345,7 +2331,7 @@ post_os(POST_ARGS)
* 2. the -Ios=foo command line argument, if provided
* 3. -DOSNAME="\"foo\"", if provided during compilation
* 4. "sysname release" from uname(3)
- */
+ */
free(mdoc->meta.os);
mdoc->meta.os = NULL;
@@ -2364,8 +2350,8 @@ post_os(POST_ARGS)
if (NULL == defbuf) {
if (-1 == uname(&utsname)) {
mdoc_nmsg(mdoc, n, MANDOCERR_UNAME);
- defbuf = mandoc_strdup("UNKNOWN");
- } else
+ defbuf = mandoc_strdup("UNKNOWN");
+ } else
mandoc_asprintf(&defbuf, "%s %s",
utsname.sysname, utsname.release);
}
@@ -2392,7 +2378,7 @@ post_std(POST_ARGS)
if (NULL == mdoc->meta.name)
return(1);
-
+
nn = n;
mdoc->next = MDOC_NEXT_CHILD;
@@ -2403,12 +2389,12 @@ post_std(POST_ARGS)
return(1);
}
-static enum mdoc_sec
+static enum mdoc_sec
a2sec(const char *p)
{
int i;
- for (i = 0; i < (int)SEC__MAX; i++)
+ for (i = 0; i < (int)SEC__MAX; i++)
if (secnames[i] && 0 == strcmp(p, secnames[i]))
return((enum mdoc_sec)i);
@@ -2420,87 +2406,87 @@ macro2len(enum mdoct macro)
{
switch (macro) {
- case(MDOC_Ad):
+ case MDOC_Ad:
return(12);
- case(MDOC_Ao):
+ case MDOC_Ao:
return(12);
- case(MDOC_An):
+ case MDOC_An:
return(12);
- case(MDOC_Aq):
+ case MDOC_Aq:
return(12);
- case(MDOC_Ar):
+ case MDOC_Ar:
return(12);
- case(MDOC_Bo):
+ case MDOC_Bo:
return(12);
- case(MDOC_Bq):
+ case MDOC_Bq:
return(12);
- case(MDOC_Cd):
+ case MDOC_Cd:
return(12);
- case(MDOC_Cm):
+ case MDOC_Cm:
return(10);
- case(MDOC_Do):
+ case MDOC_Do:
return(10);
- case(MDOC_Dq):
+ case MDOC_Dq:
return(12);
- case(MDOC_Dv):
+ case MDOC_Dv:
return(12);
- case(MDOC_Eo):
+ case MDOC_Eo:
return(12);
- case(MDOC_Em):
+ case MDOC_Em:
return(10);
- case(MDOC_Er):
+ case MDOC_Er:
return(17);
- case(MDOC_Ev):
+ case MDOC_Ev:
return(15);
- case(MDOC_Fa):
+ case MDOC_Fa:
return(12);
- case(MDOC_Fl):
+ case MDOC_Fl:
return(10);
- case(MDOC_Fo):
+ case MDOC_Fo:
return(16);
- case(MDOC_Fn):
+ case MDOC_Fn:
return(16);
- case(MDOC_Ic):
+ case MDOC_Ic:
return(10);
- case(MDOC_Li):
+ case MDOC_Li:
return(16);
- case(MDOC_Ms):
+ case MDOC_Ms:
return(6);
- case(MDOC_Nm):
+ case MDOC_Nm:
return(10);
- case(MDOC_No):
+ case MDOC_No:
return(12);
- case(MDOC_Oo):
+ case MDOC_Oo:
return(10);
- case(MDOC_Op):
+ case MDOC_Op:
return(14);
- case(MDOC_Pa):
+ case MDOC_Pa:
return(32);
- case(MDOC_Pf):
+ case MDOC_Pf:
return(12);
- case(MDOC_Po):
+ case MDOC_Po:
return(12);
- case(MDOC_Pq):
+ case MDOC_Pq:
return(12);
- case(MDOC_Ql):
+ case MDOC_Ql:
return(16);
- case(MDOC_Qo):
+ case MDOC_Qo:
return(12);
- case(MDOC_So):
+ case MDOC_So:
return(12);
- case(MDOC_Sq):
+ case MDOC_Sq:
return(12);
- case(MDOC_Sy):
+ case MDOC_Sy:
return(6);
- case(MDOC_Sx):
+ case MDOC_Sx:
return(16);
- case(MDOC_Tn):
+ case MDOC_Tn:
return(10);
- case(MDOC_Va):
+ case MDOC_Va:
return(12);
- case(MDOC_Vt):
+ case MDOC_Vt:
return(12);
- case(MDOC_Xr):
+ case MDOC_Xr:
return(10);
default:
break;
diff --git a/usr.bin/mandoc/out.c b/usr.bin/mandoc/out.c
index a281b9d744f..55cad2527e4 100644
--- a/usr.bin/mandoc/out.c
+++ b/usr.bin/mandoc/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.20 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: out.c,v 1.21 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -35,7 +35,8 @@ static void tblcalc_literal(struct rofftbl *, struct roffcol *,
static void tblcalc_number(struct rofftbl *, struct roffcol *,
const struct tbl_opts *, const struct tbl_dat *);
-/*
+
+/*
* Convert a `scaling unit' to a consistent form, or fail. Scaling
* units are documented in groff.7, mdoc.7, man.7.
*/
@@ -52,10 +53,10 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
i = hasd = 0;
switch (*src) {
- case ('+'):
+ case '+':
src++;
break;
- case ('-'):
+ case '-':
buf[i++] = *src++;
break;
default:
@@ -83,39 +84,39 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
buf[i] = '\0';
switch (*src) {
- case ('c'):
+ case 'c':
unit = SCALE_CM;
break;
- case ('i'):
+ case 'i':
unit = SCALE_IN;
break;
- case ('P'):
+ case 'P':
unit = SCALE_PC;
break;
- case ('p'):
+ case 'p':
unit = SCALE_PT;
break;
- case ('f'):
+ case 'f':
unit = SCALE_FS;
break;
- case ('v'):
+ case 'v':
unit = SCALE_VS;
break;
- case ('m'):
+ case 'm':
unit = SCALE_EM;
break;
- case ('\0'):
+ case '\0':
if (SCALE_MAX == def)
return(0);
unit = SCALE_BU;
break;
- case ('u'):
+ case 'u':
unit = SCALE_BU;
break;
- case ('M'):
+ case 'M':
unit = SCALE_MM;
break;
- case ('n'):
+ case 'n':
unit = SCALE_EN;
break;
default:
@@ -149,8 +150,8 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp)
*/
assert(NULL == tbl->cols);
- tbl->cols = mandoc_calloc
- ((size_t)sp->opts->cols, sizeof(struct roffcol));
+ tbl->cols = mandoc_calloc((size_t)sp->opts->cols,
+ sizeof(struct roffcol));
for ( ; sp; sp = sp->next) {
if (TBL_SPAN_DATA != sp->pos)
@@ -183,26 +184,26 @@ tblcalc_data(struct rofftbl *tbl, struct roffcol *col,
/* Branch down into data sub-types. */
switch (dp->layout->pos) {
- case (TBL_CELL_HORIZ):
+ case TBL_CELL_HORIZ:
/* FALLTHROUGH */
- case (TBL_CELL_DHORIZ):
+ case TBL_CELL_DHORIZ:
sz = (*tbl->len)(1, tbl->arg);
if (col->width < sz)
col->width = sz;
break;
- case (TBL_CELL_LONG):
+ case TBL_CELL_LONG:
/* FALLTHROUGH */
- case (TBL_CELL_CENTRE):
+ case TBL_CELL_CENTRE:
/* FALLTHROUGH */
- case (TBL_CELL_LEFT):
+ case TBL_CELL_LEFT:
/* FALLTHROUGH */
- case (TBL_CELL_RIGHT):
+ case TBL_CELL_RIGHT:
tblcalc_literal(tbl, col, dp);
break;
- case (TBL_CELL_NUMBER):
+ case TBL_CELL_NUMBER:
tblcalc_number(tbl, col, opts, dp);
break;
- case (TBL_CELL_DOWN):
+ case TBL_CELL_DOWN:
break;
default:
abort();
@@ -228,7 +229,7 @@ static void
tblcalc_number(struct rofftbl *tbl, struct roffcol *col,
const struct tbl_opts *opts, const struct tbl_dat *dp)
{
- int i;
+ int i;
size_t sz, psz, ssz, d;
const char *str;
char *cp;
diff --git a/usr.bin/mandoc/out.h b/usr.bin/mandoc/out.h
index f60479552a7..197faf17ddc 100644
--- a/usr.bin/mandoc/out.h
+++ b/usr.bin/mandoc/out.h
@@ -1,4 +1,4 @@
-/* $Id: out.h,v 1.12 2011/09/18 15:54:48 schwarze Exp $ */
+/* $Id: out.h,v 1.13 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -63,8 +63,8 @@ __BEGIN_DECLS
(p)->scale = (v); } \
while (/* CONSTCOND */ 0)
-int a2roffsu(const char *, struct roffsu *, enum roffscale);
-void tblcalc(struct rofftbl *tbl, const struct tbl_span *);
+int a2roffsu(const char *, struct roffsu *, enum roffscale);
+void tblcalc(struct rofftbl *tbl, const struct tbl_span *);
__END_DECLS
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index 114bdeefbaa..97e1d067b23 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.24 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: read.c,v 1.25 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -38,7 +38,7 @@
#define REPARSE_LIMIT 1000
struct buf {
- char *buf; /* binary input buffer */
+ char *buf; /* binary input buffer */
size_t sz; /* size of binary buffer */
};
@@ -55,7 +55,7 @@ struct mparse {
char *sodest; /* filename pointed to by .so */
int reparse_count; /* finite interp. stack */
mandocmsg mmsg; /* warning/error message handler */
- const char *file;
+ const char *file;
struct buf *secondary;
char *defos; /* default operating system */
};
@@ -145,7 +145,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
/* related to equations */
"unexpected literal in equation",
-
+
"generic error",
/* related to equations */
@@ -216,6 +216,7 @@ static const char * const mandoclevels[MANDOCLEVEL_MAX] = {
"SYSERR"
};
+
static void
resize_buf(struct buf *buf, size_t initial)
{
@@ -249,7 +250,7 @@ pset(const char *buf, int pos, struct mparse *curp)
}
if (MPARSE_MDOC & curp->options) {
- if (NULL == curp->pmdoc)
+ if (NULL == curp->pmdoc)
curp->pmdoc = mdoc_alloc(
curp->roff, curp, curp->defos,
MPARSE_QUICK & curp->options ? 1 : 0);
@@ -257,7 +258,7 @@ pset(const char *buf, int pos, struct mparse *curp)
curp->mdoc = curp->pmdoc;
return;
} else if (MPARSE_MAN & curp->options) {
- if (NULL == curp->pman)
+ if (NULL == curp->pman)
curp->pman = man_alloc(curp->roff, curp,
MPARSE_QUICK & curp->options ? 1 : 0);
assert(curp->pman);
@@ -266,16 +267,16 @@ pset(const char *buf, int pos, struct mparse *curp)
}
if (pos >= 3 && 0 == memcmp(buf, ".Dd", 3)) {
- if (NULL == curp->pmdoc)
+ if (NULL == curp->pmdoc)
curp->pmdoc = mdoc_alloc(
curp->roff, curp, curp->defos,
MPARSE_QUICK & curp->options ? 1 : 0);
assert(curp->pmdoc);
curp->mdoc = curp->pmdoc;
return;
- }
+ }
- if (NULL == curp->pman)
+ if (NULL == curp->pman)
curp->pman = man_alloc(curp->roff, curp,
MPARSE_QUICK & curp->options ? 1 : 0);
assert(curp->pman);
@@ -300,8 +301,8 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start)
memset(&ln, 0, sizeof(struct buf));
- lnn = curp->line;
- pos = 0;
+ lnn = curp->line;
+ pos = 0;
for (i = 0; i < (int)blk.sz; ) {
if (0 == pos && '\0' == blk.buf[i])
@@ -338,7 +339,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start)
if (pos + 2 >= (int)ln.sz)
resize_buf(&ln, 256);
- /*
+ /*
* Warn about bogus characters. If you're using
* non-ASCII encoding, you're screwing your
* readers. Since I'd rather this not happen,
@@ -349,10 +350,10 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start)
c = (unsigned char) blk.buf[i];
- if ( ! (isascii(c) &&
- (isgraph(c) || isblank(c)))) {
+ if ( ! (isascii(c) &&
+ (isgraph(c) || isblank(c)))) {
mandoc_msg(MANDOCERR_BADCHAR, curp,
- curp->line, pos, NULL);
+ curp->line, pos, NULL);
i++;
ln.buf[pos++] = '?';
continue;
@@ -406,10 +407,10 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start)
c = (unsigned char) blk.buf[i+1];
- if ( ! (isascii(c) &&
- (isgraph(c) || isblank(c)))) {
+ if ( ! (isascii(c) &&
+ (isgraph(c) || isblank(c)))) {
mandoc_msg(MANDOCERR_BADCHAR, curp,
- curp->line, pos, NULL);
+ curp->line, pos, NULL);
i += 2;
ln.buf[pos++] = '?';
continue;
@@ -421,7 +422,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start)
ln.buf[pos++] = blk.buf[i++];
}
- if (pos >= (int)ln.sz)
+ if (pos >= (int)ln.sz)
resize_buf(&ln, 256);
ln.buf[pos] = '\0';
@@ -444,13 +445,12 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start)
*/
if (curp->secondary) {
- curp->secondary->buf =
- mandoc_realloc
- (curp->secondary->buf,
- curp->secondary->sz + pos + 2);
- memcpy(curp->secondary->buf +
- curp->secondary->sz,
- ln.buf, pos);
+ curp->secondary->buf = mandoc_realloc(
+ curp->secondary->buf,
+ curp->secondary->sz + pos + 2);
+ memcpy(curp->secondary->buf +
+ curp->secondary->sz,
+ ln.buf, pos);
curp->secondary->sz += pos;
curp->secondary->buf
[curp->secondary->sz] = '\n';
@@ -459,31 +459,30 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start)
[curp->secondary->sz] = '\0';
}
rerun:
- rr = roff_parseln
- (curp->roff, curp->line,
- &ln.buf, &ln.sz, of, &of);
+ rr = roff_parseln(curp->roff, curp->line,
+ &ln.buf, &ln.sz, of, &of);
switch (rr) {
- case (ROFF_REPARSE):
+ case ROFF_REPARSE:
if (REPARSE_LIMIT >= ++curp->reparse_count)
mparse_buf_r(curp, ln, 0);
else
mandoc_msg(MANDOCERR_ROFFLOOP, curp,
- curp->line, pos, NULL);
+ curp->line, pos, NULL);
pos = 0;
continue;
- case (ROFF_APPEND):
+ case ROFF_APPEND:
pos = (int)strlen(ln.buf);
continue;
- case (ROFF_RERUN):
+ case ROFF_RERUN:
goto rerun;
- case (ROFF_IGN):
+ case ROFF_IGN:
pos = 0;
continue;
- case (ROFF_ERR):
+ case ROFF_ERR:
assert(MANDOCLEVEL_FATAL <= curp->file_status);
break;
- case (ROFF_SO):
+ case ROFF_SO:
if (0 == (MPARSE_SO & curp->options) &&
(i >= (int)blk.sz || '\0' == blk.buf[i])) {
curp->sodest = mandoc_strdup(ln.buf + of);
@@ -495,7 +494,7 @@ rerun:
* buffer because we're going to descend into
* the file recursively.
*/
- if (curp->secondary)
+ if (curp->secondary)
curp->secondary->sz -= pos + 1;
mparse_readfd(curp, -1, ln.buf + of);
if (MANDOCLEVEL_FATAL <= curp->file_status)
@@ -524,7 +523,7 @@ rerun:
if ( ! (curp->man || curp->mdoc))
pset(ln.buf + of, pos - of, curp);
- /*
+ /*
* Lastly, push down into the parsers themselves. One
* of these will have already been set in the pset()
* routine.
@@ -540,23 +539,23 @@ rerun:
if (ROFF_TBL == rr)
while (NULL != (span = roff_span(curp->roff))) {
rc = curp->man ?
- man_addspan(curp->man, span) :
- mdoc_addspan(curp->mdoc, span);
+ man_addspan(curp->man, span) :
+ mdoc_addspan(curp->mdoc, span);
if (0 == rc)
break;
}
else if (ROFF_EQN == rr)
- rc = curp->mdoc ?
- mdoc_addeqn(curp->mdoc,
- roff_eqn(curp->roff)) :
- man_addeqn(curp->man,
- roff_eqn(curp->roff));
+ rc = curp->mdoc ?
+ mdoc_addeqn(curp->mdoc,
+ roff_eqn(curp->roff)) :
+ man_addeqn(curp->man,
+ roff_eqn(curp->roff));
else if (curp->man || curp->mdoc)
rc = curp->man ?
- man_parseln(curp->man,
- curp->line, ln.buf, of) :
- mdoc_parseln(curp->mdoc,
- curp->line, ln.buf, of);
+ man_parseln(curp->man,
+ curp->line, ln.buf, of) :
+ mdoc_parseln(curp->mdoc,
+ curp->line, ln.buf, of);
if (0 == rc) {
assert(MANDOCLEVEL_FATAL <= curp->file_status);
@@ -835,7 +834,7 @@ mandoc_vmsg(enum mandocerr t, struct mparse *m,
}
void
-mandoc_msg(enum mandocerr er, struct mparse *m,
+mandoc_msg(enum mandocerr er, struct mparse *m,
int ln, int col, const char *msg)
{
enum mandoclevel level;
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 1320bf7d111..57ab76b1dc3 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.79 2014/04/08 01:36:50 schwarze Exp $ */
+/* $Id: roff.c,v 1.80 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -133,7 +133,7 @@ struct roffnode {
#define ROFF_ARGS struct roff *r, /* parse ctx */ \
enum rofft tok, /* tok of macro */ \
- char **bufp, /* input buffer */ \
+ char **bufp, /* input buffer */ \
size_t *szp, /* size of input buffer */ \
int ln, /* parse line */ \
int ppos, /* original pos in buffer */ \
@@ -189,7 +189,7 @@ static int roff_getop(const char *, int *, char *);
static int roff_getregn(const struct roff *,
const char *, size_t);
static int roff_getregro(const char *name);
-static const char *roff_getstrn(const struct roff *,
+static const char *roff_getstrn(const struct roff *,
const char *, size_t);
static enum rofferr roff_it(ROFF_ARGS);
static enum rofferr roff_line_ignore(ROFF_ARGS);
@@ -198,13 +198,13 @@ static void roff_openeqn(struct roff *, const char *,
int, int, const char *);
static enum rofft roff_parse(struct roff *, const char *, int *);
static enum rofferr roff_parsetext(char **, size_t *, int, int *);
-static enum rofferr roff_res(struct roff *,
+static enum rofferr roff_res(struct roff *,
char **, size_t *, int, int);
static enum rofferr roff_rm(ROFF_ARGS);
static enum rofferr roff_rr(ROFF_ARGS);
static void roff_setstr(struct roff *,
const char *, const char *, int);
-static void roff_setstrn(struct roffkv **, const char *,
+static void roff_setstrn(struct roffkv **, const char *,
size_t, const char *, size_t, int);
static enum rofferr roff_so(ROFF_ARGS);
static enum rofferr roff_tr(ROFF_ARGS);
@@ -311,6 +311,7 @@ static const struct predef predefs[PREDEFS_MAX] = {
static int roffit_lines; /* number of lines to delay */
static char *roffit_macro; /* nil-terminated macro line */
+
static void
roffhash_init(void)
{
@@ -363,7 +364,6 @@ roffhash_find(const char *p, size_t s)
return(ROFF_MAX);
}
-
/*
* Pop the current node off of the stack of roff instructions currently
* pending.
@@ -374,7 +374,7 @@ roffnode_pop(struct roff *r)
struct roffnode *p;
assert(r->last);
- p = r->last;
+ p = r->last;
r->last = r->last->parent;
free(p->name);
@@ -382,7 +382,6 @@ roffnode_pop(struct roff *r)
free(p);
}
-
/*
* Push a roff node onto the instruction stack. This must later be
* removed with roffnode_pop().
@@ -405,7 +404,6 @@ roffnode_push(struct roff *r, enum rofft tok, const char *name,
r->last = p;
}
-
static void
roff_free1(struct roff *r)
{
@@ -455,7 +453,6 @@ roff_reset(struct roff *r)
r->control = 0;
}
-
void
roff_free(struct roff *r)
{
@@ -464,7 +461,6 @@ roff_free(struct roff *r)
free(r);
}
-
struct roff *
roff_alloc(struct mparse *parse, int options)
{
@@ -474,7 +470,7 @@ roff_alloc(struct mparse *parse, int options)
r->parse = parse;
r->options = options;
r->rstackpos = -1;
-
+
roffhash_init();
return(r);
@@ -529,15 +525,15 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
term = '\0';
cp = stesc + 1;
switch (*cp) {
- case ('*'):
+ case '*':
res = NULL;
break;
- case ('B'):
+ case 'B':
/* FALLTHROUGH */
- case ('w'):
+ case 'w':
term = cp[1];
/* FALLTHROUGH */
- case ('n'):
+ case 'n':
res = ubuf;
break;
default:
@@ -561,14 +557,14 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
if ('\0' == term) {
switch (*++cp) {
- case ('\0'):
+ case '\0':
maxl = 0;
break;
- case ('('):
+ case '(':
cp++;
maxl = 2;
break;
- case ('['):
+ case '[':
cp++;
term = ']';
maxl = 0;
@@ -587,10 +583,8 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
for (naml = 0; 0 == maxl || naml < maxl; naml++, cp++) {
if ('\0' == *cp) {
- mandoc_msg
- (MANDOCERR_BADESCAPE,
- r->parse, ln,
- (int)(stesc - *bufp), NULL);
+ mandoc_msg(MANDOCERR_BADESCAPE, r->parse,
+ ln, (int)(stesc - *bufp), NULL);
break;
}
if (0 == maxl && *cp == term) {
@@ -605,30 +599,29 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
*/
switch (stesc[1]) {
- case ('*'):
+ case '*':
res = roff_getstrn(r, stnam, naml);
break;
- case ('B'):
+ case 'B':
npos = 0;
irc = roff_evalnum(stnam, &npos, NULL, 0);
ubuf[0] = irc && stnam + npos + 1 == cp
? '1' : '0';
ubuf[1] = '\0';
break;
- case ('n'):
+ case 'n':
snprintf(ubuf, sizeof(ubuf), "%d",
roff_getregn(r, stnam, naml));
break;
- case ('w'):
+ case 'w':
snprintf(ubuf, sizeof(ubuf), "%d",
24 * (int)naml);
break;
}
if (NULL == res) {
- mandoc_msg
- (MANDOCERR_BADESCAPE, r->parse,
- ln, (int)(stesc - *bufp), NULL);
+ mandoc_msg(MANDOCERR_BADESCAPE, r->parse,
+ ln, (int)(stesc - *bufp), NULL);
res = "";
}
ressz = strlen(res);
@@ -709,7 +702,7 @@ roff_parsetext(char **bufp, size_t *szp, int pos, int *offs)
}
enum rofferr
-roff_parseln(struct roff *r, int ln, char **bufp,
+roff_parseln(struct roff *r, int ln, char **bufp,
size_t *szp, int pos, int *offs)
{
enum rofft t;
@@ -740,8 +733,7 @@ roff_parseln(struct roff *r, int ln, char **bufp,
if (r->last && ! ctl) {
t = r->last->tok;
assert(roffs[t].text);
- e = (*roffs[t].text)
- (r, t, bufp, szp, ln, pos, pos, offs);
+ e = (*roffs[t].text)(r, t, bufp, szp, ln, pos, pos, offs);
assert(ROFF_IGN == e || ROFF_CONT == e);
if (ROFF_CONT != e)
return(e);
@@ -763,9 +755,8 @@ roff_parseln(struct roff *r, int ln, char **bufp,
if (r->last) {
t = r->last->tok;
assert(roffs[t].sub);
- return((*roffs[t].sub)
- (r, t, bufp, szp,
- ln, ppos, pos, offs));
+ return((*roffs[t].sub)(r, t, bufp, szp,
+ ln, ppos, pos, offs));
}
/*
@@ -778,29 +769,26 @@ roff_parseln(struct roff *r, int ln, char **bufp,
return(ROFF_CONT);
assert(roffs[t].proc);
- return((*roffs[t].proc)
- (r, t, bufp, szp,
- ln, ppos, pos, offs));
+ return((*roffs[t].proc)(r, t, bufp, szp, ln, ppos, pos, offs));
}
-
void
roff_endparse(struct roff *r)
{
if (r->last)
mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse,
- r->last->line, r->last->col, NULL);
+ r->last->line, r->last->col, NULL);
if (r->eqn) {
- mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse,
- r->eqn->eqn.ln, r->eqn->eqn.pos, NULL);
+ mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse,
+ r->eqn->eqn.ln, r->eqn->eqn.pos, NULL);
eqn_end(&r->eqn);
}
if (r->tbl) {
- mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse,
- r->tbl->line, r->tbl->pos, NULL);
+ mandoc_msg(MANDOCERR_SCOPEEXIT, r->parse,
+ r->tbl->line, r->tbl->pos, NULL);
tbl_end(&r->tbl);
}
}
@@ -816,8 +804,8 @@ roff_parse(struct roff *r, const char *buf, int *pos)
size_t maclen;
enum rofft t;
- if ('\0' == buf[*pos] || '"' == buf[*pos] ||
- '\t' == buf[*pos] || ' ' == buf[*pos])
+ if ('\0' == buf[*pos] || '"' == buf[*pos] ||
+ '\t' == buf[*pos] || ' ' == buf[*pos])
return(ROFF_MAX);
/* We stop the macro parse at an escape, tab, space, or nil. */
@@ -836,7 +824,6 @@ roff_parse(struct roff *r, const char *buf, int *pos)
return(t);
}
-/* ARGSUSED */
static enum rofferr
roff_cblock(ROFF_ARGS)
{
@@ -852,18 +839,18 @@ roff_cblock(ROFF_ARGS)
}
switch (r->last->tok) {
- case (ROFF_am):
+ case ROFF_am:
/* FALLTHROUGH */
- case (ROFF_ami):
+ case ROFF_ami:
/* FALLTHROUGH */
- case (ROFF_am1):
+ case ROFF_am1:
/* FALLTHROUGH */
- case (ROFF_de):
+ case ROFF_de:
/* ROFF_de1 is remapped to ROFF_de in roff_block(). */
/* FALLTHROUGH */
- case (ROFF_dei):
+ case ROFF_dei:
/* FALLTHROUGH */
- case (ROFF_ig):
+ case ROFF_ig:
break;
default:
mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL);
@@ -879,7 +866,6 @@ roff_cblock(ROFF_ARGS)
}
-
static void
roffnode_cleanscope(struct roff *r)
{
@@ -891,7 +877,6 @@ roffnode_cleanscope(struct roff *r)
}
}
-
static void
roff_ccond(struct roff *r, int ln, int ppos)
{
@@ -902,11 +887,11 @@ roff_ccond(struct roff *r, int ln, int ppos)
}
switch (r->last->tok) {
- case (ROFF_el):
+ case ROFF_el:
/* FALLTHROUGH */
- case (ROFF_ie):
+ case ROFF_ie:
/* FALLTHROUGH */
- case (ROFF_if):
+ case ROFF_if:
break;
default:
mandoc_msg(MANDOCERR_NOSCOPE, r->parse, ln, ppos, NULL);
@@ -923,8 +908,6 @@ roff_ccond(struct roff *r, int ln, int ppos)
return;
}
-
-/* ARGSUSED */
static enum rofferr
roff_block(ROFF_ARGS)
{
@@ -1003,8 +986,6 @@ roff_block(ROFF_ARGS)
return(ROFF_IGN);
}
-
-/* ARGSUSED */
static enum rofferr
roff_block_sub(ROFF_ARGS)
{
@@ -1025,10 +1006,10 @@ roff_block_sub(ROFF_ARGS)
if ((*bufp)[i] != r->last->end[j])
break;
- if ('\0' == r->last->end[j] &&
- ('\0' == (*bufp)[i] ||
- ' ' == (*bufp)[i] ||
- '\t' == (*bufp)[i])) {
+ if ('\0' == r->last->end[j] &&
+ ('\0' == (*bufp)[i] ||
+ ' ' == (*bufp)[i] ||
+ '\t' == (*bufp)[i])) {
roffnode_pop(r);
roffnode_cleanscope(r);
@@ -1060,12 +1041,9 @@ roff_block_sub(ROFF_ARGS)
}
assert(roffs[t].proc);
- return((*roffs[t].proc)(r, t, bufp, szp,
- ln, ppos, pos, offs));
+ return((*roffs[t].proc)(r, t, bufp, szp, ln, ppos, pos, offs));
}
-
-/* ARGSUSED */
static enum rofferr
roff_block_text(ROFF_ARGS)
{
@@ -1076,8 +1054,6 @@ roff_block_text(ROFF_ARGS)
return(ROFF_IGN);
}
-
-/* ARGSUSED */
static enum rofferr
roff_cond_sub(ROFF_ARGS)
{
@@ -1098,7 +1074,7 @@ roff_cond_sub(ROFF_ARGS)
(rr || ROFFMAC_STRUCT & roffs[t].flags)) {
assert(roffs[t].proc);
return((*roffs[t].proc)(r, t, bufp, szp,
- ln, ppos, pos, offs));
+ ln, ppos, pos, offs));
}
/*
@@ -1122,7 +1098,6 @@ roff_cond_sub(ROFF_ARGS)
return(rr ? ROFF_CONT : ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_cond_text(ROFF_ARGS)
{
@@ -1233,20 +1208,20 @@ roff_evalcond(const char *v, int *pos)
wanttrue = 1;
switch (v[*pos]) {
- case ('n'):
+ case 'n':
/* FALLTHROUGH */
- case ('o'):
+ case 'o':
(*pos)++;
return(wanttrue);
- case ('c'):
+ case 'c':
/* FALLTHROUGH */
- case ('d'):
+ case 'd':
/* FALLTHROUGH */
- case ('e'):
+ case 'e':
/* FALLTHROUGH */
- case ('r'):
+ case 'r':
/* FALLTHROUGH */
- case ('t'):
+ case 't':
(*pos)++;
return(!wanttrue);
default:
@@ -1259,7 +1234,6 @@ roff_evalcond(const char *v, int *pos)
return(roff_evalstrcond(v, pos) == wanttrue);
}
-/* ARGSUSED */
static enum rofferr
roff_line_ignore(ROFF_ARGS)
{
@@ -1267,24 +1241,23 @@ roff_line_ignore(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_cond(ROFF_ARGS)
{
roffnode_push(r, tok, NULL, ln, ppos);
- /*
+ /*
* An `.el' has no conditional body: it will consume the value
* of the current rstack entry set in prior `ie' calls or
- * defaults to DENY.
+ * defaults to DENY.
*
* If we're not an `el', however, then evaluate the conditional.
*/
r->last->rule = ROFF_el == tok ?
- (r->rstackpos < 0 ? 0 : r->rstack[r->rstackpos--]) :
- roff_evalcond(*bufp, &pos);
+ (r->rstackpos < 0 ? 0 : r->rstack[r->rstackpos--]) :
+ roff_evalcond(*bufp, &pos);
/*
* An if-else will put the NEGATION of the current evaluated
@@ -1293,8 +1266,8 @@ roff_cond(ROFF_ARGS)
if (ROFF_ie == tok) {
if (r->rstackpos == RSTACK_MAX - 1) {
- mandoc_msg(MANDOCERR_MEM,
- r->parse, ln, ppos, NULL);
+ mandoc_msg(MANDOCERR_MEM,
+ r->parse, ln, ppos, NULL);
return(ROFF_ERR);
}
r->rstack[++r->rstackpos] = !r->last->rule;
@@ -1325,7 +1298,7 @@ roff_cond(ROFF_ARGS)
r->last->endspan = -1;
pos += 2;
goto out;
- }
+ }
/*
* Anything else following the conditional causes
@@ -1343,8 +1316,6 @@ out:
return(ROFF_RERUN);
}
-
-/* ARGSUSED */
static enum rofferr
roff_ds(ROFF_ARGS)
{
@@ -1386,31 +1357,31 @@ roff_getop(const char *v, int *pos, char *res)
*res = v[*pos];
switch (*res) {
- case ('+'):
+ case '+':
/* FALLTHROUGH */
- case ('-'):
+ case '-':
/* FALLTHROUGH */
- case ('*'):
+ case '*':
/* FALLTHROUGH */
- case ('/'):
+ case '/':
/* FALLTHROUGH */
- case ('%'):
+ case '%':
/* FALLTHROUGH */
- case ('&'):
+ case '&':
/* FALLTHROUGH */
- case (':'):
+ case ':':
break;
case '<':
switch (v[*pos + 1]) {
- case ('='):
+ case '=':
*res = 'l';
(*pos)++;
break;
- case ('>'):
+ case '>':
*res = '!';
(*pos)++;
break;
- case ('?'):
+ case '?':
*res = 'i';
(*pos)++;
break;
@@ -1420,11 +1391,11 @@ roff_getop(const char *v, int *pos, char *res)
break;
case '>':
switch (v[*pos + 1]) {
- case ('='):
+ case '=':
*res = 'g';
(*pos)++;
break;
- case ('?'):
+ case '?':
*res = 'a';
(*pos)++;
break;
@@ -1518,50 +1489,50 @@ roff_evalnum(const char *v, int *pos, int *res, int skipwhite)
continue;
switch (operator) {
- case ('+'):
+ case '+':
*res += operand2;
break;
- case ('-'):
+ case '-':
*res -= operand2;
break;
- case ('*'):
+ case '*':
*res *= operand2;
break;
- case ('/'):
+ case '/':
*res /= operand2;
break;
- case ('%'):
+ case '%':
*res %= operand2;
break;
- case ('<'):
+ case '<':
*res = *res < operand2;
break;
- case ('>'):
+ case '>':
*res = *res > operand2;
break;
- case ('l'):
+ case 'l':
*res = *res <= operand2;
break;
- case ('g'):
+ case 'g':
*res = *res >= operand2;
break;
- case ('='):
+ case '=':
*res = *res == operand2;
break;
- case ('!'):
+ case '!':
*res = *res != operand2;
break;
- case ('&'):
+ case '&':
*res = *res && operand2;
break;
- case (':'):
+ case ':':
*res = *res || operand2;
break;
- case ('i'):
+ case 'i':
if (operand2 < *res)
*res = operand2;
break;
- case ('a'):
+ case 'a':
if (operand2 > *res)
*res = operand2;
break;
@@ -1612,17 +1583,17 @@ roff_getregro(const char *name)
{
switch (*name) {
- case ('A'): /* ASCII approximation mode is always off. */
+ case 'A': /* ASCII approximation mode is always off. */
return(0);
- case ('g'): /* Groff compatibility mode is always on. */
+ case 'g': /* Groff compatibility mode is always on. */
return(1);
- case ('H'): /* Fixed horizontal resolution. */
+ case 'H': /* Fixed horizontal resolution. */
return (24);
- case ('j'): /* Always adjust left margin only. */
+ case 'j': /* Always adjust left margin only. */
return(0);
- case ('T'): /* Some output device is always defined. */
+ case 'T': /* Some output device is always defined. */
return(1);
- case ('V'): /* Fixed vertical resolution. */
+ case 'V': /* Fixed vertical resolution. */
return (40);
default:
return (-1);
@@ -1727,7 +1698,6 @@ roff_rr(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_rm(ROFF_ARGS)
{
@@ -1743,7 +1713,6 @@ roff_rm(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_it(ROFF_ARGS)
{
@@ -1757,7 +1726,7 @@ roff_it(ROFF_ARGS)
cp[len] = '\0';
if ((iv = mandoc_strntoi(cp, len, 10)) <= 0) {
mandoc_msg(MANDOCERR_NUMERIC, r->parse,
- ln, ppos, *bufp + 1);
+ ln, ppos, *bufp + 1);
return(ROFF_IGN);
}
cp += len + 1;
@@ -1768,7 +1737,6 @@ roff_it(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_Dd(ROFF_ARGS)
{
@@ -1781,7 +1749,6 @@ roff_Dd(ROFF_ARGS)
return(ROFF_CONT);
}
-/* ARGSUSED */
static enum rofferr
roff_TH(ROFF_ARGS)
{
@@ -1794,7 +1761,6 @@ roff_TH(ROFF_ARGS)
return(ROFF_CONT);
}
-/* ARGSUSED */
static enum rofferr
roff_TE(ROFF_ARGS)
{
@@ -1807,7 +1773,6 @@ roff_TE(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_T_(ROFF_ARGS)
{
@@ -1830,7 +1795,7 @@ roff_closeeqn(struct roff *r)
#endif
static void
-roff_openeqn(struct roff *r, const char *name, int line,
+roff_openeqn(struct roff *r, const char *name, int line,
int offs, const char *buf)
{
struct eqn_node *e;
@@ -1852,7 +1817,6 @@ roff_openeqn(struct roff *r, const char *name, int line,
}
}
-/* ARGSUSED */
static enum rofferr
roff_EQ(ROFF_ARGS)
{
@@ -1861,7 +1825,6 @@ roff_EQ(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_EN(ROFF_ARGS)
{
@@ -1870,7 +1833,6 @@ roff_EN(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_TS(ROFF_ARGS)
{
@@ -1892,7 +1854,6 @@ roff_TS(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_cc(ROFF_ARGS)
{
@@ -1909,7 +1870,6 @@ roff_cc(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_tr(ROFF_ARGS)
{
@@ -1931,9 +1891,9 @@ roff_tr(ROFF_ARGS)
if ('\\' == *first) {
esc = mandoc_escape(&p, NULL, NULL);
if (ESCAPE_ERROR == esc) {
- mandoc_msg
- (MANDOCERR_BADESCAPE, r->parse,
- ln, (int)(p - *bufp), NULL);
+ mandoc_msg(MANDOCERR_BADESCAPE,
+ r->parse, ln,
+ (int)(p - *bufp), NULL);
return(ROFF_IGN);
}
fsz = (size_t)(p - first);
@@ -1943,28 +1903,28 @@ roff_tr(ROFF_ARGS)
if ('\\' == *second) {
esc = mandoc_escape(&p, NULL, NULL);
if (ESCAPE_ERROR == esc) {
- mandoc_msg
- (MANDOCERR_BADESCAPE, r->parse,
- ln, (int)(p - *bufp), NULL);
+ mandoc_msg(MANDOCERR_BADESCAPE,
+ r->parse, ln,
+ (int)(p - *bufp), NULL);
return(ROFF_IGN);
}
ssz = (size_t)(p - second);
} else if ('\0' == *second) {
- mandoc_msg(MANDOCERR_ARGCOUNT, r->parse,
- ln, (int)(p - *bufp), NULL);
+ mandoc_msg(MANDOCERR_ARGCOUNT, r->parse,
+ ln, (int)(p - *bufp), NULL);
second = " ";
p--;
}
if (fsz > 1) {
- roff_setstrn(&r->xmbtab, first,
- fsz, second, ssz, 0);
+ roff_setstrn(&r->xmbtab, first, fsz,
+ second, ssz, 0);
continue;
}
if (NULL == r->xtab)
- r->xtab = mandoc_calloc
- (128, sizeof(struct roffstr));
+ r->xtab = mandoc_calloc(128,
+ sizeof(struct roffstr));
free(r->xtab[(int)*first].p);
r->xtab[(int)*first].p = mandoc_strndup(second, ssz);
@@ -1974,7 +1934,6 @@ roff_tr(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_so(ROFF_ARGS)
{
@@ -1999,7 +1958,6 @@ roff_so(ROFF_ARGS)
return(ROFF_SO);
}
-/* ARGSUSED */
static enum rofferr
roff_userdef(ROFF_ARGS)
{
@@ -2100,7 +2058,7 @@ roff_setstr(struct roff *r, const char *name, const char *string,
{
roff_setstrn(&r->strtab, name, strlen(name), string,
- string ? strlen(string) : 0, append);
+ string ? strlen(string) : 0, append);
}
static void
@@ -2181,8 +2139,8 @@ roff_getstrn(const struct roff *r, const char *name, size_t len)
int i;
for (n = r->strtab; n; n = n->next)
- if (0 == strncmp(name, n->key.p, len) &&
- '\0' == n->key.p[(int)len])
+ if (0 == strncmp(name, n->key.p, len) &&
+ '\0' == n->key.p[(int)len])
return(n->val.p);
for (i = 0; i < PREDEFS_MAX; i++)
@@ -2209,14 +2167,14 @@ roff_freestr(struct roffkv *r)
const struct tbl_span *
roff_span(const struct roff *r)
{
-
+
return(r->tbl ? tbl_span(r->tbl) : NULL);
}
const struct eqn *
roff_eqn(const struct roff *r)
{
-
+
return(r->last_eqn ? &r->last_eqn->eqn : NULL);
}
@@ -2275,8 +2233,8 @@ roff_strdup(const struct roff *r, const char *p)
* Append the match to the array and move
* forward by its keysize.
*/
- res = mandoc_realloc
- (res, ssz + cp->val.sz + 1);
+ res = mandoc_realloc(res,
+ ssz + cp->val.sz + 1);
memcpy(res + ssz, cp->val.p, cp->val.sz);
ssz += cp->val.sz;
p += (int)cp->key.sz;
@@ -2297,8 +2255,8 @@ roff_strdup(const struct roff *r, const char *p)
memcpy(res + ssz, pp, sz);
break;
}
- /*
- * We bail out on bad escapes.
+ /*
+ * We bail out on bad escapes.
* No need to warn: we already did so when
* roff_res() was called.
*/
@@ -2313,7 +2271,7 @@ roff_strdup(const struct roff *r, const char *p)
}
/*
- * Find out whether a line is a macro line or not.
+ * Find out whether a line is a macro line or not.
* If it is, adjust the current position and return one; if it isn't,
* return zero and don't change the current position.
* If the control character has been set with `.cc', then let that grain
diff --git a/usr.bin/mandoc/st.in b/usr.bin/mandoc/st.in
index 3ccdfa06bc8..b0c09cbf504 100644
--- a/usr.bin/mandoc/st.in
+++ b/usr.bin/mandoc/st.in
@@ -1,4 +1,4 @@
-/* $Id: st.in,v 1.17 2013/12/30 09:47:43 schwarze Exp $ */
+/* $Id: st.in,v 1.18 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -22,7 +22,7 @@
* the formatted output string.
*
* Be sure to escape strings.
- * The non-breaking blanks prevent ending an output line right before
+ * The non-breaking blanks prevent ending an output line right before
* a number. Groff prevent line breaks at the same places.
*
* REMEMBER TO ADD NEW STANDARDS TO MDOC.7!
diff --git a/usr.bin/mandoc/tbl.c b/usr.bin/mandoc/tbl.c
index 4f1aa0bc28f..9159bdbc948 100644
--- a/usr.bin/mandoc/tbl.c
+++ b/usr.bin/mandoc/tbl.c
@@ -1,4 +1,4 @@
-/* $Id: tbl.c,v 1.9 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: tbl.c,v 1.10 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,6 +26,7 @@
#include "libmandoc.h"
#include "libroff.h"
+
enum rofferr
tbl_read(struct tbl_node *tbl, int ln, const char *p, int offs)
{
@@ -49,11 +50,11 @@ tbl_read(struct tbl_node *tbl, int ln, const char *p, int offs)
/* Now process each logical section of the table. */
switch (tbl->part) {
- case (TBL_PART_OPTS):
+ case TBL_PART_OPTS:
return(tbl_option(tbl, ln, p) ? ROFF_IGN : ROFF_ERR);
- case (TBL_PART_LAYOUT):
+ case TBL_PART_LAYOUT:
return(tbl_layout(tbl, ln, p) ? ROFF_IGN : ROFF_ERR);
- case (TBL_PART_CDATA):
+ case TBL_PART_CDATA:
return(tbl_cdata(tbl, ln, p) ? ROFF_TBL : ROFF_IGN);
default:
break;
@@ -125,8 +126,8 @@ void
tbl_restart(int line, int pos, struct tbl_node *tbl)
{
if (TBL_PART_CDATA == tbl->part)
- mandoc_msg(MANDOCERR_TBLBLOCK, tbl->parse,
- tbl->line, tbl->pos, NULL);
+ mandoc_msg(MANDOCERR_TBLBLOCK, tbl->parse,
+ tbl->line, tbl->pos, NULL);
tbl->part = TBL_PART_LAYOUT;
tbl->line = line;
@@ -134,7 +135,7 @@ tbl_restart(int line, int pos, struct tbl_node *tbl)
if (NULL == tbl->first_span || NULL == tbl->first_span->first)
mandoc_msg(MANDOCERR_TBLNODATA, tbl->parse,
- tbl->line, tbl->pos, NULL);
+ tbl->line, tbl->pos, NULL);
}
const struct tbl_span *
@@ -159,14 +160,13 @@ tbl_end(struct tbl_node **tblp)
*tblp = NULL;
if (NULL == tbl->first_span || NULL == tbl->first_span->first)
- mandoc_msg(MANDOCERR_TBLNODATA, tbl->parse,
- tbl->line, tbl->pos, NULL);
+ mandoc_msg(MANDOCERR_TBLNODATA, tbl->parse,
+ tbl->line, tbl->pos, NULL);
if (tbl->last_span)
tbl->last_span->flags |= TBL_SPAN_LAST;
if (TBL_PART_CDATA == tbl->part)
- mandoc_msg(MANDOCERR_TBLBLOCK, tbl->parse,
- tbl->line, tbl->pos, NULL);
+ mandoc_msg(MANDOCERR_TBLBLOCK, tbl->parse,
+ tbl->line, tbl->pos, NULL);
}
-
diff --git a/usr.bin/mandoc/tbl_data.c b/usr.bin/mandoc/tbl_data.c
index a1e4d5bfbeb..4031cd84131 100644
--- a/usr.bin/mandoc/tbl_data.c
+++ b/usr.bin/mandoc/tbl_data.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_data.c,v 1.16 2014/03/21 22:17:01 schwarze Exp $ */
+/* $Id: tbl_data.c,v 1.17 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,13 +26,14 @@
#include "libmandoc.h"
#include "libroff.h"
-static int getdata(struct tbl_node *, struct tbl_span *,
+static int getdata(struct tbl_node *, struct tbl_span *,
int, const char *, int *);
-static struct tbl_span *newspan(struct tbl_node *, int,
+static struct tbl_span *newspan(struct tbl_node *, int,
struct tbl_row *);
+
static int
-getdata(struct tbl_node *tbl, struct tbl_span *dp,
+getdata(struct tbl_node *tbl, struct tbl_span *dp,
int ln, const char *p, int *pos)
{
struct tbl_dat *dat;
@@ -45,7 +46,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp,
else if (NULL == dp->last)
cp = dp->layout->first;
- /*
+ /*
* Skip over spanners, since
* we want to match data with data layout cells in the header.
*/
@@ -59,8 +60,8 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp,
*/
if (NULL == cp) {
- mandoc_msg(MANDOCERR_TBLEXTRADAT,
- tbl->parse, ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBLEXTRADAT, tbl->parse,
+ ln, *pos, NULL);
/* Skip to the end... */
while (p[*pos])
(*pos)++;
@@ -78,7 +79,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp,
spans++;
else
break;
-
+
dat->spans = spans;
if (dp->last) {
@@ -123,21 +124,20 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp,
dat->pos = TBL_DATA_DATA;
if (TBL_CELL_HORIZ == dat->layout->pos ||
- TBL_CELL_DHORIZ == dat->layout->pos ||
- TBL_CELL_DOWN == dat->layout->pos)
+ TBL_CELL_DHORIZ == dat->layout->pos ||
+ TBL_CELL_DOWN == dat->layout->pos)
if (TBL_DATA_DATA == dat->pos && '\0' != *dat->string)
- mandoc_msg(MANDOCERR_TBLIGNDATA,
- tbl->parse, ln, sv, NULL);
+ mandoc_msg(MANDOCERR_TBLIGNDATA,
+ tbl->parse, ln, sv, NULL);
return(1);
}
-/* ARGSUSED */
int
tbl_cdata(struct tbl_node *tbl, int ln, const char *p)
{
struct tbl_dat *dat;
- size_t sz;
+ size_t sz;
int pos;
pos = 0;
@@ -168,9 +168,9 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p)
} else
dat->string = mandoc_strdup(p);
- if (TBL_CELL_DOWN == dat->layout->pos)
- mandoc_msg(MANDOCERR_TBLIGNDATA,
- tbl->parse, ln, pos, NULL);
+ if (TBL_CELL_DOWN == dat->layout->pos)
+ mandoc_msg(MANDOCERR_TBLIGNDATA, tbl->parse,
+ ln, pos, NULL);
return(0);
}
@@ -212,7 +212,7 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p)
return(0);
}
- /*
+ /*
* Choose a layout row: take the one following the last parsed
* span's. If that doesn't exist, use the last parsed span's.
* If there's no last parsed span, use the first row. Lastly,
@@ -226,11 +226,11 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p)
for (rp = tbl->last_span->layout->next;
rp && rp->first; rp = rp->next) {
switch (rp->first->pos) {
- case (TBL_CELL_HORIZ):
+ case TBL_CELL_HORIZ:
dp = newspan(tbl, ln, rp);
dp->pos = TBL_SPAN_HORIZ;
continue;
- case (TBL_CELL_DHORIZ):
+ case TBL_CELL_DHORIZ:
dp = newspan(tbl, ln, rp);
dp->pos = TBL_SPAN_DHORIZ;
continue;
diff --git a/usr.bin/mandoc/tbl_html.c b/usr.bin/mandoc/tbl_html.c
index 81e954c2559..86e930d68ea 100644
--- a/usr.bin/mandoc/tbl_html.c
+++ b/usr.bin/mandoc/tbl_html.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_html.c,v 1.6 2012/05/26 20:03:34 schwarze Exp $ */
+/* $Id: tbl_html.c,v 1.7 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,10 +14,6 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -31,15 +27,14 @@ static void html_tblopen(struct html *, const struct tbl_span *);
static size_t html_tbl_len(size_t, void *);
static size_t html_tbl_strlen(const char *, void *);
-/* ARGSUSED */
+
static size_t
html_tbl_len(size_t sz, void *arg)
{
-
+
return(sz);
}
-/* ARGSUSED */
static size_t
html_tbl_strlen(const char *p, void *arg)
{
@@ -107,9 +102,9 @@ print_tbl(struct html *h, const struct tbl_span *sp)
tt = print_otag(h, TAG_TR, 0, NULL);
switch (sp->pos) {
- case (TBL_SPAN_HORIZ):
+ case TBL_SPAN_HORIZ:
/* FALLTHROUGH */
- case (TBL_SPAN_DHORIZ):
+ case TBL_SPAN_DHORIZ:
PAIR_INIT(&tag, ATTR_COLSPAN, "0");
print_otag(h, TAG_TD, 1, &tag);
break;
diff --git a/usr.bin/mandoc/tbl_layout.c b/usr.bin/mandoc/tbl_layout.c
index c07ddd22739..9c96444cf3c 100644
--- a/usr.bin/mandoc/tbl_layout.c
+++ b/usr.bin/mandoc/tbl_layout.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_layout.c,v 1.13 2014/03/28 23:25:54 schwarze Exp $ */
+/* $Id: tbl_layout.c,v 1.14 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -51,16 +51,17 @@ static const struct tbl_phrase keys[KEYS_MAX] = {
{ '=', TBL_CELL_DHORIZ }
};
-static int mods(struct tbl_node *, struct tbl_cell *,
+static int mods(struct tbl_node *, struct tbl_cell *,
int, const char *, int *);
-static int cell(struct tbl_node *, struct tbl_row *,
+static int cell(struct tbl_node *, struct tbl_row *,
int, const char *, int *);
static void row(struct tbl_node *, int, const char *, int *);
static struct tbl_cell *cell_alloc(struct tbl_node *, struct tbl_row *,
enum tbl_cellt, int vert);
+
static int
-mods(struct tbl_node *tbl, struct tbl_cell *cp,
+mods(struct tbl_node *tbl, struct tbl_cell *cp,
int ln, const char *p, int *pos)
{
char buf[5];
@@ -69,35 +70,35 @@ mods(struct tbl_node *tbl, struct tbl_cell *cp,
/* Not all types accept modifiers. */
switch (cp->pos) {
- case (TBL_CELL_DOWN):
+ case TBL_CELL_DOWN:
/* FALLTHROUGH */
- case (TBL_CELL_HORIZ):
+ case TBL_CELL_HORIZ:
/* FALLTHROUGH */
- case (TBL_CELL_DHORIZ):
+ case TBL_CELL_DHORIZ:
return(1);
default:
break;
}
mod:
- /*
+ /*
* XXX: since, at least for now, modifiers are non-conflicting
* (are separable by value, regardless of position), we let
* modifiers come in any order. The existing tbl doesn't let
* this happen.
*/
switch (p[*pos]) {
- case ('\0'):
+ case '\0':
/* FALLTHROUGH */
- case (' '):
+ case ' ':
/* FALLTHROUGH */
- case ('\t'):
+ case '\t':
/* FALLTHROUGH */
- case (','):
+ case ',':
/* FALLTHROUGH */
- case ('.'):
+ case '.':
/* FALLTHROUGH */
- case ('|'):
+ case '|':
return(1);
default:
break;
@@ -113,8 +114,8 @@ mod:
(*pos)++;
goto mod;
}
- mandoc_msg(MANDOCERR_TBLLAYOUT,
- tbl->parse, ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
+ ln, *pos, NULL);
return(0);
}
@@ -131,8 +132,8 @@ mod:
/* No greater than 4 digits. */
if (4 == i) {
- mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
- ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBLLAYOUT,
+ tbl->parse, ln, *pos, NULL);
return(0);
}
@@ -141,69 +142,69 @@ mod:
goto mod;
/* NOTREACHED */
- }
+ }
/* TODO: GNU has many more extensions. */
switch (tolower((unsigned char)p[(*pos)++])) {
- case ('z'):
+ case 'z':
cp->flags |= TBL_CELL_WIGN;
goto mod;
- case ('u'):
+ case 'u':
cp->flags |= TBL_CELL_UP;
goto mod;
- case ('e'):
+ case 'e':
cp->flags |= TBL_CELL_EQUAL;
goto mod;
- case ('t'):
+ case 't':
cp->flags |= TBL_CELL_TALIGN;
goto mod;
- case ('d'):
+ case 'd':
cp->flags |= TBL_CELL_BALIGN;
goto mod;
- case ('w'): /* XXX for now, ignore minimal column width */
+ case 'w': /* XXX for now, ignore minimal column width */
goto mod;
- case ('f'):
+ case 'f':
break;
- case ('r'):
+ case 'r':
/* FALLTHROUGH */
- case ('b'):
+ case 'b':
/* FALLTHROUGH */
- case ('i'):
+ case 'i':
(*pos)--;
break;
default:
mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
- ln, *pos - 1, NULL);
+ ln, *pos - 1, NULL);
return(0);
}
switch (tolower((unsigned char)p[(*pos)++])) {
- case ('3'):
+ case '3':
/* FALLTHROUGH */
- case ('b'):
+ case 'b':
cp->flags |= TBL_CELL_BOLD;
goto mod;
- case ('2'):
+ case '2':
/* FALLTHROUGH */
- case ('i'):
+ case 'i':
cp->flags |= TBL_CELL_ITALIC;
goto mod;
- case ('1'):
+ case '1':
/* FALLTHROUGH */
- case ('r'):
+ case 'r':
goto mod;
default:
break;
}
mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
- ln, *pos - 1, NULL);
+ ln, *pos - 1, NULL);
return(0);
}
static int
-cell(struct tbl_node *tbl, struct tbl_row *rp,
+cell(struct tbl_node *tbl, struct tbl_row *rp,
int ln, const char *p, int *pos)
{
int vert, i;
@@ -230,8 +231,8 @@ cell(struct tbl_node *tbl, struct tbl_row *rp,
break;
if (KEYS_MAX == i) {
- mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
- ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
+ ln, *pos, NULL);
return(0);
}
@@ -248,14 +249,15 @@ cell(struct tbl_node *tbl, struct tbl_row *rp,
if (TBL_CELL_SPAN == c) {
if (NULL == rp->first) {
mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
- ln, *pos, NULL);
+ ln, *pos, NULL);
return(0);
} else if (rp->last)
switch (rp->last->pos) {
- case (TBL_CELL_HORIZ):
- case (TBL_CELL_DHORIZ):
- mandoc_msg(MANDOCERR_TBLLAYOUT, tbl->parse,
- ln, *pos, NULL);
+ case TBL_CELL_HORIZ:
+ /* FALLTHROUGH */
+ case TBL_CELL_DHORIZ:
+ mandoc_msg(MANDOCERR_TBLLAYOUT,
+ tbl->parse, ln, *pos, NULL);
return(0);
default:
break;
@@ -286,7 +288,6 @@ cell(struct tbl_node *tbl, struct tbl_row *rp,
return(mods(tbl, cell_alloc(tbl, rp, c, vert), ln, p, pos));
}
-
static void
row(struct tbl_node *tbl, int ln, const char *p, int *pos)
{
@@ -317,9 +318,9 @@ cell:
if ('.' == p[*pos]) {
tbl->part = TBL_PART_DATA;
- if (NULL == tbl->first_row)
- mandoc_msg(MANDOCERR_TBLNOLAYOUT, tbl->parse,
- ln, *pos, NULL);
+ if (NULL == tbl->first_row)
+ mandoc_msg(MANDOCERR_TBLNOLAYOUT,
+ tbl->parse, ln, *pos, NULL);
(*pos)++;
return;
}
diff --git a/usr.bin/mandoc/tbl_opts.c b/usr.bin/mandoc/tbl_opts.c
index 8111a2aea83..89bc9c636fd 100644
--- a/usr.bin/mandoc/tbl_opts.c
+++ b/usr.bin/mandoc/tbl_opts.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_opts.c,v 1.4 2011/04/24 16:22:02 schwarze Exp $ */
+/* $Id: tbl_opts.c,v 1.5 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -58,10 +58,10 @@ struct tbl_phrase {
static const struct tbl_phrase keys[KEY_MAXKEYS] = {
{ "center", TBL_OPT_CENTRE, KEY_CENTRE},
{ "centre", TBL_OPT_CENTRE, KEY_CENTRE},
- { "delim", 0, KEY_DELIM},
+ { "delim", 0, KEY_DELIM},
{ "expand", TBL_OPT_EXPAND, KEY_EXPAND},
- { "box", TBL_OPT_BOX, KEY_BOX},
- { "doublebox", TBL_OPT_DBOX, KEY_DBOX},
+ { "box", TBL_OPT_BOX, KEY_BOX},
+ { "doublebox", TBL_OPT_DBOX, KEY_DBOX},
{ "allbox", TBL_OPT_ALLBOX, KEY_ALLBOX},
{ "frame", TBL_OPT_BOX, KEY_FRAME},
{ "doubleframe", TBL_OPT_DBOX, KEY_DFRAME},
@@ -72,11 +72,12 @@ static const struct tbl_phrase keys[KEY_MAXKEYS] = {
{ "nospaces", TBL_OPT_NOSPACE, KEY_NOSPACE},
};
-static int arg(struct tbl_node *, int,
+static int arg(struct tbl_node *, int,
const char *, int *, enum tbl_ident);
-static void opt(struct tbl_node *, int,
+static void opt(struct tbl_node *, int,
const char *, int *);
+
static int
arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
{
@@ -89,8 +90,8 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
/* Arguments always begin with a parenthesis. */
if ('(' != p[*pos]) {
- mandoc_msg(MANDOCERR_TBL, tbl->parse,
- ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse,
+ ln, *pos, NULL);
return(0);
}
@@ -103,27 +104,27 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
*/
switch (key) {
- case (KEY_DELIM):
+ case KEY_DELIM:
if ('\0' == p[(*pos)++]) {
mandoc_msg(MANDOCERR_TBL, tbl->parse,
- ln, *pos - 1, NULL);
+ ln, *pos - 1, NULL);
return(0);
- }
+ }
if ('\0' == p[(*pos)++]) {
mandoc_msg(MANDOCERR_TBL, tbl->parse,
- ln, *pos - 1, NULL);
+ ln, *pos - 1, NULL);
return(0);
- }
+ }
break;
- case (KEY_TAB):
+ case KEY_TAB:
if ('\0' != (tbl->opts.tab = p[(*pos)++]))
break;
mandoc_msg(MANDOCERR_TBL, tbl->parse,
- ln, *pos - 1, NULL);
+ ln, *pos - 1, NULL);
return(0);
- case (KEY_LINESIZE):
+ case KEY_LINESIZE:
for (i = 0; i < KEY_MAXNUMSZ && p[*pos]; i++, (*pos)++) {
buf[i] = p[*pos];
if ( ! isdigit((unsigned char)buf[i]))
@@ -138,12 +139,12 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos, NULL);
return(0);
- case (KEY_DPOINT):
+ case KEY_DPOINT:
if ('\0' != (tbl->opts.decimal = p[(*pos)++]))
break;
- mandoc_msg(MANDOCERR_TBL, tbl->parse,
- ln, *pos - 1, NULL);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse,
+ ln, *pos - 1, NULL);
return(0);
default:
abort();
@@ -178,7 +179,7 @@ again: /*
* options ::= option_list [:space:]* [;][\n]
* option_list ::= option option_tail
* option_tail ::= [:space:]+ option_list |
- * ::= epsilon
+ * ::= epsilon
* option ::= [:alpha:]+ args
* args ::= [:space:]* [(] [:alpha:]+ [)]
*/
@@ -211,7 +212,7 @@ again: /*
while (isspace((unsigned char)p[*pos]))
(*pos)++;
- /*
+ /*
* Look through all of the available keys to find one that
* matches the input. FIXME: hashtable this.
*/
@@ -227,7 +228,7 @@ again: /*
* of the sequence altogether.
*/
- if (keys[i].key)
+ if (keys[i].key)
tbl->opts.opts |= keys[i].key;
else if ( ! arg(tbl, ln, p, pos, keys[i].ident))
return;
@@ -235,7 +236,7 @@ again: /*
break;
}
- /*
+ /*
* Allow us to recover from bad options by continuing to another
* parse sequence.
*/
diff --git a/usr.bin/mandoc/tbl_term.c b/usr.bin/mandoc/tbl_term.c
index 5b806d88644..4e4f70a9792 100644
--- a/usr.bin/mandoc/tbl_term.c
+++ b/usr.bin/mandoc/tbl_term.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_term.c,v 1.15 2014/03/28 23:25:54 schwarze Exp $ */
+/* $Id: tbl_term.c,v 1.16 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -28,14 +28,14 @@ static size_t term_tbl_len(size_t, void *);
static size_t term_tbl_strlen(const char *, void *);
static void tbl_char(struct termp *, char, size_t);
static void tbl_data(struct termp *, const struct tbl_opts *,
- const struct tbl_dat *,
+ const struct tbl_dat *,
const struct roffcol *);
static size_t tbl_rulewidth(struct termp *, const struct tbl_head *);
static void tbl_hframe(struct termp *, const struct tbl_span *, int);
-static void tbl_literal(struct termp *, const struct tbl_dat *,
+static void tbl_literal(struct termp *, const struct tbl_dat *,
const struct roffcol *);
-static void tbl_number(struct termp *, const struct tbl_opts *,
- const struct tbl_dat *,
+static void tbl_number(struct termp *, const struct tbl_opts *,
+ const struct tbl_dat *,
const struct roffcol *);
static void tbl_hrule(struct termp *, const struct tbl_span *);
static void tbl_vrule(struct termp *, const struct tbl_head *);
@@ -62,7 +62,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
const struct tbl_dat *dp;
struct roffcol *col;
int spans;
- size_t rmargin, maxrmargin;
+ size_t rmargin, maxrmargin;
rmargin = tp->rmargin;
maxrmargin = tp->maxrmargin;
@@ -104,7 +104,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
if ((TBL_OPT_BOX | TBL_OPT_DBOX) & sp->opts->opts ||
sp->head->vert)
term_word(tp, TBL_SPAN_HORIZ == sp->pos ||
- TBL_SPAN_DHORIZ == sp->pos ? "+" : "|");
+ TBL_SPAN_DHORIZ == sp->pos ? "+" : "|");
/*
* Now print the actual data itself depending on the span type.
@@ -113,18 +113,18 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
*/
switch (sp->pos) {
- case (TBL_SPAN_HORIZ):
+ case TBL_SPAN_HORIZ:
/* FALLTHROUGH */
- case (TBL_SPAN_DHORIZ):
+ case TBL_SPAN_DHORIZ:
tbl_hrule(tp, sp);
break;
- case (TBL_SPAN_DATA):
+ case TBL_SPAN_DATA:
/* Iterate over template headers. */
dp = sp->first;
spans = 0;
for (hp = sp->head; hp; hp = hp->next) {
- /*
+ /*
* If the current data header is invoked during
* a spanner ("spans" > 0), don't emit anything
* at all.
@@ -141,7 +141,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
col = &tp->tbl.cols[hp->ident];
tbl_data(tp, sp->opts, dp, col);
- /*
+ /*
* Go to the next data cell and assign the
* number of subsequent spans, if applicable.
*/
@@ -159,7 +159,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
if ((TBL_OPT_BOX | TBL_OPT_DBOX) & sp->opts->opts ||
sp->layout->vert)
term_word(tp, TBL_SPAN_HORIZ == sp->pos ||
- TBL_SPAN_DHORIZ == sp->pos ? "+" : " |");
+ TBL_SPAN_DHORIZ == sp->pos ? "+" : " |");
term_flushln(tp);
/*
@@ -253,8 +253,8 @@ tbl_hframe(struct termp *tp, const struct tbl_span *sp, int outer)
static void
tbl_data(struct termp *tp, const struct tbl_opts *opts,
- const struct tbl_dat *dp,
- const struct roffcol *col)
+ const struct tbl_dat *dp,
+ const struct roffcol *col)
{
if (NULL == dp) {
@@ -264,43 +264,43 @@ tbl_data(struct termp *tp, const struct tbl_opts *opts,
assert(dp->layout);
switch (dp->pos) {
- case (TBL_DATA_NONE):
+ case TBL_DATA_NONE:
tbl_char(tp, ASCII_NBRSP, col->width);
return;
- case (TBL_DATA_HORIZ):
+ case TBL_DATA_HORIZ:
/* FALLTHROUGH */
- case (TBL_DATA_NHORIZ):
+ case TBL_DATA_NHORIZ:
tbl_char(tp, '-', col->width);
return;
- case (TBL_DATA_NDHORIZ):
+ case TBL_DATA_NDHORIZ:
/* FALLTHROUGH */
- case (TBL_DATA_DHORIZ):
+ case TBL_DATA_DHORIZ:
tbl_char(tp, '=', col->width);
return;
default:
break;
}
-
+
switch (dp->layout->pos) {
- case (TBL_CELL_HORIZ):
+ case TBL_CELL_HORIZ:
tbl_char(tp, '-', col->width);
break;
- case (TBL_CELL_DHORIZ):
+ case TBL_CELL_DHORIZ:
tbl_char(tp, '=', col->width);
break;
- case (TBL_CELL_LONG):
+ case TBL_CELL_LONG:
/* FALLTHROUGH */
- case (TBL_CELL_CENTRE):
+ case TBL_CELL_CENTRE:
/* FALLTHROUGH */
- case (TBL_CELL_LEFT):
+ case TBL_CELL_LEFT:
/* FALLTHROUGH */
- case (TBL_CELL_RIGHT):
+ case TBL_CELL_RIGHT:
tbl_literal(tp, dp, col);
break;
- case (TBL_CELL_NUMBER):
+ case TBL_CELL_NUMBER:
tbl_number(tp, opts, dp, col);
break;
- case (TBL_CELL_DOWN):
+ case TBL_CELL_DOWN:
tbl_char(tp, ASCII_NBRSP, col->width);
break;
default:
@@ -336,7 +336,7 @@ tbl_char(struct termp *tp, char c, size_t len)
}
static void
-tbl_literal(struct termp *tp, const struct tbl_dat *dp,
+tbl_literal(struct termp *tp, const struct tbl_dat *dp,
const struct roffcol *col)
{
struct tbl_head *hp;
@@ -355,17 +355,17 @@ tbl_literal(struct termp *tp, const struct tbl_dat *dp,
padl = 0;
switch (dp->layout->pos) {
- case (TBL_CELL_LONG):
+ case TBL_CELL_LONG:
padl = term_len(tp, 1);
padr = padr > padl ? padr - padl : 0;
break;
- case (TBL_CELL_CENTRE):
+ case TBL_CELL_CENTRE:
if (2 > padr)
break;
padl = padr / 2;
padr -= padl;
break;
- case (TBL_CELL_RIGHT):
+ case TBL_CELL_RIGHT:
padl = padr;
padr = 0;
break;
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index 30ed864bd7a..51153525ac5 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.82 2014/04/08 07:13:01 schwarze Exp $ */
+/* $Id: term.c,v 1.83 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -35,6 +35,7 @@ static void bufferc(struct termp *, char);
static void encode(struct termp *, const char *, size_t);
static void encode1(struct termp *, int);
+
void
term_free(struct termp *p)
{
@@ -47,9 +48,8 @@ term_free(struct termp *p)
free(p);
}
-
void
-term_begin(struct termp *p, term_margin head,
+term_begin(struct termp *p, term_margin head,
term_margin foot, const void *arg)
{
@@ -59,7 +59,6 @@ term_begin(struct termp *p, term_margin head,
(*p->begin)(p);
}
-
void
term_end(struct termp *p)
{
@@ -167,7 +166,7 @@ term_flushln(struct termp *p)
/* Regular word. */
/* Break at the hyphen point if we overrun. */
- if (vend > vis && vend < bp &&
+ if (vend > vis && vend < bp &&
(ASCII_HYPH == p->buf[j] ||
ASCII_BREAK == p->buf[j]))
jhy = j;
@@ -247,7 +246,7 @@ term_flushln(struct termp *p)
(*p->letter)(p, p->buf[i]);
if (8 == p->buf[i])
p->viscol -= (*p->width)(p, p->buf[i-1]);
- else
+ else
p->viscol += (*p->width)(p, p->buf[i]);
}
vis = vend;
@@ -271,7 +270,7 @@ term_flushln(struct termp *p)
if (TERMP_HANG & p->flags) {
p->overstep = (int)(vis - maxvis +
- p->trailspace * (*p->width)(p, ' '));
+ p->trailspace * (*p->width)(p, ' '));
/*
* If we have overstepped the margin, temporarily move
@@ -294,8 +293,7 @@ term_flushln(struct termp *p)
}
}
-
-/*
+/*
* A newline only breaks an existing line; it won't assert vertical
* space. All data in the output buffer is flushed prior to the newline
* assertion.
@@ -309,7 +307,6 @@ term_newln(struct termp *p)
term_flushln(p);
}
-
/*
* Asserts a vertical space (a full, empty line-break between lines).
* Note that if used twice, this will cause two blank spaces and so on.
@@ -338,7 +335,6 @@ term_fontlast(struct termp *p)
p->fontq[p->fonti] = f;
}
-
void
term_fontrepl(struct termp *p, enum termfont f)
{
@@ -347,7 +343,6 @@ term_fontrepl(struct termp *p, enum termfont f)
p->fontq[p->fonti] = f;
}
-
void
term_fontpush(struct termp *p, enum termfont f)
{
@@ -357,7 +352,6 @@ term_fontpush(struct termp *p, enum termfont f)
p->fontq[++p->fonti] = f;
}
-
const void *
term_fontq(struct termp *p)
{
@@ -365,7 +359,6 @@ term_fontq(struct termp *p)
return(&p->fontq[p->fonti]);
}
-
enum termfont
term_fonttop(struct termp *p)
{
@@ -373,7 +366,6 @@ term_fonttop(struct termp *p)
return(p->fontq[p->fonti]);
}
-
void
term_fontpopq(struct termp *p, const void *key)
{
@@ -383,7 +375,6 @@ term_fontpopq(struct termp *p, const void *key)
assert(p->fonti >= 0);
}
-
void
term_fontpop(struct termp *p)
{
@@ -453,13 +444,13 @@ term_word(struct termp *p, const char *word)
if (TERMENC_ASCII != p->enc)
switch (esc) {
- case (ESCAPE_UNICODE):
+ case ESCAPE_UNICODE:
uc = mchars_num2uc(seq + 1, sz - 1);
if ('\0' == uc)
break;
encode1(p, uc);
continue;
- case (ESCAPE_SPECIAL):
+ case ESCAPE_SPECIAL:
uc = mchars_spec2cp(p->symtab, seq, sz);
if (uc <= 0)
break;
@@ -470,45 +461,45 @@ term_word(struct termp *p, const char *word)
}
switch (esc) {
- case (ESCAPE_UNICODE):
+ case ESCAPE_UNICODE:
encode1(p, '?');
break;
- case (ESCAPE_NUMBERED):
+ case ESCAPE_NUMBERED:
c = mchars_num2char(seq, sz);
if ('\0' != c)
encode(p, &c, 1);
break;
- case (ESCAPE_SPECIAL):
+ case ESCAPE_SPECIAL:
cp = mchars_spec2str(p->symtab, seq, sz, &ssz);
- if (NULL != cp)
+ if (NULL != cp)
encode(p, cp, ssz);
else if (1 == ssz)
encode(p, seq, sz);
break;
- case (ESCAPE_FONTBOLD):
+ case ESCAPE_FONTBOLD:
term_fontrepl(p, TERMFONT_BOLD);
break;
- case (ESCAPE_FONTITALIC):
+ case ESCAPE_FONTITALIC:
term_fontrepl(p, TERMFONT_UNDER);
break;
- case (ESCAPE_FONTBI):
+ case ESCAPE_FONTBI:
term_fontrepl(p, TERMFONT_BI);
break;
- case (ESCAPE_FONT):
+ case ESCAPE_FONT:
/* FALLTHROUGH */
- case (ESCAPE_FONTROMAN):
+ case ESCAPE_FONTROMAN:
term_fontrepl(p, TERMFONT_NONE);
break;
- case (ESCAPE_FONTPREV):
+ case ESCAPE_FONTPREV:
term_fontlast(p);
break;
- case (ESCAPE_NOSPACE):
+ case ESCAPE_NOSPACE:
if (TERMP_SKIPCHAR & p->flags)
p->flags &= ~TERMP_SKIPCHAR;
else if ('\0' == *word)
p->flags |= TERMP_NOSPACE;
break;
- case (ESCAPE_SKIPCHAR):
+ case ESCAPE_SKIPCHAR:
p->flags |= TERMP_SKIPCHAR;
break;
default:
@@ -591,7 +582,7 @@ encode(struct termp *p, const char *word, size_t sz)
*/
if (TERMFONT_NONE == term_fonttop(p)) {
- if (p->col + sz >= p->maxcols)
+ if (p->col + sz >= p->maxcols)
adjbuf(p, p->col + sz);
for (i = 0; i < sz; i++)
p->buf[p->col++] = word[i];
@@ -623,11 +614,11 @@ term_setwidth(struct termp *p, const char *wstr)
width = 0;
if (NULL != wstr) {
switch (*wstr) {
- case ('+'):
+ case '+':
iop = 1;
wstr++;
break;
- case ('-'):
+ case '-':
iop = -1;
wstr++;
break;
@@ -684,7 +675,7 @@ term_strlen(const struct termp *p, const char *cp)
sz += cond_width(p, *cp++, &skip);
switch (*cp) {
- case ('\\'):
+ case '\\':
cp++;
esc = mandoc_escape(&cp, &seq, &ssz);
if (ESCAPE_ERROR == esc)
@@ -692,16 +683,16 @@ term_strlen(const struct termp *p, const char *cp)
if (TERMENC_ASCII != p->enc)
switch (esc) {
- case (ESCAPE_UNICODE):
- c = mchars_num2uc
- (seq + 1, ssz - 1);
+ case ESCAPE_UNICODE:
+ c = mchars_num2uc(seq + 1,
+ ssz - 1);
if ('\0' == c)
break;
sz += cond_width(p, c, &skip);
continue;
- case (ESCAPE_SPECIAL):
- c = mchars_spec2cp
- (p->symtab, seq, ssz);
+ case ESCAPE_SPECIAL:
+ c = mchars_spec2cp(p->symtab,
+ seq, ssz);
if (c <= 0)
break;
sz += cond_width(p, c, &skip);
@@ -713,17 +704,17 @@ term_strlen(const struct termp *p, const char *cp)
rhs = NULL;
switch (esc) {
- case (ESCAPE_UNICODE):
+ case ESCAPE_UNICODE:
sz += cond_width(p, '?', &skip);
break;
- case (ESCAPE_NUMBERED):
+ case ESCAPE_NUMBERED:
c = mchars_num2char(seq, ssz);
if ('\0' != c)
sz += cond_width(p, c, &skip);
break;
- case (ESCAPE_SPECIAL):
- rhs = mchars_spec2str
- (p->symtab, seq, ssz, &rsz);
+ case ESCAPE_SPECIAL:
+ rhs = mchars_spec2str(p->symtab,
+ seq, ssz, &rsz);
if (ssz != 1 || rhs)
break;
@@ -731,7 +722,7 @@ term_strlen(const struct termp *p, const char *cp)
rhs = seq;
rsz = ssz;
break;
- case (ESCAPE_SKIPCHAR):
+ case ESCAPE_SKIPCHAR:
skip = 1;
break;
default:
@@ -749,15 +740,15 @@ term_strlen(const struct termp *p, const char *cp)
for (i = 0; i < rsz; i++)
sz += (*p->width)(p, *rhs++);
break;
- case (ASCII_NBRSP):
+ case ASCII_NBRSP:
sz += cond_width(p, ' ', &skip);
cp++;
break;
- case (ASCII_HYPH):
+ case ASCII_HYPH:
sz += cond_width(p, '-', &skip);
cp++;
/* FALLTHROUGH */
- case (ASCII_BREAK):
+ case ASCII_BREAK:
break;
default:
break;
@@ -767,29 +758,28 @@ term_strlen(const struct termp *p, const char *cp)
return(sz);
}
-/* ARGSUSED */
size_t
term_vspan(const struct termp *p, const struct roffsu *su)
{
double r;
switch (su->unit) {
- case (SCALE_CM):
+ case SCALE_CM:
r = su->scale * 2;
break;
- case (SCALE_IN):
+ case SCALE_IN:
r = su->scale * 6;
break;
- case (SCALE_PC):
+ case SCALE_PC:
r = su->scale;
break;
- case (SCALE_PT):
+ case SCALE_PT:
r = su->scale / 8;
break;
- case (SCALE_MM):
+ case SCALE_MM:
r = su->scale / 1000;
break;
- case (SCALE_VS):
+ case SCALE_VS:
r = su->scale;
break;
default:
@@ -799,8 +789,7 @@ term_vspan(const struct termp *p, const struct roffsu *su)
if (r < 0.0)
r = 0.0;
- return(/* LINTED */(size_t)
- r);
+ return((size_t)r);
}
size_t
@@ -811,6 +800,5 @@ term_hspan(const struct termp *p, const struct roffsu *su)
v = ((*p->hspan)(p, su));
if (v < 0.0)
v = 0.0;
- return((size_t) /* LINTED */
- v);
+ return((size_t)v);
}
diff --git a/usr.bin/mandoc/term.h b/usr.bin/mandoc/term.h
index 10cf8a330f7..30671706d58 100644
--- a/usr.bin/mandoc/term.h
+++ b/usr.bin/mandoc/term.h
@@ -1,4 +1,4 @@
-/* $Id: term.h,v 1.44 2014/04/08 07:13:01 schwarze Exp $ */
+/* $Id: term.h,v 1.45 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -111,12 +111,12 @@ void term_newln(struct termp *);
void term_vspace(struct termp *);
void term_word(struct termp *, const char *);
void term_flushln(struct termp *);
-void term_begin(struct termp *, term_margin,
+void term_begin(struct termp *, term_margin,
term_margin, const void *);
void term_end(struct termp *);
void term_setwidth(struct termp *, const char *);
-size_t term_hspan(const struct termp *,
+size_t term_hspan(const struct termp *,
const struct roffsu *);
size_t term_vspan(const struct termp *,
const struct roffsu *);
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c
index 7deeb630cb6..44d16ef593b 100644
--- a/usr.bin/mandoc/term_ascii.c
+++ b/usr.bin/mandoc/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.13 2014/03/30 21:27:59 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.14 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -46,6 +46,7 @@ static void locale_endline(struct termp *);
static void locale_letter(struct termp *, int);
static size_t locale_width(const struct termp *, int);
+
static struct termp *
ascii_init(enum termenc enc, char *outopts)
{
@@ -72,8 +73,8 @@ ascii_init(enum termenc enc, char *outopts)
if (TERMENC_ASCII != enc) {
v = TERMENC_LOCALE == enc ?
- setlocale(LC_ALL, "") :
- setlocale(LC_CTYPE, "en_US.UTF-8");
+ setlocale(LC_ALL, "") :
+ setlocale(LC_CTYPE, "en_US.UTF-8");
if (NULL != v && MB_CUR_MAX > 1) {
p->enc = enc;
p->advance = locale_advance;
@@ -90,13 +91,13 @@ ascii_init(enum termenc enc, char *outopts)
while (outopts && *outopts)
switch (getsubopt(&outopts, UNCONST(toks), &v)) {
- case (0):
+ case 0:
p->defindent = (size_t)atoi(v);
break;
- case (1):
+ case 1:
p->defrmargin = (size_t)atoi(v);
break;
- case (2):
+ case 2:
/*
* Temporary, undocumented mode
* to imitate mdoc(7) output style.
@@ -129,7 +130,6 @@ utf8_alloc(char *outopts)
return(ascii_init(TERMENC_UTF8, outopts));
}
-
void *
locale_alloc(char *outopts)
{
@@ -152,7 +152,6 @@ ascii_setwidth(struct termp *p, int iop, size_t width)
p->rmargin = p->maxrmargin = p->defrmargin;
}
-/* ARGSUSED */
static size_t
ascii_width(const struct termp *p, int c)
{
@@ -167,11 +166,10 @@ ascii_free(void *arg)
term_free((struct termp *)arg);
}
-/* ARGSUSED */
static void
ascii_letter(struct termp *p, int c)
{
-
+
putchar(c);
}
@@ -189,7 +187,6 @@ ascii_end(struct termp *p)
(*p->footf)(p, p->argf);
}
-/* ARGSUSED */
static void
ascii_endline(struct termp *p)
{
@@ -197,17 +194,15 @@ ascii_endline(struct termp *p)
putchar('\n');
}
-/* ARGSUSED */
static void
ascii_advance(struct termp *p, size_t len)
{
- size_t i;
+ size_t i;
for (i = 0; i < len; i++)
putchar(' ');
}
-/* ARGSUSED */
static double
ascii_hspan(const struct termp *p, const struct roffsu *su)
{
@@ -219,22 +214,22 @@ ascii_hspan(const struct termp *p, const struct roffsu *su)
*/
switch (su->unit) {
- case (SCALE_CM):
+ case SCALE_CM:
r = 4 * su->scale;
break;
- case (SCALE_IN):
+ case SCALE_IN:
r = 10 * su->scale;
break;
- case (SCALE_PC):
+ case SCALE_PC:
r = (10 * su->scale) / 6;
break;
- case (SCALE_PT):
+ case SCALE_PT:
r = (10 * su->scale) / 72;
break;
- case (SCALE_MM):
+ case SCALE_MM:
r = su->scale / 1000;
break;
- case (SCALE_VS):
+ case SCALE_VS:
r = su->scale * 2 - 1;
break;
default:
@@ -245,7 +240,6 @@ ascii_hspan(const struct termp *p, const struct roffsu *su)
return(r);
}
-/* ARGSUSED */
static size_t
locale_width(const struct termp *p, int c)
{
@@ -254,17 +248,15 @@ locale_width(const struct termp *p, int c)
return((rc = wcwidth(c)) < 0 ? 0 : rc);
}
-/* ARGSUSED */
static void
locale_advance(struct termp *p, size_t len)
{
- size_t i;
+ size_t i;
for (i = 0; i < len; i++)
putwchar(L' ');
}
-/* ARGSUSED */
static void
locale_endline(struct termp *p)
{
@@ -272,10 +264,9 @@ locale_endline(struct termp *p)
putwchar(L'\n');
}
-/* ARGSUSED */
static void
locale_letter(struct termp *p, int c)
{
-
+
putwchar(c);
}
diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c
index 83ba17bc738..9fd3c2da19f 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.23 2014/03/30 21:27:59 schwarze Exp $ */
+/* $Id: term_ps.c,v 1.24 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -36,11 +36,11 @@
#define PS_BUFSLOP 128
/* Convert PostScript point "x" to an AFM unit. */
-#define PNT2AFM(p, x) /* LINTED */ \
+#define PNT2AFM(p, x) \
(size_t)((double)(x) * (1000.0 / (double)(p)->ps->scale))
/* Convert an AFM unit "x" to a PostScript points */
-#define AFM2PNT(p, x) /* LINTED */ \
+#define AFM2PNT(p, x) \
((double)(x) / (1000.0 / (double)(p)->ps->scale))
struct glyph {
@@ -76,7 +76,7 @@ struct termp_ps {
size_t left; /* body left (AFM units) */
size_t header; /* header pos (AFM units) */
size_t footer; /* footer pos (AFM units) */
- size_t pdfbytes; /* current output byte */
+ size_t pdfbytes; /* current output byte */
size_t pdflastpg; /* byte of last page mark */
size_t pdfbody; /* start of body object */
size_t *pdfobjs; /* table of object offsets */
@@ -447,7 +447,7 @@ pspdf_alloc(char *outopts)
p->letter = ps_letter;
p->setwidth = ps_setwidth;
p->width = ps_width;
-
+
toks[0] = "paper";
toks[1] = NULL;
@@ -455,7 +455,7 @@ pspdf_alloc(char *outopts)
while (outopts && *outopts)
switch (getsubopt(&outopts, UNCONST(toks), &v)) {
- case (0):
+ case 0:
pp = v;
break;
default:
@@ -491,7 +491,7 @@ pspdf_alloc(char *outopts)
fprintf(stderr, "%s: Unknown paper\n", pp);
}
- /*
+ /*
* This MUST be defined before any PNT2AFM or AFM2PNT
* calculations occur.
*/
@@ -505,10 +505,8 @@ pspdf_alloc(char *outopts)
/* Margins are 1/9 the page x and y. */
- marginx = /* LINTED */
- (size_t)((double)pagex / 9.0);
- marginy = /* LINTED */
- (size_t)((double)pagey / 9.0);
+ marginx = (size_t)((double)pagex / 9.0);
+ marginy = (size_t)((double)pagey / 9.0);
/* Line-height is 1.4em. */
@@ -527,7 +525,6 @@ pspdf_alloc(char *outopts)
return(p);
}
-
static void
ps_setwidth(struct termp *p, int iop, size_t width)
{
@@ -543,7 +540,6 @@ ps_setwidth(struct termp *p, int iop, size_t width)
p->ps->lastwidth = lastwidth;
}
-
void
pspdf_free(void *arg)
{
@@ -560,7 +556,6 @@ pspdf_free(void *arg)
term_free(p);
}
-
static void
ps_printf(struct termp *p, const char *fmt, ...)
{
@@ -578,12 +573,11 @@ ps_printf(struct termp *p, const char *fmt, ...)
if ( ! (PS_MARGINS & p->ps->flags)) {
len = vprintf(fmt, ap);
va_end(ap);
- p->ps->pdfbytes += /* LINTED */
- len < 0 ? 0 : (size_t)len;
+ p->ps->pdfbytes += len < 0 ? 0 : (size_t)len;
return;
}
- /*
+ /*
* XXX: I assume that the in-margin print won't exceed
* PS_BUFSLOP (128 bytes), which is reasonable but still an
* assumption that will cause pukeage if it's not the case.
@@ -599,7 +593,6 @@ ps_printf(struct termp *p, const char *fmt, ...)
p->ps->psmargcur = strlen(p->ps->psmarg);
}
-
static void
ps_putchar(struct termp *p, char c)
{
@@ -608,7 +601,6 @@ ps_putchar(struct termp *p, char c)
/* See ps_printf(). */
if ( ! (PS_MARGINS & p->ps->flags)) {
- /* LINTED */
putchar(c);
p->ps->pdfbytes++;
return;
@@ -621,7 +613,6 @@ ps_putchar(struct termp *p, char c)
p->ps->psmarg[pos] = '\0';
}
-
static void
pdf_obj(struct termp *p, size_t obj)
{
@@ -630,9 +621,8 @@ pdf_obj(struct termp *p, size_t obj)
if ((obj - 1) >= p->ps->pdfobjsz) {
p->ps->pdfobjsz = obj + 128;
- p->ps->pdfobjs = realloc
- (p->ps->pdfobjs,
- p->ps->pdfobjsz * sizeof(size_t));
+ p->ps->pdfobjs = realloc(p->ps->pdfobjs,
+ p->ps->pdfobjsz * sizeof(size_t));
if (NULL == p->ps->pdfobjs) {
perror(NULL);
exit((int)MANDOCLEVEL_SYSERR);
@@ -643,7 +633,6 @@ pdf_obj(struct termp *p, size_t obj)
ps_printf(p, "%zu 0 obj\n", obj);
}
-
static void
ps_closepage(struct termp *p)
{
@@ -676,7 +665,7 @@ ps_closepage(struct termp *p)
pdf_obj(p, base + 2);
ps_printf(p, "<<\n/ProcSet [/PDF /Text]\n");
ps_printf(p, "/Font <<\n");
- for (i = 0; i < (int)TERMFONT__MAX; i++)
+ for (i = 0; i < (int)TERMFONT__MAX; i++)
ps_printf(p, "/F%d %d 0 R\n", i, 3 + i);
ps_printf(p, ">>\n>>\n");
@@ -697,8 +686,6 @@ ps_closepage(struct termp *p)
p->ps->flags |= PS_NEWPAGE;
}
-
-/* ARGSUSED */
static void
ps_end(struct termp *p)
{
@@ -721,7 +708,7 @@ ps_end(struct termp *p)
ps_printf(p, "%%%%Pages: %zu\n", p->ps->pages);
ps_printf(p, "%%%%EOF\n");
return;
- }
+ }
pdf_obj(p, 2);
ps_printf(p, "<<\n/Type /Pages\n");
@@ -733,11 +720,9 @@ ps_end(struct termp *p)
ps_printf(p, "/Kids [");
for (i = 0; i < p->ps->pages; i++)
- ps_printf(p, " %zu 0 R", i * 4 +
- p->ps->pdfbody + 3);
+ ps_printf(p, " %zu 0 R", i * 4 + p->ps->pdfbody + 3);
- base = (p->ps->pages - 1) * 4 +
- p->ps->pdfbody + 4;
+ base = (p->ps->pages - 1) * 4 + p->ps->pdfbody + 4;
ps_printf(p, "]\n>>\nendobj\n");
pdf_obj(p, base);
@@ -751,8 +736,8 @@ ps_end(struct termp *p)
ps_printf(p, "0000000000 65535 f \n");
for (i = 0; i < base; i++)
- ps_printf(p, "%.10zu 00000 n \n",
- p->ps->pdfobjs[(int)i]);
+ ps_printf(p, "%.10zu 00000 n \n",
+ p->ps->pdfobjs[(int)i]);
ps_printf(p, "trailer\n");
ps_printf(p, "<<\n");
@@ -765,14 +750,13 @@ ps_end(struct termp *p)
ps_printf(p, "%%%%EOF\n");
}
-
static void
ps_begin(struct termp *p)
{
time_t t;
int i;
- /*
+ /*
* Print margins into margin buffer. Nothing gets output to the
* screen yet, so we don't need to initialise the primary state.
*/
@@ -805,7 +789,7 @@ ps_begin(struct termp *p)
assert(p->ps->psmarg);
assert('\0' != p->ps->psmarg[0]);
- /*
+ /*
* Print header and initialise page state. Following this,
* stuff gets printed to the screen, so make sure we're sane.
*/
@@ -820,9 +804,9 @@ ps_begin(struct termp *p)
ps_printf(p, "%%%%Pages: (atend)\n");
ps_printf(p, "%%%%PageOrder: Ascend\n");
ps_printf(p, "%%%%DocumentMedia: "
- "Default %zu %zu 0 () ()\n",
- (size_t)AFM2PNT(p, p->ps->width),
- (size_t)AFM2PNT(p, p->ps->height));
+ "Default %zu %zu 0 () ()\n",
+ (size_t)AFM2PNT(p, p->ps->width),
+ (size_t)AFM2PNT(p, p->ps->height));
ps_printf(p, "%%%%DocumentNeededResources: font");
for (i = 0; i < (int)TERMFONT__MAX; i++)
@@ -854,7 +838,6 @@ ps_begin(struct termp *p)
ps_setfont(p, TERMFONT_NONE);
}
-
static void
ps_pletter(struct termp *p, int c)
{
@@ -867,25 +850,23 @@ ps_pletter(struct termp *p, int c)
if (PS_NEWPAGE & p->ps->flags) {
if (TERMTYPE_PS == p->type) {
- ps_printf(p, "%%%%Page: %zu %zu\n",
- p->ps->pages + 1,
- p->ps->pages + 1);
- ps_printf(p, "/%s %zu selectfont\n",
- fonts[(int)p->ps->lastf].name,
- p->ps->scale);
+ ps_printf(p, "%%%%Page: %zu %zu\n",
+ p->ps->pages + 1, p->ps->pages + 1);
+ ps_printf(p, "/%s %zu selectfont\n",
+ fonts[(int)p->ps->lastf].name,
+ p->ps->scale);
} else {
- pdf_obj(p, p->ps->pdfbody +
- p->ps->pages * 4);
+ pdf_obj(p, p->ps->pdfbody +
+ p->ps->pages * 4);
ps_printf(p, "<<\n");
- ps_printf(p, "/Length %zu 0 R\n",
- p->ps->pdfbody + 1 +
- p->ps->pages * 4);
+ ps_printf(p, "/Length %zu 0 R\n",
+ p->ps->pdfbody + 1 + p->ps->pages * 4);
ps_printf(p, ">>\nstream\n");
}
p->ps->pdflastpg = p->ps->pdfbytes;
p->ps->flags &= ~PS_NEWPAGE;
}
-
+
/*
* If we're not in a PostScript "word" context, then open one
* now at the current cursor.
@@ -893,16 +874,15 @@ ps_pletter(struct termp *p, int c)
if ( ! (PS_INLINE & p->ps->flags)) {
if (TERMTYPE_PS != p->type) {
- ps_printf(p, "BT\n/F%d %zu Tf\n",
- (int)p->ps->lastf,
- p->ps->scale);
+ ps_printf(p, "BT\n/F%d %zu Tf\n",
+ (int)p->ps->lastf, p->ps->scale);
ps_printf(p, "%.3f %.3f Td\n(",
- AFM2PNT(p, p->ps->pscol),
- AFM2PNT(p, p->ps->psrow));
+ AFM2PNT(p, p->ps->pscol),
+ AFM2PNT(p, p->ps->psrow));
} else
- ps_printf(p, "%.3f %.3f moveto\n(",
- AFM2PNT(p, p->ps->pscol),
- AFM2PNT(p, p->ps->psrow));
+ ps_printf(p, "%.3f %.3f moveto\n(",
+ AFM2PNT(p, p->ps->pscol),
+ AFM2PNT(p, p->ps->psrow));
p->ps->flags |= PS_INLINE;
}
@@ -916,11 +896,11 @@ ps_pletter(struct termp *p, int c)
*/
switch (c) {
- case ('('):
+ case '(':
/* FALLTHROUGH */
- case (')'):
+ case ')':
/* FALLTHROUGH */
- case ('\\'):
+ case '\\':
ps_putchar(p, '\\');
break;
default:
@@ -935,19 +915,18 @@ ps_pletter(struct termp *p, int c)
ps_putchar(p, ' ');
p->ps->pscol += (size_t)fonts[f].gly[0].wx;
return;
- }
+ }
ps_putchar(p, (char)c);
c -= 32;
p->ps->pscol += (size_t)fonts[f].gly[c].wx;
}
-
static void
ps_pclose(struct termp *p)
{
- /*
+ /*
* Spit out that we're exiting a word context (this is a
* "partial close" because we don't check the last-char buffer
* or anything).
@@ -955,7 +934,7 @@ ps_pclose(struct termp *p)
if ( ! (PS_INLINE & p->ps->flags))
return;
-
+
if (TERMTYPE_PS != p->type) {
ps_printf(p, ") Tj\nET\n");
} else
@@ -964,7 +943,6 @@ ps_pclose(struct termp *p)
p->ps->flags &= ~PS_INLINE;
}
-
static void
ps_fclose(struct termp *p)
{
@@ -992,13 +970,11 @@ ps_fclose(struct termp *p)
ps_pclose(p);
}
-
static void
ps_letter(struct termp *p, int arg)
{
char cc, c;
- /* LINTED */
c = arg >= 128 || arg <= 0 ? '?' : arg;
/*
@@ -1043,7 +1019,6 @@ ps_letter(struct termp *p, int arg)
ps_pletter(p, c);
}
-
static void
ps_advance(struct termp *p, size_t len)
{
@@ -1059,7 +1034,6 @@ ps_advance(struct termp *p, size_t len)
p->ps->pscol += len;
}
-
static void
ps_endline(struct termp *p)
{
@@ -1071,7 +1045,7 @@ ps_endline(struct termp *p)
/*
* If we're in the margin, don't try to recalculate our current
* row. XXX: if the column tries to be fancy with multiple
- * lines, we'll do nasty stuff.
+ * lines, we'll do nasty stuff.
*/
if (PS_MARGINS & p->ps->flags)
@@ -1091,8 +1065,7 @@ ps_endline(struct termp *p)
* showpage and restart our row.
*/
- if (p->ps->psrow >= p->ps->lineheight +
- p->ps->bottom) {
+ if (p->ps->psrow >= p->ps->lineheight + p->ps->bottom) {
p->ps->psrow -= p->ps->lineheight;
return;
}
@@ -1100,14 +1073,13 @@ ps_endline(struct termp *p)
ps_closepage(p);
}
-
static void
ps_setfont(struct termp *p, enum termfont f)
{
assert(f < TERMFONT__MAX);
p->ps->lastf = f;
-
+
/*
* If we're still at the top of the page, let the font-setting
* be delayed until we actually have stuff to print.
@@ -1117,17 +1089,13 @@ ps_setfont(struct termp *p, enum termfont f)
return;
if (TERMTYPE_PS == p->type)
- ps_printf(p, "/%s %zu selectfont\n",
- fonts[(int)f].name,
- p->ps->scale);
+ ps_printf(p, "/%s %zu selectfont\n",
+ fonts[(int)f].name, p->ps->scale);
else
- ps_printf(p, "/F%d %zu Tf\n",
- (int)f,
- p->ps->scale);
+ ps_printf(p, "/F%d %zu Tf\n",
+ (int)f, p->ps->scale);
}
-
-/* ARGSUSED */
static size_t
ps_width(const struct termp *p, int c)
{
@@ -1139,42 +1107,41 @@ ps_width(const struct termp *p, int c)
return((size_t)fonts[(int)TERMFONT_NONE].gly[c].wx);
}
-
static double
ps_hspan(const struct termp *p, const struct roffsu *su)
{
double r;
-
+
/*
* All of these measurements are derived by converting from the
* native measurement to AFM units.
*/
switch (su->unit) {
- case (SCALE_CM):
+ case SCALE_CM:
r = PNT2AFM(p, su->scale * 28.34);
break;
- case (SCALE_IN):
+ case SCALE_IN:
r = PNT2AFM(p, su->scale * 72);
break;
- case (SCALE_PC):
+ case SCALE_PC:
r = PNT2AFM(p, su->scale * 12);
break;
- case (SCALE_PT):
+ case SCALE_PT:
r = PNT2AFM(p, su->scale * 100);
break;
- case (SCALE_EM):
+ case SCALE_EM:
r = su->scale *
- fonts[(int)TERMFONT_NONE].gly[109 - 32].wx;
+ fonts[(int)TERMFONT_NONE].gly[109 - 32].wx;
break;
- case (SCALE_MM):
+ case SCALE_MM:
r = PNT2AFM(p, su->scale * 2.834);
break;
- case (SCALE_EN):
+ case SCALE_EN:
r = su->scale *
- fonts[(int)TERMFONT_NONE].gly[110 - 32].wx;
+ fonts[(int)TERMFONT_NONE].gly[110 - 32].wx;
break;
- case (SCALE_VS):
+ case SCALE_VS:
r = su->scale * p->ps->lineheight;
break;
default:
@@ -1199,4 +1166,3 @@ ps_growbuf(struct termp *p, size_t sz)
p->ps->psmarg = mandoc_realloc
(p->ps->psmarg, p->ps->psmargsz);
}
-
diff --git a/usr.bin/mandoc/tree.c b/usr.bin/mandoc/tree.c
index edbd2945d12..defa6161898 100644
--- a/usr.bin/mandoc/tree.c
+++ b/usr.bin/mandoc/tree.c
@@ -1,4 +1,4 @@
-/* $Id: tree.c,v 1.20 2014/03/08 15:50:21 schwarze Exp $ */
+/* $Id: tree.c,v 1.21 2014/04/20 16:44:44 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -32,7 +32,6 @@ static void print_mdoc(const struct mdoc_node *, int);
static void print_span(const struct tbl_span *, int);
-/* ARGSUSED */
void
tree_mdoc(void *arg, const struct mdoc *mdoc)
{
@@ -40,8 +39,6 @@ tree_mdoc(void *arg, const struct mdoc *mdoc)
print_mdoc(mdoc_node(mdoc), 0);
}
-
-/* ARGSUSED */
void
tree_man(void *arg, const struct man *man)
{
@@ -49,7 +46,6 @@ tree_man(void *arg, const struct man *man)
print_man(man_node(man), 0);
}
-
static void
print_mdoc(const struct mdoc_node *n, int indent)
{
@@ -63,33 +59,33 @@ print_mdoc(const struct mdoc_node *n, int indent)
t = p = NULL;
switch (n->type) {
- case (MDOC_ROOT):
+ case MDOC_ROOT:
t = "root";
break;
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
t = "block";
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
t = "block-head";
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
if (n->end)
t = "body-end";
else
t = "block-body";
break;
- case (MDOC_TAIL):
+ case MDOC_TAIL:
t = "block-tail";
break;
- case (MDOC_ELEM):
+ case MDOC_ELEM:
t = "elem";
break;
- case (MDOC_TEXT):
+ case MDOC_TEXT:
t = "text";
break;
- case (MDOC_TBL):
+ case MDOC_TBL:
/* FALLTHROUGH */
- case (MDOC_EQN):
+ case MDOC_EQN:
break;
default:
abort();
@@ -97,37 +93,37 @@ print_mdoc(const struct mdoc_node *n, int indent)
}
switch (n->type) {
- case (MDOC_TEXT):
+ case MDOC_TEXT:
p = n->string;
break;
- case (MDOC_BODY):
+ case MDOC_BODY:
p = mdoc_macronames[n->tok];
break;
- case (MDOC_HEAD):
+ case MDOC_HEAD:
p = mdoc_macronames[n->tok];
break;
- case (MDOC_TAIL):
+ case MDOC_TAIL:
p = mdoc_macronames[n->tok];
break;
- case (MDOC_ELEM):
+ case MDOC_ELEM:
p = mdoc_macronames[n->tok];
if (n->args) {
argv = n->args->argv;
argc = n->args->argc;
}
break;
- case (MDOC_BLOCK):
+ case MDOC_BLOCK:
p = mdoc_macronames[n->tok];
if (n->args) {
argv = n->args->argv;
argc = n->args->argc;
}
break;
- case (MDOC_TBL):
+ case MDOC_TBL:
/* FALLTHROUGH */
- case (MDOC_EQN):
+ case MDOC_EQN:
break;
- case (MDOC_ROOT):
+ case MDOC_ROOT:
p = "root";
break;
default:
@@ -172,7 +168,6 @@ print_mdoc(const struct mdoc_node *n, int indent)
print_mdoc(n->next, indent);
}
-
static void
print_man(const struct man_node *n, int indent)
{
@@ -182,30 +177,30 @@ print_man(const struct man_node *n, int indent)
t = p = NULL;
switch (n->type) {
- case (MAN_ROOT):
+ case MAN_ROOT:
t = "root";
break;
- case (MAN_ELEM):
+ case MAN_ELEM:
t = "elem";
break;
- case (MAN_TEXT):
+ case MAN_TEXT:
t = "text";
break;
- case (MAN_BLOCK):
+ case MAN_BLOCK:
t = "block";
break;
- case (MAN_HEAD):
+ case MAN_HEAD:
t = "block-head";
break;
- case (MAN_BODY):
+ case MAN_BODY:
t = "block-body";
break;
- case (MAN_TAIL):
+ case MAN_TAIL:
t = "block-tail";
break;
- case (MAN_TBL):
+ case MAN_TBL:
/* FALLTHROUGH */
- case (MAN_EQN):
+ case MAN_EQN:
break;
default:
abort();
@@ -213,26 +208,26 @@ print_man(const struct man_node *n, int indent)
}
switch (n->type) {
- case (MAN_TEXT):
+ case MAN_TEXT:
p = n->string;
break;
- case (MAN_ELEM):
+ case MAN_ELEM:
/* FALLTHROUGH */
- case (MAN_BLOCK):
+ case MAN_BLOCK:
/* FALLTHROUGH */
- case (MAN_HEAD):
+ case MAN_HEAD:
/* FALLTHROUGH */
- case (MAN_TAIL):
+ case MAN_TAIL:
/* FALLTHROUGH */
- case (MAN_BODY):
+ case MAN_BODY:
p = man_macronames[n->tok];
break;
- case (MAN_ROOT):
+ case MAN_ROOT:
p = "root";
break;
- case (MAN_TBL):
+ case MAN_TBL:
/* FALLTHROUGH */
- case (MAN_EQN):
+ case MAN_EQN:
break;
default:
abort();
@@ -273,30 +268,30 @@ print_box(const struct eqn_box *ep, int indent)
t = NULL;
switch (ep->type) {
- case (EQN_ROOT):
+ case EQN_ROOT:
t = "eqn-root";
break;
- case (EQN_LIST):
+ case EQN_LIST:
t = "eqn-list";
break;
- case (EQN_SUBEXPR):
+ case EQN_SUBEXPR:
t = "eqn-expr";
break;
- case (EQN_TEXT):
+ case EQN_TEXT:
t = "eqn-text";
break;
- case (EQN_MATRIX):
+ case EQN_MATRIX:
t = "eqn-matrix";
break;
}
assert(t);
- printf("%s(%d, %d, %d, %d, %d, \"%s\", \"%s\") %s\n",
- t, EQN_DEFSIZE == ep->size ? 0 : ep->size,
- ep->pos, ep->font, ep->mark, ep->pile,
- ep->left ? ep->left : "",
- ep->right ? ep->right : "",
- ep->text ? ep->text : "");
+ printf("%s(%d, %d, %d, %d, %d, \"%s\", \"%s\") %s\n",
+ t, EQN_DEFSIZE == ep->size ? 0 : ep->size,
+ ep->pos, ep->font, ep->mark, ep->pile,
+ ep->left ? ep->left : "",
+ ep->right ? ep->right : "",
+ ep->text ? ep->text : "");
print_box(ep->first, indent + 1);
print_box(ep->next, indent);
@@ -312,10 +307,10 @@ print_span(const struct tbl_span *sp, int indent)
putchar('\t');
switch (sp->pos) {
- case (TBL_SPAN_HORIZ):
+ case TBL_SPAN_HORIZ:
putchar('-');
return;
- case (TBL_SPAN_DHORIZ):
+ case TBL_SPAN_DHORIZ:
putchar('=');
return;
default:
@@ -324,14 +319,14 @@ print_span(const struct tbl_span *sp, int indent)
for (dp = sp->first; dp; dp = dp->next) {
switch (dp->pos) {
- case (TBL_DATA_HORIZ):
+ case TBL_DATA_HORIZ:
/* FALLTHROUGH */
- case (TBL_DATA_NHORIZ):
+ case TBL_DATA_NHORIZ:
putchar('-');
continue;
- case (TBL_DATA_DHORIZ):
+ case TBL_DATA_DHORIZ:
/* FALLTHROUGH */
- case (TBL_DATA_NDHORIZ):
+ case TBL_DATA_NDHORIZ:
putchar('=');
continue;
default: