- if ( ! rew_warn(m, m->last, er))
- return(0);
- if ( ! man_valid_post(m))
- return(0);
-
- m->next = MAN_ROOT == m->last->type ?
- MAN_NEXT_CHILD : MAN_NEXT_SIBLING;
-
- 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)
- 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
-rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n)
-{
- enum rew c;
-
- /* We cannot progress beyond the root ever. */
- if (MAN_ROOT == n->type)
- return(REW_HALT);
-
- assert(n->parent);
-
- /* Normal nodes shouldn't go to the level of the root. */
- if (MAN_ROOT == n->parent->type)
- return(REW_REWIND);
-
- /* Already-validated nodes should be closed out. */
- if (MAN_VALID & n->flags)
- return(REW_NOHALT);
-
- /* First: rewind to ourselves. */
- if (type == n->type && tok == n->tok)
- return(REW_REWIND);
-
- /*
- * Next follow the implicit scope-smashings as defined by man.7:
- * section, sub-section, etc.
+ /*
+ * If we ended up at the parent of the node we were
+ * supposed to rewind to, that means the target node
+ * got deleted, so add the next node we parse as a child
+ * of the parent instead of as a sibling of the target.