Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/mdocml/dist Import mdocml 1.9.13:



details:   https://anonhg.NetBSD.org/src/rev/1f891f6640a7
branches:  trunk
changeset: 748805:1f891f6640a7
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Nov 05 18:24:50 2009 +0000

description:
Import mdocml 1.9.13:
- added: -fign-escape
- fix: -Thtml accessibility (identifiers, table summary, etc.)
- fix: -Tascii -mdoc segfault with specific `Bl -hang' lists
- portability: bzero() -> memset()
- portability: warnx -> fprintf/perror
- fix: -Thtml buffer munging with certain tags
- fix: -Thtml output of some tags (empty divs, etc.)
- portability: compiler attributes
- documentation: significant man.7 and mdoc.7 improvements

diffstat:

 external/bsd/mdocml/dist/arch.c          |    3 +-
 external/bsd/mdocml/dist/att.c           |    3 +-
 external/bsd/mdocml/dist/chars.c         |   21 +-
 external/bsd/mdocml/dist/html.c          |  103 +++--
 external/bsd/mdocml/dist/html.h          |    8 +-
 external/bsd/mdocml/dist/lib.c           |    3 +-
 external/bsd/mdocml/dist/lib.in          |   11 +-
 external/bsd/mdocml/dist/libman.h        |    3 +-
 external/bsd/mdocml/dist/libmandoc.h     |   11 +-
 external/bsd/mdocml/dist/libmdoc.h       |    3 +-
 external/bsd/mdocml/dist/main.c          |   97 ++---
 external/bsd/mdocml/dist/man.7           |  512 +++++++++++++++++++++++++++---
 external/bsd/mdocml/dist/man.c           |   61 +--
 external/bsd/mdocml/dist/man.h           |    4 +-
 external/bsd/mdocml/dist/man_action.c    |   58 +--
 external/bsd/mdocml/dist/man_html.c      |   18 +-
 external/bsd/mdocml/dist/man_term.c      |   26 +-
 external/bsd/mdocml/dist/man_validate.c  |    4 +-
 external/bsd/mdocml/dist/mandoc.1        |    7 +-
 external/bsd/mdocml/dist/mandoc.c        |  124 +++++++-
 external/bsd/mdocml/dist/mdoc.7          |  242 +++++++++++---
 external/bsd/mdocml/dist/mdoc.c          |   62 +--
 external/bsd/mdocml/dist/mdoc.h          |    4 +-
 external/bsd/mdocml/dist/mdoc_argv.c     |   47 +-
 external/bsd/mdocml/dist/mdoc_html.c     |   64 ++-
 external/bsd/mdocml/dist/mdoc_macro.c    |    3 +-
 external/bsd/mdocml/dist/mdoc_strings.c  |   28 +-
 external/bsd/mdocml/dist/mdoc_term.c     |   38 +-
 external/bsd/mdocml/dist/mdoc_validate.c |    9 +-
 external/bsd/mdocml/dist/msec.c          |    3 +-
 external/bsd/mdocml/dist/st.c            |    3 +-
 external/bsd/mdocml/dist/term.c          |   54 +-
 external/bsd/mdocml/dist/tree.c          |    4 +-
 external/bsd/mdocml/dist/vol.c           |    3 +-
 34 files changed, 1116 insertions(+), 528 deletions(-)

diffs (truncated from 3265 to 300 lines):

diff -r 1bafe2b318cf -r 1f891f6640a7 external/bsd/mdocml/dist/arch.c
--- a/external/bsd/mdocml/dist/arch.c   Thu Nov 05 18:20:40 2009 +0000
+++ b/external/bsd/mdocml/dist/arch.c   Thu Nov 05 18:24:50 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: arch.c,v 1.4 2009/06/10 20:18:43 kristaps Exp $ */
+/*     $Vendor-Id: arch.c,v 1.5 2009/10/26 17:05:43 kristaps Exp $ */
 /*
  * Copyright (c) 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -16,6 +16,7 @@
  */
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 
 #include "libmdoc.h"
 
diff -r 1bafe2b318cf -r 1f891f6640a7 external/bsd/mdocml/dist/att.c
--- a/external/bsd/mdocml/dist/att.c    Thu Nov 05 18:20:40 2009 +0000
+++ b/external/bsd/mdocml/dist/att.c    Thu Nov 05 18:24:50 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: att.c,v 1.4 2009/06/10 20:18:43 kristaps Exp $ */
+/*     $Vendor-Id: att.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */
 /*
  * Copyright (c) 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -16,6 +16,7 @@
  */
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 
 #include "libmdoc.h"
 
diff -r 1bafe2b318cf -r 1f891f6640a7 external/bsd/mdocml/dist/chars.c
--- a/external/bsd/mdocml/dist/chars.c  Thu Nov 05 18:20:40 2009 +0000
+++ b/external/bsd/mdocml/dist/chars.c  Thu Nov 05 18:24:50 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: chars.c,v 1.9 2009/09/23 11:02:21 kristaps Exp $ */
+/*     $Vendor-Id: chars.c,v 1.12 2009/11/01 07:44:32 kristaps Exp $ */
 /*
  * Copyright (c) 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -15,7 +15,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include <assert.h>
-#include <err.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -35,7 +35,7 @@
        int               type;
 #define        CHARS_CHAR       (1 << 0)
 #define        CHARS_STRING     (1 << 1)
-#define CHARS_BOTH      (0x03)
+#define CHARS_BOTH      (CHARS_CHAR | CHARS_STRING)
 };
 
 #define        LINES_MAX         351
@@ -89,13 +89,17 @@
         * (they're in-line re-ordered during lookup).
         */
 
-       if (NULL == (tab = malloc(sizeof(struct tbl))))
-               err(1, "malloc");
-       tab->type = type;
+       tab = malloc(sizeof(struct tbl));
+       if (NULL == tab) {
+               perror(NULL);
+               exit(EXIT_FAILURE);
+       }
 
        htab = calloc(PRINT_HI - PRINT_LO + 1, sizeof(struct ln **));
-       if (NULL == htab)
-               err(1, "malloc");
+       if (NULL == htab) {
+               perror(NULL);
+               exit(EXIT_FAILURE);
+       }
 
        for (i = 0; i < LINES_MAX; i++) {
                hash = (int)lines[i].code[0] - PRINT_LO;
@@ -111,6 +115,7 @@
        }
 
        tab->htab = htab;
+       tab->type = type;
        return(tab);
 }
 
diff -r 1bafe2b318cf -r 1f891f6640a7 external/bsd/mdocml/dist/html.c
--- a/external/bsd/mdocml/dist/html.c   Thu Nov 05 18:20:40 2009 +0000
+++ b/external/bsd/mdocml/dist/html.c   Thu Nov 05 18:24:50 2009 +0000
@@ -1,4 +1,4 @@
-/*     $Vendor-Id: html.c,v 1.66 2009/10/26 08:18:15 kristaps Exp $ */
+/*     $Vendor-Id: html.c,v 1.80 2009/11/02 06:22:44 kristaps Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps%kth.se@localhost>
  *
@@ -17,9 +17,9 @@
 #include <sys/types.h>
 
 #include <assert.h>
-#include <err.h>
+#include <ctype.h>
+#include <stdarg.h>
 #include <stdio.h>
-#include <stdarg.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
@@ -80,6 +80,7 @@
        "valign",
        "target",
        "id",
+       "summary",
 };
 
 #ifdef __linux__
@@ -98,16 +99,15 @@
        toks[2] = "includes";
        toks[3] = NULL;
 
-       if (NULL == (h = calloc(1, sizeof(struct html))))
-               return(NULL);
+       h = calloc(1, sizeof(struct html));
+       if (NULL == h) {
+               perror(NULL);
+               exit(EXIT_FAILURE);
+       }
 
        h->tags.head = NULL;
        h->ords.head = NULL;
-
-       if (NULL == (h->symtab = chars_init(CHARS_HTML))) {
-               free(h);
-               return(NULL);
-       }
+       h->symtab = chars_init(CHARS_HTML);
 
        while (outopts && *outopts)
                switch (getsubopt(&outopts, UNCONST(toks), &v)) {
@@ -189,15 +189,13 @@
 print_spec(struct html *h, const char *p, int len)
 {
        const char      *rhs;
-       int              i;
        size_t           sz;
 
        rhs = chars_a2ascii(h->symtab, p, (size_t)len, &sz);
 
        if (NULL == rhs) 
                return;
-       for (i = 0; i < (int)sz; i++) 
-               putchar(rhs[i]);
+       fwrite(rhs, 1, sz, stdout);
 }
 
 
@@ -205,15 +203,13 @@
 print_res(struct html *h, const char *p, int len)
 {
        const char      *rhs;
-       int              i;
        size_t           sz;
 
        rhs = chars_a2res(h->symtab, p, (size_t)len, &sz);
 
        if (NULL == rhs)
                return;
-       for (i = 0; i < (int)sz; i++) 
-               putchar(rhs[i]);
+       fwrite(rhs, 1, sz, stdout);
 }
 
 
@@ -320,26 +316,27 @@
 static void
 print_encode(struct html *h, const char *p)
 {
+       size_t           sz;
 
        for (; *p; p++) {
+               sz = strcspn(p, "\\<>&");
+
+               fwrite(p, 1, sz, stdout);
+               p += /* LINTED */
+                       sz;
+
                if ('\\' == *p) {
                        print_escape(h, &p);
                        continue;
-               }
-               switch (*p) {
-               case ('<'):
-                       printf("&lt;");
-                       break;
-               case ('>'):
-                       printf("&gt;");
+               } else if ('\0' == *p)
                        break;
-               case ('&'):
+
+               if ('<' == *p)
+                       printf("&lt;");
+               else if ('>' == *p)
+                       printf("&gt;");
+               else if ('&' == *p)
                        printf("&amp;");
-                       break;
-               default:
-                       putchar(*p);
-                       break;
-               }
        }
 }
 
@@ -352,8 +349,11 @@
        struct tag      *t;
 
        if ( ! (HTML_NOSTACK & htmltags[tag].flags)) {
-               if (NULL == (t = malloc(sizeof(struct tag))))
-                       err(EXIT_FAILURE, "malloc");
+               t = malloc(sizeof(struct tag));
+               if (NULL == t) {
+                       perror(NULL);
+                       exit(EXIT_FAILURE);
+               }
                t->tag = tag;
                t->next = h->tags.head;
                h->tags.head = t;
@@ -362,16 +362,16 @@
 
        if ( ! (HTML_NOSPACE & h->flags))
                if ( ! (HTML_CLRLINE & htmltags[tag].flags))
-                       printf(" ");
+                       putchar(' ');
 
        printf("<%s", htmltags[tag].name);
        for (i = 0; i < sz; i++) {
                printf(" %s=\"", htmlattrs[p[i].key]);
                assert(p->val);
                print_encode(h, p[i].val);
-               printf("\"");
+               putchar('\"');
        }
-       printf(">");
+       putchar('>');
 
        h->flags |= HTML_NOSPACE;
        if (HTML_CLRLINE & htmltags[tag].flags)
@@ -389,11 +389,11 @@
 {
        
        printf("</%s>", htmltags[tag].name);
-       if (HTML_CLRLINE & htmltags[tag].flags)
+       if (HTML_CLRLINE & htmltags[tag].flags) {
                h->flags |= HTML_NOSPACE;
-       if (HTML_CLRLINE & htmltags[tag].flags)
                h->flags |= HTML_NEWLINE;
-       else
+               putchar('\n');
+       } else
                h->flags &= ~HTML_NEWLINE;
 }
 
@@ -438,7 +438,7 @@
                }
 
        if ( ! (h->flags & HTML_NOSPACE))
-               printf(" ");
+               putchar(' ');
 
        h->flags &= ~HTML_NOSPACE;
        h->flags &= ~HTML_NEWLINE;
@@ -647,3 +647,30 @@
                buffmt(h, "%s: %d%s;", p, (int)v, u);
 }
 
+
+void
+html_idcat(char *dst, const char *src, int sz)
+{
+       int              ssz;
+
+       assert(sz);
+
+       /* Cf. <http://www.w3.org/TR/html4/types.html#h-6.2>. */
+
+       for ( ; *dst != '\0' && sz; dst++, sz--)
+               /* Jump to end. */ ;
+
+       assert(sz > 2);
+
+       /* We can't start with a number (bah). */
+
+       *dst++ = 'x';
+       *dst = '\0';



Home | Main Index | Thread Index | Old Index