diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-05-01 01:31:16 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-05-01 01:31:16 +0300 |
commit | 2076b7637d834f9fcb26144037f6985fee9bbe9b (patch) | |
tree | 346fb9b3983e94acfefac74c270f11871a570c52 | |
parent | fc9d0ad4a67789490761459c6334bbf4dc689ce0 (diff) | |
download | mailutils-2076b7637d834f9fcb26144037f6985fee9bbe9b.tar.gz mailutils-2076b7637d834f9fcb26144037f6985fee9bbe9b.tar.bz2 |
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.
-rw-r--r-- | examples/header.c | 7 | ||||
-rw-r--r-- | examples/mimetest.c | 4 | ||||
-rw-r--r-- | examples/mta.c | 5 | ||||
-rw-r--r-- | examples/nntpclient.c | 1 |
4 files changed, 10 insertions, 7 deletions
diff --git a/examples/header.c b/examples/header.c index 742bc2b5e..90cce65b4 100644 --- a/examples/header.c +++ b/examples/header.c @@ -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 diff --git a/examples/mimetest.c b/examples/mimetest.c index ed527bac9..8e38ca9e9 100644 --- a/examples/mimetest.c +++ b/examples/mimetest.c @@ -250,12 +250,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) { diff --git a/examples/mta.c b/examples/mta.c index 6d1048085..16049550b 100644 --- a/examples/mta.c +++ b/examples/mta.c @@ -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; diff --git a/examples/nntpclient.c b/examples/nntpclient.c index 2c652f145..4fac95309 100644 --- a/examples/nntpclient.c +++ b/examples/nntpclient.c @@ -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); |