xref: /netbsd-src/external/ibm-public/postfix/dist/src/util/vstring_vstream.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /*	$NetBSD: vstring_vstream.h,v 1.2 2017/02/14 01:16:49 christos Exp $	*/
2 
3 #ifndef _VSTRING_VSTREAM_H_INCLUDED_
4 #define _VSTRING_VSTREAM_H_INCLUDED_
5 
6 /*++
7 /* NAME
8 /*	vstring_vstream 3h
9 /* SUMMARY
10 /*	auto-resizing string library
11 /* SYNOPSIS
12 /*	#include <vstring_vstream.h>
13 /* DESCRIPTION
14 
15  /*
16   * Utility library.
17   */
18 #include <vstream.h>
19 #include <vstring.h>
20 
21  /*
22   * External interface.
23   */
24 extern int WARN_UNUSED_RESULT vstring_get(VSTRING *, VSTREAM *);
25 extern int WARN_UNUSED_RESULT vstring_get_nonl(VSTRING *, VSTREAM *);
26 extern int WARN_UNUSED_RESULT vstring_get_null(VSTRING *, VSTREAM *);
27 extern int WARN_UNUSED_RESULT vstring_get_bound(VSTRING *, VSTREAM *, ssize_t);
28 extern int WARN_UNUSED_RESULT vstring_get_nonl_bound(VSTRING *, VSTREAM *, ssize_t);
29 extern int WARN_UNUSED_RESULT vstring_get_null_bound(VSTRING *, VSTREAM *, ssize_t);
30 
31  /*
32   * Backwards compatibility for code that still uses the vstring_fgets()
33   * interface. Unfortunately we can't change the macro name to upper case.
34   */
35 #define vstring_fgets(s, p) \
36 	(vstring_get((s), (p)) == VSTREAM_EOF ? 0 : (s))
37 #define vstring_fgets_nonl(s, p) \
38 	(vstring_get_nonl((s), (p)) == VSTREAM_EOF ? 0 : (s))
39 #define vstring_fgets_null(s, p) \
40 	(vstring_get_null((s), (p)) == VSTREAM_EOF ? 0 : (s))
41 #define vstring_fgets_bound(s, p, l) \
42 	(vstring_get_bound((s), (p), (l)) == VSTREAM_EOF ? 0 : (s))
43 #define vstring_fgets_nonl_bound(s, p, l) \
44 	(vstring_get_nonl_bound((s), (p), (l)) == VSTREAM_EOF ? 0 : (s))
45 
46 /* LICENSE
47 /* .ad
48 /* .fi
49 /*	The Secure Mailer license must be distributed with this software.
50 /* AUTHOR(S)
51 /*	Wietse Venema
52 /*	IBM T.J. Watson Research
53 /*	P.O. Box 704
54 /*	Yorktown Heights, NY 10598, USA
55 /*--*/
56 
57 #endif
58