7 /* convert record stream to printable form
11 /* recdump reads a record stream from standard input and
12 /* writes the content to standard output in printable form.
14 /* Problems are reported to the standard error stream.
18 /* The Secure Mailer license must be distributed with this software.
21 /* IBM T.J. Watson Research
23 /* Yorktown Heights, NY 10598, USA
31 /* Utility library. */
33 #include <msg_vstream.h>
38 #include <rec_streamlf.h>
41 int main(int unused_argc
, char **argv
)
43 VSTRING
*buf
= vstring_alloc(100);
47 msg_vstream_init(argv
[0], VSTREAM_OUT
);
49 while (offset
= vstream_ftell(VSTREAM_IN
),
50 ((type
= rec_get(VSTREAM_IN
, buf
, 0)) != REC_TYPE_EOF
51 && type
!= REC_TYPE_ERROR
)) {
52 vstream_fprintf(VSTREAM_OUT
, "%15s|%4ld|%3ld|%s\n",
53 rec_type_name(type
), offset
,
54 (long) VSTRING_LEN(buf
), vstring_str(buf
));
56 vstream_fflush(VSTREAM_OUT
);