Skip to content
Permalink
Browse files

11190 Update mandoc to 1.14.5

Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gergő Doma <domag02@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
  • Loading branch information...
Mno-hime authored and danmcd committed May 30, 2019
1 parent 0718894 commit cec8643b41ebefad6c677010fc784dc4bb0550f3
Showing with 7,267 additions and 5,241 deletions.
  1. +3 −1 usr/src/cmd/mandoc/Makefile.common
  2. +8 −7 usr/src/cmd/mandoc/THIRDPARTYLICENSE
  3. +54 −0 usr/src/cmd/mandoc/arch.c
  4. +1 −3 usr/src/cmd/mandoc/att.c
  5. +16 −21 usr/src/cmd/mandoc/chars.c
  6. +2 −0 usr/src/cmd/mandoc/config.h
  7. +6 −6 usr/src/cmd/mandoc/dbm.c
  8. +57 −36 usr/src/cmd/mandoc/eqn.c
  9. +72 −0 usr/src/cmd/mandoc/eqn.h
  10. +2 −1 usr/src/cmd/mandoc/eqn_html.c
  11. +48 −0 usr/src/cmd/mandoc/eqn_parse.h
  12. +3 −3 usr/src/cmd/mandoc/eqn_term.c
  13. +189 −88 usr/src/cmd/mandoc/html.c
  14. +14 −5 usr/src/cmd/mandoc/html.h
  15. +1 −4 usr/src/cmd/mandoc/lib.c
  16. +12 −10 usr/src/cmd/mandoc/libman.h
  17. +31 −23 usr/src/cmd/mandoc/libmandoc.h
  18. +8 −8 usr/src/cmd/mandoc/libmdoc.h
  19. +0 −80 usr/src/cmd/mandoc/libroff.h
  20. +108 −115 usr/src/cmd/mandoc/main.c
  21. +12 −12 usr/src/cmd/mandoc/main.h
  22. +66 −104 usr/src/cmd/mandoc/man.c
  23. +1 −2 usr/src/cmd/mandoc/man.h
  24. +231 −234 usr/src/cmd/mandoc/man_html.c
  25. +130 −84 usr/src/cmd/mandoc/man_macro.c
  26. +177 −148 usr/src/cmd/mandoc/man_term.c
  27. +128 −83 usr/src/cmd/mandoc/man_validate.c
  28. +5 −3 usr/src/cmd/mandoc/manconf.h
  29. +163 −153 usr/src/cmd/mandoc/mandoc.c
  30. +30 −211 usr/src/cmd/mandoc/mandoc.h
  31. +329 −0 usr/src/cmd/mandoc/mandoc_msg.c
  32. +43 −0 usr/src/cmd/mandoc/mandoc_parse.h
  33. +35 −37 usr/src/cmd/mandoc/mandocdb.c
  34. +17 −7 usr/src/cmd/mandoc/manpath.c
  35. +8 −12 usr/src/cmd/mandoc/mansearch.c
  36. +1 −2 usr/src/cmd/mandoc/mansearch.h
  37. +15 −44 usr/src/cmd/mandoc/mdoc.c
  38. +4 −1 usr/src/cmd/mandoc/mdoc.h
  39. +28 −25 usr/src/cmd/mandoc/mdoc_argv.c
  40. +258 −179 usr/src/cmd/mandoc/mdoc_html.c
  41. +183 −89 usr/src/cmd/mandoc/mdoc_macro.c
  42. +67 −44 usr/src/cmd/mandoc/mdoc_man.c
  43. +44 −22 usr/src/cmd/mandoc/mdoc_markdown.c
  44. +8 −52 usr/src/cmd/mandoc/mdoc_state.c
  45. +67 −83 usr/src/cmd/mandoc/mdoc_term.c
  46. +233 −326 usr/src/cmd/mandoc/mdoc_validate.c
  47. +2 −1 usr/src/cmd/mandoc/msec.c
  48. +259 −75 usr/src/cmd/mandoc/out.c
  49. +3 −2 usr/src/cmd/mandoc/out.h
  50. +4 −1 usr/src/cmd/mandoc/preconv.c
  51. +256 −474 usr/src/cmd/mandoc/read.c
  52. +857 −442 usr/src/cmd/mandoc/roff.c
  53. +29 −57 usr/src/cmd/mandoc/roff.h
  54. +41 −10 usr/src/cmd/mandoc/roff_html.c
  55. +56 −2 usr/src/cmd/mandoc/roff_int.h
  56. +22 −26 usr/src/cmd/mandoc/roff_term.c
  57. +79 −27 usr/src/cmd/mandoc/roff_validate.c
  58. +49 −5 usr/src/cmd/mandoc/st.c
  59. +0 −76 usr/src/cmd/mandoc/st.in
  60. +35 −10 usr/src/cmd/mandoc/tag.c
  61. +2 −1 usr/src/cmd/mandoc/tag.h
  62. +40 −36 usr/src/cmd/mandoc/tbl.c
  63. +122 −0 usr/src/cmd/mandoc/tbl.h
  64. +86 −27 usr/src/cmd/mandoc/tbl_data.c
  65. +131 −27 usr/src/cmd/mandoc/tbl_html.c
  66. +47 −0 usr/src/cmd/mandoc/tbl_int.h
  67. +16 −18 usr/src/cmd/mandoc/tbl_layout.c
  68. +11 −11 usr/src/cmd/mandoc/tbl_opts.c
  69. +30 −0 usr/src/cmd/mandoc/tbl_parse.h
  70. +461 −204 usr/src/cmd/mandoc/tbl_term.c
  71. +305 −186 usr/src/cmd/mandoc/term.c
  72. +4 −2 usr/src/cmd/mandoc/term.h
  73. +6 −7 usr/src/cmd/mandoc/term_ascii.c
  74. +1 −1 usr/src/cmd/mandoc/term_tab.c
  75. +55 −41 usr/src/cmd/mandoc/tree.c
  76. +122 −12 usr/src/man/man1/mandoc.1
  77. +15 −9 usr/src/man/man5/mandoc_char.5
  78. +372 −237 usr/src/man/man5/mandoc_roff.5
  79. +692 −821 usr/src/man/man5/mdoc.5
  80. +32 −12 usr/src/man/man5/tbl.5
  81. +107 −13 usr/src/tools/scripts/webrev.sh
