Skip to content

Commit

Permalink
14111 Update mandoc to 1.14.6
Browse files Browse the repository at this point in the history
Reviewed by: Yuri Pankov <ypankov@tintri.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@joyent.com>
  • Loading branch information
rmustacc committed Jan 5, 2022
1 parent a8f22b5 commit 4d13117
Show file tree
Hide file tree
Showing 74 changed files with 4,371 additions and 2,648 deletions.
6 changes: 4 additions & 2 deletions usr/src/cmd/mandoc/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ OBJS= arch.o \
term_ascii.o \
term_ps.o \
term_tab.o \
term_tag.o \
tree.o

OBJS += compat_ohash.o
OBJS += compat_ohash.o compat_stringlist.o

# XXX gcc 4.4.4 false positive
# gcc 4.4.4 false positive
roff.o := CERRWARN += $(CNOWARN_UNINIT)
main.o := CERRWARN += $(CNOWARN_UNINIT)

# not linted
SMATCH=off
Expand Down
22 changes: 19 additions & 3 deletions usr/src/cmd/mandoc/THIRDPARTYLICENSE
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
$Id: LICENSE,v 1.21 2018/11/26 17:11:11 schwarze Exp $
$Id: LICENSE,v 1.22 2021/09/19 11:02:09 schwarze Exp $

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-2018 Ingo Schwarze <schwarze@openbsd.org>
Copyright (c) 2010-2021 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) 2017 Anthony Bentley <bentley@openbsd.org>
Copyright (c) 1998, 2004, 2010 Todd C. Miller <Todd.Miller@courtesan.com>
Copyright (c) 1998, 2004, 2010, 2015 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>
Expand All @@ -37,3 +37,19 @@ 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.


The following files included from outside sources are protected by
other people's Copyright and are distributed under various 2-clause
and 3-clause BSD licenses; see these individual files for details.

soelim.c, soelim.1:
Copyright (c) 2014 Baptiste Daroussin <bapt@freebsd.org>

compat_err.c, compat_fts.c, compat_fts.h,
compat_getsubopt.c, compat_strcasestr.c, compat_strsep.c,
man.1:
Copyright (c) 1989,1990,1993,1994 The Regents of the University of California

compat_stringlist.c, compat_stringlist.h:
Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
4 changes: 2 additions & 2 deletions usr/src/cmd/mandoc/arch.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: arch.c,v 1.14 2019/03/04 13:01:57 schwarze Exp $ */
/* $Id: arch.c,v 1.17 2021/05/13 13:33:11 schwarze Exp $ */
/*
* Copyright (c) 2017, 2019 Ingo Schwarze <schwarze@openbsd.org>
*
Expand Down Expand Up @@ -26,7 +26,7 @@ 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
"octeon", "powerpc64", "riscv64", "sparc64", NULL
};
const char *netbsd_arch[] = {
"acorn26", "acorn32", "algor", "alpha", "amiga",
Expand Down
4 changes: 2 additions & 2 deletions usr/src/cmd/mandoc/att.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: att.c,v 1.18 2018/12/13 11:55:46 schwarze Exp $ */
/* $Id: att.c,v 1.19 2021/09/04 20:26:43 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
Expand Down Expand Up @@ -37,7 +37,7 @@ mdoc_a2att(const char *p)
LINE("v5", "Version\\~5 AT&T UNIX");
LINE("v6", "Version\\~6 AT&T UNIX");
LINE("v7", "Version\\~7 AT&T UNIX");
LINE("32v", "Version\\~32V AT&T UNIX");
LINE("32v", "Version\\~7 AT&T UNIX/32V");
LINE("III", "AT&T System\\~III UNIX");
LINE("V", "AT&T System\\~V UNIX");
LINE("V.1", "AT&T System\\~V Release\\~1 UNIX");
Expand Down
7 changes: 4 additions & 3 deletions usr/src/cmd/mandoc/chars.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* $Id: chars.c,v 1.78 2018/12/15 19:30:26 schwarze Exp $ */
/* $Id: chars.c,v 1.79 2020/02/13 16:18:29 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011, 2014, 2015, 2017, 2018, 2020
* 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
Expand Down Expand Up @@ -47,7 +48,7 @@ static struct ln lines[] = {
/* Spacing. */
{ " ", ascii_nbrsp, 0x00a0 },
{ "~", ascii_nbrsp, 0x00a0 },
{ "0", " ", 0x2002 },
{ "0", ascii_nbrsp, 0x00a0 },
{ ":", ascii_break, 0 },

/* Lines. */
Expand Down
13 changes: 2 additions & 11 deletions usr/src/cmd/mandoc/compat_ohash.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#include "config.h"

#if HAVE_OHASH

int dummy;

#else

/* $Id: compat_ohash.c,v 1.7 2020/06/15 01:37:15 schwarze Exp $ */
/* $OpenBSD: ohash.c,v 1.1 2014/06/02 18:52:03 deraadt Exp $ */

/* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
Expand All @@ -22,9 +15,9 @@ int dummy;
* 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 <sys/types.h>

#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
Expand Down Expand Up @@ -335,5 +328,3 @@ ohash_qlookupi(struct ohash *h, const char *s, const char **e)
hv = ohash_interval(s, e);
return ohash_lookup_interval(h, s, *e, hv);
}

#endif /*!HAVE_OHASH*/
135 changes: 135 additions & 0 deletions usr/src/cmd/mandoc/compat_stringlist.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/* $Id: compat_stringlist.c,v 1.8 2020/06/15 21:48:09 schwarze Exp $ */
/* $NetBSD: stringlist.c,v 1.14 2015/05/21 01:29:13 christos Exp $ */

