Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
5845b9ae
...
5845b9ae92508c10e2c1d1124b3813cac2a4dff7
authored
2006-12-30 15:52:20 +0000
by
Wojciech Polak
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Updated to the new libmu_cpp.
1 parent
63c14513
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
112 deletions
examples/cpp/addr.cc
examples/cpp/http.cc
examples/cpp/iconv.cc
examples/cpp/listop.cc
examples/cpp/mailcap.cc
examples/cpp/murun.cc
examples/cpp/sfrom.cc
examples/cpp/url-parse.cc
examples/cpp/addr.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
#include <iostream>
...
...
@@ -37,30 +38,30 @@ parse (const char *str)
try
{
Address
address
(
str
);
count
=
address
.
G
etCount
();
count
=
address
.
g
etCount
();
cout
<<
str
<<
"=> count "
<<
count
<<
endl
;
for
(
no
=
1
;
no
<=
count
;
no
++
)
{
bool
isgroup
=
address
.
I
sGroup
(
no
);
bool
isgroup
=
address
.
i
sGroup
(
no
);
cout
<<
no
<<
" "
;
if
(
isgroup
)
cout
<<
"group "
<<
address
.
G
etPersonal
(
no
)
<<
endl
;
cout
<<
"group "
<<
address
.
g
etPersonal
(
no
)
<<
endl
;
else
cout
<<
"email "
<<
address
.
G
etEmail
(
no
)
<<
endl
;
cout
<<
"email "
<<
address
.
g
etEmail
(
no
)
<<
endl
;
if
(
!
isgroup
)
cout
<<
" personal "
<<
address
.
G
etPersonal
(
no
)
<<
endl
;
cout
<<
" personal "
<<
address
.
g
etPersonal
(
no
)
<<
endl
;
cout
<<
" comments "
<<
address
.
G
etComments
(
no
)
<<
endl
;
cout
<<
" local-part "
<<
address
.
G
etLocalPart
(
no
)
<<
" domain "
<<
address
.
G
etDomain
(
no
)
<<
endl
;
cout
<<
" route "
<<
address
.
G
etRoute
(
no
)
<<
endl
;
cout
<<
" comments "
<<
address
.
g
etComments
(
no
)
<<
endl
;
cout
<<
" local-part "
<<
address
.
g
etLocalPart
(
no
)
<<
" domain "
<<
address
.
g
etDomain
(
no
)
<<
endl
;
cout
<<
" route "
<<
address
.
g
etRoute
(
no
)
<<
endl
;
}
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
cout
<<
endl
;
...
...
examples/cpp/http.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
/* This is an example program to illustrate the use of stream functions.
...
...
@@ -40,10 +41,10 @@ main ()
connect_again:
try
{
stream
.
O
pen
();
stream
.
o
pen
();
}
catch
(
Stream
::
EAgain
)
{
stream
.
W
ait
(
MU_STREAM_READY_WR
);
stream
.
w
ait
(
MU_STREAM_READY_WR
);
goto
connect_again
;
}
...
...
@@ -53,14 +54,14 @@ main ()
stream
<<
wbuf
;
}
catch
(
Stream
::
EAgain
)
{
stream
.
W
ait
(
MU_STREAM_READY_WR
);
off
+=
stream
.
G
etWriten
();
stream
.
w
ait
(
MU_STREAM_READY_WR
);
off
+=
stream
.
g
etWriten
();
goto
write_again
;
}
if
(
stream
.
G
etWriten
()
!=
wbuf
.
length
())
if
(
stream
.
g
etWriten
()
!=
wbuf
.
length
())
{
cerr
<<
"stream.
G
etWriten() != wbuf length"
<<
endl
;
cerr
<<
"stream.
g
etWriten() != wbuf length"
<<
endl
;
exit
(
1
);
}
...
...
@@ -71,15 +72,15 @@ main ()
stream
>>
rbuf
;
}
catch
(
Stream
::
EAgain
)
{
stream
.
W
ait
(
MU_STREAM_READY_RD
);
stream
.
w
ait
(
MU_STREAM_READY_RD
);
goto
read_again
;
}
cout
<<
rbuf
.
substr
(
0
,
stream
.
G
etReadn
());
cout
<<
rbuf
.
substr
(
0
,
stream
.
g
etReadn
());
}
while
(
stream
.
G
etReadn
());
while
(
stream
.
g
etReadn
());
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
exit
(
1
);
}
...
...
examples/cpp/iconv.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
#include <iostream>
...
...
@@ -36,28 +37,28 @@ main (int argc, char **argv)
}
try
{
StdioStream
*
in
=
new
StdioStream
(
stdin
,
0
);
in
->
O
pen
();
StdioStream
*
in
=
new
StdioStream
(
stdin
,
0
);
in
->
o
pen
();
FilterStream
cvt
;
cvt
.
I
convCreate
(
*
in
,
(
string
)
argv
[
1
],
(
string
)
argv
[
2
],
0
,
mu_fallback_none
);
cvt
.
O
pen
();
cvt
.
i
convCreate
(
*
in
,
(
string
)
argv
[
1
],
(
string
)
argv
[
2
],
0
,
mu_fallback_none
);
cvt
.
o
pen
();
delete
in
;
StdioStream
out
(
stdout
,
0
);
out
.
O
pen
();
out
.
o
pen
();
do
{
cvt
.
R
ead
(
buffer
,
sizeof
(
buffer
),
total
);
out
.
SequentialWrite
(
buffer
,
cvt
.
G
etReadn
());
total
+=
cvt
.
G
etReadn
();
}
while
(
cvt
.
G
etReadn
());
cvt
.
r
ead
(
buffer
,
sizeof
(
buffer
),
total
);
out
.
sequentialWrite
(
buffer
,
cvt
.
g
etReadn
());
total
+=
cvt
.
g
etReadn
();
}
while
(
cvt
.
g
etReadn
());
out
.
F
lush
();
out
.
f
lush
();
delete
in
;
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
exit
(
1
);
}
...
...
examples/cpp/listop.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
#include <iostream>
...
...
@@ -37,9 +38,9 @@ print (List& lst)
{
Iterator
itr
(
lst
);
for
(
itr
.
First
();
!
itr
.
I
sDone
();
itr
++
)
for
(
itr
.
first
();
!
itr
.
i
sDone
();
itr
++
)
{
char
*
text
=
(
char
*
)
itr
.
C
urrent
();
char
*
text
=
(
char
*
)
itr
.
c
urrent
();
cout
<<
text
<<
endl
;
}
}
...
...
@@ -52,7 +53,7 @@ next (Iterator* itr, char *arg)
if
(
skip
==
0
)
cout
<<
"next arg?"
<<
endl
;
while
(
skip
--
)
itr
->
N
ext
();
itr
->
n
ext
();
}
void
...
...
@@ -68,10 +69,10 @@ del (List& lst, int argc, char **argv)
while
(
--
argc
)
{
try
{
lst
.
R
emove
(
strdup
(
*++
argv
));
lst
.
r
emove
(
strdup
(
*++
argv
));
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
}
}
...
...
@@ -90,10 +91,10 @@ add (List& lst, int argc, char **argv)
while
(
--
argc
)
{
try
{
lst
.
A
ppend
(
strdup
(
*++
argv
));
lst
.
a
ppend
(
strdup
(
*++
argv
));
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
}
}
...
...
@@ -111,10 +112,10 @@ prep (List& lst, int argc, char **argv)
while
(
--
argc
)
{
try
{
lst
.
P
repend
(
strdup
(
*++
argv
));
lst
.
p
repend
(
strdup
(
*++
argv
));
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
}
}
...
...
@@ -130,10 +131,10 @@ repl (List& lst, int argc, char **argv)
}
try
{
lst
.
R
eplace
(
argv
[
1
],
strdup
(
argv
[
2
]));
lst
.
r
eplace
(
argv
[
1
],
strdup
(
argv
[
2
]));
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
}
...
...
@@ -168,23 +169,23 @@ find (Iterator* itr, char* arg)
return
;
}
itr
->
C
urrent
((
void
**
)
&
text
);
for
(
itr
->
First
();
!
itr
->
IsDone
();
itr
->
N
ext
())
itr
->
c
urrent
((
void
**
)
&
text
);
for
(
itr
->
first
();
!
itr
->
isDone
();
itr
->
n
ext
())
{
char
*
item
;
itr
->
C
urrent
((
void
**
)
&
item
);
itr
->
c
urrent
((
void
**
)
&
item
);
if
(
!
strcmp
(
arg
,
item
))
return
;
}
cerr
<<
arg
<<
" not in list"
<<
endl
;
for
(
itr
->
First
();
!
itr
->
IsDone
();
itr
->
N
ext
())
for
(
itr
->
first
();
!
itr
->
isDone
();
itr
->
n
ext
())
{
char
*
item
;
itr
->
C
urrent
((
void
**
)
&
item
);
itr
->
c
urrent
((
void
**
)
&
item
);
if
(
!
strcmp
(
text
,
item
))
return
;
}
...
...
@@ -217,7 +218,7 @@ shell (List& lst)
for
(
num
=
0
;
num
<
NITR
;
num
++
)
{
itr
[
num
]
=
new
Iterator
(
lst
);
itr
[
num
]
->
F
irst
();
itr
[
num
]
->
f
irst
();
}
num
=
0
;
...
...
@@ -229,26 +230,26 @@ shell (List& lst)
char
**
argv
;
try
{
itr
[
num
]
->
C
urrent
((
void
**
)
&
text
);
itr
[
num
]
->
c
urrent
((
void
**
)
&
text
);
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
cout
<<
num
<<
":("
<<
(
text
?
text
:
"NULL"
)
<<
")> "
;
if
(
cin
.
getline
(
buf
,
sizeof
(
buf
)).
eof
())
return
;
rc
=
argcv_get
(
buf
,
""
,
"#"
,
&
argc
,
&
argv
);
rc
=
mu_
argcv_get
(
buf
,
""
,
"#"
,
&
argc
,
&
argv
);
if
(
rc
)
cerr
<<
"argcv_get: "
<<
rc
<<
endl
;
cerr
<<
"
mu_
argcv_get: "
<<
rc
<<
endl
;
if
(
argc
>
0
)
{
if
(
!
strcmp
(
argv
[
0
],
"next"
))
next
(
itr
[
num
],
argv
[
1
]);
else
if
(
!
strcmp
(
argv
[
0
],
"first"
))
itr
[
num
]
->
F
irst
();
itr
[
num
]
->
f
irst
();
else
if
(
!
strcmp
(
argv
[
0
],
"del"
))
del
(
lst
,
argc
,
argv
);
else
if
(
!
strcmp
(
argv
[
0
],
"add"
))
...
...
@@ -279,7 +280,7 @@ shell (List& lst)
text
=
(
char
*
)
lst
[
n
];
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
// else
...
...
@@ -289,7 +290,7 @@ shell (List& lst)
else
cerr
<<
"?"
<<
endl
;
}
argcv_free
(
argc
,
argv
);
mu_
argcv_free
(
argc
,
argv
);
}
}
...
...
@@ -319,17 +320,17 @@ main (int argc, char **argv)
try
{
List
lst
;
lst
.
S
etComparator
(
string_comp
);
lst
.
s
etComparator
(
string_comp
);
while
(
argc
--
)
{
lst
.
A
ppend
(
*
argv
++
);
lst
.
a
ppend
(
*
argv
++
);
}
shell
(
lst
);
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
return
0
;
...
...
examples/cpp/mailcap.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
#include <iostream>
...
...
@@ -31,7 +32,7 @@ main (int argc, char **argv)
try
{
FileStream
stream
((
std
::
string
)
file
,
MU_STREAM_READ
);
stream
.
O
pen
();
stream
.
o
pen
();
Mailcap
mailcap
(
stream
);
...
...
@@ -39,7 +40,7 @@ main (int argc, char **argv)
size_t
count
=
0
;
string
buffer
;
count
=
mailcap
.
G
etCount
();
count
=
mailcap
.
g
etCount
();
for
(
i
=
1
;
i
<=
count
;
i
++
)
{
size_t
j
;
...
...
@@ -47,26 +48,26 @@ main (int argc, char **argv)
cout
<<
"entry["
<<
i
<<
"]
\n
"
;
MailcapEntry
entry
=
mailcap
.
G
etEntry
(
i
);
MailcapEntry
entry
=
mailcap
.
g
etEntry
(
i
);
/* typefield. */
buffer
=
entry
.
G
etTypeField
();
buffer
=
entry
.
g
etTypeField
();
cout
<<
"
\t
typefield: "
<<
buffer
<<
endl
;
/* view-command. */
buffer
=
entry
.
G
etViewCommand
();
buffer
=
entry
.
g
etViewCommand
();
cout
<<
"
\t
view-command: "
<<
buffer
<<
endl
;
/* fields. */
fields_count
=
entry
.
F
ieldsCount
();
fields_count
=
entry
.
f
ieldsCount
();
for
(
j
=
1
;
j
<=
fields_count
;
j
++
)
{
try
{
buffer
=
entry
.
G
etField
(
j
);
buffer
=
entry
.
g
etField
(
j
);
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
M
ethod
()
<<
": cannot retrieve field "
<<
j
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
m
ethod
()
<<
": cannot retrieve field "
<<
j
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
}
cout
<<
"
\t
fields["
<<
j
<<
"]: "
<<
buffer
<<
endl
;
}
...
...
@@ -75,7 +76,7 @@ main (int argc, char **argv)
}
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
exit
(
1
);
}
...
...
examples/cpp/murun.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
#include <iostream>
...
...
@@ -31,11 +32,11 @@ read_and_print (Stream *in, Stream& out)
{
char
buffer
[
128
];
in
->
S
equentialReadLine
(
buffer
,
sizeof
(
buffer
));
while
(
in
->
G
etReadn
())
in
->
s
equentialReadLine
(
buffer
,
sizeof
(
buffer
));
while
(
in
->
g
etReadn
())
{
out
.
SequentialWrite
(
buffer
,
in
->
G
etReadn
());
in
->
S
equentialReadLine
(
buffer
,
sizeof
(
buffer
));
out
.
sequentialWrite
(
buffer
,
in
->
g
etReadn
());
in
->
s
equentialReadLine
(
buffer
,
sizeof
(
buffer
));
}
}
...
...
@@ -46,21 +47,21 @@ createFilter (bool read_stdin, char *cmdline, int flags)
if
(
read_stdin
)
{
StdioStream
*
in
=
new
StdioStream
(
stdin
,
0
);
in
->
O
pen
();
in
->
o
pen
();
FilterProgStream
*
stream
=
new
FilterProgStream
(
cmdline
,
in
);
stream
->
O
pen
();
stream
->
o
pen
();
return
stream
;
}
else
{
ProgStream
*
stream
=
new
ProgStream
(
cmdline
,
flags
);
stream
->
O
pen
();
stream
->
o
pen
();
return
stream
;
}
}
catch
(
Exception
&
e
)
{
cerr
<<
progname
<<
": cannot create program filter stream: "
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
exit
(
1
);
}
}
...
...
@@ -89,20 +90,20 @@ main (int argc, char *argv[])
exit
(
1
);
}
argcv_string
(
argc
-
i
,
&
argv
[
i
],
&
cmdline
);
mu_
argcv_string
(
argc
-
i
,
&
argv
[
i
],
&
cmdline
);
stream
=
createFilter
(
read_stdin
,
cmdline
,
flags
);
try
{
StdioStream
out
(
stdout
,
0
);
out
.
O
pen
();
out
.
o
pen
();
read_and_print
(
stream
,
out
);
delete
stream
;
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
exit
(
1
);
}
...
...
examples/cpp/sfrom.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
#include <iostream>
...
...
@@ -33,7 +34,7 @@ int main (int argc, char* argv[])
if
(
argc
==
1
)
exit
(
0
);
mu_register_local_mbox_formats
();
mu_register_local_mbox_formats
();
Message
msg
;
Header
hdr
;
...
...
@@ -42,22 +43,22 @@ int main (int argc, char* argv[])
MailboxDefault
mbox
(
argv
[
1
]);
mbox
.
O
pen
(
MU_STREAM_READ
);
total
=
mbox
.
M
essagesCount
();
mbox
.
o
pen
(
MU_STREAM_READ
);
total
=
mbox
.
m
essagesCount
();
cout
<<
"Total: "
<<
total
<<
endl
;
for
(
int
msgno
=
1
;
msgno
<=
total
;
msgno
++
)
{
msg
=
mbox
[
msgno
];
hdr
=
msg
.
G
etHeader
();
hdr
=
msg
.
g
etHeader
();
cout
<<
hdr
[
MU_HEADER_FROM
]
<<
" "
<<
hdr
[
MU_HEADER_SUBJECT
]
<<
endl
;
}
mbox
.
C
lose
();
mbox
.
c
lose
();
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
exit
(
1
);
}
...
...
examples/cpp/url-parse.cc
View file @
5845b9a
/*
GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -14,7 +14,8 @@
You should have received a copy of the GNU General Public License
along with GNU Mailutils; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
*/
#include <iostream>
...
...
@@ -39,19 +40,19 @@ main ()
try
{
Url
url
(
str
);
url
.
P
arse
();
cout
<<
"
\t
scheme <"
<<
url
.
G
etScheme
()
<<
">"
<<
endl
;
cout
<<
"
\t
user <"
<<
url
.
G
etUser
()
<<
">"
<<
endl
;
cout
<<
"
\t
passwd <"
<<
url
.
G
etPasswd
()
<<
">"
<<
endl
;
cout
<<
"
\t
auth <"
<<
url
.
G
etAuth
()
<<
">"
<<
endl
;
cout
<<
"
\t
host <"
<<
url
.
G
etHost
()
<<
">"
<<
endl
;
cout
<<
"
\t
port "
<<
url
.
G
etPort
()
<<
endl
;
cout
<<
"
\t
path <"
<<
url
.
G
etPath
()
<<
">"
<<
endl
;
cout
<<
"
\t
query <"
<<
url
.
G
etQuery
()
<<
">"
<<
endl
;
url
.
p
arse
();
cout
<<
"
\t
scheme <"
<<
url
.
g
etScheme
()
<<
">"
<<
endl
;
cout
<<
"
\t
user <"
<<
url
.
g
etUser
()
<<
">"
<<
endl
;
cout
<<
"
\t
passwd <"
<<
url
.
g
etPasswd
()
<<
">"
<<
endl
;
cout
<<
"
\t
auth <"
<<
url
.
g
etAuth
()
<<
">"
<<
endl
;
cout
<<
"
\t
host <"
<<
url
.
g
etHost
()
<<
">"
<<
endl
;
cout
<<
"
\t
port "
<<
url
.
g
etPort
()
<<
endl
;
cout
<<
"
\t
path <"
<<
url
.
g
etPath
()
<<
">"
<<
endl
;
cout
<<
"
\t
query <"
<<
url
.
g
etQuery
()
<<
">"
<<
endl
;
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
Method
()
<<
": "
<<
e
.
M
sgError
()
<<
endl
;
cerr
<<
e
.
method
()
<<
": "
<<
e
.
m
sgError
()
<<
endl
;
goto
again
;
}
}
...
...
Please
register
or
sign in
to post a comment