@@ -17,7 +17,8 @@

PROG= mandoc

OBJS= att.o \
OBJS= arch.o \
att.o \
chars.o \
dba.o \
dba_array.o \
@@ -39,6 +40,7 @@ OBJS= att.o \
man_validate.o \
mandoc.o \
mandoc_aux.o \
mandoc_msg.o \
mandoc_ohash.o \
mandoc_xr.o \
mandocdb.o \
@@ -1,24 +1,25 @@
$Id: LICENSE,v 1.17 2017/06/23 15:58:14 schwarze Exp $
$Id: LICENSE,v 1.21 2018/11/26 17:11:11 schwarze Exp $

With the exceptions noted below, all code and documentation
contained in the mandoc toolkit is protected by the Copyright
of the following developers:
With the exceptions noted below, all non-trivial files contained
in the mandoc toolkit are protected by the Copyright of the following
developers:

Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
Copyright (c) 1999, 2004, 2017 Marc Espie <espie@openbsd.org>
Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger <joerg@netbsd.org>
Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
Copyright (c) 2014 Baptiste Daroussin <bapt@freebsd.org>
Copyright (c) 2016 Ed Maste <emaste@freebsd.org>
Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
Copyright (c) 2017 Anthony Bentley <bentley@openbsd.org>
Copyright (c) 1998, 2004, 2010 Todd C. Miller <Todd.Miller@courtesan.com>
Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
Copyright (c) 2004 Ted Unangst <tedu@openbsd.org>
Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
Copyright (c) 2003, 2007, 2008, 2014 Jason McIntyre <jmc@openbsd.org>

See the individual source files for information about who contributed
See the individual files for information about who contributed
to which file during which years.


