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
5c470f14
...
5c470f1488e05c87bdaef2936eb74670d49ee5ab
authored
2001-06-25 08:11:39 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Implemented Write. Fixed memory leaks.
1 parent
2400d34e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
25 deletions
mail/write.c
mail/write.c
View file @
5c470f1
...
...
@@ -45,26 +45,25 @@ mail_write (int argc, char **argv)
if
(
isupper
(
argv
[
0
][
0
]))
sender
=
1
;
else
if
(
argc
>=
2
)
filename
=
argv
[
--
argc
]
;
filename
=
strdup
(
argv
[
--
argc
])
;
else
{
filename
=
strdup
(
"mbox"
);
}
num
=
util_expand_msglist
(
argc
,
argv
,
&
msglist
);
if
(
sender
)
{
mailbox_get_message
(
mbox
,
num
>
0
?
msglist
[
0
]
:
cursor
,
0
);
/* get from */
/* filename = login name part */
filename
=
util_get_sender
(
msglist
[
0
],
1
);
if
(
!
filename
)
{
free
(
msglist
);
return
1
;
}
}
output
=
fopen
(
filename
,
"a"
);
if
(
num
>
0
)
{
for
(
i
=
0
;
i
<
num
;
i
++
)
for
(
i
=
0
;
i
<
num
;
i
++
)
{
mailbox_get_message
(
mbox
,
msglist
[
i
],
&
msg
);
message_get_body
(
msg
,
&
bod
);
...
...
@@ -79,22 +78,6 @@ mail_write (int argc, char **argv)
}
/* mark as saved */
}
}
else
{
mailbox_get_message
(
mbox
,
cursor
,
&
msg
);
message_get_body
(
msg
,
&
bod
);
body_get_stream
(
bod
,
&
stream
);
/* should there be a separator? */
while
(
stream_read
(
stream
,
buffer
,
sizeof
(
buffer
)
-
1
,
off
,
&
n
)
==
0
&&
n
!=
0
)
{
buffer
[
n
]
=
'\0'
;
fprintf
(
output
,
"%s"
,
buffer
);
off
+=
n
;
}
/* mark as save */
}
fclose
(
output
);
free
(
msglist
);
...
...
Please
register
or
sign in
to post a comment