Permalink
Browse files

5051 import mdocml-1.12.3

Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Rich Lowe <richlowe@richlowe.net>
  • Loading branch information...
gdamore committed Jul 25, 2014
1 parent 7f18da4 commit 698f87a48e2e945bfe5493ce168e0d0ae1cedd5c
Showing with 4,062 additions and 2,437 deletions.
  1. +1 −2 usr/src/cmd/mandoc/Makefile.common
  2. +3 −2 usr/src/cmd/mandoc/arch.in
  3. +3 −3 usr/src/cmd/mandoc/chars.c
  4. +2 −1 usr/src/cmd/mandoc/chars.in
  5. +12 −8 usr/src/cmd/mandoc/config.h
  6. +91 −33 usr/src/cmd/mandoc/html.c
  7. +3 −1 usr/src/cmd/mandoc/html.h
  8. +64 −2 usr/src/cmd/mandoc/lib.in
  9. +6 −6 usr/src/cmd/mandoc/libman.h
  10. +9 −13 usr/src/cmd/mandoc/libmandoc.h
  11. +16 −11 usr/src/cmd/mandoc/libmdoc.h
  12. +2 −2 usr/src/cmd/mandoc/libroff.h
  13. +23 −7 usr/src/cmd/mandoc/main.c
  14. +138 −130 usr/src/cmd/mandoc/man.c
  15. +5 −1 usr/src/cmd/mandoc/man.h
  16. +60 −30 usr/src/cmd/mandoc/man_html.c
  17. +105 −74 usr/src/cmd/mandoc/man_macro.c
  18. +169 −76 usr/src/cmd/mandoc/man_term.c
  19. +128 −86 usr/src/cmd/mandoc/man_validate.c
  20. +148 −215 usr/src/cmd/mandoc/mandoc.c
  21. +17 −17 usr/src/cmd/mandoc/mandoc.h
  22. +172 −143 usr/src/cmd/mandoc/mdoc.c
  23. +4 −1 usr/src/cmd/mandoc/mdoc.h
  24. +54 −75 usr/src/cmd/mandoc/mdoc_argv.c
  25. +35 −38 usr/src/cmd/mandoc/mdoc_html.c
  26. +330 −263 usr/src/cmd/mandoc/mdoc_macro.c
  27. +1,167 −206 usr/src/cmd/mandoc/mdoc_man.c
  28. +169 −145 usr/src/cmd/mandoc/mdoc_term.c
  29. +270 −104 usr/src/cmd/mandoc/mdoc_validate.c
  30. +5 −140 usr/src/cmd/mandoc/msec.in
  31. +10 −32 usr/src/cmd/mandoc/out.c
  32. +3 −8 usr/src/cmd/mandoc/preconv.c
  33. +2 −2 usr/src/cmd/mandoc/predefs.in
  34. +59 −39 usr/src/cmd/mandoc/read.c
  35. +461 −164 usr/src/cmd/mandoc/roff.c
  36. +14 −10 usr/src/cmd/mandoc/st.in
  37. +20 −20 usr/src/cmd/mandoc/tbl.c
  38. +5 −7 usr/src/cmd/mandoc/tbl_data.c
  39. +6 −14 usr/src/cmd/mandoc/tbl_html.c
  40. +36 −118 usr/src/cmd/mandoc/tbl_layout.c
  41. +59 −79 usr/src/cmd/mandoc/tbl_term.c
  42. +133 −78 usr/src/cmd/mandoc/term.c
  43. +15 −11 usr/src/cmd/mandoc/term.h
  44. +2 −3 usr/src/cmd/mandoc/term_ascii.c
  45. +11 −9 usr/src/cmd/mandoc/tree.c
  46. +9 −2 usr/src/man/Makefile.man
  47. +1 −1 usr/src/man/man1/man.1
  48. +2 −2 usr/src/man/man1/mandoc.1
  49. +3 −3 usr/src/man/man5/man.5