@@ -0,0 +1,54 @@
/* $Id: arch.c,v 1.14 2019/03/04 13:01:57 schwarze Exp $ */
/*
* Copyright (c) 2017, 2019 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"

#include <string.h>

#include "roff.h"

int
arch_valid(const char *arch, enum mandoc_os os)
{
const char *openbsd_arch[] = {
"alpha", "amd64", "arm64", "armv7", "hppa", "i386",
"landisk", "loongson", "luna88k", "macppc", "mips64",
"octeon", "sgi", "socppc", "sparc64", NULL
};
const char *netbsd_arch[] = {
"acorn26", "acorn32", "algor", "alpha", "amiga",
"arc", "atari",
"bebox", "cats", "cesfic", "cobalt", "dreamcast",
"emips", "evbarm", "evbmips", "evbppc", "evbsh3", "evbsh5",
"hp300", "hpcarm", "hpcmips", "hpcsh", "hppa",
"i386", "ibmnws", "luna68k",
"mac68k", "macppc", "mipsco", "mmeye", "mvme68k", "mvmeppc",
"netwinder", "news68k", "newsmips", "next68k",
"pc532", "playstation2", "pmax", "pmppc", "prep",
"sandpoint", "sbmips", "sgimips", "shark",
"sparc", "sparc64", "sun2", "sun3",
"vax", "walnut", "x68k", "x86", "x86_64", "xen", NULL
};
const char **arches[] = { NULL, netbsd_arch, openbsd_arch };
const char **arch_p;

if ((arch_p = arches[os]) == NULL)
return 1;
for (; *arch_p != NULL; arch_p++)
if (strcmp(*arch_p, arch) == 0)
return 1;
return 0;
}
@@ -1,4 +1,4 @@
/* $Id: att.c,v 1.16 2017/06/24 14:38:32 schwarze Exp $ */
/* $Id: att.c,v 1.18 2018/12/13 11:55:46 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -19,9 +19,7 @@
#include <sys/types.h>
#include <string.h>

#include "mandoc.h"
#include "roff.h"
#include "mdoc.h"
#include "libmdoc.h"

#define LINE(x, y) \
@@ -1,7 +1,7 @@
/* $Id: chars.c,v 1.73 2017/08/23 13:01:29 schwarze Exp $ */
/* $Id: chars.c,v 1.78 2018/12/15 19:30:26 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011,2014,2015,2017,2018 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
@@ -23,6 +23,7 @@
#include <ctype.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

@@ -47,20 +48,13 @@ static struct ln lines[] = {
{ " ", ascii_nbrsp, 0x00a0 },
{ "~", ascii_nbrsp, 0x00a0 },
{ "0", " ", 0x2002 },
{ "|", "", 0 },
{ "^", "", 0 },
{ "&", "", 0 },
{ "%", "", 0 },
{ ":", ascii_break, 0 },
/* XXX The following three do not really belong here. */
{ "t", "", 0 },
{ "c", "", 0 },
{ "}", "", 0 },

