Fix build under Solaris (10?) by providing implementations of strcasestr(3)
and strsep(3) taken from NetBSD.
This commit is contained in:
parent
a8097218f3
commit
e2a2cd4f51
5 changed files with 151 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.38 2013/10/11 14:45:18 wiz Exp $
|
||||
# $NetBSD: Makefile,v 1.39 2013/12/29 19:19:03 tron Exp $
|
||||
|
||||
DISTNAME= mdocml-1.12.2
|
||||
CATEGORIES= textproc devel
|
||||
|
@ -26,5 +26,8 @@ SUBST_SED.roff= -e 's,Xr roff,Xr mandoc-roff,g'
|
|||
MAKE_FLAGS+= STATIC=
|
||||
.endif
|
||||
|
||||
post-extract:
|
||||
${CP} -p ${FILESDIR}/*.c ${WRKSRC}
|
||||
|
||||
.include "../../mk/bdb.buildlink3.mk"
|
||||
.include "../../mk/bsd.pkg.mk"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
$NetBSD: distinfo,v 1.30 2013/10/11 14:45:18 wiz Exp $
|
||||
$NetBSD: distinfo,v 1.31 2013/12/29 19:19:03 tron Exp $
|
||||
|
||||
SHA1 (mdocml-1.12.2.tar.gz) = 6a86cc4f373bcc51aa8bf1a7499db368e977a166
|
||||
RMD160 (mdocml-1.12.2.tar.gz) = 8fcd1b9dd20b3a2eee9412d210e1b994c9ae7c17
|
||||
Size (mdocml-1.12.2.tar.gz) = 286400 bytes
|
||||
SHA1 (patch-Makefile) = 569fdf24dff306c6c7222a3807e99d9ae1bb0ce6
|
||||
SHA1 (patch-apropos__db.c) = 74ec4c549c2a093f9d5090209f89c16bebc3a749
|
||||
SHA1 (patch-apropos__db.c) = 862851ae479d8ee0b296269fb0b79e30c6f55435
|
||||
SHA1 (patch-catman.c) = c7738a6c1089963b83556cafc6bdca2735d28c48
|
||||
SHA1 (patch-cgi.c) = 2eccde5060bbf0479c80f0b4368ebf1950c90c47
|
||||
SHA1 (patch-config.h.post) = ff9805110e590e19a65bf9a6130e1b086893cfb0
|
||||
|
|
58
textproc/mdocml/files/strcasestr.c
Normal file
58
textproc/mdocml/files/strcasestr.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* $NetBSD: strcasestr.c,v 1.1 2013/12/29 19:19:03 tron Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
*
|
||||
* 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.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
|
||||
/*
|
||||
* Find the first occurrence of find in s, ignore case.
|
||||
*/
|
||||
char *
|
||||
strcasestr(const char *s, const char *find)
|
||||
{
|
||||
char c, sc;
|
||||
size_t len;
|
||||
|
||||
if ((c = *find++) != 0) {
|
||||
c = tolower((unsigned char)c);
|
||||
len = strlen(find);
|
||||
do {
|
||||
do {
|
||||
if ((sc = *s++) == 0)
|
||||
return (NULL);
|
||||
} while ((char)tolower((unsigned char)sc) != c);
|
||||
} while (strncasecmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
return __UNCONST(s);
|
||||
}
|
69
textproc/mdocml/files/strsep.c
Normal file
69
textproc/mdocml/files/strsep.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* $NetBSD: strsep.c,v 1.1 2013/12/29 19:19:03 tron Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Get next token from string *stringp, where tokens are possibly-empty
|
||||
* strings separated by characters from delim.
|
||||
*
|
||||
* Writes NULs into the string at *stringp to end tokens.
|
||||
* delim need not remain constant from call to call.
|
||||
* On return, *stringp points past the last NUL written (if there might
|
||||
* be further tokens), or is NULL (if there are definitely no more tokens).
|
||||
*
|
||||
* If *stringp is NULL, strsep returns NULL.
|
||||
*/
|
||||
char *
|
||||
strsep(char **stringp, const char *delim)
|
||||
{
|
||||
char *s;
|
||||
const char *spanp;
|
||||
int c, sc;
|
||||
char *tok;
|
||||
|
||||
if ((s = *stringp) == NULL)
|
||||
return (NULL);
|
||||
for (tok = s;;) {
|
||||
c = *s++;
|
||||
spanp = delim;
|
||||
do {
|
||||
if ((sc = *spanp++) == c) {
|
||||
if (c == 0)
|
||||
s = NULL;
|
||||
else
|
||||
s[-1] = 0;
|
||||
*stringp = s;
|
||||
return (tok);
|
||||
}
|
||||
} while (sc != 0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
$NetBSD: patch-apropos__db.c,v 1.2 2013/10/11 14:45:18 wiz Exp $
|
||||
$NetBSD: patch-apropos__db.c,v 1.3 2013/12/29 19:19:03 tron Exp $
|
||||
|
||||
SunOS fix.
|
||||
|
||||
--- apropos_db.c.orig 2013-10-05 14:09:07.000000000 +0000
|
||||
+++ apropos_db.c
|
||||
--- apropos_db.c.orig 2013-10-05 15:09:07.000000000 +0100
|
||||
+++ apropos_db.c 2013-12-29 19:07:21.000000000 +0000
|
||||
@@ -30,14 +30,19 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
@ -29,3 +29,18 @@ SunOS fix.
|
|||
# include <db.h>
|
||||
#endif
|
||||
|
||||
@@ -141,6 +146,14 @@
|
||||
const struct expr *, size_t terms,
|
||||
struct mchars *, int);
|
||||
|
||||
+#ifdef __sun
|
||||
+#define strsep pkgsrc_strsep
|
||||
+#define strcasestr pkgsrc_strcasestr
|
||||
+
|
||||
+#include "strsep.c"
|
||||
+#include "strcasestr.c"
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Open the keyword mandoc-db database.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue