Print the number of lines along with the message sizes.
Showing
1 changed file
with
16 additions
and
6 deletions
... | @@ -119,7 +119,7 @@ main (int argc, char **argv) | ... | @@ -119,7 +119,7 @@ main (int argc, char **argv) |
119 | message_t msg; | 119 | message_t msg; |
120 | header_t hdr; | 120 | header_t hdr; |
121 | size_t nparts; | 121 | size_t nparts; |
122 | size_t msize; | 122 | size_t msize, nlines; |
123 | 123 | ||
124 | if ((ret = mailbox_get_message (mbox, i, &msg)) != 0) | 124 | if ((ret = mailbox_get_message (mbox, i, &msg)) != 0) |
125 | { | 125 | { |
... | @@ -131,6 +131,11 @@ main (int argc, char **argv) | ... | @@ -131,6 +131,11 @@ main (int argc, char **argv) |
131 | fprintf (stderr, "message_size - %s\n", mu_strerror (ret)); | 131 | fprintf (stderr, "message_size - %s\n", mu_strerror (ret)); |
132 | exit (2); | 132 | exit (2); |
133 | } | 133 | } |
134 | if ((ret = message_lines (msg, &nlines)) != 0) | ||
135 | { | ||
136 | fprintf (stderr, "message_lines - %s\n", mu_strerror (ret)); | ||
137 | exit (2); | ||
138 | } | ||
134 | if ((ret = message_get_header (msg, &hdr)) != 0) | 139 | if ((ret = message_get_header (msg, &hdr)) != 0) |
135 | { | 140 | { |
136 | fprintf (stderr, "message_get_header - %s\n", mu_strerror (ret)); | 141 | fprintf (stderr, "message_get_header - %s\n", mu_strerror (ret)); |
... | @@ -150,8 +155,8 @@ main (int argc, char **argv) | ... | @@ -150,8 +155,8 @@ main (int argc, char **argv) |
150 | } | 155 | } |
151 | printf ("Number of parts in message - %lu\n", | 156 | printf ("Number of parts in message - %lu\n", |
152 | (unsigned long) nparts); | 157 | (unsigned long) nparts); |
153 | printf ("Total message size - %lu\n", | 158 | printf ("Total message size - %lu/%lu\n", |
154 | (unsigned long) msize); | 159 | (unsigned long) msize, (unsigned long) nlines); |
155 | message_display_parts (msg, 0); | 160 | message_display_parts (msg, 0); |
156 | } | 161 | } |
157 | mailbox_close (mbox); | 162 | mailbox_close (mbox); |
... | @@ -165,7 +170,7 @@ void | ... | @@ -165,7 +170,7 @@ void |
165 | message_display_parts (message_t msg, int indent) | 170 | message_display_parts (message_t msg, int indent) |
166 | { | 171 | { |
167 | int ret, j; | 172 | int ret, j; |
168 | size_t msize, nparts, nsubparts; | 173 | size_t msize, nlines, nparts, nsubparts; |
169 | message_t part; | 174 | message_t part; |
170 | header_t hdr; | 175 | header_t hdr; |
171 | char type[256]; | 176 | char type[256]; |
... | @@ -197,6 +202,11 @@ message_display_parts (message_t msg, int indent) | ... | @@ -197,6 +202,11 @@ message_display_parts (message_t msg, int indent) |
197 | fprintf (stderr, "message_size - %s\n", mu_strerror (ret)); | 202 | fprintf (stderr, "message_size - %s\n", mu_strerror (ret)); |
198 | exit (2); | 203 | exit (2); |
199 | } | 204 | } |
205 | if ((ret = message_lines (part, &nlines)) != 0) | ||
206 | { | ||
207 | fprintf (stderr, "message_lines - %s\n", mu_strerror (ret)); | ||
208 | exit (2); | ||
209 | } | ||
200 | if ((ret = message_get_header (part, &hdr)) != 0) | 210 | if ((ret = message_get_header (part, &hdr)) != 0) |
201 | { | 211 | { |
202 | fprintf (stderr, "message_get_header - %s\n", mu_strerror (ret)); | 212 | fprintf (stderr, "message_get_header - %s\n", mu_strerror (ret)); |
... | @@ -205,8 +215,8 @@ message_display_parts (message_t msg, int indent) | ... | @@ -205,8 +215,8 @@ message_display_parts (message_t msg, int indent) |
205 | header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type), | 215 | header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type), |
206 | NULL); | 216 | NULL); |
207 | printf ("%*.*sType of part %d = %s\n", indent, indent, "", j, type); | 217 | printf ("%*.*sType of part %d = %s\n", indent, indent, "", j, type); |
208 | printf ("%*.*sMessage part size - %lu\n", indent, indent, "", | 218 | printf ("%*.*sMessage part size - %lu/%lu\n", indent, indent, "", |
209 | (unsigned long) msize); | 219 | (unsigned long) msize, (unsigned long) nlines); |
210 | encoding[0] = '\0'; | 220 | encoding[0] = '\0'; |
211 | header_get_value (hdr, MU_HEADER_CONTENT_TRANSFER_ENCODING, encoding, | 221 | header_get_value (hdr, MU_HEADER_CONTENT_TRANSFER_ENCODING, encoding, |
212 | sizeof (encoding), NULL); | 222 | sizeof (encoding), NULL); | ... | ... |
-
Please register or sign in to post a comment