/* Lines. */
{ "ba", "|", 0x007c },
{ "br", "|", 0x2502 },
{ "ul", "_", 0x005f },
{ "_", "_", 0x005f },
{ "ru", "_", 0x005f },
{ "rn", "-", 0x203e },
{ "bb", "|", 0x00a6 },
@@ -82,10 +76,10 @@ static struct ln lines[] = {
{ "sh", "#", 0x0023 },
{ "CR", "<cr>", 0x21b5 },
{ "OK", "\\/", 0x2713 },
{ "CL", "<club>", 0x2663 },
{ "SP", "<spade>", 0x2660 },
{ "HE", "<heart>", 0x2665 },
{ "DI", "<diamond>", 0x2666 },
{ "CL", "C", 0x2663 },
{ "SP", "S", 0x2660 },
{ "HE", "H", 0x2665 },
{ "DI", "D", 0x2666 },

/* Legal symbols. */
{ "co", "(C)", 0x00a9 },
@@ -240,7 +234,7 @@ static struct ln lines[] = {
{ "Ah", "<Aleph>", 0x2135 },
{ "Im", "<Im>", 0x2111 },
{ "Re", "<Re>", 0x211c },
{ "wp", "P", 0x2118 },
{ "wp", "p", 0x2118 },
{ "pd", "<del>", 0x2202 },
{ "-h", "/h", 0x210f },
{ "hbar", "/h", 0x210f },
@@ -287,18 +281,21 @@ static struct ln lines[] = {
{ "ho", ",", 0x02db },
{ "ha", "^", 0x005e },
{ "ti", "~", 0x007e },
{ "u02DC", "~", 0x02dc },

/* Accented letters. */
{ "'A", "'\bA", 0x00c1 },
{ "'E", "'\bE", 0x00c9 },
{ "'I", "'\bI", 0x00cd },
{ "'O", "'\bO", 0x00d3 },
{ "'U", "'\bU", 0x00da },
{ "'Y", "'\bY", 0x00dd },
{ "'a", "'\ba", 0x00e1 },
{ "'e", "'\be", 0x00e9 },
{ "'i", "'\bi", 0x00ed },
{ "'o", "'\bo", 0x00f3 },
{ "'u", "'\bu", 0x00fa },
{ "'y", "'\by", 0x00fd },
{ "`A", "`\bA", 0x00c0 },
{ "`E", "`\bE", 0x00c8 },
{ "`I", "`\bI", 0x00cc },
@@ -359,7 +356,7 @@ static struct ln lines[] = {
{ "Eu", "EUR", 0x20ac },
{ "eu", "EUR", 0x20ac },
{ "Ye", "=\bY", 0x00a5 },
{ "Po", "GBP", 0x00a3 },
{ "Po", "-\bL", 0x00a3 },
{ "Cs", "o\bx", 0x00a4 },
{ "Fn", ",\bf", 0x0192 },

@@ -460,7 +457,7 @@ mchars_spec2cp(const char *p, size_t sz)

end = p + sz;
ln = ohash_find(&mchars, ohash_qlookupi(&mchars, p, &end));
return ln != NULL ? ln->unicode : sz == 1 ? (unsigned char)*p : -1;
return ln != NULL ? ln->unicode : -1;
}

int
@@ -490,10 +487,8 @@ mchars_spec2str(const char *p, size_t sz, size_t *rsz)

end = p + sz;
ln = ohash_find(&mchars, ohash_qlookupi(&mchars, p, &end));
if (ln == NULL) {
*rsz = 1;
return sz == 1 ? p : NULL;
}
if (ln == NULL)
return NULL;

*rsz = strlen(ln->ascii);
return ln->ascii;
@@ -40,6 +40,8 @@
#define HAVE_WCHAR 1
#define HAVE_OHASH 0

#define OSENUM MANDOC_OS_OTHER

#define BINM_APROPOS "apropos"
#define BINM_MAKEWHATIS "man -w"
#define BINM_MAN "man"
@@ -1,4 +1,4 @@
/* $Id: dbm.c,v 1.5 2016/10/18 22:27:25 schwarze Exp $ */
/* $Id: dbm.c,v 1.6 2018/11/19 19:22:07 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -151,17 +151,17 @@ dbm_page_get(int32_t ip)
assert(ip < npages);
res.name = dbm_get(pages[ip].name);
if (res.name == NULL)
res.name = "(NULL)";
res.name = "(NULL)\0";
res.sect = dbm_get(pages[ip].sect);
if (res.sect == NULL)
res.sect = "(NULL)";
res.sect = "(NULL)\0";
res.arch = pages[ip].arch ? dbm_get(pages[ip].arch) : NULL;
res.desc = dbm_get(pages[ip].desc);
if (res.desc == NULL)
res.desc = "(NULL)";
res.file = dbm_get(pages[ip].file);
if (res.file == NULL)
res.file = " (NULL)";
res.file = " (NULL)\0";
res.addr = dbm_addr(pages + ip);
return &res;
}
@@ -233,7 +233,7 @@ static struct dbm_res
page_bytitle(enum iter arg_iter, const struct dbm_match *arg_match)
{
static const struct dbm_match *match;
static const char *cp;
static const char *cp;
static int32_t ip;
struct dbm_res res = {-1, 0};

@@ -315,7 +315,7 @@ page_byarch(const struct dbm_match *arg_match)
static const struct dbm_match *match;
struct dbm_res res = {-1, 0};
static int32_t ip;
const char *cp;
const char *cp;

/* Initialize for a new iteration. */

0 comments on commit cec8643

Please sign in to comment.
You can’t perform that action at this time.