@@ -29,5 +29,4 @@ preconv_OBJS = preconv.o
CFLAGS += $(CC_VERBOSE)
CPPFLAGS += -DHAVE_CONFIG_H -DUSE_WCHAR \
- -DOSNAME="\"illumos\"" \
- -DVERSION="\"1.12.1\""
+ -DOSNAME="\"illumos\""
@@ -1,4 +1,4 @@
-/* $Id: arch.in,v 1.12 2012/01/28 14:02:17 joerg Exp $ */
+/* $Id: arch.in,v 1.14 2013/09/16 22:12:57 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -38,9 +38,9 @@ LINE("arm", "ARM")
LINE("arm26", "ARM26")
LINE("arm32", "ARM32")
LINE("armish", "ARMISH")
+LINE("armv7", "ARMv7")
LINE("aviion", "AViiON")
LINE("atari", "ATARI")
-LINE("beagle", "Beagle")
LINE("bebox", "BeBox")
LINE("cats", "cats")
LINE("cesfic", "CESFIC")
@@ -81,6 +81,7 @@ LINE("netwinder", "NetWinder")
LINE("news68k", "NeWS68k")
LINE("newsmips", "NeWSMIPS")
LINE("next68k", "NeXT68k")
+LINE("octeon", "OCTEON")
LINE("ofppc", "OFPPC")
LINE("palm", "Palm")
LINE("pc532", "PC532")
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.52 2011/11/08 00:15:23 kristaps Exp $ */
+/* $Id: chars.c,v 1.54 2013/06/20 22:39:30 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -37,7 +37,7 @@ struct ln {
int unicode;
};
-#define LINES_MAX 328
+#define LINES_MAX 329
#define CHAR(in, ch, code) \
{ NULL, (in), (ch), (code) },
@@ -77,7 +77,7 @@ mchars_alloc(void)
*/
tab = mandoc_malloc(sizeof(struct mchars));
- htab = mandoc_calloc(PRINT_HI - PRINT_LO + 1, sizeof(struct ln **));
+ htab = mandoc_calloc(PRINT_HI - PRINT_LO + 1, sizeof(struct ln *));
for (i = 0; i < LINES_MAX; i++) {
hash = (int)lines[i].code[0] - PRINT_LO;
@@ -1,4 +1,4 @@
-/* $Id: chars.in,v 1.42 2011/10/02 10:02:26 kristaps Exp $ */
+/* $Id: chars.in,v 1.43 2013/06/20 22:39:30 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -42,6 +42,7 @@ CHAR("&", "", 0)
CHAR("^", "", 0)
CHAR("|", "", 0)
CHAR("}", "", 0)
+CHAR("t", "", 0)
/* Accents. */
CHAR("a\"", "\"", 779)
@@ -7,10 +7,12 @@
#include <stdio.h>
+#define VERSION "1.12.3"
#define HAVE_STRPTIME
#define HAVE_GETSUBOPT
#define HAVE_STRLCAT
#define HAVE_STRLCPY
+#define HAVE_MMAP
#include <sys/types.h>
@@ -29,14 +31,16 @@
# endif
#endif
-#if defined(__APPLE__)
-# define htobe32(x) OSSwapHostToBigInt32(x)
-# define betoh32(x) OSSwapBigToHostInt32(x)
-# define htobe64(x) OSSwapHostToBigInt64(x)
-# define betoh64(x) OSSwapBigToHostInt64(x)
-#elif defined(__linux__)
-# define betoh32(x) be32toh(x)
-# define betoh64(x) be64toh(x)
+#ifndef HAVE_BETOH64
+# if defined(__APPLE__)
+# define betoh64(x) OSSwapBigToHostInt64(x)
+# define htobe64(x) OSSwapHostToBigInt64(x)
+# elif defined(__sun)
+# define betoh64(x) BE_64(x)
+# define htobe64(x) BE_64(x)
+# else
+# define betoh64(x) be64toh(x)
+# endif
#endif
#ifndef HAVE_STRLCAT
View
@@ -1,7 +1,7 @@
-/* $Id: html.c,v 1.150 2011/10/05 21:35:17 kristaps Exp $ */
+/* $Id: html.c,v 1.152 2013/08/08 20:07:47 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -235,6 +235,9 @@ print_metaf(struct html *h, enum mandoc_esc deco)
case (ESCAPE_FONTBOLD):
font = HTMLFONT_BOLD;
break;
+ case (ESCAPE_FONTBI):
+ font = HTMLFONT_BI;
+ break;
case (ESCAPE_FONT):
/* FALLTHROUGH */
case (ESCAPE_FONTROMAN):
@@ -253,17 +256,27 @@ print_metaf(struct html *h, enum mandoc_esc deco)
h->metal = h->metac;
h->metac = font;
- if (HTMLFONT_NONE != font)
- h->metaf = HTMLFONT_BOLD == font ?
- print_otag(h, TAG_B, 0, NULL) :
- print_otag(h, TAG_I, 0, NULL);
+ switch (font) {
+ case (HTMLFONT_ITALIC):
+ h->metaf = print_otag(h, TAG_I, 0, NULL);
+ break;
+ case (HTMLFONT_BOLD):
+ h->metaf = print_otag(h, TAG_B, 0, NULL);
+ break;
+ case (HTMLFONT_BI):
+ h->metaf = print_otag(h, TAG_B, 0, NULL);
+ print_otag(h, TAG_I, 0, NULL);
+ break;
+ default:
+ break;
+ }
}
int
html_strlen(const char *cp)
{
- int ssz, sz;
- const char *seq, *p;
+ size_t rsz;
+ int skip, sz;
/*
* Account for escaped sequences within string length
@@ -274,26 +287,41 @@ html_strlen(const char *cp)
*/
sz = 0;
- while (NULL != (p = strchr(cp, '\\'))) {
- sz += (int)(p - cp);
- ++cp;
- switch (mandoc_escape(&cp, &seq, &ssz)) {
+ skip = 0;
+ while (1) {
+ rsz = strcspn(cp, "\\");
+ if (rsz) {
+ cp += rsz;
+ if (skip) {
+ skip = 0;
+ rsz--;
+ }
+ sz += rsz;
+ }
+ if ('\0' == *cp)
+ break;
+ cp++;
+ switch (mandoc_escape(&cp, NULL, NULL)) {
case (ESCAPE_ERROR):
return(sz);
case (ESCAPE_UNICODE):
/* FALLTHROUGH */
case (ESCAPE_NUMBERED):
/* FALLTHROUGH */
case (ESCAPE_SPECIAL):
- sz++;
+ if (skip)
+ skip = 0;
+ else
+ sz++;
+ break;
+ case (ESCAPE_SKIPCHAR):
+ skip = 1;
break;
default:
break;
}
}
-
- assert(sz >= 0);
- return(sz + strlen(cp));
+ return(sz);
}
static int
@@ -308,6 +336,12 @@ print_encode(struct html *h, const char *p, int norecurse)
nospace = 0;
while ('\0' != *p) {
+ if (HTML_SKIPCHAR & h->flags && '\\' != *p) {
+ h->flags &= ~HTML_SKIPCHAR;
+ p++;
+ continue;
+ }
+
sz = strcspn(p, rejs);
fwrite(p, 1, sz, stdout);
@@ -337,6 +371,33 @@ print_encode(struct html *h, const char *p, int norecurse)
if (ESCAPE_ERROR == esc)
break;
+ switch (esc) {
+ case (ESCAPE_FONT):
+ /* FALLTHROUGH */
+ case (ESCAPE_FONTPREV):
+ /* FALLTHROUGH */
+ case (ESCAPE_FONTBOLD):
+ /* FALLTHROUGH */
+ case (ESCAPE_FONTITALIC):
+ /* FALLTHROUGH */
+ case (ESCAPE_FONTBI):
+ /* FALLTHROUGH */
+ case (ESCAPE_FONTROMAN):
+ if (0 == norecurse)
+ print_metaf(h, esc);
+ continue;
+ case (ESCAPE_SKIPCHAR):
+ h->flags |= HTML_SKIPCHAR;
+ continue;
+ default:
+ break;
+ }
+
+ if (h->flags & HTML_SKIPCHAR) {
+ h->flags &= ~HTML_SKIPCHAR;
+ continue;
+ }
+
switch (esc) {
case (ESCAPE_UNICODE):
/* Skip passed "u" header. */
@@ -356,19 +417,6 @@ print_encode(struct html *h, const char *p, int norecurse)
else if (-1 == c && 1 == len)
putchar((int)*seq);
break;
- case (ESCAPE_FONT):
- /* FALLTHROUGH */
- case (ESCAPE_FONTPREV):
- /* FALLTHROUGH */
- case (ESCAPE_FONTBOLD):
- /* FALLTHROUGH */
- case (ESCAPE_FONTITALIC):
- /* FALLTHROUGH */
- case (ESCAPE_FONTROMAN):
- if (norecurse)
- break;
- print_metaf(h, esc);
- break;
case (ESCAPE_NOSPACE):
if ('\0' == *p)
nospace = 1;
@@ -511,10 +559,20 @@ print_text(struct html *h, const char *word)
}
assert(NULL == h->metaf);
- if (HTMLFONT_NONE != h->metac)
- h->metaf = HTMLFONT_BOLD == h->metac ?
- print_otag(h, TAG_B, 0, NULL) :
- print_otag(h, TAG_I, 0, NULL);
+ switch (h->metac) {
+ case (HTMLFONT_ITALIC):
+ h->metaf = print_otag(h, TAG_I, 0, NULL);
+ break;
+ case (HTMLFONT_BOLD):
+ h->metaf = print_otag(h, TAG_B, 0, NULL);
+ break;
+ case (HTMLFONT_BI):
+ h->metaf = print_otag(h, TAG_B, 0, NULL);
+ print_otag(h, TAG_I, 0, NULL);
+ break;
+ default:
+ break;
+ }
assert(word);
if ( ! print_encode(h, word, 0)) {
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.47 2011/10/05 21:35:17 kristaps Exp $ */
+/* $Id: html.h,v 1.49 2013/08/08 20:07:47 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -75,6 +75,7 @@ enum htmlfont {
HTMLFONT_NONE = 0,
HTMLFONT_BOLD,
HTMLFONT_ITALIC,
+ HTMLFONT_BI,
HTMLFONT_MAX
};
@@ -117,6 +118,7 @@ struct html {
#define HTML_PREKEEP (1 << 3)
#define HTML_NONOSPACE (1 << 4) /* never add spaces */
#define HTML_LITERAL (1 << 5) /* literal (e.g., <PRE>) context */
+#define HTML_SKIPCHAR (1 << 6) /* skip the next character */
struct tagq tags; /* stack of open tags */
struct rofftbl tbl; /* current table */
struct tag *tblt; /* current open table scope */
View
@@ -10,9 +10,71 @@
*/
/*
- * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/
/*
- * TBD
+ * Note that we don't document "legacy" libraries that have moved into
+ * libc. While there will be section 3lib man pages for them, they
+ * won't be referenced in other man pages.
*/
+LINE("libadm", "General Administrative Library (libadm, \\-ladm)")
+LINE("libbsdmalloc", "BSD Memory Allocation Library (libbsdmalloc, -lbsdmalloc)")
+LINE("libbsm", "Security and Auditing Library (libbsm, \\lbsm)")
+LINE("libc", "Standard C Library (libc, \\-lc)")
+LINE("libc_db", "Threads Debugging Library (libc_db, \\-lc_db)")
+LINE("libcfgadm", "Configuration Adminstration Library (libcfgadm, \\-lcfgadm)")
+LINE("libcommputil", "Communication Protocol Parser Utilities Library (libpcommutil, \\-lcommputil)")
+LINE("libcontract", "Contract Management Library (libcontract, \\-lcontract)")
+LINE("libcpc", "CPU Performance Counters Library (libcpc, \\-lcpc)")
+LINE("libcurses", "Curses Library (libcurses, \\-lcurses)")
+LINE("libdat", "Direct Access Transport Library (libdat, \\-ldat)")
+LINE("libdevid", "Device ID Library (libdevid, \\-ldevid)")
+LINE("libdevinfo", "Device Information Library (libdevinfo, \\-ldevinfo)")
+LINE("libdlpi", "Data Link Provider Interface (DLPI) Library (libdlp, \\-ldlpi)")
+LINE("libdns_sd", "DNS Service Discovery Library (libdns_sd, \\-ldns_sd)")
+LINE("libelf", "ELF Access Library (libelf, \\-lelf)")
+LINE("libexacct", "Extended Accounting File Access Library (libexacct, \\-lexacct)")
+LINE("libfcoe", "FCoE Port Management Library (libfcoe, \\-lfcoe)")
+LINE("libfstyp", "File System Type Identification Library (libfstyp, \\-lfstyp \\-lnvpair)")
+LINE("libgen", "String Pattern Matching Library (libgen, \\-lgen)")
+LINE("libgss", "Generic Security Services Library (libgss, \\-lgss)")
+LINE("libiscsit", "iSCSI Management Library (libiscsit, \\-liscsit)")
+LINE("libkstat", "Kernel Statistics Library (libkstat, \\-lkstat)")
+LINE("libkvm", "Kernel VM Library (libkvm, \\-lkvm)")
+LINE("libldap", "LDAP Library (libldap, \\-lldap)")
+LINE("liblgrp", "Locality Group Library (liblgrp, -llgrp)")
+LINE("libm", "Mathematical Library (libm, -lm)")
+LINE("libmail", "User Mailbox Library (libmail, -lmail)")
+LINE("libmalloc", "Memory Allocation Library (libmalloc, -lmalloc)")
+LINE("libmd", "Message Digest Library (libmd, -lmd)")
+LINE("libmp", "Multiple Precision Library (libmp, -lmp)")
+LINE("libmpapi", "Common Multipath Management Library (libmpapi, -lMPAPI)")
+LINE("libnsl", "Network Services Library (libnsl, \\-lnsl)")
+LINE("libnvpair", "Name-Value Pair Library (libnvpair, \\-lnvpair)")
+LINE("libpam", "PAM (Pluggable Authentication Module) Library (libpam, \\-lpam)")
+LINE("libpicl", "PICL Library (libpicl, \\-lpicl)")
+LINE("libpicltree", "PICL Plug-In Library (libpicltree, \\-lpicltree)")
+LINE("libpkcs11", "PKCS#11 Cryptographic Framework Library (libpkcs11, \\-lpkcs11)")
+LINE("libpool", "Pool Configuration Manipulation Library (libpool, \\-lpool)")
+LINE("libproc", "Process Control Library (libproc, \\-lproc)")
+LINE("libproject", "Project Database Access Library (libproject, \\-lproject)")
+LINE("libresolv", "Resolver Library (libresolv, \\-lresolv \\-lsocket \\-lnsl)")
+LINE("librpc", "RPC Service Library (librpcsvc, \\-lrpc)")
+LINE("librsm", "Remote Shared Memory Interface Library (librsm, \\-lrsm)")
+LINE("libsasl", "Simple Authentication and Security Library (libsasl, \\-lsasl)")
+LINE("libscf", "Service Configuration Facility Library (libscf, \\-lscf)")
+LINE("libsec", "File Access Control Library (libsec, \\-lsec)")
+LINE("libsecdb", "Security Attributes Database Library (libsecdb, \\-lsecdb)")
+LINE("libsip", "Session Initiation Protocol Library (libsip, \\-lsip)")
+LINE("libslp", "Service Location Protocol Library (libslp, \\-lslp)")
+LINE("libsocket", "Sockets Library (libsocket, \\-lsocket)")
+LINE("libstmf", "SCSI Target Mode Framework Library (libstmf, \\-lstmf)")
+LINE("libsysevet", "System Event Inteface Library (libsysevent, \\-lsysevent)")
+LINE("libtecla", "Interactive Command Line Input Library (libtecla, \\-ltecla)")
+LINE("libtnfctl", "TNF Probe Control Library (libtnfctl, \\-ltnfctl)")
+LINE("libtsol", "Trusted Extensions Library (libtsol, \\-ltsol)")
+LINE("libuuid", "UUID Library (libuuid, \\-luuid)")
+LINE("libvolmgt", "Volume Management Library (libvolmgt, \\-lvolmgt)")
+LINE("libxcurses", "X/Open Curses Library (libxcurses, \\-lxcurses)")
+LINE("libxnet", "X/Open Networking Library (libxnet, \\-lxnet)")
Oops, something went wrong.

0 comments on commit 698f87a

Please sign in to comment.