void mdoc_state_reset(struct roff_man *mdoc) { roff_setreg(mdoc->roff, "nS", 0, '='); mdoc->flags = 0; }
static void state_sh(STATE_ARGS) { struct roff_node *nch; char *secname; if (n->type != ROFFT_HEAD) return; if ( ! (n->flags & MDOC_VALID)) { secname = NULL; deroff(&secname, n); /* * Set the section attribute for the BLOCK, HEAD, * and HEAD children; the latter can only be TEXT * nodes, so no recursion is needed. For other * nodes, including the .Sh BODY, this is done * when allocating the node data structures, but * for .Sh BLOCK and HEAD, the section is still * unknown at that time. */ n->sec = n->parent->sec = secname == NULL ? SEC_CUSTOM : mdoc_a2sec(secname); for (nch = n->child; nch != NULL; nch = nch->next) nch->sec = n->sec; free(secname); } if ((mdoc->lastsec = n->sec) == SEC_SYNOPSIS) { roff_setreg(mdoc->roff, "nS", 1, '='); mdoc->flags |= MDOC_SYNOPSIS; } else { roff_setreg(mdoc->roff, "nS", 0, '='); mdoc->flags &= ~MDOC_SYNOPSIS; } }
/* ARGSUSED */ static enum rofferr roff_nr(ROFF_ARGS) { const char *key; char *val; size_t sz; int iv; char sign; val = *bufp + pos; key = roff_getname(r, &val, ln, pos); sign = *val; if ('+' == sign || '-' == sign) val++; sz = strspn(val, "0123456789"); iv = sz ? mandoc_strntoi(val, sz, 10) : 0; roff_setreg(r, key, iv, sign); return(ROFF_IGN); }