| 1 |
/* |
| 2 |
* $XdotOrg: xc/include/Xfuncs.h,v 1.4 2005/11/08 06:33:25 jkj Exp $ |
| 3 |
* $Xorg: Xfuncs.h,v 1.4 2001/02/09 02:03:22 xorgcvs Exp $ |
| 4 |
* |
| 5 |
* |
| 6 |
Copyright 1990, 1998 The Open Group |
| 7 |
|
| 8 |
Permission to use, copy, modify, distribute, and sell this software and its |
| 9 |
documentation for any purpose is hereby granted without fee, provided that |
| 10 |
the above copyright notice appear in all copies and that both that |
| 11 |
copyright notice and this permission notice appear in supporting |
| 12 |
documentation. |
| 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 |
OPEN GROUP 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 Open Group 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 Open Group. |
| 27 |
* |
| 28 |
*/ |
| 29 |
|
| 30 |
#ifndef _XFUNCS_H_ |
| 31 |
#define _XFUNCS_H_ |
| 32 |
|
| 33 |
#include <nx-X11/Xosdefs.h> |
| 34 |
|
| 35 |
#ifdef X_USEBFUNCS |
| 36 |
void bcopy(); |
| 37 |
void bzero(); |
| 38 |
int bcmp(); |
| 39 |
#else |
| 40 |
#if defined(SYSV) && !defined(__SCO__) && !defined(sun) && !defined(__UNIXWARE__) |
| 41 |
#include <memory.h> |
| 42 |
void bcopy(); |
| 43 |
#define bzero(b,len) memset(b, 0, len) |
| 44 |
#define bcmp(b1,b2,len) memcmp(b1, b2, len) |
| 45 |
#else |
| 46 |
#include <string.h> |
| 47 |
#if defined(__SCO__) || defined(sun) || defined(__UNIXWARE__) |
| 48 |
#include <strings.h> |
| 49 |
#endif |
| 50 |
#define _XFUNCS_H_INCLUDED_STRING_H |
| 51 |
#if defined(sun) |
| 52 |
#define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) |
| 53 |
#define bzero(b,len) memset(b, 0, (size_t)(len)) |
| 54 |
#define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len)) |
| 55 |
#endif |
| 56 |
#endif |
| 57 |
#endif /* X_USEBFUNCS */ |
| 58 |
|
| 59 |
/* the new Xfuncs.h */ |
| 60 |
|
| 61 |
#if !defined(X_NOT_STDC_ENV) && (!defined(sun) || defined(SVR4)) |
| 62 |
/* the ANSI C way */ |
| 63 |
#ifndef _XFUNCS_H_INCLUDED_STRING_H |
| 64 |
#include <string.h> |
| 65 |
#endif |
| 66 |
#undef bzero |
| 67 |
#define bzero(b,len) memset(b,0,len) |
| 68 |
#else /* else X_NOT_STDC_ENV or SunOS 4 */ |
| 69 |
#if defined(SYSV) || defined(luna) || defined(sun) || defined(__sxg__) |
| 70 |
#include <memory.h> |
| 71 |
#define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) |
| 72 |
#if defined(SYSV) && defined(_XBCOPYFUNC) |
| 73 |
#undef memmove |
| 74 |
#define memmove(dst,src,len) _XBCOPYFUNC((char *)(src),(char *)(dst),(int)(len)) |
| 75 |
#define _XNEEDBCOPYFUNC |
| 76 |
#endif |
| 77 |
#else /* else vanilla BSD */ |
| 78 |
#define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) |
| 79 |
#define memcpy(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) |
| 80 |
#define memcmp(b1,b2,len) bcmp((char *)(b1),(char *)(b2),(int)(len)) |
| 81 |
#endif /* SYSV else */ |
| 82 |
#endif /* ! X_NOT_STDC_ENV else */ |
| 83 |
|
| 84 |
#if defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) |
| 85 |
#define atexit(f) on_exit(f, 0) |
| 86 |
#endif |
| 87 |
|
| 88 |
#endif /* _XFUNCS_H_ */ |