/*-
* Copyright (c) 1994, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"

#include <stdlib.h>
#include <string.h>
#include "compat_stringlist.h"

#define _SL_CHUNKSIZE 20

/*
* sl_init(): Initialize a string list
*/
StringList *
sl_init(void)
{
StringList *sl;

sl = malloc(sizeof(StringList));
if (sl == NULL)
return NULL;

sl->sl_cur = 0;
sl->sl_max = _SL_CHUNKSIZE;
sl->sl_str = reallocarray(NULL, sl->sl_max, sizeof(char *));
if (sl->sl_str == NULL) {
free(sl);
sl = NULL;
}
return sl;
}


/*
* sl_add(): Add an item to the string list
*/
int
sl_add(StringList *sl, char *name)
{
if (sl->sl_cur == sl->sl_max - 1) {
char **new;

new = reallocarray(sl->sl_str, (sl->sl_max + _SL_CHUNKSIZE),
sizeof(char *));
if (new == NULL)
return -1;
sl->sl_max += _SL_CHUNKSIZE;
sl->sl_str = new;
}
sl->sl_str[sl->sl_cur++] = name;
return 0;
}


/*
* sl_free(): Free a stringlist
*/
void
sl_free(StringList *sl, int all)
{
size_t i;

if (sl == NULL)
return;
if (sl->sl_str) {
if (all)
for (i = 0; i < sl->sl_cur; i++)
free(sl->sl_str[i]);
free(sl->sl_str);
}
free(sl);
}


/*
* sl_find(): Find a name in the string list
*/
char *
sl_find(StringList *sl, const char *name)
{
size_t i;

for (i = 0; i < sl->sl_cur; i++)
if (strcmp(sl->sl_str[i], name) == 0)
return sl->sl_str[i];

return NULL;
}

int
sl_delete(StringList *sl, const char *name, int all)
{
size_t i, j;

for (i = 0; i < sl->sl_cur; i++)
if (strcmp(sl->sl_str[i], name) == 0) {
if (all)
free(sl->sl_str[i]);
for (j = i + 1; j < sl->sl_cur; j++)
sl->sl_str[j - 1] = sl->sl_str[j];
sl->sl_str[--sl->sl_cur] = NULL;
return 0;
}
return -1;
}

48 changes: 48 additions & 0 deletions usr/src/cmd/mandoc/compat_stringlist.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* $Id: compat_stringlist.h,v 1.5 2020/06/15 21:48:09 schwarze Exp $ */
/* $NetBSD: stringlist.h,v 1.7 2008/04/28 20:22:54 martin Exp $ */

/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <sys/types.h>

/*
* Simple string list
*/
typedef struct _stringlist {
char **sl_str;
size_t sl_max;
size_t sl_cur;
} StringList;

StringList *sl_init(void);
int sl_add(StringList *, char *);
void sl_free(StringList *, int);
char *sl_find(StringList *, const char *);
int sl_delete(StringList *, const char *, int);
18 changes: 14 additions & 4 deletions usr/src/cmd/mandoc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
#define O_DIRECTORY 0
#endif

#ifdef __cplusplus
#error "Do not use C++. See the INSTALL file."
#endif


#define MAN_CONF_FILE "/etc/man.conf"
#define MANPATH_BASE "/usr/share/man"
#define MANPATH_DEFAULT "/usr/share/man:/usr/gnu/share/man"
#define MANPATH_DEFAULT "/usr/share/man"
#define OSENUM MANDOC_OS_OTHER
#define UTF8_LOCALE "en_US.UTF-8"
#define EFTYPE EINVAL
#define HAVE_CMSG_XPG42 0

#define HAVE_DIRENT_NAMLEN 0
#define HAVE_ENDIAN 1
#define HAVE_ERR 1
Expand All @@ -27,7 +33,9 @@
#define HAVE_GETLINE 1
#define HAVE_GETSUBOPT 1
#define HAVE_ISBLANK 1
#define HAVE_LESS_T 1
#define HAVE_MKDTEMP 1
#define HAVE_MKSTEMPS 1
#define HAVE_NTOHL 1
#define HAVE_PLEDGE 0
#define HAVE_PROGNAME 1
Expand All @@ -48,12 +56,14 @@
#define HAVE_VASPRINTF 1
#define HAVE_WCHAR 1
#define HAVE_OHASH 0

#define OSENUM MANDOC_OS_OTHER
#define NEED_XPG4_2 1

#define BINM_APROPOS "apropos"
#define BINM_MAKEWHATIS "man -w"
#define BINM_CATMAN "catman"
#define BINM_MAN "man"
#define BINM_SOELIM "soelim"
#define BINM_WHATIS "whatis"
#define BINM_PAGER "less"

#endif /* MANDOC_CONFIG_H */
4 changes: 3 additions & 1 deletion usr/src/cmd/mandoc/dba_array.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: dba_array.c,v 1.1 2016/07/19 21:31:55 schwarze Exp $ */
/* $Id: dba_array.c,v 1.2 2020/06/22 19:20:40 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
Expand All @@ -17,6 +17,8 @@
* Allocation-based arrays for the mandoc database, for read-write access.
* The interface is defined in "dba_array.h".
*/
#include "config.h"

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
Expand Down
Loading

0 comments on commit 4d13117

Please sign in to comment.