1258945Sroberto/*
2258945Sroberto * lib_strbuf.h - definitions for routines which use the common string buffers
3258945Sroberto */
4280849Scy#ifndef LIB_STRBUF_H
5280849Scy#define LIB_STRBUF_H
6258945Sroberto
7258945Sroberto#include <ntp_types.h>
8280849Scy#include <ntp_malloc.h>			/* for ZERO() */
9258945Sroberto
10258945Sroberto/*
11258945Sroberto * Sizes of things
12258945Sroberto */
13280849Scy#define LIB_NUMBUF	16
14280849Scy#define	LIB_BUFLENGTH	128
15258945Sroberto
16280849Scytypedef char libbufstr[LIB_BUFLENGTH];
17280849Scyextern libbufstr lib_stringbuf[LIB_NUMBUF];
18280849Scyextern int lib_nextbuf;
19280849Scyextern int lib_inited;
20280849Scy
21280849Scy
22258945Sroberto/*
23258945Sroberto * Macro to get a pointer to the next buffer
24258945Sroberto */
25280849Scy#define	LIB_GETBUF(bufp)					\
26280849Scy	do {							\
27280849Scy		ZERO(lib_stringbuf[lib_nextbuf]);		\
28280849Scy		(bufp) = &lib_stringbuf[lib_nextbuf++][0];	\
29280849Scy		lib_nextbuf %= COUNTOF(lib_stringbuf);		\
30280849Scy	} while (FALSE)
31258945Sroberto
32280849Scy#endif	/* LIB_STRBUF_H */
33