summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apropos.c13
-rw-r--r--arch.c3
-rw-r--r--att.c3
-rw-r--r--chars.c17
-rw-r--r--chars.in2
-rw-r--r--eqn.c63
-rw-r--r--eqn_html.c8
-rw-r--r--eqn_term.c3
-rw-r--r--html.c124
-rw-r--r--html.h12
-rw-r--r--libman.h4
-rw-r--r--libmandoc.h20
-rw-r--r--libmdoc.h8
-rw-r--r--libroff.h4
-rw-r--r--main.c87
-rw-r--r--main.h2
-rw-r--r--man.c74
-rw-r--r--man_hash.c5
-rw-r--r--man_html.c69
-rw-r--r--man_macro.c58
-rw-r--r--man_term.c188
-rw-r--r--man_validate.c88
-rw-r--r--mandoc.c122
-rw-r--r--mandoc.h10
-rw-r--r--mandocdb.c131
-rw-r--r--manpath.c5
-rw-r--r--mansearch.c24
-rw-r--r--mdoc.c155
-rw-r--r--mdoc.h18
-rw-r--r--mdoc_argv.c90
-rw-r--r--mdoc_hash.c3
-rw-r--r--mdoc_html.c488
-rw-r--r--mdoc_macro.c281
-rw-r--r--mdoc_man.c139
-rw-r--r--mdoc_term.c531
-rw-r--r--mdoc_validate.c492
-rw-r--r--out.c51
-rw-r--r--out.h4
-rw-r--r--read.c97
-rw-r--r--roff.c282
-rw-r--r--st.in2
-rw-r--r--tbl.c22
-rw-r--r--tbl_data.c38
-rw-r--r--tbl_html.c9
-rw-r--r--tbl_layout.c97
-rw-r--r--tbl_opts.c45
-rw-r--r--tbl_term.c64
-rw-r--r--term.c106
-rw-r--r--term.h4
-rw-r--r--term_ascii.c41
-rw-r--r--term_ps.c162
-rw-r--r--tree.c111
52 files changed, 1985 insertions, 2494 deletions
diff --git a/apropos.c b/apropos.c
index ac7e6d87..7b35c7ae 100644
--- a/apropos.c
+++ b/apropos.c
@@ -31,6 +31,7 @@
#include "manpath.h"
#include "mansearch.h"
+
int
main(int argc, char *argv[])
{
@@ -63,22 +64,22 @@ main(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/arch.c b/arch.c
index 37590774..2a9af4e1 100644
--- a/arch.c
+++ b/arch.c
@@ -26,11 +26,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/att.c b/att.c
index 05320d74..3113f9c9 100644
--- a/att.c
+++ b/att.c
@@ -26,11 +26,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/chars.c b/chars.c
index 9ca0d571..1e9a186e 100644
--- a/chars.c
+++ b/chars.c
@@ -52,9 +52,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)
{
@@ -111,18 +112,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');
@@ -131,7 +132,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;
@@ -160,8 +161,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/chars.in b/chars.in
index f3ef747a..afdd4edc 100644
--- a/chars.in
+++ b/chars.in
@@ -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/eqn.c b/eqn.c
index 045ec460..d2347cb4 100644
--- a/eqn.c
+++ b/eqn.c
@@ -138,12 +138,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 *);
@@ -157,7 +156,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 *);
@@ -278,9 +277,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;
@@ -299,7 +298,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);
@@ -414,11 +413,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);
@@ -513,9 +512,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))) {
@@ -530,7 +528,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))
@@ -576,7 +574,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);
@@ -591,7 +589,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);
@@ -763,9 +761,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)
@@ -791,8 +789,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;
}
@@ -853,8 +851,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.
*/
@@ -866,15 +864,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';
@@ -902,7 +899,7 @@ eqn_do_gfont(struct eqn_node *ep)
if (NULL == eqn_nextrawtok(ep, NULL)) {
EQN_MSG(MANDOCERR_EQNEOF, ep);
return(0);
- }
+ }
return(1);
}
@@ -915,7 +912,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);
}
@@ -941,9 +938,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/eqn_html.c b/eqn_html.c
index f1cd769c..1ae45551 100644
--- a/eqn_html.c
+++ b/eqn_html.c
@@ -35,9 +35,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 +59,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/eqn_term.c b/eqn_term.c
index af4b2cb3..7d6f9487 100644
--- a/eqn_term.c
+++ b/eqn_term.c
@@ -37,6 +37,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 +69,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/html.c b/html.c
index 0d24e197..82ac8c7f 100644
--- a/html.c
+++ b/html.c
@@ -115,6 +115,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)
{
@@ -136,16 +137,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:
@@ -162,7 +163,6 @@ html_alloc(char *outopts)
return(ml_alloc(outopts, HTML_HTML_4_01_STRICT));
}
-
void *
xhtml_alloc(char *outopts)
{
@@ -170,7 +170,6 @@ xhtml_alloc(char *outopts)
return(ml_alloc(outopts, HTML_XHTML_1_0_STRICT));
}
-
void
html_free(void *p)
{
@@ -180,17 +179,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)
{
@@ -227,21 +225,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:
@@ -258,13 +256,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;
@@ -303,19 +301,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:
@@ -353,22 +351,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;
@@ -379,21 +377,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:
@@ -406,25 +404,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;
@@ -436,7 +434,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)
{
@@ -445,9 +442,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;
@@ -497,7 +493,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:
@@ -514,16 +510,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
@@ -534,7 +529,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";
@@ -547,8 +542,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
@@ -567,13 +562,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;
@@ -596,14 +591,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.
*/
@@ -619,7 +613,6 @@ print_tagq(struct html *h, const struct tag *until)
}
}
-
void
print_stagq(struct html *h, const struct tag *suntil)
{
@@ -628,7 +621,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.
*/
@@ -674,8 +667,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);
}
@@ -695,12 +688,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:
@@ -714,21 +707,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/html.h b/html.h
index 2e847074..0547c597 100644
--- a/html.h
+++ b/html.h
@@ -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 *);
@@ -153,12 +153,12 @@ __attribute__((__format__ (__printf__, 2, 3)))
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/libman.h b/libman.h
index 0ea9cb69..d8132eb5 100644
--- a/libman.h
+++ b/libman.h
@@ -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/libmandoc.h b/libmandoc.h
index d10fed38..882d701d 100644
--- a/libmandoc.h
+++ b/libmandoc.h
@@ -36,12 +36,12 @@ struct roff;
struct mdoc;
struct man;
-void mandoc_msg(enum mandocerr, struct mparse *,
+void mandoc_msg(enum mandocerr, struct mparse *,
int, int, const char *);
#if __GNUC__ - 0 >= 4
__attribute__((__format__ (__printf__, 5, 6)))
#endif
-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);
@@ -49,36 +49,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/libmdoc.h b/libmdoc.h
index 9bfddd31..3f5e13dd 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -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/libroff.h b/libroff.h
index aae33aad..465d2da9 100644
--- a/libroff.h
+++ b/libroff.h
@@ -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/main.c b/main.c
index ff76f340..64100318 100644
--- a/main.c
+++ b/main.c
@@ -60,9 +60,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 */
@@ -71,7 +71,7 @@ struct curparse {
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));
@@ -80,6 +80,7 @@ static int woptions(struct curparse *, char *);
static const char *progname;
+
int
main(int argc, char *argv[])
{
@@ -102,39 +103,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:
@@ -193,15 +194,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;
@@ -231,31 +232,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;
@@ -264,29 +265,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;
@@ -367,7 +368,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";
@@ -379,18 +380,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:
@@ -403,14 +404,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/main.h b/main.h
index d08c609b..e143758c 100644
--- a/main.h
+++ b/main.h
@@ -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/man.c b/man.c
index ca625305..1ad78a55 100644
--- a/man.c
+++ b/man.c
@@ -35,9 +35,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",
@@ -50,12 +50,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);
@@ -72,7 +72,6 @@ man_node(const struct man *man)
return(man->first);
}
-
const struct man_meta *
man_meta(const struct man *man)
{
@@ -81,7 +80,6 @@ man_meta(const struct man *man)
return(&man->meta);
}
-
void
man_reset(struct man *man)
{
@@ -90,7 +88,6 @@ man_reset(struct man *man)
man_alloc1(man);
}
-
void
man_free(struct man *man)
{
@@ -99,7 +96,6 @@ man_free(struct man *man)
free(man);
}
-
struct man *
man_alloc(struct roff *roff, struct mparse *parse, int quick)
{
@@ -116,7 +112,6 @@ man_alloc(struct roff *roff, struct mparse *parse, int quick)
return(p);
}
-
int
man_endparse(struct man *man)
{
@@ -128,7 +123,6 @@ man_endparse(struct man *man)
return(0);
}
-
int
man_parseln(struct man *man, int ln, char *buf, int offs)
{
@@ -138,11 +132,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)
{
@@ -161,7 +154,6 @@ man_free1(struct man *man)
free(man->meta.msec);
}
-
static void
man_alloc1(struct man *man)
{
@@ -185,12 +177,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;
@@ -198,7 +190,7 @@ man_node_append(struct man *man, struct man_node *p)
abort();
/* NOTREACHED */
}
-
+
assert(p->parent);
p->parent->nchild++;
@@ -206,15 +198,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;
@@ -225,9 +217,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;
@@ -238,9 +230,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;
@@ -257,7 +248,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)
{
@@ -270,7 +260,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)
{
@@ -283,7 +272,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)
{
@@ -296,7 +284,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)
{
@@ -309,7 +296,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)
{
@@ -337,7 +323,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().
@@ -351,7 +336,6 @@ man_node_free(struct man_node *p)
free(p);
}
-
void
man_node_delete(struct man *man, struct man_node *p)
{
@@ -453,9 +437,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);
@@ -512,8 +496,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';
@@ -521,8 +505,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);
}
@@ -531,7 +515,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.
*/
@@ -539,7 +523,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.
@@ -555,7 +539,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]);
@@ -586,7 +570,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]);
@@ -615,13 +599,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;
@@ -636,7 +620,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/man_hash.c b/man_hash.c
index 0f8dd3e4..9228e7ef 100644
--- a/man_hash.c
+++ b/man_hash.c
@@ -48,6 +48,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.
@@ -59,8 +60,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];
@@ -79,7 +79,6 @@ man_hash_init(void)
}
}
-
enum mant
man_hash_find(const char *tmp)
{
diff --git a/man_html.c b/man_html.c
index b1134e1a..7cf0ef4e 100644
--- a/man_html.c
+++ b/man_html.c
@@ -53,7 +53,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);
@@ -90,7 +90,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 */
@@ -122,6 +122,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.
@@ -156,7 +157,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;
@@ -171,15 +172,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)
{
@@ -192,7 +191,6 @@ print_man_head(MAN_ARGS)
print_text(h, h->buf);
}
-
static void
print_man_nodelist(MAN_ARGS)
{
@@ -202,7 +200,6 @@ print_man_nodelist(MAN_ARGS)
print_man_nodelist(man, n->next, mh, h);
}
-
static void
print_man_node(MAN_ARGS)
{
@@ -213,10 +210,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
@@ -234,10 +231,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
@@ -246,7 +243,7 @@ print_man_node(MAN_ARGS)
print_tbl(h, n->span);
return;
default:
- /*
+ /*
* Close out scope of font prior to opening a macro
* scope.
*/
@@ -276,10 +273,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)
@@ -288,7 +285,6 @@ print_man_node(MAN_ARGS)
}
}
-
static int
a2width(const struct man_node *n, struct roffsu *su)
{
@@ -301,8 +297,6 @@ a2width(const struct man_node *n, struct roffsu *su)
return(0);
}
-
-/* ARGSUSED */
static void
man_root_pre(MAN_ARGS)
{
@@ -349,8 +343,6 @@ man_root_pre(MAN_ARGS)
print_tagq(h, t);
}
-
-/* ARGSUSED */
static void
man_root_post(MAN_ARGS)
{
@@ -384,7 +376,6 @@ man_root_post(MAN_ARGS)
}
-/* ARGSUSED */
static int
man_br_pre(MAN_ARGS)
{
@@ -411,7 +402,6 @@ man_br_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_SH_pre(MAN_ARGS)
{
@@ -429,7 +419,6 @@ man_SH_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_alt_pre(MAN_ARGS)
{
@@ -438,7 +427,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;
@@ -446,22 +435,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:
@@ -487,18 +476,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)
{
@@ -516,7 +503,6 @@ man_SS_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_PP_pre(MAN_ARGS)
{
@@ -529,13 +515,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) {
@@ -567,7 +552,6 @@ man_IP_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_HP_pre(MAN_ARGS)
{
@@ -596,7 +580,6 @@ man_HP_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_OP_pre(MAN_ARGS)
{
@@ -626,8 +609,6 @@ man_OP_pre(MAN_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
man_B_pre(MAN_ARGS)
{
@@ -636,16 +617,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)
{
@@ -659,7 +638,6 @@ man_literal_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_in_pre(MAN_ARGS)
{
@@ -668,7 +646,6 @@ man_in_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_ign_pre(MAN_ARGS)
{
@@ -676,7 +653,6 @@ man_ign_pre(MAN_ARGS)
return(0);
}
-/* ARGSUSED */
static int
man_RS_pre(MAN_ARGS)
{
@@ -699,7 +675,6 @@ man_RS_pre(MAN_ARGS)
return(1);
}
-/* ARGSUSED */
static int
man_UR_pre(MAN_ARGS)
{
diff --git a/man_macro.c b/man_macro.c
index 9049a6ad..cc119b79 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -40,16 +40,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] = {
@@ -115,13 +115,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;
@@ -130,7 +129,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
@@ -153,24 +151,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;
@@ -197,20 +193,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))
@@ -238,7 +234,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'
@@ -250,9 +245,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).
@@ -264,7 +258,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.
*/
@@ -277,18 +271,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:
@@ -304,14 +297,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)
{
@@ -351,15 +342,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)
{
@@ -411,8 +399,6 @@ blk_imp(MACRO_PROT_ARGS)
return(man_body_alloc(man, line, ppos, tok));
}
-
-/* ARGSUSED */
int
in_line_eoln(MACRO_PROT_ARGS)
{
@@ -452,7 +438,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. */
@@ -463,7 +449,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
@@ -482,7 +468,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/man_term.c b/man_term.c
index 281c2e56..c17fd96d 100644
--- a/man_term.c
+++ b/man_term.c
@@ -45,7 +45,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
@@ -64,7 +64,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);
@@ -105,7 +105,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 */
@@ -138,7 +138,6 @@ static const struct termact termacts[MAN_MAX] = {
};
-
void
terminal_man(void *arg, const struct man *man)
{
@@ -189,7 +188,6 @@ a2height(const struct termp *p, const char *cp)
return(term_vspan(p, &su));
}
-
static int
a2width(const struct termp *p, const char *cp)
{
@@ -228,7 +226,7 @@ print_bvspace(struct termp *p, const struct man_node *n, int pardist)
term_vspace(p);
}
-/* ARGSUSED */
+
static int
pre_ign(DECL_ARGS)
{
@@ -236,8 +234,6 @@ pre_ign(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_ll(DECL_ARGS)
{
@@ -246,8 +242,6 @@ pre_ll(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_I(DECL_ARGS)
{
@@ -256,8 +250,6 @@ pre_I(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
pre_literal(DECL_ARGS)
{
@@ -285,7 +277,6 @@ pre_literal(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_PD(DECL_ARGS)
{
@@ -300,7 +291,6 @@ pre_PD(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_alternate(DECL_ARGS)
{
@@ -309,27 +299,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;
@@ -352,7 +342,6 @@ pre_alternate(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_B(DECL_ARGS)
{
@@ -361,7 +350,6 @@ pre_B(DECL_ARGS)
return(1);
}
-/* ARGSUSED */
static int
pre_OP(DECL_ARGS)
{
@@ -384,7 +372,6 @@ pre_OP(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_ft(DECL_ARGS)
{
@@ -397,26 +384,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:
@@ -425,7 +412,6 @@ pre_ft(DECL_ARGS)
return(0);
}
-/* ARGSUSED */
static int
pre_in(DECL_ARGS)
{
@@ -459,7 +445,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. */
@@ -470,8 +456,6 @@ pre_in(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_sp(DECL_ARGS)
{
@@ -481,15 +465,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:
@@ -499,7 +483,7 @@ pre_sp(DECL_ARGS)
neg = 0;
switch (n->tok) {
- case (MAN_br):
+ case MAN_br:
len = 0;
break;
default:
@@ -527,8 +511,6 @@ pre_sp(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
pre_HP(DECL_ARGS)
{
@@ -537,10 +519,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);
@@ -573,14 +555,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;
@@ -592,14 +572,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;
@@ -611,8 +589,6 @@ pre_PP(DECL_ARGS)
return(MAN_HEAD != n->type);
}
-
-/* ARGSUSED */
static int
pre_IP(DECL_ARGS)
{
@@ -621,14 +597,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:
@@ -645,7 +621,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);
@@ -668,10 +644,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;
@@ -680,20 +656,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;
@@ -702,8 +676,6 @@ post_IP(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
pre_TP(DECL_ARGS)
{
@@ -712,14 +684,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:
@@ -737,7 +709,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);
@@ -764,10 +736,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;
@@ -778,17 +750,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;
@@ -797,15 +767,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);
@@ -818,11 +786,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:
@@ -832,17 +800,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:
@@ -850,15 +816,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);
@@ -872,11 +836,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:
@@ -886,17 +850,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:
@@ -904,7 +866,6 @@ post_SH(DECL_ARGS)
}
}
-/* ARGSUSED */
static int
pre_RS(DECL_ARGS)
{
@@ -912,10 +873,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;
@@ -924,13 +885,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;
@@ -939,7 +900,6 @@ pre_RS(DECL_ARGS)
return(1);
}
-/* ARGSUSED */
static void
post_RS(DECL_ARGS)
{
@@ -947,9 +907,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);
@@ -958,8 +918,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;
@@ -969,7 +929,6 @@ post_RS(DECL_ARGS)
mt->lmargincur = mt->lmarginsz;
}
-/* ARGSUSED */
static int
pre_UR(DECL_ARGS)
{
@@ -977,7 +936,6 @@ pre_UR(DECL_ARGS)
return (MAN_HEAD != n->type);
}
-/* ARGSUSED */
static void
post_UR(DECL_ARGS)
{
@@ -1002,7 +960,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
@@ -1017,15 +975,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;
@@ -1088,7 +1046,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)
{
@@ -1156,7 +1113,6 @@ print_man_foot(struct termp *p, const void *arg)
term_flushln(p);
}
-
static void
print_man_head(struct termp *p, const void *arg)
{
@@ -1183,7 +1139,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;
@@ -1216,7 +1172,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/man_validate.c b/man_validate.c
index 4e8374f4..03a5f4c5 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -134,13 +134,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;
@@ -149,12 +149,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)
{
@@ -165,14 +164,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;
@@ -187,9 +186,8 @@ man_valid_post(struct man *man)
return(1);
}
-
static int
-check_root(CHKARGS)
+check_root(CHKARGS)
{
if (MAN_BLINE & man->flags)
@@ -211,7 +209,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);
@@ -240,8 +238,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); \
}
@@ -274,27 +272,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;
@@ -303,17 +301,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);
}
@@ -331,7 +326,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);
@@ -343,27 +338,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;
@@ -379,11 +373,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;
@@ -405,7 +399,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 */
@@ -413,8 +407,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;
}
@@ -572,13 +566,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/mandoc.c b/mandoc.c
index eb393a2b..7ddead57 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -46,7 +46,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,
@@ -75,11 +75,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
@@ -91,7 +91,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;
@@ -105,50 +105,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;
@@ -163,19 +163,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;
@@ -187,19 +187,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;
@@ -211,7 +211,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)++;
@@ -227,10 +227,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. */
@@ -238,15 +238,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;
@@ -278,9 +278,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))
@@ -302,7 +302,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) {
/*
@@ -320,27 +320,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;
@@ -372,7 +372,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
if ('"' == *start) {
quoted = 1;
start++;
- }
+ }
pairs = 0;
white = 0;
@@ -391,14 +391,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++;
@@ -541,21 +541,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/mandoc.h b/mandoc.h
index ff0779ae..4fb4492a 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -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,11 +409,11 @@ __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 *);
@@ -422,7 +422,7 @@ enum mandoclevel mparse_readfd(struct mparse *, int, const char *);
enum mandoclevel mparse_readmem(struct mparse *, const void *, size_t,
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/mandocdb.c b/mandocdb.c
index de0467a9..4025cb5b 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -180,12 +180,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 */
@@ -320,6 +320,7 @@ static const struct mdoc_handler mdocs[MDOC_MAX] = {
{ NULL, 0 }, /* Ta */
};
+
int
main(int argc, char *argv[])
{
@@ -348,7 +349,7 @@ main(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.
*/
@@ -363,32 +364,32 @@ main(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);
@@ -396,18 +397,18 @@ main(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:
@@ -470,8 +471,8 @@ main(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]);
@@ -538,7 +539,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);
@@ -552,7 +553,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
*
@@ -592,7 +593,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");
@@ -615,7 +616,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) {
@@ -672,9 +673,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:
@@ -684,10 +685,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.
@@ -708,14 +709,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.
@@ -747,7 +748,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
*
@@ -984,7 +985,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);
@@ -1113,14 +1114,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,
@@ -1335,7 +1336,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,
@@ -1405,7 +1406,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;
}
@@ -1469,11 +1470,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.
@@ -1487,7 +1488,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
@@ -1569,15 +1570,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;
@@ -1601,8 +1602,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);
/*
@@ -1645,11 +1646,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, ' ')))
@@ -1866,7 +1867,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 */
@@ -1886,17 +1887,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;
@@ -1913,8 +1914,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)
@@ -2125,11 +2126,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");
@@ -2151,11 +2152,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);
@@ -2186,7 +2187,7 @@ dbopen(int real)
const char *sql;
int rc, ofl;
- if (nodb)
+ if (nodb)
return(1);
*tempfilename = '\0';
@@ -2206,7 +2207,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;
@@ -2399,10 +2400,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/manpath.c b/manpath.c
index 5138c045..56fb73a0 100644
--- a/manpath.c
+++ b/manpath.c
@@ -169,9 +169,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/mansearch.c b/mansearch.c
index d42b97fb..cbf2cec8 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -64,7 +64,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 */
@@ -87,7 +87,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,
@@ -101,6 +101,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)
{
@@ -235,11 +236,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);
@@ -288,9 +288,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;
@@ -309,7 +309,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);
@@ -327,8 +327,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/mdoc.c b/mdoc.c
index 58c65508..5a9271b0 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -35,7 +35,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",
@@ -46,11 +46,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",
@@ -67,22 +64,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"
};
@@ -91,13 +85,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);
@@ -105,6 +99,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)
{
@@ -113,7 +108,6 @@ mdoc_node(const struct mdoc *mdoc)
return(mdoc->first);
}
-
const struct mdoc_meta *
mdoc_meta(const struct mdoc *mdoc)
{
@@ -122,7 +116,6 @@ mdoc_meta(const struct mdoc *mdoc)
return(&mdoc->meta);
}
-
/*
* Frees volatile resources (parse tree, meta-data, fields).
*/
@@ -148,7 +141,6 @@ mdoc_free1(struct mdoc *mdoc)
free(mdoc->meta.date);
}
-
/*
* Allocate all volatile resources (parse tree, meta-data, fields).
*/
@@ -166,7 +158,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
@@ -181,7 +172,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.
@@ -194,9 +184,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,
@@ -216,7 +205,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.
@@ -280,7 +268,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()).
@@ -305,8 +292,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
@@ -316,16 +303,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");
@@ -354,12 +341,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;
@@ -376,13 +363,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:
@@ -393,15 +380,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);
@@ -414,9 +401,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;
@@ -427,9 +414,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;
@@ -455,7 +441,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)
{
@@ -468,7 +453,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)
{
@@ -484,7 +468,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)
{
@@ -497,7 +480,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)
@@ -514,9 +496,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;
@@ -527,13 +508,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:
@@ -546,9 +527,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;
@@ -559,7 +539,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:
@@ -615,7 +595,6 @@ mdoc_node_free(struct mdoc_node *p)
free(p);
}
-
static void
mdoc_node_unlink(struct mdoc *mdoc, struct mdoc_node *n)
{
@@ -653,7 +632,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)
{
@@ -724,7 +702,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);
}
@@ -758,16 +736,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));
@@ -853,7 +831,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.
@@ -876,14 +853,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';
@@ -891,8 +868,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);
}
@@ -906,7 +883,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.
*/
@@ -920,7 +897,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);
}
@@ -934,7 +911,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;
@@ -948,18 +925,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. */
@@ -985,27 +962,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/mdoc.h b/mdoc.h
index daf02d1c..cd86a4f8 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -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/mdoc_argv.c b/mdoc_argv.c
index 17179f43..bc469896 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -33,7 +33,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,
@@ -53,12 +53,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] = {
@@ -150,8 +150,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 */
@@ -159,32 +159,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 */
@@ -202,7 +202,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 */
@@ -213,7 +213,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 */
@@ -241,8 +241,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 */
@@ -302,14 +302,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';
/*
@@ -328,7 +328,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.
*/
@@ -343,15 +343,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;
}
@@ -359,11 +359,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);
}
@@ -399,7 +399,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);
}
@@ -416,7 +416,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;
@@ -445,7 +445,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;
@@ -486,7 +486,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;
@@ -499,7 +499,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).
*/
@@ -600,7 +600,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
@@ -629,7 +629,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)
@@ -651,7 +651,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;
@@ -667,8 +667,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);
}
@@ -677,7 +677,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/mdoc_hash.c b/mdoc_hash.c
index da9a9836..0a5517b7 100644
--- a/mdoc_hash.c
+++ b/mdoc_hash.c
@@ -32,6 +32,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.
@@ -76,7 +77,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/mdoc_html.c b/mdoc_html.c
index bc6d4efa..5d2d4b7d 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -53,7 +53,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 *);
@@ -127,8 +127,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 */
@@ -136,32 +136,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 */
@@ -179,7 +179,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 */
@@ -190,7 +190,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 */
@@ -211,15 +211,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 */
@@ -229,21 +229,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 */
};
@@ -262,16 +262,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
@@ -287,7 +287,6 @@ a2width(const char *p, struct roffsu *su)
}
}
-
/*
* See the same function in mdoc_term.c for documentation.
*/
@@ -298,27 +297,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;
@@ -330,7 +329,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
@@ -352,7 +350,6 @@ a2offs(const char *p, struct roffsu *su)
SCALE_HS_INIT(su, html_strlen(p));
}
-
static void
print_mdoc(MDOC_ARGS)
{
@@ -369,15 +366,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)
{
@@ -393,7 +388,6 @@ print_mdoc_head(MDOC_ARGS)
print_text(h, h->buf);
}
-
static void
print_mdoc_nodelist(MDOC_ARGS)
{
@@ -403,7 +397,6 @@ print_mdoc_nodelist(MDOC_ARGS)
print_mdoc_nodelist(meta, n->next, h);
}
-
static void
print_mdoc_node(MDOC_ARGS)
{
@@ -414,10 +407,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);
@@ -434,10 +427,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
@@ -476,10 +469,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)
@@ -488,7 +481,6 @@ print_mdoc_node(MDOC_ARGS)
}
}
-/* ARGSUSED */
static void
mdoc_root_post(MDOC_ARGS)
{
@@ -519,8 +511,6 @@ mdoc_root_post(MDOC_ARGS)
print_tagq(h, t);
}
-
-/* ARGSUSED */
static int
mdoc_root_pre(MDOC_ARGS)
{
@@ -570,8 +560,6 @@ mdoc_root_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_sh_pre(MDOC_ARGS)
{
@@ -602,7 +590,6 @@ mdoc_sh_pre(MDOC_ARGS)
return(1);
}
-/* ARGSUSED */
static int
mdoc_ss_pre(MDOC_ARGS)
{
@@ -633,8 +620,6 @@ mdoc_ss_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_fl_pre(MDOC_ARGS)
{
@@ -658,8 +643,6 @@ mdoc_fl_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_nd_pre(MDOC_ARGS)
{
@@ -676,7 +659,6 @@ mdoc_nd_pre(MDOC_ARGS)
return(1);
}
-
static int
mdoc_nm_pre(MDOC_ARGS)
{
@@ -685,19 +667,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:
@@ -726,8 +708,6 @@ mdoc_nm_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_xr_pre(MDOC_ARGS)
{
@@ -739,9 +719,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
@@ -762,8 +742,6 @@ mdoc_xr_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_ns_pre(MDOC_ARGS)
{
@@ -773,8 +751,6 @@ mdoc_ns_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ar_pre(MDOC_ARGS)
{
@@ -785,8 +761,6 @@ mdoc_ar_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_xx_pre(MDOC_ARGS)
{
@@ -795,22 +769,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:
@@ -830,8 +804,6 @@ mdoc_xx_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_bx_pre(MDOC_ARGS)
{
@@ -859,7 +831,6 @@ mdoc_bx_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_it_pre(MDOC_ARGS)
{
@@ -883,25 +854,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);
@@ -911,36 +882,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;
@@ -950,7 +921,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);
@@ -961,7 +932,7 @@ mdoc_it_pre(MDOC_ARGS)
}
} else {
switch (type) {
- case (LIST_column):
+ case LIST_column:
print_otag(h, TAG_TR, 1, tag);
break;
default:
@@ -972,7 +943,6 @@ mdoc_it_pre(MDOC_ARGS)
return(1);
}
-/* ARGSUSED */
static int
mdoc_bl_pre(MDOC_ARGS)
{
@@ -1031,30 +1001,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:
@@ -1065,7 +1035,6 @@ mdoc_bl_pre(MDOC_ARGS)
return(1);
}
-/* ARGSUSED */
static int
mdoc_ex_pre(MDOC_ARGS)
{
@@ -1102,12 +1071,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)
{
@@ -1118,8 +1085,6 @@ mdoc_em_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_d1_pre(MDOC_ARGS)
{
@@ -1144,13 +1109,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)
{
@@ -1173,13 +1136,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;
@@ -1204,13 +1165,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);
@@ -1233,21 +1194,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;
@@ -1266,8 +1227,6 @@ mdoc_bd_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_pa_pre(MDOC_ARGS)
{
@@ -1278,8 +1237,6 @@ mdoc_pa_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ad_pre(MDOC_ARGS)
{
@@ -1290,8 +1247,6 @@ mdoc_ad_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_an_pre(MDOC_ARGS)
{
@@ -1304,8 +1259,6 @@ mdoc_an_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_cd_pre(MDOC_ARGS)
{
@@ -1317,8 +1270,6 @@ mdoc_cd_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_dv_pre(MDOC_ARGS)
{
@@ -1329,8 +1280,6 @@ mdoc_dv_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ev_pre(MDOC_ARGS)
{
@@ -1341,8 +1290,6 @@ mdoc_ev_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_er_pre(MDOC_ARGS)
{
@@ -1353,8 +1300,6 @@ mdoc_er_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_fa_pre(MDOC_ARGS)
{
@@ -1386,8 +1331,6 @@ mdoc_fa_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_fd_pre(MDOC_ARGS)
{
@@ -1416,21 +1359,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);
@@ -1447,8 +1390,6 @@ mdoc_fd_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_vt_pre(MDOC_ARGS)
{
@@ -1467,8 +1408,6 @@ mdoc_vt_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ft_pre(MDOC_ARGS)
{
@@ -1480,8 +1419,6 @@ mdoc_ft_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_fn_pre(MDOC_ARGS)
{
@@ -1502,7 +1439,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);
@@ -1574,15 +1511,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
@@ -1600,7 +1535,6 @@ mdoc_sm_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_ll_pre(MDOC_ARGS)
{
@@ -1608,7 +1542,6 @@ mdoc_ll_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_pp_pre(MDOC_ARGS)
{
@@ -1617,7 +1550,6 @@ mdoc_pp_pre(MDOC_ARGS)
return(0);
}
-/* ARGSUSED */
static int
mdoc_sp_pre(MDOC_ARGS)
{
@@ -1645,7 +1577,6 @@ mdoc_sp_pre(MDOC_ARGS)
}
-/* ARGSUSED */
static int
mdoc_lk_pre(MDOC_ARGS)
{
@@ -1670,8 +1601,6 @@ mdoc_lk_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_mt_pre(MDOC_ARGS)
{
@@ -1692,12 +1621,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)
{
@@ -1726,8 +1653,6 @@ mdoc_fo_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
mdoc_fo_post(MDOC_ARGS)
{
@@ -1740,8 +1665,6 @@ mdoc_fo_post(MDOC_ARGS)
print_text(h, ";");
}
-
-/* ARGSUSED */
static int
mdoc_in_pre(MDOC_ARGS)
{
@@ -1777,7 +1700,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);
@@ -1797,8 +1720,6 @@ mdoc_in_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_ic_pre(MDOC_ARGS)
{
@@ -1809,8 +1730,6 @@ mdoc_ic_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_rv_pre(MDOC_ARGS)
{
@@ -1850,19 +1769,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)
{
@@ -1873,20 +1790,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)
{
@@ -1898,18 +1811,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");
@@ -1921,8 +1834,6 @@ mdoc_bf_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_ms_pre(MDOC_ARGS)
{
@@ -1933,8 +1844,6 @@ mdoc_ms_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_igndelim_pre(MDOC_ARGS)
{
@@ -1943,8 +1852,6 @@ mdoc_igndelim_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc_pf_post(MDOC_ARGS)
{
@@ -1952,8 +1859,6 @@ mdoc_pf_post(MDOC_ARGS)
h->flags |= HTML_NOSPACE;
}
-
-/* ARGSUSED */
static int
mdoc_rs_pre(MDOC_ARGS)
{
@@ -1970,9 +1875,6 @@ mdoc_rs_pre(MDOC_ARGS)
return(1);
}
-
-
-/* ARGSUSED */
static int
mdoc_li_pre(MDOC_ARGS)
{
@@ -1983,8 +1885,6 @@ mdoc_li_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_sy_pre(MDOC_ARGS)
{
@@ -1995,8 +1895,6 @@ mdoc_sy_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc_bt_pre(MDOC_ARGS)
{
@@ -2005,8 +1903,6 @@ mdoc_bt_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_ud_pre(MDOC_ARGS)
{
@@ -2015,8 +1911,6 @@ mdoc_ud_pre(MDOC_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
mdoc_lb_pre(MDOC_ARGS)
{
@@ -2030,8 +1924,6 @@ mdoc_lb_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
mdoc__x_pre(MDOC_ARGS)
{
@@ -2041,52 +1933,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:
@@ -2105,8 +1997,6 @@ mdoc__x_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc__x_post(MDOC_ARGS)
{
@@ -2125,18 +2015,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;
@@ -2148,8 +2036,6 @@ mdoc_bk_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc_bk_post(MDOC_ARGS)
{
@@ -2158,8 +2044,6 @@ mdoc_bk_post(MDOC_ARGS)
h->flags &= ~(HTML_KEEP | HTML_PREKEEP);
}
-
-/* ARGSUSED */
static int
mdoc_quote_pre(MDOC_ARGS)
{
@@ -2169,54 +2053,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:
@@ -2228,8 +2112,6 @@ mdoc_quote_pre(MDOC_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
mdoc_quote_post(MDOC_ARGS)
{
@@ -2240,46 +2122,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:
@@ -2287,5 +2169,3 @@ mdoc_quote_post(MDOC_ARGS)
/* NOTREACHED */
}
}
-
-
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 7c80d234..47b84287 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -40,33 +40,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] = {
@@ -230,7 +230,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 &&
@@ -242,7 +242,6 @@ mdoc_macroend(struct mdoc *mdoc)
return(rew_last(mdoc, mdoc->first));
}
-
/*
* Look up a macro from within a subsequent context.
*/
@@ -255,7 +254,6 @@ lookup(enum mdoct from, const char *p)
return(lookup_raw(p));
}
-
/*
* Lookup a macro following the initial line macro.
*/
@@ -271,7 +269,6 @@ lookup_raw(const char *p)
return(MDOC_MAX);
}
-
static int
rew_last(struct mdoc *mdoc, const struct mdoc_node *to)
{
@@ -280,7 +277,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
@@ -300,7 +297,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.
@@ -309,37 +305,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);
@@ -347,7 +343,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
@@ -359,7 +354,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)
{
@@ -375,7 +370,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)
@@ -399,14 +394,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;
@@ -416,19 +411,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);
@@ -457,7 +452,6 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
REWIND_FORCE : REWIND_LATER);
}
-
static int
rew_elem(struct mdoc *mdoc, enum mdoct tok)
{
@@ -472,7 +466,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.
@@ -537,8 +530,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);
}
@@ -549,9 +542,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;
@@ -559,30 +551,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);
}
@@ -616,7 +608,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);
@@ -645,8 +637,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);
@@ -691,9 +683,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)
@@ -702,7 +693,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;
@@ -710,10 +701,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;
@@ -750,7 +741,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.
@@ -781,7 +772,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))
@@ -792,7 +783,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);
@@ -844,7 +835,6 @@ blk_exp_close(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
static int
in_line(MACRO_PROT_ARGS)
{
@@ -864,17 +854,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:
@@ -889,7 +879,7 @@ in_line(MACRO_PROT_ARGS)
if (ARGV_WORD == av) {
*pos = la;
break;
- }
+ }
if (ARGV_EOLN == av)
break;
if (ARGV_ARG == av)
@@ -912,7 +902,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)
@@ -923,15 +913,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))
@@ -939,12 +929,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);
@@ -958,13 +948,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;
}
@@ -1024,7 +1014,6 @@ in_line(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
static int
blk_full(MACRO_PROT_ARGS)
{
@@ -1066,7 +1055,7 @@ blk_full(MACRO_PROT_ARGS)
if (ARGV_WORD == av) {
*pos = la;
break;
- }
+ }
if (ARGV_EOLN == av)
break;
@@ -1087,8 +1076,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
@@ -1141,17 +1130,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;
@@ -1165,9 +1154,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.
@@ -1176,7 +1165,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))
@@ -1201,8 +1190,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,
@@ -1221,7 +1210,7 @@ blk_full(MACRO_PROT_ARGS)
return(0);
head = mdoc->last;
}
-
+
if (nl && ! append_delims(mdoc, line, pos, buf))
return(0);
@@ -1237,9 +1226,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);
}
@@ -1265,7 +1254,6 @@ out:
return(1);
}
-
static int
blk_part_imp(MACRO_PROT_ARGS)
{
@@ -1316,7 +1304,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;
@@ -1356,7 +1344,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)) {
@@ -1368,15 +1356,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);
@@ -1401,7 +1389,6 @@ blk_part_imp(MACRO_PROT_ARGS)
return(1);
}
-
static int
blk_part_exp(MACRO_PROT_ARGS)
{
@@ -1421,7 +1408,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;
@@ -1437,7 +1424,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);
@@ -1509,8 +1496,6 @@ blk_part_exp(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
-/* ARGSUSED */
static int
in_line_argn(MACRO_PROT_ARGS)
{
@@ -1532,18 +1517,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:
@@ -1558,7 +1543,7 @@ in_line_argn(MACRO_PROT_ARGS)
if (ARGV_WORD == av) {
*pos = la;
break;
- }
+ }
if (ARGV_EOLN == av)
break;
@@ -1580,9 +1565,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;
@@ -1609,9 +1594,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;
@@ -1635,7 +1620,6 @@ in_line_argn(MACRO_PROT_ARGS)
return(append_delims(mdoc, line, pos, buf));
}
-
static int
in_line_eoln(MACRO_PROT_ARGS)
{
@@ -1661,7 +1645,7 @@ in_line_eoln(MACRO_PROT_ARGS)
*pos = la;
break;
}
- if (ARGV_EOLN == av)
+ if (ARGV_EOLN == av)
break;
if (ARGV_ARG == av)
continue;
@@ -1705,8 +1689,6 @@ in_line_eoln(MACRO_PROT_ARGS)
return(rew_elem(mdoc, tok));
}
-
-/* ARGSUSED */
static int
ctx_synopsis(MACRO_PROT_ARGS)
{
@@ -1733,8 +1715,6 @@ ctx_synopsis(MACRO_PROT_ARGS)
return(blk_part_imp(mdoc, tok, line, ppos, pos, buf));
}
-
-/* ARGSUSED */
static int
obsolete(MACRO_PROT_ARGS)
{
@@ -1743,7 +1723,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
@@ -1783,8 +1762,6 @@ phrase(struct mdoc *mdoc, int line, int ppos, char *buf)
return(1);
}
-
-/* ARGSUSED */
static int
phrase_ta(MACRO_PROT_ARGS)
{
diff --git a/mdoc_man.c b/mdoc_man.c
index e5b65d38..f5a7a09f 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -274,6 +274,7 @@ static struct {
size_t size;
} fontqueue;
+
static void
font_push(char newfont)
{
@@ -281,7 +282,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("");
@@ -307,7 +308,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) {
@@ -362,16 +363,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;
@@ -490,7 +491,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();
@@ -548,8 +549,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");
@@ -587,8 +588,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;
@@ -605,7 +606,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.
@@ -697,8 +698,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;
@@ -711,8 +712,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('\"');
@@ -764,26 +765,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;
@@ -800,11 +801,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);
@@ -863,18 +864,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:
@@ -897,9 +898,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:
@@ -931,10 +932,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);
@@ -953,10 +954,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:
@@ -1151,15 +1152,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;
@@ -1175,10 +1176,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:
@@ -1234,7 +1235,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 ||
@@ -1243,24 +1244,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;
@@ -1271,17 +1272,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;
@@ -1330,32 +1331,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;
@@ -1369,7 +1370,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;
@@ -1464,12 +1465,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:
@@ -1567,10 +1568,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/mdoc_term.c b/mdoc_term.c
index 9a87ec90..3df7ebc8 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -42,7 +42,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 {
@@ -57,11 +57,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);
@@ -128,8 +128,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 */
@@ -137,30 +137,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 */
@@ -180,7 +180,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 */
@@ -191,7 +191,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 */
@@ -219,8 +219,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 */
@@ -230,21 +230,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 */
};
@@ -279,7 +279,6 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
term_end(p);
}
-
static void
print_mdoc_nodelist(DECL_ARGS)
{
@@ -289,8 +288,6 @@ print_mdoc_nodelist(DECL_ARGS)
print_mdoc_nodelist(p, pair, meta, n->next);
}
-
-/* ARGSUSED */
static void
print_mdoc_node(DECL_ARGS)
{
@@ -325,7 +322,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)
@@ -334,10 +331,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:
@@ -354,11 +351,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)
@@ -392,7 +389,6 @@ print_mdoc_node(DECL_ARGS)
}
}
-
static void
print_mdoc_foot(struct termp *p, const void *arg)
{
@@ -402,7 +398,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:
@@ -413,8 +409,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;
@@ -442,7 +438,6 @@ print_mdoc_foot(struct termp *p, const void *arg)
p->flags = 0;
}
-
static void
print_mdoc_head(struct termp *p, const void *arg)
{
@@ -515,7 +510,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)
{
@@ -529,7 +523,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)
{
@@ -542,7 +535,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)
{
@@ -562,16 +554,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;
@@ -617,7 +608,6 @@ print_bvspace(struct termp *p,
}
-/* ARGSUSED */
static int
termp_ll_pre(DECL_ARGS)
{
@@ -626,15 +616,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) {
@@ -645,7 +633,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.
@@ -657,7 +645,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;
@@ -671,21 +659,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
@@ -706,7 +692,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.
@@ -716,30 +702,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;
@@ -747,7 +733,7 @@ termp_it_pre(DECL_ARGS)
break;
}
- /*
+ /*
* Whitespace control. Inset bodies need an initial space,
* while diagonal bodies need two.
*/
@@ -755,12 +741,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:
@@ -770,7 +756,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;
@@ -786,7 +772,7 @@ termp_it_pre(DECL_ARGS)
*/
switch (type) {
- case (LIST_enum):
+ case LIST_enum:
/*
* Weird special case.
* Very narrow enum lists actually hang.
@@ -794,17 +780,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;
@@ -814,15 +800,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;
@@ -832,7 +818,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;
@@ -845,7 +831,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;
@@ -855,7 +841,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.
@@ -864,26 +850,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;
@@ -893,10 +879,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.
*/
@@ -909,53 +895,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;
@@ -966,8 +952,6 @@ termp_it_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_it_post(DECL_ARGS)
{
@@ -979,15 +963,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;
@@ -996,7 +980,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.
@@ -1007,8 +991,6 @@ termp_it_post(DECL_ARGS)
p->trailspace = 0;
}
-
-/* ARGSUSED */
static int
termp_nm_pre(DECL_ARGS)
{
@@ -1061,8 +1043,6 @@ termp_nm_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_nm_post(DECL_ARGS)
{
@@ -1077,8 +1057,6 @@ termp_nm_post(DECL_ARGS)
term_flushln(p);
}
-
-/* ARGSUSED */
static int
termp_fl_pre(DECL_ARGS)
{
@@ -1094,8 +1072,6 @@ termp_fl_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp__a_pre(DECL_ARGS)
{
@@ -1107,8 +1083,6 @@ termp__a_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_an_pre(DECL_ARGS)
{
@@ -1124,7 +1098,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)
@@ -1143,8 +1117,6 @@ termp_an_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_an_post(DECL_ARGS)
{
@@ -1165,8 +1137,6 @@ termp_an_post(DECL_ARGS)
}
-
-/* ARGSUSED */
static int
termp_ns_pre(DECL_ARGS)
{
@@ -1176,8 +1146,6 @@ termp_ns_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_rs_pre(DECL_ARGS)
{
@@ -1189,8 +1157,6 @@ termp_rs_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_rv_pre(DECL_ARGS)
{
@@ -1222,21 +1188,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)
{
@@ -1265,14 +1229,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)
{
@@ -1288,8 +1250,6 @@ termp_nd_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_bl_pre(DECL_ARGS)
{
@@ -1297,8 +1257,6 @@ termp_bl_pre(DECL_ARGS)
return(MDOC_HEAD != n->type);
}
-
-/* ARGSUSED */
static void
termp_bl_post(DECL_ARGS)
{
@@ -1307,7 +1265,6 @@ termp_bl_post(DECL_ARGS)
term_newln(p);
}
-/* ARGSUSED */
static int
termp_xr_pre(DECL_ARGS)
{
@@ -1318,7 +1275,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;
@@ -1342,7 +1299,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.
*/
@@ -1354,10 +1311,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;
}
@@ -1368,18 +1325,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;
@@ -1391,7 +1348,6 @@ synopsis_pre(struct termp *p, const struct mdoc_node *n)
}
}
-
static int
termp_vt_pre(DECL_ARGS)
{
@@ -1408,8 +1364,6 @@ termp_vt_pre(DECL_ARGS)
return(termp_under_pre(p, pair, meta, n));
}
-
-/* ARGSUSED */
static int
termp_bold_pre(DECL_ARGS)
{
@@ -1418,8 +1372,6 @@ termp_bold_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_fd_pre(DECL_ARGS)
{
@@ -1428,8 +1380,6 @@ termp_fd_pre(DECL_ARGS)
return(termp_bold_pre(p, pair, meta, n));
}
-
-/* ARGSUSED */
static void
termp_fd_post(DECL_ARGS)
{
@@ -1437,8 +1387,6 @@ termp_fd_post(DECL_ARGS)
term_newln(p);
}
-
-/* ARGSUSED */
static int
termp_sh_pre(DECL_ARGS)
{
@@ -1446,16 +1394,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);
@@ -1466,17 +1414,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;
@@ -1485,8 +1431,6 @@ termp_sh_post(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
termp_bt_pre(DECL_ARGS)
{
@@ -1496,8 +1440,6 @@ termp_bt_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
termp_lb_post(DECL_ARGS)
{
@@ -1506,8 +1448,6 @@ termp_lb_post(DECL_ARGS)
term_newln(p);
}
-
-/* ARGSUSED */
static int
termp_ud_pre(DECL_ARGS)
{
@@ -1517,8 +1457,6 @@ termp_ud_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_d1_pre(DECL_ARGS)
{
@@ -1530,8 +1468,6 @@ termp_d1_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_ft_pre(DECL_ARGS)
{
@@ -1542,8 +1478,6 @@ termp_ft_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_fn_pre(DECL_ARGS)
{
@@ -1605,8 +1539,6 @@ termp_fn_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_fa_pre(DECL_ARGS)
{
@@ -1632,8 +1564,6 @@ termp_fa_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_bd_pre(DECL_ARGS)
{
@@ -1656,9 +1586,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;
@@ -1678,21 +1608,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;
@@ -1709,21 +1639,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;
@@ -1733,8 +1661,6 @@ termp_bd_post(DECL_ARGS)
p->maxrmargin = rmax;
}
-
-/* ARGSUSED */
static int
termp_bx_pre(DECL_ARGS)
{
@@ -1758,8 +1684,6 @@ termp_bx_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_xx_pre(DECL_ARGS)
{
@@ -1768,22 +1692,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:
@@ -1801,8 +1725,6 @@ termp_xx_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static void
termp_pf_post(DECL_ARGS)
{
@@ -1810,19 +1732,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;
@@ -1833,8 +1753,6 @@ termp_ss_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_ss_post(DECL_ARGS)
{
@@ -1843,8 +1761,6 @@ termp_ss_post(DECL_ARGS)
term_newln(p);
}
-
-/* ARGSUSED */
static int
termp_cd_pre(DECL_ARGS)
{
@@ -1854,8 +1770,6 @@ termp_cd_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_in_pre(DECL_ARGS)
{
@@ -1875,8 +1789,6 @@ termp_in_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_in_post(DECL_ARGS)
{
@@ -1891,18 +1803,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:
@@ -1918,8 +1828,6 @@ termp_sp_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_quote_pre(DECL_ARGS)
{
@@ -1928,49 +1836,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:
@@ -1982,8 +1890,6 @@ termp_quote_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_quote_post(DECL_ARGS)
{
@@ -1994,49 +1900,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:
@@ -2045,8 +1951,6 @@ termp_quote_post(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
termp_fo_pre(DECL_ARGS)
{
@@ -2089,13 +1993,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;
@@ -2108,8 +2010,6 @@ termp_fo_post(DECL_ARGS)
}
}
-
-/* ARGSUSED */
static int
termp_bf_pre(DECL_ARGS)
{
@@ -2119,18 +2019,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)
{
@@ -2146,8 +2044,6 @@ termp_sm_pre(DECL_ARGS)
return(0);
}
-
-/* ARGSUSED */
static int
termp_ap_pre(DECL_ARGS)
{
@@ -2158,8 +2054,6 @@ termp_ap_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp____post(DECL_ARGS)
{
@@ -2187,8 +2081,6 @@ termp____post(DECL_ARGS)
term_word(p, ",");
}
-
-/* ARGSUSED */
static int
termp_li_pre(DECL_ARGS)
{
@@ -2197,8 +2089,6 @@ termp_li_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static int
termp_lk_pre(DECL_ARGS)
{
@@ -2225,18 +2115,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;
@@ -2248,8 +2136,6 @@ termp_bk_pre(DECL_ARGS)
return(1);
}
-
-/* ARGSUSED */
static void
termp_bk_post(DECL_ARGS)
{
@@ -2258,7 +2144,6 @@ termp_bk_post(DECL_ARGS)
p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
}
-/* ARGSUSED */
static void
termp__t_post(DECL_ARGS)
{
@@ -2268,13 +2153,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)
{
@@ -2284,14 +2168,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/mdoc_validate.c b/mdoc_validate.c
index fc0b6e18..b604fa5c 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -66,11 +66,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 *);
@@ -186,32 +186,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 */
@@ -219,10 +219,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 */
@@ -237,7 +237,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 */
@@ -249,11 +249,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 */
@@ -271,15 +271,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 */
@@ -289,12 +289,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 */
@@ -352,6 +352,7 @@ static const char * const secnames[SEC__MAX] = {
NULL
};
+
int
mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
{
@@ -360,17 +361,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;
@@ -381,12 +382,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)
{
@@ -397,13 +397,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;
@@ -412,14 +412,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;
@@ -427,19 +427,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);
@@ -450,9 +450,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);
}
@@ -566,9 +566,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);
}
@@ -581,7 +581,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;
@@ -592,7 +592,6 @@ pre_display(PRE_ARGS)
return(1);
}
-
static int
pre_bl(PRE_ARGS)
{
@@ -614,58 +613,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];
@@ -674,7 +672,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];
@@ -710,19 +708,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;
@@ -735,7 +733,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
@@ -743,31 +741,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;
@@ -778,12 +776,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;
@@ -800,32 +797,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];
@@ -834,7 +830,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;
@@ -874,7 +870,6 @@ pre_bd(PRE_ARGS)
return(1);
}
-
static int
pre_ss(PRE_ARGS)
{
@@ -884,7 +879,6 @@ pre_ss(PRE_ARGS)
return(check_parent(mdoc, n, MDOC_Sh, MDOC_BODY));
}
-
static int
pre_sh(PRE_ARGS)
{
@@ -894,7 +888,6 @@ pre_sh(PRE_ARGS)
return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT));
}
-
static int
pre_it(PRE_ARGS)
{
@@ -905,7 +898,6 @@ pre_it(PRE_ARGS)
return(check_parent(mdoc, n, MDOC_Bl, MDOC_BODY));
}
-
static int
pre_an(PRE_ARGS)
{
@@ -913,10 +905,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;
@@ -979,7 +971,6 @@ pre_dd(PRE_ARGS)
return(1);
}
-
static int
post_bf(POST_ARGS)
{
@@ -997,7 +988,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);
@@ -1010,9 +1001,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) {
@@ -1024,7 +1015,7 @@ post_bf(POST_ARGS)
}
/* Extract argument into data. */
-
+
if (np->parent->args) {
arg = np->parent->args->argv[0].arg;
if (MDOC_Emphasis == arg)
@@ -1046,7 +1037,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);
@@ -1076,11 +1067,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);
@@ -1095,7 +1086,6 @@ post_eoln(POST_ARGS)
return(1);
}
-
static int
post_vt(POST_ARGS)
{
@@ -1111,15 +1101,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)
{
@@ -1139,7 +1128,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
@@ -1166,37 +1155,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);
@@ -1214,7 +1203,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);
@@ -1254,7 +1243,6 @@ post_an(POST_ARGS)
return(1);
}
-
static int
post_it(POST_ARGS)
{
@@ -1275,37 +1263,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);
@@ -1324,9 +1312,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;
@@ -1336,7 +1324,7 @@ post_it(POST_ARGS)
}
static int
-post_bl_block(POST_ARGS)
+post_bl_block(POST_ARGS)
{
struct mdoc_node *n, *ni, *nc;
@@ -1350,8 +1338,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);
@@ -1367,11 +1355,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;
@@ -1426,7 +1414,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;
@@ -1478,7 +1466,7 @@ post_bl_block_tag(POST_ARGS)
sz = ssz;
break;
- }
+ }
/* Defaults to ten ens. */
@@ -1492,8 +1480,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;
@@ -1507,9 +1495,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;
@@ -1526,7 +1513,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.
*/
@@ -1540,7 +1527,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;
@@ -1554,8 +1541,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;
@@ -1583,11 +1570,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);
@@ -1692,14 +1679,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);
@@ -1740,10 +1727,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);
@@ -1797,13 +1784,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;
@@ -1812,7 +1799,7 @@ post_rs(POST_ARGS)
nn->prev = nn->next = NULL;
- /*
+ /*
* Scan back until we reach a node that's
* ordered before `nn'.
*/
@@ -1861,15 +1848,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);
@@ -2025,19 +2012,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,
@@ -2083,7 +2070,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'.
*/
@@ -2143,10 +2130,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)
@@ -2156,7 +2143,7 @@ pre_literal(PRE_ARGS)
abort();
/* NOTREACHED */
}
-
+
return(1);
}
@@ -2213,7 +2200,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.
*/
@@ -2221,8 +2208,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)) {
@@ -2234,12 +2221,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. */
@@ -2250,10 +2237,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);
@@ -2264,16 +2251,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);
@@ -2286,9 +2273,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. */
@@ -2317,7 +2304,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.
@@ -2325,8 +2312,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);
}
@@ -2349,7 +2335,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;
@@ -2368,8 +2354,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);
}
@@ -2396,7 +2382,7 @@ post_std(POST_ARGS)
if (NULL == mdoc->meta.name)
return(1);
-
+
nn = n;
mdoc->next = MDOC_NEXT_CHILD;
@@ -2407,12 +2393,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);
@@ -2424,87 +2410,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/out.c b/out.c
index 672e8727..6ae02fb5 100644
--- a/out.c
+++ b/out.c
@@ -39,7 +39,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.
*/
@@ -56,10 +57,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:
@@ -87,39 +88,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:
@@ -153,8 +154,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)
@@ -187,26 +188,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();
@@ -232,7 +233,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/out.h b/out.h
index fefe2b01..0bf9e9c0 100644
--- a/out.h
+++ b/out.h
@@ -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/read.c b/read.c
index 98c245a0..3fe826aa 100644
--- a/read.c
+++ b/read.c
@@ -46,7 +46,7 @@
#define REPARSE_LIMIT 1000
struct buf {
- char *buf; /* binary input buffer */
+ char *buf; /* binary input buffer */
size_t sz; /* size of binary buffer */
};
@@ -63,7 +63,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 */
};
@@ -153,7 +153,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
/* related to equations */
"unexpected literal in equation",
-
+
"generic error",
/* related to equations */
@@ -224,6 +224,7 @@ static const char * const mandoclevels[MANDOCLEVEL_MAX] = {
"SYSERR"
};
+
static void
resize_buf(struct buf *buf, size_t initial)
{
@@ -257,7 +258,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);
@@ -265,7 +266,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);
@@ -274,16 +275,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);
@@ -308,8 +309,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])
@@ -346,7 +347,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,
@@ -357,10 +358,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;
@@ -414,10 +415,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;
@@ -429,7 +430,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';
@@ -452,13 +453,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';
@@ -467,31 +467,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);
@@ -503,7 +502,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)
@@ -532,7 +531,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.
@@ -548,23 +547,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);
@@ -860,7 +859,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/roff.c b/roff.c
index ee426699..a8524d98 100644
--- a/roff.c
+++ b/roff.c
@@ -137,7 +137,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 */ \
@@ -193,7 +193,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);
@@ -202,13 +202,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);
@@ -315,6 +315,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)
{
@@ -367,7 +368,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.
@@ -378,7 +378,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);
@@ -386,7 +386,6 @@ roffnode_pop(struct roff *r)
free(p);
}
-
/*
* Push a roff node onto the instruction stack. This must later be
* removed with roffnode_pop().
@@ -409,7 +408,6 @@ roffnode_push(struct roff *r, enum rofft tok, const char *name,
r->last = p;
}
-
static void
roff_free1(struct roff *r)
{
@@ -459,7 +457,6 @@ roff_reset(struct roff *r)
r->control = 0;
}
-
void
roff_free(struct roff *r)
{
@@ -468,7 +465,6 @@ roff_free(struct roff *r)
free(r);
}
-
struct roff *
roff_alloc(struct mparse *parse, int options)
{
@@ -478,7 +474,7 @@ roff_alloc(struct mparse *parse, int options)
r->parse = parse;
r->options = options;
r->rstackpos = -1;
-
+
roffhash_init();
return(r);
@@ -533,15 +529,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:
@@ -565,14 +561,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;
@@ -591,10 +587,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) {
@@ -609,30 +603,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);
@@ -713,7 +706,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;
@@ -744,8 +737,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);
@@ -767,9 +759,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));
}
/*
@@ -782,29 +773,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);
}
}
@@ -820,8 +808,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. */
@@ -840,7 +828,6 @@ roff_parse(struct roff *r, const char *buf, int *pos)
return(t);
}
-/* ARGSUSED */
static enum rofferr
roff_cblock(ROFF_ARGS)
{
@@ -856,18 +843,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);
@@ -883,7 +870,6 @@ roff_cblock(ROFF_ARGS)
}
-
static void
roffnode_cleanscope(struct roff *r)
{
@@ -895,7 +881,6 @@ roffnode_cleanscope(struct roff *r)
}
}
-
static void
roff_ccond(struct roff *r, int ln, int ppos)
{
@@ -906,11 +891,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);
@@ -927,8 +912,6 @@ roff_ccond(struct roff *r, int ln, int ppos)
return;
}
-
-/* ARGSUSED */
static enum rofferr
roff_block(ROFF_ARGS)
{
@@ -1007,8 +990,6 @@ roff_block(ROFF_ARGS)
return(ROFF_IGN);
}
-
-/* ARGSUSED */
static enum rofferr
roff_block_sub(ROFF_ARGS)
{
@@ -1029,10 +1010,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);
@@ -1064,12 +1045,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)
{
@@ -1080,8 +1058,6 @@ roff_block_text(ROFF_ARGS)
return(ROFF_IGN);
}
-
-/* ARGSUSED */
static enum rofferr
roff_cond_sub(ROFF_ARGS)
{
@@ -1102,7 +1078,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));
}
/*
@@ -1126,7 +1102,6 @@ roff_cond_sub(ROFF_ARGS)
return(rr ? ROFF_CONT : ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_cond_text(ROFF_ARGS)
{
@@ -1237,20 +1212,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:
@@ -1263,7 +1238,6 @@ roff_evalcond(const char *v, int *pos)
return(roff_evalstrcond(v, pos) == wanttrue);
}
-/* ARGSUSED */
static enum rofferr
roff_line_ignore(ROFF_ARGS)
{
@@ -1271,24 +1245,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
@@ -1297,8 +1270,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;
@@ -1329,7 +1302,7 @@ roff_cond(ROFF_ARGS)
r->last->endspan = -1;
pos += 2;
goto out;
- }
+ }
/*
* Anything else following the conditional causes
@@ -1347,8 +1320,6 @@ out:
return(ROFF_RERUN);
}
-
-/* ARGSUSED */
static enum rofferr
roff_ds(ROFF_ARGS)
{
@@ -1390,31 +1361,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;
@@ -1424,11 +1395,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;
@@ -1522,50 +1493,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;
@@ -1616,17 +1587,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);
@@ -1731,7 +1702,6 @@ roff_rr(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_rm(ROFF_ARGS)
{
@@ -1747,7 +1717,6 @@ roff_rm(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_it(ROFF_ARGS)
{
@@ -1761,7 +1730,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;
@@ -1772,7 +1741,6 @@ roff_it(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_Dd(ROFF_ARGS)
{
@@ -1785,7 +1753,6 @@ roff_Dd(ROFF_ARGS)
return(ROFF_CONT);
}
-/* ARGSUSED */
static enum rofferr
roff_TH(ROFF_ARGS)
{
@@ -1798,7 +1765,6 @@ roff_TH(ROFF_ARGS)
return(ROFF_CONT);
}
-/* ARGSUSED */
static enum rofferr
roff_TE(ROFF_ARGS)
{
@@ -1811,7 +1777,6 @@ roff_TE(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_T_(ROFF_ARGS)
{
@@ -1834,7 +1799,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;
@@ -1856,7 +1821,6 @@ roff_openeqn(struct roff *r, const char *name, int line,
}
}
-/* ARGSUSED */
static enum rofferr
roff_EQ(ROFF_ARGS)
{
@@ -1865,7 +1829,6 @@ roff_EQ(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_EN(ROFF_ARGS)
{
@@ -1874,7 +1837,6 @@ roff_EN(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_TS(ROFF_ARGS)
{
@@ -1896,7 +1858,6 @@ roff_TS(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_cc(ROFF_ARGS)
{
@@ -1913,7 +1874,6 @@ roff_cc(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_tr(ROFF_ARGS)
{
@@ -1935,9 +1895,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);
@@ -1947,28 +1907,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);
@@ -1978,7 +1938,6 @@ roff_tr(ROFF_ARGS)
return(ROFF_IGN);
}
-/* ARGSUSED */
static enum rofferr
roff_so(ROFF_ARGS)
{
@@ -2003,7 +1962,6 @@ roff_so(ROFF_ARGS)
return(ROFF_SO);
}
-/* ARGSUSED */
static enum rofferr
roff_userdef(ROFF_ARGS)
{
@@ -2104,7 +2062,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
@@ -2185,8 +2143,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++)
@@ -2213,14 +2171,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);
}
@@ -2279,8 +2237,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;
@@ -2301,8 +2259,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.
*/
@@ -2317,7 +2275,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/st.in b/st.in
index 4a001816..71d5ed92 100644
--- a/st.in
+++ b/st.in
@@ -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/tbl.c b/tbl.c
index 74776dab..5fa4c143 100644
--- a/tbl.c
+++ b/tbl.c
@@ -30,6 +30,7 @@
#include "libmandoc.h"
#include "libroff.h"
+
enum rofferr
tbl_read(struct tbl_node *tbl, int ln, const char *p, int offs)
{
@@ -53,11 +54,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;
@@ -129,8 +130,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;
@@ -138,7 +139,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 *
@@ -163,14 +164,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/tbl_data.c b/tbl_data.c
index f52a9a65..89c5741e 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -30,13 +30,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;
@@ -49,7 +50,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.
*/
@@ -63,8 +64,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)++;
@@ -82,7 +83,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp,
spans++;
else
break;
-
+
dat->spans = spans;
if (dp->last) {
@@ -127,21 +128,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;
@@ -172,9 +172,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);
}
@@ -216,7 +216,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,
@@ -230,11 +230,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/tbl_html.c b/tbl_html.c
index 7adbdcc5..fbf6ef91 100644
--- a/tbl_html.c
+++ b/tbl_html.c
@@ -31,15 +31,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 +106,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/tbl_layout.c b/tbl_layout.c
index 999207a4..c2ff3bf1 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -55,16 +55,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];
@@ -73,35 +74,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;
@@ -117,8 +118,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);
}
@@ -135,8 +136,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);
}
@@ -145,69 +146,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;
@@ -234,8 +235,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);
}
@@ -252,14 +253,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;
@@ -290,7 +292,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)
{
@@ -321,9 +322,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/tbl_opts.c b/tbl_opts.c
index 7ffd0fdb..cf80b888 100644
--- a/tbl_opts.c
+++ b/tbl_opts.c
@@ -62,10 +62,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},
@@ -76,11 +76,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)
{
@@ -93,8 +94,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);
}
@@ -107,27 +108,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]))
@@ -142,12 +143,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();
@@ -182,7 +183,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:]+ [)]
*/
@@ -215,7 +216,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.
*/
@@ -231,7 +232,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;
@@ -239,7 +240,7 @@ again: /*
break;
}
- /*
+ /*
* Allow us to recover from bad options by continuing to another
* parse sequence.
*/
diff --git a/tbl_term.c b/tbl_term.c
index 5cd5e65d..fbe72af7 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -32,14 +32,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 *);
@@ -66,7 +66,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;
@@ -108,7 +108,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.
@@ -117,18 +117,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.
@@ -145,7 +145,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.
*/
@@ -163,7 +163,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);
/*
@@ -257,8 +257,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) {
@@ -268,43 +268,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:
@@ -340,7 +340,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;
@@ -359,17 +359,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/term.c b/term.c
index 606642e8..20549129 100644
--- a/term.c
+++ b/term.c
@@ -39,6 +39,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)
{
@@ -51,9 +52,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)
{
@@ -63,7 +63,6 @@ term_begin(struct termp *p, term_margin head,
(*p->begin)(p);
}
-
void
term_end(struct termp *p)
{
@@ -171,7 +170,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;
@@ -251,7 +250,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;
@@ -275,7 +274,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
@@ -298,8 +297,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.
@@ -313,7 +311,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.
@@ -342,7 +339,6 @@ term_fontlast(struct termp *p)
p->fontq[p->fonti] = f;
}
-
void
term_fontrepl(struct termp *p, enum termfont f)
{
@@ -351,7 +347,6 @@ term_fontrepl(struct termp *p, enum termfont f)
p->fontq[p->fonti] = f;
}
-
void
term_fontpush(struct termp *p, enum termfont f)
{
@@ -361,7 +356,6 @@ term_fontpush(struct termp *p, enum termfont f)
p->fontq[++p->fonti] = f;
}
-
const void *
term_fontq(struct termp *p)
{
@@ -369,7 +363,6 @@ term_fontq(struct termp *p)
return(&p->fontq[p->fonti]);
}
-
enum termfont
term_fonttop(struct termp *p)
{
@@ -377,7 +370,6 @@ term_fonttop(struct termp *p)
return(p->fontq[p->fonti]);
}
-
void
term_fontpopq(struct termp *p, const void *key)
{
@@ -387,7 +379,6 @@ term_fontpopq(struct termp *p, const void *key)
assert(p->fonti >= 0);
}
-
void
term_fontpop(struct termp *p)
{
@@ -457,13 +448,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;
@@ -474,45 +465,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:
@@ -595,7 +586,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];
@@ -627,11 +618,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;
@@ -688,7 +679,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)
@@ -696,16 +687,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);
@@ -717,17 +708,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;
@@ -735,7 +726,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:
@@ -753,15 +744,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;
@@ -771,29 +762,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:
@@ -803,8 +793,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
@@ -815,6 +804,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/term.h b/term.h
index 533ca696..4fe518e8 100644
--- a/term.h
+++ b/term.h
@@ -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/term_ascii.c b/term_ascii.c
index edf203a2..b7712dc4 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -67,6 +67,7 @@ static void locale_letter(struct termp *, int);
static size_t locale_width(const struct termp *, int);
#endif
+
static struct termp *
ascii_init(enum termenc enc, char *outopts)
{
@@ -94,8 +95,8 @@ ascii_init(enum termenc enc, char *outopts)
#ifdef USE_WCHAR
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;
@@ -113,13 +114,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.
@@ -152,7 +153,6 @@ utf8_alloc(char *outopts)
return(ascii_init(TERMENC_UTF8, outopts));
}
-
void *
locale_alloc(char *outopts)
{
@@ -175,7 +175,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)
{
@@ -190,11 +189,10 @@ ascii_free(void *arg)
term_free((struct termp *)arg);
}
-/* ARGSUSED */
static void
ascii_letter(struct termp *p, int c)
{
-
+
putchar(c);
}
@@ -212,7 +210,6 @@ ascii_end(struct termp *p)
(*p->footf)(p, p->argf);
}
-/* ARGSUSED */
static void
ascii_endline(struct termp *p)
{
@@ -220,17 +217,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)
{
@@ -242,22 +237,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:
@@ -269,7 +264,6 @@ ascii_hspan(const struct termp *p, const struct roffsu *su)
}
#ifdef USE_WCHAR
-/* ARGSUSED */
static size_t
locale_width(const struct termp *p, int c)
{
@@ -278,17 +272,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)
{
@@ -296,11 +288,10 @@ locale_endline(struct termp *p)
putwchar(L'\n');
}
-/* ARGSUSED */
static void
locale_letter(struct termp *p, int c)
{
-
+
putwchar(c);
}
#endif
diff --git a/term_ps.c b/term_ps.c
index 6e46502a..942f7272 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -40,11 +40,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 {
@@ -80,7 +80,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 */
@@ -454,7 +454,7 @@ pspdf_alloc(char *outopts)
p->letter = ps_letter;
p->setwidth = ps_setwidth;
p->width = ps_width;
-
+
toks[0] = "paper";
toks[1] = NULL;
@@ -462,7 +462,7 @@ pspdf_alloc(char *outopts)
while (outopts && *outopts)
switch (getsubopt(&outopts, UNCONST(toks), &v)) {
- case (0):
+ case 0:
pp = v;
break;
default:
@@ -498,7 +498,7 @@ pspdf_alloc(char *outopts)
fprintf(stderr, "%s: Unknown paper\n", pp);
}
- /*
+ /*
* This MUST be defined before any PNT2AFM or AFM2PNT
* calculations occur.
*/
@@ -512,10 +512,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. */
@@ -534,7 +532,6 @@ pspdf_alloc(char *outopts)
return(p);
}
-
static void
ps_setwidth(struct termp *p, int iop, size_t width)
{
@@ -550,7 +547,6 @@ ps_setwidth(struct termp *p, int iop, size_t width)
p->ps->lastwidth = lastwidth;
}
-
void
pspdf_free(void *arg)
{
@@ -567,7 +563,6 @@ pspdf_free(void *arg)
term_free(p);
}
-
static void
ps_printf(struct termp *p, const char *fmt, ...)
{
@@ -585,12 +580,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.
@@ -606,7 +600,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)
{
@@ -615,7 +608,6 @@ ps_putchar(struct termp *p, char c)
/* See ps_printf(). */
if ( ! (PS_MARGINS & p->ps->flags)) {
- /* LINTED */
putchar(c);
p->ps->pdfbytes++;
return;
@@ -628,7 +620,6 @@ ps_putchar(struct termp *p, char c)
p->ps->psmarg[pos] = '\0';
}
-
static void
pdf_obj(struct termp *p, size_t obj)
{
@@ -637,9 +628,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);
@@ -650,7 +640,6 @@ pdf_obj(struct termp *p, size_t obj)
ps_printf(p, "%zu 0 obj\n", obj);
}
-
static void
ps_closepage(struct termp *p)
{
@@ -683,7 +672,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");
@@ -704,8 +693,6 @@ ps_closepage(struct termp *p)
p->ps->flags |= PS_NEWPAGE;
}
-
-/* ARGSUSED */
static void
ps_end(struct termp *p)
{
@@ -728,7 +715,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");
@@ -740,11 +727,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);
@@ -758,8 +743,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");
@@ -772,14 +757,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.
*/
@@ -812,7 +796,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.
*/
@@ -827,9 +811,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++)
@@ -861,7 +845,6 @@ ps_begin(struct termp *p)
ps_setfont(p, TERMFONT_NONE);
}
-
static void
ps_pletter(struct termp *p, int c)
{
@@ -874,25 +857,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.
@@ -900,16 +881,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;
}
@@ -923,11 +903,11 @@ ps_pletter(struct termp *p, int c)
*/
switch (c) {
- case ('('):
+ case '(':
/* FALLTHROUGH */
- case (')'):
+ case ')':
/* FALLTHROUGH */
- case ('\\'):
+ case '\\':
ps_putchar(p, '\\');
break;
default:
@@ -942,19 +922,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).
@@ -962,7 +941,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
@@ -971,7 +950,6 @@ ps_pclose(struct termp *p)
p->ps->flags &= ~PS_INLINE;
}
-
static void
ps_fclose(struct termp *p)
{
@@ -999,13 +977,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;
/*
@@ -1050,7 +1026,6 @@ ps_letter(struct termp *p, int arg)
ps_pletter(p, c);
}
-
static void
ps_advance(struct termp *p, size_t len)
{
@@ -1066,7 +1041,6 @@ ps_advance(struct termp *p, size_t len)
p->ps->pscol += len;
}
-
static void
ps_endline(struct termp *p)
{
@@ -1078,7 +1052,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)
@@ -1098,8 +1072,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;
}
@@ -1107,14 +1080,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.
@@ -1124,17 +1096,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)
{
@@ -1146,42 +1114,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:
@@ -1206,4 +1173,3 @@ ps_growbuf(struct termp *p, size_t sz)
p->ps->psmarg = mandoc_realloc
(p->ps->psmarg, p->ps->psmargsz);
}
-
diff --git a/tree.c b/tree.c
index 558c794e..49f20602 100644
--- a/tree.c
+++ b/tree.c
@@ -36,7 +36,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)
{
@@ -44,8 +43,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)
{
@@ -53,7 +50,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)
{
@@ -67,33 +63,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();
@@ -101,37 +97,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:
@@ -176,7 +172,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)
{
@@ -186,30 +181,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();
@@ -217,26 +212,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();
@@ -277,30 +272,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);
@@ -316,10 +311,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:
@@ -328,14 +323,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: