3 #ifndef _RECORD_H_INCLUDED_
4 #define _RECORD_H_INCLUDED_
10 /* simple typed record I/O
12 /* #include <record.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 { \
60 for (_c = 1, _l = (buflen); (_l >>= 7U) != 0; _c++) \
62 (reclen) = 1 + _c + (buflen); \
66 * Stuff that needs <stdarg.h>
68 extern int rec_vfprintf(VSTREAM
*, int, const char *, va_list);
73 /* The Secure Mailer license must be distributed with this software.
76 /* IBM T.J. Watson Research
78 /* Yorktown Heights, NY 10598, USA