summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2010-09-21 19:42:11 +0200
committerWojciech Polak <polak@gnu.org>2010-09-21 19:42:36 +0200
commit5984fc0cd9f8841e574991ba8155cb1448389af3 (patch)
treee4c2805fe1552004e870aed546784da509291ea8 /examples
parent89ea7423fc240601e018851dbb219a07d476e1d4 (diff)
downloadmailutils-5984fc0cd9f8841e574991ba8155cb1448389af3.tar.gz
mailutils-5984fc0cd9f8841e574991ba8155cb1448389af3.tar.bz2
Update C++ API and the examples.
* include/mailutils/cpp/pop3.h (capa): Add reread parameter. (getline): Add new prototype. (send, readline): Remove. (response, stat): Change prototype. * libmu_cpp/pop3.cc: Likewise. * include/mailutils/cpp/stream.h (read, write, readline): Change prototype. (sequential_readline, sequential_write): Remove. * libmu_cpp/stream.cc: Likewise.
Diffstat (limited to 'examples')
-rw-r--r--examples/cpp/iconv.cc8
-rw-r--r--examples/cpp/mimetest.cc4
-rw-r--r--examples/cpp/msg-send.cc2
-rw-r--r--examples/cpp/murun.cc10
4 files changed, 11 insertions, 13 deletions
diff --git a/examples/cpp/iconv.cc b/examples/cpp/iconv.cc
index 290178404..e94c47bae 100644
--- a/examples/cpp/iconv.cc
+++ b/examples/cpp/iconv.cc
@@ -39,7 +39,7 @@ main (int argc, char **argv)
}
try {
- StdioStream *in = new StdioStream (stdin, 0);
+ StdioStream *in = new StdioStream (MU_STDIN_FD, 0);
in->open ();
FilterIconvStream cvt (*in, (string)argv[1], (string)argv[2], 0,
@@ -47,12 +47,12 @@ main (int argc, char **argv)
cvt.open ();
delete in;
- StdioStream out (stdout, 0);
+ StdioStream out (MU_STDOUT_FD, 0);
out.open ();
do {
- cvt.read (buffer, sizeof (buffer), total);
- out.sequential_write (buffer, cvt.get_read_count ());
+ cvt.read (buffer, sizeof (buffer));
+ out.write (buffer, cvt.get_read_count ());
total += cvt.get_read_count ();
} while (cvt.get_read_count ());
diff --git a/examples/cpp/mimetest.cc b/examples/cpp/mimetest.cc
index 40249ed1a..2215b947c 100644
--- a/examples/cpp/mimetest.cc
+++ b/examples/cpp/mimetest.cc
@@ -187,14 +187,12 @@ message_display_parts (Message& msg, int indent)
Stream stream = body.get_stream ();
FilterStream filter (stream, encoding, 0, 0);
- int offset = 0;
char buf[2048];
- while (filter.readline (buf, sizeof (buf), offset) == 0 &&
+ while (filter.readline (buf, sizeof (buf)) == 0 &&
filter.get_read_count ())
{
cout << setw (indent) << setfill (' ') << buf;
- offset += filter.get_read_count ();
}
}
else
diff --git a/examples/cpp/msg-send.cc b/examples/cpp/msg-send.cc
index 1c5eac601..79b300d68 100644
--- a/examples/cpp/msg-send.cc
+++ b/examples/cpp/msg-send.cc
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
}
try {
- StdioStream in (stdin, MU_STREAM_SEEK);
+ StdioStream in (MU_STDIN_FD, MU_STREAM_SEEK);
in.open ();
Message msg;
diff --git a/examples/cpp/murun.cc b/examples/cpp/murun.cc
index 13d30203d..6dc1e1a22 100644
--- a/examples/cpp/murun.cc
+++ b/examples/cpp/murun.cc
@@ -33,11 +33,11 @@ read_and_print (Stream *in, Stream& out)
{
char buffer[128];
- in->sequential_readline (buffer, sizeof (buffer));
+ in->readline (buffer, sizeof (buffer));
while (in->get_read_count ())
{
- out.sequential_write (buffer, in->get_read_count ());
- in->sequential_readline (buffer, sizeof (buffer));
+ out.write (buffer, in->get_read_count ());
+ in->readline (buffer, sizeof (buffer));
}
}
@@ -47,7 +47,7 @@ create_filter (bool read_stdin, char *cmdline, int flags)
try {
if (read_stdin)
{
- StdioStream *in = new StdioStream (stdin, 0);
+ StdioStream *in = new StdioStream (MU_STDIN_FD, 0);
in->open ();
FilterProgStream *stream = new FilterProgStream (cmdline, in);
stream->open ();
@@ -96,7 +96,7 @@ main (int argc, char *argv[])
stream = create_filter (read_stdin, cmdline, flags);
try {
- StdioStream out (stdout, 0);
+ StdioStream out (MU_STDOUT_FD, 0);
out.open ();
read_and_print (stream, out);

Return to:

Send suggestions and report system problems to the System administrator.