Commit 7220d9dd 7220d9ddf7abd7ec0cb499194b3272467b4bf91c by Sergey Poznyakoff

Fix compilation of several example programs.

* examples/header.c: Use streamrefs.
* examples/mimetest.c: Likewise.
* examples/mta.c: Likewise.
* examples/nntpclient.c: Remove an unused variable.
1 parent 1f4deff1
......@@ -173,7 +173,7 @@ cmd_dump (int argc, char **argv)
if (argc == 2)
off = strtoul (argv[1], NULL, 0);
status = mu_header_get_stream (header, &stream);
status = mu_header_get_streamref (header, &stream);
if (status)
{
mu_error ("%u: cannot get stream: %s", line_num, mu_strerror (status));
......@@ -183,6 +183,7 @@ cmd_dump (int argc, char **argv)
status = mu_stream_seek (stream, off, SEEK_SET, NULL);
if (status)
{
mu_stream_destroy (&stream);
mu_error ("%u: cannot seek: %s", line_num, mu_strerror (status));
return;
}
......@@ -192,6 +193,7 @@ cmd_dump (int argc, char **argv)
{
fwrite (buf, 1, n, stdout);
}
mu_stream_destroy (&stream);
}
void
......@@ -272,7 +274,7 @@ cmd_write (int argc, char **argv)
if (check_args (argv[0], argc, 1, 1))
return;
status = mu_header_get_stream (header, &str);
status = mu_header_get_streamref (header, &str);
if (status)
{
mu_error ("%u: cannot get stream: %s", line_num, mu_strerror (status));
......@@ -286,6 +288,7 @@ cmd_write (int argc, char **argv)
if (buf[0] == '\n')
break;
}
mu_stream_destroy (&str);
}
void
......
......@@ -249,12 +249,12 @@ message_display_parts (mu_message_t msg, int indent)
printf ("%*.*sText Message\n", indent, indent, "");
printf ("%*.*sBegin\n", indent, indent, "");
mu_message_get_body (part, &body);
mu_body_get_stream (body, &str);
mu_body_get_streamref (body, &str);
/* Make sure the original body stream is not closed when
str gets destroyed */
mu_filter_create (&str, str, encoding, MU_FILTER_DECODE,
MU_STREAM_READ | MU_STREAM_NO_CLOSE);
while (mu_stream_readline (str, buf, sizeof (buf), &nbytes) == 0
&& nbytes)
{
......
......@@ -19,7 +19,7 @@
/* This is a "fake" mta designed for testing purposes. It imitates
sendmail sending and daemon modes. It does not actually send anything,
instead it just outputs the transcript of what would have been done.
instead it just outputs a transcript of what would have been done.
Invocation:
......@@ -326,7 +326,7 @@ mta_send (mu_message_t msg)
fprintf (diag, "ENVELOPE TO: %s\n", value);
free (value);
mu_message_get_stream (msg, &stream);
mu_message_get_streamref (msg, &stream);
line = 0;
fprintf (diag, "%4lu: ", (unsigned long) line);
while (mu_stream_read (stream, buffer, sizeof buffer - 1, &n) == 0
......@@ -344,6 +344,7 @@ mta_send (mu_message_t msg)
}
}
}
mu_stream_destroy (&stream);
fprintf (diag, "\nEND OF MESSAGE\n");
fflush (diag);
return 0;
......
......@@ -423,7 +423,6 @@ com_body (char *arg)
if (status == 0 && stream != NULL)
{
size_t n = 0;
char buf[128];
while (mu_stream_readline (stream, buf, sizeof buf, 0) == 0)
printf ("%s", buf);
......