Lines Matching refs:input
14 dump_timestamp(struct istream *input, const char *name, const char *value)
24 name, input->v_offset, value);
31 dump_size(struct istream *input, const char *name, const char *value)
41 name, input->v_offset, value);
48 static unsigned int dump_file_hdr(struct istream *input)
53 if ((line = i_stream_read_next_line(input)) == NULL)
60 i_fatal("%s is not a dbox file", i_stream_get_name(input));
77 dump_timestamp(input, "file.create_stamp", *arg + 1);
90 dump_msg_hdr(struct istream *input, unsigned int hdr_size, uoff_t *msg_size_r)
97 if (i_stream_read_bytes(input, &data, &size, hdr_size) <= 0) {
101 "%"PRIuSIZE_T" bytes", input->v_offset, size);
103 printf("offset %"PRIuUOFF_T":\n", input->v_offset);
110 i_fatal("dbox wrong pre-magic at %"PRIuUOFF_T, input->v_offset);
112 msg_size = dump_size(input, "msg.size",
115 i_stream_skip(input, hdr_size);
120 static void dump_msg_metadata(struct istream *input)
128 if (i_stream_read_bytes(input, &data, &size, sizeof(hdr)) <= 0) {
130 input->v_offset);
134 i_fatal("dbox wrong post-magic at %"PRIuUOFF_T, input->v_offset);
135 i_stream_skip(input, sizeof(hdr));
139 if ((line = i_stream_read_next_line(input)) == NULL)
155 dump_timestamp(input, "msg.received", line + 1);
158 (void)dump_size(input, "msg.physical-size", line + 1);
161 (void)dump_size(input, "msg.virtual-size", line + 1);
181 static bool dump_msg(struct istream *input, unsigned int hdr_size)
185 if (!dump_msg_hdr(input, hdr_size, &msg_size))
187 i_stream_skip(input, msg_size);
188 dump_msg_metadata(input);
194 struct istream *input;
203 input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
204 i_stream_set_name(input, argv[1]);
205 hdr_size = dump_file_hdr(input);
209 ret = dump_msg(input, hdr_size);
212 i_stream_destroy(&input);