summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-10-08 15:19:41 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-10-08 15:19:41 +0300
commit0bf8123e1c49fc4ac4383ff95e26f486d6b8948b (patch)
tree131e71afc0b718f95e8fdee1cf6ebeebb712b5ef /examples
parent20bcdece82079305c006b956f1340391b64ee498 (diff)
downloadmailutils-0bf8123e1c49fc4ac4383ff95e26f486d6b8948b.tar.gz
mailutils-0bf8123e1c49fc4ac4383ff95e26f486d6b8948b.tar.bz2
Improve mta simulator output.
* examples/mta.c (mta_send): A line number refers to the start of each line, not end of it. * mail/testsuite/mail/send.exp: Reflect this change. * sieve/tests/redirect.at: Likewise. * sieve/tests/reject.at: Likewise.
Diffstat (limited to 'examples')
-rw-r--r--examples/mta.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/examples/mta.c b/examples/mta.c
index 4d2777418..8fb265c95 100644
--- a/examples/mta.c
+++ b/examples/mta.c
@@ -326,7 +326,8 @@ mta_send (mu_message_t msg)
mu_stream_t stream = NULL;
size_t line;
char *value;
-
+ int newline = 0;
+
value = from_address ();
if (value)
{
@@ -340,7 +341,7 @@ mta_send (mu_message_t msg)
mu_message_get_streamref (msg, &stream);
line = 0;
- fprintf (diag, "%4lu: ", (unsigned long) line);
+ newline = 1;
while (mu_stream_read (stream, buffer, sizeof buffer - 1, &n) == 0
&& n != 0)
{
@@ -348,16 +349,23 @@ mta_send (mu_message_t msg)
for (i = 0; i < n; i++)
{
+ if (newline)
+ {
+ fprintf (diag, "%4lu: ", (unsigned long) line);
+ newline = 0;
+ }
fputc (buffer[i], diag);
if (buffer[i] == '\n')
{
line++;
- fprintf (diag, "%4lu: ", (unsigned long) line);
+ newline = 1;
}
}
}
mu_stream_destroy (&stream);
- fprintf (diag, "\nEND OF MESSAGE\n");
+ if (!newline)
+ fprintf (diag, "\n(no newline at EOF)\n");
+ fprintf (diag, "END OF MESSAGE\n");
fflush (diag);
return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.