Sync usage with man page.
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / record.h
blobbbe12e759ba7c0a1299127c0929d3b7a8afdd9a6
1 /* $NetBSD$ */
3 #ifndef _RECORD_H_INCLUDED_
4 #define _RECORD_H_INCLUDED_
6 /*++
7 /* NAME
8 /* record 3h
9 /* SUMMARY
10 /* simple typed record I/O
11 /* SYNOPSIS
12 /* #include <record.h>
13 /* DESCRIPTION
14 /* .nf
17 * System library.
19 #include <stdarg.h>
22 * Utility library.
24 #include <vstring.h>
25 #include <vstream.h>
28 * Record type values are positive numbers 0..255. Negative record type
29 * values are reserved for diagnostics.
31 #define REC_TYPE_EOF -1 /* no record */
32 #define REC_TYPE_ERROR -2 /* bad record */
35 * Functional interface.
37 extern int rec_get_raw(VSTREAM *, VSTRING *, ssize_t, int);
38 extern int rec_put(VSTREAM *, int, const char *, ssize_t);
39 extern int rec_put_type(VSTREAM *, int, off_t);
40 extern int PRINTFLIKE(3, 4) rec_fprintf(VSTREAM *, int, const char *,...);
41 extern int rec_fputs(VSTREAM *, int, const char *);
42 extern int rec_goto(VSTREAM *, const char *);
43 extern int rec_pad(VSTREAM *, int, int);
45 #define REC_PUT_BUF(v, t, b) rec_put((v), (t), vstring_str(b), VSTRING_LEN(b))
47 #define REC_FLAG_NONE (0)
48 #define REC_FLAG_FOLLOW_PTR (1<<0) /* follow PTR records */
49 #define REC_FLAG_SKIP_DTXT (1<<1) /* skip DTXT records */
50 #define REC_FLAG_SEEK_END (1<<2) /* seek EOF after END record */
52 #define REC_FLAG_DEFAULT \
53 (REC_FLAG_FOLLOW_PTR | REC_FLAG_SKIP_DTXT | REC_FLAG_SEEK_END)
55 #define rec_get(fp, buf, limit) \
56 rec_get_raw((fp), (buf), (limit), REC_FLAG_DEFAULT)
58 #define REC_SPACE_NEED(buflen, reclen) do { \
59 ssize_t _c, _l; \
60 for (_c = 1, _l = (buflen); (_l >>= 7U) != 0; _c++) \
61 ; \
62 (reclen) = 1 + _c + (buflen); \
63 } while (0)
66 * Stuff that needs <stdarg.h>
68 extern int rec_vfprintf(VSTREAM *, int, const char *, va_list);
70 /* LICENSE
71 /* .ad
72 /* .fi
73 /* The Secure Mailer license must be distributed with this software.
74 /* AUTHOR(S)
75 /* Wietse Venema
76 /* IBM T.J. Watson Research
77 /* P.O. Box 704
78 /* Yorktown Heights, NY 10598, USA
79 /*--*/
81 #endif