1 /*
2  * $TOG: Xmfuncs.h /main/1 1997/03/24 16:25:46 dbl $
3  *
4  *
5 Copyright (c) 1990  X Consortium
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
27  *
28  */
29 
30 #ifndef _XFUNCS_H_
31 #define _XFUNCS_H_
32 
33 #include <X11/Xosdefs.h>
34 
35 /* the old Xfuncs.h, for pre-R6 */
36 
37 #ifdef X_USEBFUNCS
38 void bcopy();
39 void bzero();
40 int bcmp();
41 #else
42 #if (__STDC__ && !defined(X_NOT_STDC_ENV) && !defined(sun) && !defined(macII) && !defined(apollo)) || defined(SVR4) || defined(hpux) || defined(_IBMR2) || defined(_SEQUENT_)
43 #include <string.h>
44 #define _XFUNCS_H_INCLUDED_STRING_H
45 #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len))
46 #define bzero(b,len) memset(b, 0, (size_t)(len))
47 #define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len))
48 #else
49 #ifdef sgi
50 #include <bstring.h>
51 #else
52 #ifdef SYSV
53 #include <memory.h>
54 void bcopy();
55 #define bzero(b,len) memset(b, 0, len)
56 #define bcmp(b1,b2,len) memcmp(b1, b2, len)
57 #else /* bsd */
58 void bcopy();
59 void bzero();
60 int bcmp();
61 #endif /* SYSV */
62 #endif /* sgi */
63 #endif /* __STDC__ and relatives */
64 #endif /* X_USEBFUNCS */
65 
66 /* the new Xfuncs.h */
67 
68 #if !defined(X_NOT_STDC_ENV) && (!defined(sun) || defined(SVR4))
69 /* the ANSI C way */
70 #ifndef _XFUNCS_H_INCLUDED_STRING_H
71 #include <string.h>
72 #endif
73 #undef bzero
74 #define bzero(b,len) memset(b,0,len)
75 #else /* else X_NOT_STDC_ENV or SunOS 4 */
76 #if defined(SYSV) || defined(luna) || defined(sun) || defined(__sxg__)
77 #include <memory.h>
78 #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len))
79 #if defined(SYSV) && defined(_XBCOPYFUNC)
80 #undef memmove
81 #define memmove(dst,src,len) _XBCOPYFUNC((char *)(src),(char *)(dst),(int)(len))
82 #define _XNEEDBCOPYFUNC
83 #endif
84 #else /* else vanilla BSD */
85 #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len))
86 #define memcpy(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len))
87 #define memcmp(b1,b2,len) bcmp((char *)(b1),(char *)(b2),(int)(len))
88 #endif /* SYSV else */
89 #endif /* ! X_NOT_STDC_ENV else */
90 
91 #endif /* _XFUNCS_H_ */
92