Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / ntp / dist / include / ntp_string.h
blob5d5cd3728c17caedf5f9707a5861ba471955697c
1 /* $NetBSD$ */
3 /*
4 * Define string ops: strchr strrchr memcmp memmove memset
5 */
7 #ifndef _ntp_string_h
8 #define _ntp_string_h
10 #ifdef HAVE_CONFIG_H
11 #include <config.h>
12 #endif
14 #ifdef HAVE_MEMORY_H
15 # include <memory.h>
16 #endif
18 #ifdef HAVE_STRING_H
19 # include <string.h>
20 #endif
22 #ifdef HAVE_BSTRING_H
23 # include <bstring.h>
24 #endif
26 #ifndef STDC_HEADERS
27 # ifndef HAVE_STRCHR
28 # include <strings.h>
29 # define strchr index
30 # define strrchr rindex
31 # endif
32 # ifndef __GNUC__
33 char *strchr(), *strrchr();
34 # endif
35 # ifndef HAVE_MEMCPY
36 # define NTP_NEED_BOPS
37 # endif
38 #endif /* STDC_HEADERS */
40 #ifdef NTP_NEED_BOPS
42 #ifdef HAVE_STRINGS_H
43 # include <strings.h> /* bcmp, bcopy, bzero */
44 #endif
46 void ntp_memset (char *, int, int);
48 #define memcmp(a, b, c) bcmp(a, b, (int)(c))
49 #define memmove(t, f, c) bcopy(f, t, (int)(c))
50 #define memcpy(t, f, c) bcopy(f, t, (int)(c))
51 #define memset(a, x, c) if (0 == (x)) \
52 bzero(a, (int)(c)); \
53 else \
54 ntp_memset((char *)(a), x, c)
55 #endif /* NTP_NEED_BOPS */
57 #endif /* _ntp_string_h */