1 /* c-memstr.h: memcpy, strchr, etc.
3 Copyright 1992, 1993, 1994, 1995, 1997 1998, 1999, 2000, 2004, 2005,
4 2006, 2008 Karl Berry and Olaf Weber.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, see <http://www.gnu.org/licenses/>. */
19 #ifndef KPATHSEA_C_MEMSTR_H
20 #define KPATHSEA_C_MEMSTR_H
22 /* <X11/Xfuncs.h> tries to declare bcopy etc., which can only conflict. */
28 /* don't ever want both string.h and strings.h; fails on AIX. */
34 /* An ANSI string.h and pre-ANSI memory.h might conflict. */
35 #if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
37 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
39 /* Just to be complete, we make both the system V/ANSI and the BSD
40 versions of the string functions available. */
41 #if !defined(HAVE_STRCHR) && !defined(strchr)
45 #if !defined(HAVE_STRRCHR) && !defined(strrchr)
46 #define strrchr rindex
49 #if !defined(HAVE_MEMCMP) && !defined(memcmp)
50 #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
53 #if !defined(HAVE_MEMCPY) && !defined(memcpy)
54 #define memcpy(to, from, len) bcopy ((from), (to), (len))
57 /* Note that these functions should not be used. */
58 #if !defined(HAVE_BCMP) && !defined(bcmp)
59 #define bcmp(s1, s2, len) memcmp ((s1), (s2), (len))
62 #if !defined(HAVE_BCOPY) && !defined(bcopy)
63 #define bcopy(from, to, len) memcpy ((to), (from), (len))
66 #if !defined(HAVE_BZERO) && !defined(bzero)
67 #define bzero(s, len) memset ((s), 0, (len))
70 #if !defined(HAVE_INDEX) && !defined(index)
71 #define index(s, c) strchr ((s), (c))
74 #if !defined(HAVE_RINDEX) && !defined(rindex)
75 #define rindex(s, c) strrchr ((s), (c))
78 #if !defined(HAVE_STRING_H)
79 extern char *strtok ();
81 extern char *strstr ();
85 #endif /* not KPATHSEA_C_MEMSTR_H */