xref: /netbsd-src/external/bsd/ntp/dist/include/lib_strbuf.h (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: lib_strbuf.h,v 1.1.1.1 2009/12/13 16:54:49 kardel Exp $	*/
2 
3 /*
4  * lib_strbuf.h - definitions for routines which use the common string buffers
5  */
6 
7 #include <ntp_types.h>
8 
9 /*
10  * Sizes of things
11  */
12 #define	LIB_NUMBUFS	200
13 #define	LIB_BUFLENGTH	80
14 
15 /*
16  * Macro to get a pointer to the next buffer
17  */
18 #define	LIB_GETBUF(buf) \
19 	do { \
20 		if (!lib_inited) \
21 			init_lib(); \
22 		buf = &lib_stringbuf[lib_nextbuf][0]; \
23 		if (++lib_nextbuf >= LIB_NUMBUFS) \
24 			lib_nextbuf = 0; \
25 		memset(buf, 0, LIB_BUFLENGTH); \
26 	} while (0)
27 
28 extern char lib_stringbuf[LIB_NUMBUFS][LIB_BUFLENGTH];
29 extern int lib_nextbuf;
30 extern int lib_inited;
31