-$Id: LICENSE,v 1.7 2015/02/16 14:56:22 schwarze Exp $
+$Id: LICENSE,v 1.8 2015/05/20 22:22:59 schwarze Exp $
With the exceptions noted below, all code and documentation
contained in the mdocml toolkit is protected by the Copyright
Copyright (c) 2010-2015 Ingo Schwarze <schwarze@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) 1999, 2004 Marc Espie <espie@openbsd.org>
Copyright (c) 1998, 2004, 2010 Todd C. Miller <Todd.Miller@courtesan.com>
Copyright (c) 2008 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
The following files included from outside sources are protected by
-other people's Copyright and are distributed under a 3-clause BSD
-license; see these individual files for details.
+other people's Copyright and are distributed under various 2-clause,
+3-clause, and 4-clause BSD licenses; see these individual files for
+details.
+
+soelim.c, soelim.1:
+Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
compat_fts.c, compat_fts.h,
compat_getsubopt.c, compat_strcasestr.c, compat_strsep.c,
compat_fgetln.c:
Copyright (c) 1998 The NetBSD Foundation, Inc.
+
+compat_stringlist.c, compat_stringlist.h:
+Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
-# $Id: Makefile,v 1.461 2015/04/02 21:36:49 schwarze Exp $
+# $Id: Makefile,v 1.462 2015/05/20 22:22:59 schwarze Exp $
#
# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
# Copyright (c) 2011, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
test-sqlite3.c \
test-sqlite3_errstr.c \
test-strcasestr.c \
+ test-stringlist.c \
test-strlcat.c \
test-strlcpy.c \
test-strptime.c \
compat_reallocarray.c \
compat_sqlite3_errstr.c \
compat_strcasestr.c \
+ compat_stringlist.c \
compat_strlcat.c \
compat_strlcpy.c \
compat_strsep.c \
preconv.c \
read.c \
roff.c \
+ soelim.c \
st.c \
tbl.c \
tbl_data.c \
chars.in \
compat_fts.h \
compat_ohash.h \
+ compat_stringlist.h \
configure \
configure.local.example \
demandoc.1 \
predefs.in \
roff.7 \
roff.h \
+ soelim.1 \
st.in \
style.css \
tbl.3 \
DEMANDOC_OBJS = demandoc.o
+SOELIM_OBJS = soelim.o compat_stringlist.o
+
WWW_MANS = apropos.1.html \
demandoc.1.html \
man.1.html \
mandoc.1.html \
+ soelim.1.html \
mandoc.3.html \
mandoc_escape.3.html \
mandoc_headers.3.html \
all: base-build $(BUILD_TARGETS) Makefile.local
-base-build: mandoc demandoc
+base-build: mandoc demandoc soelim
cgi-build: man.cgi
rm -f man.cgi $(CGI_OBJS)
rm -f manpage $(MANPAGE_OBJS)
rm -f demandoc $(DEMANDOC_OBJS)
+ rm -f soelim $(SOELIM_OBJS)
rm -f $(WWW_MANS) $(WWW_OBJS)
rm -rf *.dSYM
mkdir -p $(DESTDIR)$(MANDIR)/man3
mkdir -p $(DESTDIR)$(MANDIR)/man5
mkdir -p $(DESTDIR)$(MANDIR)/man7
- $(INSTALL_PROGRAM) mandoc demandoc $(DESTDIR)$(BINDIR)
+ $(INSTALL_PROGRAM) mandoc demandoc soelim $(DESTDIR)$(BINDIR)
ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_MAN)
$(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
$(INSTALL_LIB) man.h mandoc.h mandoc_aux.h mdoc.h roff.h \
$(DESTDIR)$(INCLUDEDIR)
- $(INSTALL_MAN) mandoc.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
+ $(INSTALL_MAN) mandoc.1 demandoc.1 soelim.1 $(DESTDIR)$(MANDIR)/man1
$(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
$(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \
mchars_alloc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
demandoc: $(DEMANDOC_OBJS) libmandoc.a
$(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
+soelim: $(SOELIM_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(SOELIM_OBJS)
+
# --- maintainer targets ---
www-install: www
+/* $Id: compat_stringlist.c,v 1.2 2015/05/20 22:22:59 schwarze Exp $ */
/*
- * Copyright (c) 1994 Christos Zoulas
+ * Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: stringlist.c,v 1.2 1997/01/17 07:26:20 lukem Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <stdio.h>
-#include <string.h>
#include <err.h>
#include <stdlib.h>
-#include <stringlist.h>
-#include "un-namespace.h"
+#include <string.h>
+#include "compat_stringlist.h"
#define _SL_CHUNKSIZE 20
sl = malloc(sizeof(StringList));
if (sl == NULL)
- _err(1, "stringlist: %m");
+ err(1, "stringlist");
sl->sl_cur = 0;
sl->sl_max = _SL_CHUNKSIZE;
sl->sl_str = malloc(sl->sl_max * sizeof(char *));
if (sl->sl_str == NULL)
- _err(1, "stringlist: %m");
+ err(1, "stringlist");
return sl;
}
+/* $Id: compat_stringlist.h,v 1.2 2015/05/20 22:22:59 schwarze Exp $ */
/* $NetBSD: stringlist.h,v 1.2 1997/01/17 06:11:36 lukem Exp $ */
/*
- * Copyright (c) 1994 Christos Zoulas
+ * Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* 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.
- *
- * $FreeBSD$
*/
-#ifndef _STRINGLIST_H
-#define _STRINGLIST_H
-#include <sys/cdefs.h>
#include <sys/types.h>
/*
void sl_free(StringList *, int);
char *sl_find(StringList *, const char *);
__END_DECLS
-
-#endif /* _STRINGLIST_H */
HAVE_MMAP=
HAVE_REALLOCARRAY=
HAVE_STRCASESTR=
+HAVE_STRINGLIST=
HAVE_STRLCAT=
HAVE_STRLCPY=
HAVE_STRPTIME=
CGIBINDIR=
BINM_APROPOS="apropos"
+BINM_MAKEWHATIS="makewhatis"
BINM_MAN="man"
+BINM_SOELIM="soelim"
BINM_WHATIS="whatis"
-BINM_MAKEWHATIS="makewhatis"
MANM_MAN="man"
MANM_MANCONF="man.conf"
MANM_MDOC="mdoc"
runtest mmap MMAP || true
runtest reallocarray REALLOCARRAY || true
runtest strcasestr STRCASESTR || true
+runtest stringlist STRINGLIST || true
runtest strlcat STRLCAT || true
runtest strlcpy STRLCPY || true
runtest strptime STRPTIME || true
#define HAVE_MMAP ${HAVE_MMAP}
#define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
#define HAVE_STRCASESTR ${HAVE_STRCASESTR}
+#define HAVE_STRINGLIST ${HAVE_STRINGLIST}
#define HAVE_STRLCAT ${HAVE_STRLCAT}
#define HAVE_STRLCPY ${HAVE_STRLCPY}
#define HAVE_STRPTIME ${HAVE_STRPTIME}
#define HAVE_MANPATH ${HAVE_MANPATH}
#define BINM_APROPOS "${BINM_APROPOS}"
+#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}"
#define BINM_MAN "${BINM_MAN}"
+#define BINM_SOELIM "${BINM_SOELIM}"
#define BINM_WHATIS "${BINM_WHATIS}"
-#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}"
#if !defined(__BEGIN_DECLS)
# ifdef __cplusplus
HTDOCDIR = ${HTDOCDIR}
CGIBINDIR = ${CGIBINDIR}
BINM_APROPOS = ${BINM_APROPOS}
+BINM_MAKEWHATIS = ${BINM_MAKEWHATIS}
BINM_MAN = ${BINM_MAN}
+BINM_SOELIM = ${BINM_SOELIM}
BINM_WHATIS = ${BINM_WHATIS}
-BINM_MAKEWHATIS = ${BINM_MAKEWHATIS}
MANM_MAN = ${MANM_MAN}
MANM_MANCONF = ${MANM_MANCONF}
MANM_MDOC = ${MANM_MDOC}
-# $Id: configure.local.example,v 1.8 2015/03/27 00:18:14 schwarze Exp $
+# $Id: configure.local.example,v 1.9 2015/05/20 22:22:59 schwarze Exp $
#
# Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
#
MANM_TBL="mandoc_tbl" # default is "tbl"
# Some distributions may want to avoid naming conflicts
-# with another man(1) utility.
-# If you want to change the name of the binary program,
-# the following alternative name is suggested.
-# Using a different name is possible as well.
-# This changes the name of the installed section 1 manual page as well.
+# with other man(1) and soelim(1) utilities.
+# If you want to change the names of binary programs,
+# the following alternative names are suggested.
+# Using different names is possible as well.
+# This changes the names of the installed section 1 manual pages as well.
BINM_MAN=mman # default is "man"
+BINM_SOELIM=msoelim # default is "soelim"
# It is possible to change the utility program used for installation
# and the modes files are installed with. The defaults are:
+.\" $Id: soelim.1,v 1.2 2015/05/20 22:22:59 schwarze Exp $
+.\"
.\" Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
.\" All rights reserved.
.\"
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd May 1, 2015
+.Dd $Mdocdate: May 20 2015 $
.Dt SOELIM 1
.Os
.Sh NAME
-/*-
+/* $Id: soelim.c,v 1.2 2015/05/20 22:22:59 schwarze Exp $ */
+/*
* Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
* All rights reserved.
*
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
+#include <sys/types.h>
-#define _WITH_GETLINE
+#include <ctype.h>
+#include <err.h>
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
-#include <stdbool.h>
#include <string.h>
+#if HAVE_STRINGLIST
#include <stringlist.h>
-#include <err.h>
-#include <ctype.h>
+#else
+#include "compat_stringlist.h"
+#endif
+#include <unistd.h>
#define C_OPTION 0x1
--- /dev/null
+/* $Id: test-stringlist.c,v 1.1 2015/05/20 22:22:59 schwarze Exp $ */
+/*
+ * Copyright (c) 2015 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 <stringlist.h>
+
+int
+main(void)
+{
+ StringList *sl;
+ char teststr[] = "test";
+
+ if ((sl = sl_init()) == NULL)
+ return(1);
+ if (sl_add(sl, teststr))
+ return(2);
+ if (sl->sl_cur != 1)
+ return(3);
+ if (sl->sl_str[0] != teststr)
+ return(4);
+
+ sl_free(sl, 0);
+ return(0);
+}