~ubuntu-branches/ubuntu/hoary/postfix/hoary-security

« back to all changes in this revision

Viewing changes to src/global/recdump.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-10-06 11:50:33 UTC
  • Revision ID: james.westby@ubuntu.com-20041006115033-ooo6yfg6kmoteu04
Tags: upstream-2.1.3
ImportĀ upstreamĀ versionĀ 2.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*++
 
2
/* NAME
 
3
/*      recdump 1
 
4
/* SUMMARY
 
5
/*      convert record stream to printable form
 
6
/* SYNOPSIS
 
7
/*      recdump
 
8
/* DESCRIPTION
 
9
/*      recdump reads a record stream from standard input and
 
10
/*      writes the content to standard output in printable form.
 
11
/* DIAGNOSTICS
 
12
/*      Problems are reported to the standard error stream.
 
13
/* LICENSE
 
14
/* .ad
 
15
/* .fi
 
16
/*      The Secure Mailer license must be distributed with this software.
 
17
/* AUTHOR(S)
 
18
/*      Wietse Venema
 
19
/*      IBM T.J. Watson Research
 
20
/*      P.O. Box 704
 
21
/*      Yorktown Heights, NY 10598, USA
 
22
/*--*/
 
23
 
 
24
/* System library. */
 
25
 
 
26
#include <sys_defs.h>
 
27
 
 
28
/* Utility library. */
 
29
 
 
30
#include <msg_vstream.h>
 
31
 
 
32
/* Global library. */
 
33
 
 
34
#include <record.h>
 
35
#include <rec_streamlf.h>
 
36
#include <rec_type.h>
 
37
 
 
38
int     main(int unused_argc, char **argv)
 
39
{
 
40
    VSTRING *buf = vstring_alloc(100);
 
41
    long    offset;
 
42
    int     type;
 
43
 
 
44
    msg_vstream_init(argv[0], VSTREAM_OUT);
 
45
 
 
46
    while (offset = vstream_ftell(VSTREAM_IN),
 
47
           ((type = rec_get(VSTREAM_IN, buf, 0)) != REC_TYPE_EOF
 
48
           && type != REC_TYPE_ERROR)) {
 
49
        vstream_fprintf(VSTREAM_OUT, "%15s|%4ld|%3d|%s\n",
 
50
                        rec_type_name(type), offset,
 
51
                        VSTRING_LEN(buf), vstring_str(buf));
 
52
    }
 
53
    vstream_fflush(VSTREAM_OUT);
 
54
    vstring_free(buf);
 
55
    exit(0);
 
56
}