2999
|
1 /* c-memstr.h: memcpy, strchr, etc. |
|
2 |
|
3 Copyright (C) 1992, 93, 94, 95, 97 Free Software Foundation, Inc. |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 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 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public |
|
16 License along with this library; if not, write to the Free Software |
|
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
18 |
|
19 #ifndef KPATHSEA_C_MEMSTR_H |
|
20 #define KPATHSEA_C_MEMSTR_H |
|
21 |
|
22 /* <X11/Xfuncs.h> tries to declare bcopy etc., which can only conflict. */ |
|
23 #define _XFUNCS_H_ |
|
24 |
|
25 /* Just to be complete, we make both the system V/ANSI and the BSD |
|
26 versions of the string functions available. */ |
|
27 #if defined (STDC_HEADERS) || defined (HAVE_STRING_H) |
|
28 #if 0 /* OK, we'll try without; seems to be unnecessary now. */ |
|
29 #define SYSV /* so <X11/Xos.h> knows not to include <strings.h> */ |
|
30 #endif /* 0 */ |
|
31 #include <string.h> |
|
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 /* Do not define these if we are not STDC_HEADERS, because in that |
|
39 case X11/Xos.h defines `strchr' to be `index'. */ |
|
40 #ifdef STDC_HEADERS |
|
41 /* Let's hope that if index/rindex are defined, they're defined to the |
|
42 right thing. */ |
|
43 #ifndef index |
|
44 #define index strchr |
|
45 #endif |
|
46 #ifndef rindex |
|
47 #define rindex strrchr |
|
48 #endif |
|
49 #endif /* STDC_HEADERS */ |
|
50 |
|
51 #ifndef HAVE_BCOPY |
|
52 #ifndef bcmp |
|
53 #define bcmp(s1, s2, len) memcmp ((s1), (s2), (len)) |
|
54 #endif |
|
55 #ifndef bcopy |
|
56 #define bcopy(from, to, len) memcpy ((to), (from), (len)) |
|
57 #endif |
|
58 #ifndef bzero |
|
59 #define bzero(s, len) memset ((s), 0, (len)) |
|
60 #endif |
|
61 #endif /* not HAVE_BCOPY */ |
|
62 |
|
63 #else /* not (STDC_HEADERS or HAVE_STRING_H) */ |
|
64 |
|
65 #include <strings.h> |
|
66 |
|
67 #ifndef strchr |
|
68 #define strchr index |
|
69 #endif |
|
70 #ifndef strrchr |
|
71 #define strrchr rindex |
|
72 #endif |
|
73 |
|
74 #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n)) |
|
75 #define memcpy(to, from, len) bcopy ((from), (to), (len)) |
|
76 |
|
77 extern char *strtok (); |
|
78 extern char *strstr (); |
|
79 |
|
80 #endif /* not (STDC_HEADERS or HAVE_STRING_H) */ |
|
81 |
|
82 #endif /* not KPATHSEA_C_MEMSTR_H */ |