-static struct roffnode *roffnode_new(int, struct rofftree *);
-static void roffnode_free(struct rofftree *);
-static void roff_warn(const struct rofftree *,
- const char *, char *, ...);
-static void roff_err(const struct rofftree *,
- const char *, char *, ...);
-static int roffpurgepunct(struct rofftree *, char **);
-static int roffscan(int, const int *);
-static int rofffindtok(const char *);
-static int rofffindarg(const char *);
-static int rofffindcallable(const char *);
-static int roffismsec(const char *);
-static int roffispunct(const char *);
-static int roffargs(const struct rofftree *,
- int, char *, char **);
-static int roffargok(int, int);
-static int roffnextopt(const struct rofftree *,
- int, char ***, char **);
-static int roffparseopts(struct rofftree *, int,
- char ***, int *, char **);
-static int roffcall(struct rofftree *, int, char **);
-static int roffexit(struct rofftree *, int);
-static int roffparse(struct rofftree *, char *);
-static int textparse(struct rofftree *, char *);
-static int roffdata(struct rofftree *, int, char *);
-static int roffspecial(struct rofftree *, int,
- const char *, const int *,
- const char **, size_t, char **);
-static int roffsetname(struct rofftree *, char **);
-
-#ifdef __linux__
-extern size_t strlcat(char *, const char *, size_t);
-extern size_t strlcpy(char *, const char *, size_t);
-extern int vsnprintf(char *, size_t,
- const char *, va_list);
-extern char *strptime(const char *, const char *,
- struct tm *);
-#endif
-
-int
-roff_free(struct rofftree *tree, int flush)
-{
- int error, t;
- struct roffnode *n;
-
- error = 0;
-
- if ( ! flush)
- goto end;
-
- error = 1;
-
- if (ROFF_PRELUDE & tree->state) {
- roff_err(tree, NULL, "prelude never finished");
- goto end;
- }
-
- for (n = tree->last; n; n = n->parent) {
- if (0 != tokens[n->tok].ctx)
- continue;
- roff_err(tree, NULL, "closing explicit scope `%s'",
- toknames[n->tok]);
- goto end;
- }
-
- while (tree->last) {
- t = tree->last->tok;
- if ( ! roffexit(tree, t))
- goto end;
- }
-
- if ( ! (*tree->cb.rofftail)(tree->arg))
- goto end;
-
- error = 0;
-
-end: