]> git.cameronkatri.com Git - mandoc.git/blobdiff - man.c
Sync to OpenBSD:
[mandoc.git] / man.c
diff --git a/man.c b/man.c
index 618aaf53e176604b1f75e1d852ec9118768b993d..147662e91253b465dab70f77f1479219e30bf7ae 100644 (file)
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/*     $Id: man.c,v 1.87 2010/08/20 01:02:07 schwarze Exp $ */
+/*     $Id: man.c,v 1.92 2010/12/08 10:58:22 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -36,11 +36,10 @@ const       char *const __man_macronames[MAN_MAX] = {
        "IP",           "HP",           "SM",           "SB",
        "BI",           "IB",           "BR",           "RB",
        "R",            "B",            "I",            "IR",
-       "RI",           "na",           "i",            "sp",
-       "nf",           "fi",           "r",            "RE",
-       "RS",           "DT",           "UC",           "PD",
-       "Sp",           "Vb",           "Ve",           "AT",
-       "in"
+       "RI",           "na",           "sp",           "nf",
+       "fi",           "RE",           "RS",           "DT",
+       "UC",           "PD",           "AT",           "in",
+       "ft"
        };
 
 const  char * const *man_macronames = __man_macronames;
@@ -216,8 +215,6 @@ man_node_append(struct man *man, struct man_node *p)
        case (MAN_TEXT):
                if ( ! man_valid_post(man))
                        return(0);
-               if ( ! man_action_post(man))
-                       return(0);
                break;
        default:
                break;
@@ -476,9 +473,7 @@ man_pmacro(struct man *m, int ln, char *buf, int offs)
 
        tok = (j > 0 && j < 4) ? man_hash_find(mac) : MAN_MAX;
        if (MAN_MAX == tok) {
-               man_vmsg(m, MANDOCERR_MACRO, ln, ppos, 
-                   "unknown macro: %s%s",
-                   buf, strlen(buf) > 3 ? "..." : "");
+               man_vmsg(m, MANDOCERR_MACRO, ln, ppos, "%s", buf + ppos - 1);
                return(1);
        }
 
@@ -497,37 +492,23 @@ man_pmacro(struct man *m, int ln, char *buf, int offs)
                        goto err;
 
        /* 
-        * Remove prior ELINE macro, as it's being clobbering by a new
+        * 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.
         */
 
        if ( ! (MAN_NSCOPED & man_macros[tok].flags) &&
                        m->flags & MAN_ELINE) {
-               assert(MAN_TEXT != m->last->type);
-
-               /*
-                * This occurs in the following construction:
-                *   .B
-                *   .br
-                *   .B
-                *   .br
-                *   I hate man macros.
-                * Flat-out disallow this madness.
-                */
-               if (MAN_NSCOPED & man_macros[m->last->tok].flags) {
-                       man_pmsg(m, ln, ppos, MANDOCERR_SYNTLINESCOPE);
-                       return(0);
-               }
-
                n = m->last;
+               assert(MAN_TEXT != n->type);
 
-               assert(n);
-               assert(NULL == n->child);
-               assert(0 == n->nchild);
+               /* Remove repeated NSCOPED macros causing ELINE. */
 
-               if ( ! man_nmsg(m, n, MANDOCERR_LINESCOPE))
-                       return(0);
+               if (MAN_NSCOPED & man_macros[n->tok].flags)
+                       n = n->parent;
+
+               man_vmsg(m, MANDOCERR_LINESCOPE, n->line, n->pos,
+                               "%s", man_macronames[n->tok]);
 
                man_node_delete(m, n);
                m->flags &= ~MAN_ELINE;