Annotation of embedaddon/ntp/include/ntp_string.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Define string ops: strchr strrchr memcmp memmove memset
! 3: */
! 4:
! 5: #ifndef _ntp_string_h
! 6: #define _ntp_string_h
! 7:
! 8: #ifdef HAVE_CONFIG_H
! 9: #include <config.h>
! 10: #endif
! 11:
! 12: #ifdef HAVE_MEMORY_H
! 13: # include <memory.h>
! 14: #endif
! 15:
! 16: #ifdef HAVE_STRING_H
! 17: # include <string.h>
! 18: #endif
! 19:
! 20: #ifdef HAVE_BSTRING_H
! 21: # include <bstring.h>
! 22: #endif
! 23:
! 24: #ifndef STDC_HEADERS
! 25: # ifndef HAVE_STRCHR
! 26: # include <strings.h>
! 27: # define strchr index
! 28: # define strrchr rindex
! 29: # endif
! 30: # ifndef __GNUC__
! 31: char *strchr(), *strrchr();
! 32: # endif
! 33: # ifndef HAVE_MEMCPY
! 34: # define NTP_NEED_BOPS
! 35: # endif
! 36: #endif /* STDC_HEADERS */
! 37:
! 38: #ifdef NTP_NEED_BOPS
! 39:
! 40: #ifdef HAVE_STRINGS_H
! 41: # include <strings.h> /* bcmp, bcopy, bzero */
! 42: #endif
! 43:
! 44: void ntp_memset (char *, int, int);
! 45:
! 46: #define memcmp(a, b, c) bcmp(a, b, (int)(c))
! 47: #define memmove(t, f, c) bcopy(f, t, (int)(c))
! 48: #define memcpy(t, f, c) bcopy(f, t, (int)(c))
! 49: #define memset(a, x, c) if (0 == (x)) \
! 50: bzero(a, (int)(c)); \
! 51: else \
! 52: ntp_memset((char *)(a), x, c)
! 53: #endif /* NTP_NEED_BOPS */
! 54:
! 55: #endif /* _ntp_string_h */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>