1 /* c-memstr.h: memcpy, strchr, etc.
2 
3    Copyright 1992-2013 Karl Berry and Olaf Weber.
4 
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public License
16    along with this library; if not, see <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef KPATHSEA_C_MEMSTR_H
19 #define KPATHSEA_C_MEMSTR_H
20 
21 /* <X11/Xfuncs.h> tries to declare bcopy etc., which can only conflict.  */
22 #define _XFUNCS_H_
23 
24 #ifdef HAVE_STRING_H
25 #include <string.h>
26 #else
27 /* don't ever want both string.h and strings.h; fails on AIX.  */
28 #ifdef HAVE_STRINGS_H
29 #include <strings.h>
30 #endif
31 #endif
32 
33 /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
34 #if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
35 #include <memory.h>
36 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
37 
38 /* For ancient systems that lack the system V/ANSI version of the
39    string functions we express them in terms of the BSD versions.  */
40 #if !defined(HAVE_STRCHR) && !defined(strchr)
41 #define strchr index
42 #endif
43 
44 #if !defined(HAVE_STRRCHR) && !defined(strrchr)
45 #define strrchr rindex
46 #endif
47 
48 #if !defined(HAVE_MEMCMP) && !defined(memcmp)
49 #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
50 #endif
51 
52 #if !defined(HAVE_MEMCPY) && !defined(memcpy)
53 #define memcpy(to, from, len) bcopy ((from), (to), (len))
54 #endif
55 
56 #if !defined(HAVE_STRING_H)
57 extern char *strtok ();
58 #ifndef strstr
59 extern char *strstr ();
60 #endif
61 #endif
62 
63 #endif /* not KPATHSEA_C_MEMSTR_H */
64