diff options
-rw-r--r-- | LICENSE | 13 | ||||
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | compat_stringlist.c | 20 | ||||
-rw-r--r-- | compat_stringlist.h | 10 | ||||
-rwxr-xr-x | configure | 12 | ||||
-rw-r--r-- | configure.local.example | 11 | ||||
-rw-r--r-- | soelim.1 | 6 | ||||
-rw-r--r-- | soelim.c | 19 | ||||
-rw-r--r-- | test-stringlist.c | 37 |
9 files changed, 99 insertions, 47 deletions
@@ -8,10 +8,12 @@ Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> 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 @@ -35,8 +37,12 @@ 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 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, @@ -45,3 +51,6 @@ Copyright (c) 1989,1990,1993,1994 The Regents of the University of California compat_fgetln.c: Copyright (c) 1998 The NetBSD Foundation, Inc. + +compat_stringlist.c, compat_stringlist.h: +Copyright (c) 1994 Christos Zoulas <christos@netbsd.org> @@ -31,6 +31,7 @@ TESTSRCS = test-dirent-namlen.c \ test-sqlite3.c \ test-sqlite3_errstr.c \ test-strcasestr.c \ + test-stringlist.c \ test-strlcat.c \ test-strlcpy.c \ test-strptime.c \ @@ -51,6 +52,7 @@ SRCS = att.c \ compat_reallocarray.c \ compat_sqlite3_errstr.c \ compat_strcasestr.c \ + compat_stringlist.c \ compat_strlcat.c \ compat_strlcpy.c \ compat_strsep.c \ @@ -89,6 +91,7 @@ SRCS = att.c \ preconv.c \ read.c \ roff.c \ + soelim.c \ st.c \ tbl.c \ tbl_data.c \ @@ -113,6 +116,7 @@ DISTFILES = INSTALL \ chars.in \ compat_fts.h \ compat_ohash.h \ + compat_stringlist.h \ configure \ configure.local.example \ demandoc.1 \ @@ -154,6 +158,7 @@ DISTFILES = INSTALL \ predefs.in \ roff.7 \ roff.h \ + soelim.1 \ st.in \ style.css \ tbl.3 \ @@ -247,10 +252,13 @@ MANPAGE_OBJS = manpage.o mansearch.o mansearch_const.o manpath.o 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 \ @@ -288,7 +296,7 @@ include Makefile.local all: base-build $(BUILD_TARGETS) Makefile.local -base-build: mandoc demandoc +base-build: mandoc demandoc soelim cgi-build: man.cgi @@ -314,6 +322,7 @@ clean: 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 @@ -326,12 +335,12 @@ base-install: base-build 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 @@ -393,6 +402,9 @@ man.cgi: $(CGI_OBJS) libmandoc.a 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 diff --git a/compat_stringlist.c b/compat_stringlist.c index a09a8e70..1068b461 100644 --- a/compat_stringlist.c +++ b/compat_stringlist.c @@ -1,5 +1,6 @@ +/* $Id$ */ /* - * 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 @@ -26,19 +27,10 @@ * 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 @@ -52,13 +44,13 @@ sl_init(void) 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; } diff --git a/compat_stringlist.h b/compat_stringlist.h index d3154b34..541a83db 100644 --- a/compat_stringlist.h +++ b/compat_stringlist.h @@ -1,7 +1,8 @@ +/* $Id$ */ /* $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 @@ -29,13 +30,8 @@ * 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> /* @@ -53,5 +49,3 @@ int sl_add(StringList *, char *); void sl_free(StringList *, int); char *sl_find(StringList *, const char *); __END_DECLS - -#endif /* _STRINGLIST_H */ @@ -51,6 +51,7 @@ HAVE_MKDTEMP= HAVE_MMAP= HAVE_REALLOCARRAY= HAVE_STRCASESTR= +HAVE_STRINGLIST= HAVE_STRLCAT= HAVE_STRLCPY= HAVE_STRPTIME= @@ -78,9 +79,10 @@ HTDOCDIR= 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" @@ -177,6 +179,7 @@ runtest mkdtemp MKDTEMP || true 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 @@ -295,6 +298,7 @@ cat << __HEREDOC__ #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} @@ -308,9 +312,10 @@ cat << __HEREDOC__ #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 @@ -420,9 +425,10 @@ WWWPREFIX = ${WWWPREFIX} 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} diff --git a/configure.local.example b/configure.local.example index c4a2573e..498e121d 100644 --- a/configure.local.example +++ b/configure.local.example @@ -115,13 +115,14 @@ MANM_EQN="mandoc_eqn" # default is "eqn" 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: @@ -1,3 +1,5 @@ +.\" $Id$ +.\" .\" Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org> .\" All rights reserved. .\" @@ -22,9 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD$ -.\" -.Dd May 1, 2015 +.Dd $Mdocdate$ .Dt SOELIM 1 .Os .Sh NAME @@ -1,4 +1,5 @@ -/*- +/* $Id$ */ +/* * Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org> * All rights reserved. * @@ -24,20 +25,20 @@ * 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 diff --git a/test-stringlist.c b/test-stringlist.c new file mode 100644 index 00000000..0cc1cd3d --- /dev/null +++ b/test-stringlist.c @@ -0,0 +1,37 @@ +/* $Id$ */ +/* + * 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); +} |