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
b7a718c6
...
b7a718c62dbe461728a7c4d758ca3ceb0fa4c260
authored
2001-09-27 04:05:45 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
More update but still not functional.
1 parent
66dc09fd
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
118 additions
and
112 deletions
mailbox2/dotlock.c
mailbox2/fstream.c
mailbox2/include/mailutils/mbox.h
mailbox2/include/mailutils/sys/mbox.h
mailbox2/lockfile.c
mailbox2/mbox/Makefile.am
mailbox2/mbox/mbox_append.c
mailbox2/mbox/mbox_attribute.c
mailbox2/mbox/mbox_blines.c
mailbox2/mbox/mbox_bsize.c
mailbox2/mbox/mbox_expunge.c
mailbox2/mbox/mbox_hcache.c
mailbox2/mbox/mbox_hlines.c
mailbox2/mbox/mbox_hsize.c
mailbox2/mbox/mbox_scan.c
mailbox2/mbox/mbox_separator.c
mailbox2/mbox/mbox_stream.c
mailbox2/dotlock.c
View file @
b7a718c
...
...
@@ -221,7 +221,7 @@ _lockfile_dotlock_ctor (struct _lockfile_dotlock *dotlock,
const
char
*
filename
)
{
mu_refcount_create
(
&
dotlock
->
refcount
);
if
(
dotlock
->
refcount
)
if
(
dotlock
->
refcount
==
NULL
)
return
MU_ERROR_NO_MEMORY
;
dotlock
->
fname
=
calloc
(
strlen
(
filename
)
+
5
/*strlen(".lock")*/
+
1
,
1
);
...
...
mailbox2/fstream.c
View file @
b7a718c
...
...
@@ -284,9 +284,7 @@ _stream_stdio_open (stream_t stream, const char *filename, int port, int flags)
}
/* Map the flags to the system equivalent. */
if
(
flags
&
MU_STREAM_WRITE
&&
flags
&
MU_STREAM_READ
)
return
EINVAL
;
else
if
(
flags
&
MU_STREAM_WRITE
)
if
((
flags
&
MU_STREAM_WRITE
)
&&
!
(
flags
&
MU_STREAM_READ
))
flg
=
O_WRONLY
;
else
if
(
flags
&
MU_STREAM_RDWR
)
flg
=
O_RDWR
;
...
...
mailbox2/include/mailutils/mbox.h
View file @
b7a718c
...
...
@@ -65,10 +65,8 @@ extern int mbox_get_blines __P ((mbox_t, unsigned int, unsigned int *));
extern
int
mbox_get_size
__P
((
mbox_t
,
off_t
*
));
extern
int
mbox_save_attributes
__P
((
mbox_t
));
extern
int
mbox_mark_deleted
__P
((
mbox_t
,
unsigned
int
));
extern
int
mbox_unmark_deleted
__P
((
mbox_t
,
unsigned
int
));
extern
int
mbox_expunge
__P
((
mbox_t
,
int
));
extern
int
mbox_
changed_on_disk
__P
((
mbox_t
));
extern
int
mbox_
has_newmail
__P
((
mbox_t
));
extern
int
mbox_set_progress_cb
__P
((
mbox_t
,
int
(
*
)
__P
((
int
,
void
*
)),
void
*
));
...
...
mailbox2/include/mailutils/sys/mbox.h
View file @
b7a718c
...
...
@@ -89,7 +89,6 @@ struct _mbox_message
{
stream_t
stream
;
unsigned
int
lines
;
unsigned
int
size
;
off_t
start
;
off_t
end
;
}
header
,
body
;
...
...
mailbox2/lockfile.c
View file @
b7a718c
...
...
@@ -57,16 +57,16 @@ int
lockfile_touchlock
(
lockfile_t
lockfile
)
{
if
(
lockfile
==
NULL
||
lockfile
->
vtable
==
NULL
||
lockfile
->
vtable
->
lock
==
NULL
)
||
lockfile
->
vtable
->
touch
lock
==
NULL
)
return
MU_ERROR_NOT_SUPPORTED
;
return
lockfile
->
vtable
->
lock
(
lockfile
);
return
lockfile
->
vtable
->
touch
lock
(
lockfile
);
}
int
lockfile_unlock
(
lockfile_t
lockfile
)
{
if
(
lockfile
==
NULL
||
lockfile
->
vtable
==
NULL
||
lockfile
->
vtable
->
lock
==
NULL
)
||
lockfile
->
vtable
->
un
lock
==
NULL
)
return
MU_ERROR_NOT_SUPPORTED
;
return
lockfile
->
vtable
->
lock
(
lockfile
);
return
lockfile
->
vtable
->
un
lock
(
lockfile
);
}
...
...
mailbox2/mbox/Makefile.am
View file @
b7a718c
...
...
@@ -16,7 +16,7 @@ libmbox_la_SOURCES = \
mbox_bstream.c
\
mbox_carrier.c
\
mbox_cb.c
\
mbox_
changed
.c
\
mbox_
newmail
.c
\
mbox_close.c
\
mbox_create.c
\
mbox_destroy.c
\
...
...
mailbox2/mbox/mbox_append.c
View file @
b7a718c
...
...
@@ -80,11 +80,11 @@
(buf[4] == ' ' || buf[4] == '\t'))
/* Save the uidvalidity:
+ if it is an empty mbox in the first message append
+ if for the first message the uidvalidity is not the same
from the mbox->uidvalidity.
+ if it is the first message append
and save_uidvalidity is set.
- strip X-IMAPBASE, X-UID, Content-Length and Status.
- strip X-IMAPBASE, X-UID
- add X-UID base on mbox->uidnext.
- mangle any leading "From " in the body to ">From "
...
...
@@ -100,6 +100,8 @@ mbox_append_separator (mbox_t mbox, const char *sep)
{
char
separator
[
256
];
size_t
len
;
const
char
nl
=
'\n'
;
int
status
=
0
;
if
(
sep
==
NULL
)
{
...
...
@@ -121,7 +123,14 @@ mbox_append_separator (mbox_t mbox, const char *sep)
len
=
strlen
(
sep
);
/* Write the separator. */
return
stream_write
(
mbox
->
carrier
,
sep
,
len
,
NULL
);
status
=
stream_write
(
mbox
->
carrier
,
sep
,
len
,
NULL
);
if
(
status
!=
0
)
return
status
;
/* Add the trailing newline. */
if
(
len
&&
sep
[
len
-
1
]
!=
'\n'
)
status
=
stream_write
(
mbox
->
carrier
,
&
nl
,
1
,
NULL
);
return
status
;
}
/* Assuming that the file is lock. */
...
...
@@ -329,6 +338,7 @@ mbox_append_hb0 (mbox_t mbox, const char *sep, attribute_t attribute,
}
else
{
stream_flush
(
mbox
->
carrier
);
lockfile_unlock
(
mbox
->
lockfile
);
mbox
->
uidnext
++
;
}
...
...
mailbox2/mbox/mbox_attribute.c
View file @
b7a718c
...
...
@@ -146,19 +146,6 @@ attribute_mbox_create (attribute_t *pattribute, mbox_t mbox,
{
struct
_attribute_mbox
*
ma
;
int
status
;
attribute_t
attribute
;
char
buf
[
128
];
/* Get the attribute from the status field. */
*
buf
=
'\0'
;
status
=
mbox_header_get_value
(
mbox
,
msgno
,
"Status"
,
buf
,
sizeof
buf
,
0
);
if
(
status
!=
0
)
return
status
;
status
=
attribute_status_create
(
&
attribute
,
buf
);
if
(
status
!=
0
)
return
status
;
attribute_get_flags
(
attribute
,
&
mbox
->
umessages
[
msgno
-
1
]
->
attr_flags
);
attribute_destroy
(
&
attribute
);
ma
=
calloc
(
1
,
sizeof
*
ma
);
if
(
ma
==
NULL
)
...
...
mailbox2/mbox/mbox_blines.c
View file @
b7a718c
...
...
@@ -30,7 +30,7 @@ mbox_get_blines (mbox_t mbox, unsigned int msgno, unsigned int *plines)
if
(
mbox
&&
msgno
)
{
msgno
--
;
if
(
msgno
>=
mbox
->
messages_count
)
if
(
msgno
<
mbox
->
messages_count
)
lines
=
mbox
->
umessages
[
msgno
]
->
body
.
lines
;
}
if
(
plines
)
...
...
mailbox2/mbox/mbox_bsize.c
View file @
b7a718c
...
...
@@ -30,8 +30,9 @@ mbox_get_bsize (mbox_t mbox, unsigned int msgno, unsigned int *psize)
if
(
mbox
&&
msgno
)
{
msgno
--
;
if
(
msgno
>=
mbox
->
messages_count
)
size
=
mbox
->
umessages
[
msgno
]
->
body
.
size
;
if
(
msgno
<
mbox
->
messages_count
)
size
=
mbox
->
umessages
[
msgno
]
->
body
.
end
-
mbox
->
umessages
[
msgno
]
->
body
.
start
;
}
if
(
psize
)
*
psize
=
size
;
...
...
mailbox2/mbox/mbox_expunge.c
View file @
b7a718c
...
...
@@ -125,6 +125,7 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
int
tmp_fd
;
char
*
tmp_name
=
NULL
;
mbox_t
tmp_mbox
=
NULL
;
off_t
tmp_size
=
0
;
size_t
save_uidvalidity
=
0
;
/* uidvalidity is save in the first message. */
if
(
mbox
==
NULL
)
...
...
@@ -196,18 +197,6 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
return
status
;
}
/* _Must_ have and updated view of the size of the mailbox. */
status
=
mbox_changed_on_disk
(
mbox
);
if
(
status
!=
0
)
{
mbox_close
(
tmp_mbox
);
mbox_destroy
(
&
tmp_mbox
);
remove
(
tmp_name
);
free
(
tmp_name
);
/* mu_error ("Failed to grab the lock\n"); */
return
status
;
}
/* Critical section, can not allowed signal here. */
sigemptyset
(
&
signalset
);
sigaddset
(
&
signalset
,
SIGTERM
);
...
...
@@ -250,7 +239,8 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
{
if
(
mbox_get_hstream
(
mbox
,
i
+
1
,
&
hstream
)
!=
0
||
mbox_get_bstream
(
mbox
,
i
+
1
,
&
bstream
)
!=
0
||
mbox_get_separator
(
mbox
,
i
+
1
,
&
sep
)
!=
0
)
||
mbox_get_separator
(
mbox
,
i
+
1
,
&
sep
)
!=
0
||
mbox_get_attribute
(
mbox
,
i
+
1
,
&
attribute
)
!=
0
)
{
/* mu_error ("Error expunge:%d", __LINE__); */
goto
bailout0
;
...
...
@@ -275,6 +265,13 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
}
}
/* for (;;) */
/* Get the real size of the mailbox. The size maintain in
the struct _mailbox { off_t size; } the one return in
mailbox_get_size() only return the size that mbox_scan()
is aware of not necessary the size of the file after
an append. */
stream_get_size
(
tmp_mbox
->
carrier
,
&
tmp_size
);
/* Caution: before ftruncate()ing the file see
- if we've receive new mails. Some programs may not respect the lock,
- or the lock was held for too long.
...
...
@@ -289,11 +286,11 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
if
(
len
>
0
)
{
stream_seek
(
mbox
->
carrier
,
mbox
->
size
,
MU_STREAM_WHENCE_SET
);
stream_seek
(
tmp_mbox
->
carrier
,
tmp_
mbox
->
size
,
MU_STREAM_WHENCE_SET
);
stream_seek
(
tmp_mbox
->
carrier
,
tmp_size
,
MU_STREAM_WHENCE_SET
);
while
((
status
=
stream_read
(
mbox
->
carrier
,
buffer
,
sizeof
buffer
,
&
n
))
==
0
&&
n
>
0
)
{
status
=
stream_write
(
tmp_mbox
->
carrier
,
buffer
,
n
,
&
n
);
status
=
stream_write
(
tmp_mbox
->
carrier
,
buffer
,
n
,
NULL
);
if
(
status
!=
0
)
{
/* mu_error ("Error expunge:%d: %s", __LINE__,
...
...
@@ -313,7 +310,7 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
}
/* End of precaution. */
/* Seek and rewrite it. */
if
(
t
otal
>
0
)
if
(
t
mp_size
>
0
)
{
char
buffer
[
1024
];
size_t
n
=
0
;
...
...
@@ -334,8 +331,9 @@ mbox_expunge (mbox_t mbox, int remove_deleted)
}
/* Flush/truncation. Need to flush before truncate. */
stream_get_size
(
tmp_mbox
->
carrier
,
&
tmp_size
);
stream_flush
(
mbox
->
carrier
);
status
=
stream_truncate
(
mbox
->
carrier
,
tmp_
mbox
->
size
+
marker
);
status
=
stream_truncate
(
mbox
->
carrier
,
tmp_size
+
marker
);
if
(
status
!=
0
)
{
/* mu_error ("Error expunging:%d: %s\n", __LINE__,
...
...
mailbox2/mbox/mbox_hcache.c
View file @
b7a718c
...
...
@@ -129,6 +129,7 @@ mbox_hcache_append (mbox_t mbox, unsigned int msgno, const char *name,
if
(
hc
->
values
==
NULL
)
return
MU_ERROR_NO_MEMORY
;
}
hc
->
size
=
mbox
->
hcache
.
size
;
for
(
i
=
0
;
i
<
mbox
->
hcache
.
size
;
i
++
)
{
...
...
@@ -150,8 +151,8 @@ mbox_hcache_append (mbox_t mbox, unsigned int msgno, const char *name,
strlen
(
hc
->
values
[
i
])
+
1
);
if
(
tmp
)
{
strcat
(
hc
->
values
[
i
],
value
);
hc
->
values
[
i
]
=
tmp
;
strcat
(
hc
->
values
[
i
],
value
);
}
}
}
...
...
mailbox2/mbox/mbox_hlines.c
View file @
b7a718c
...
...
@@ -30,7 +30,7 @@ mbox_get_hlines (mbox_t mbox, unsigned int msgno, unsigned int *plines)
if
(
mbox
&&
msgno
)
{
msgno
--
;
if
(
msgno
>=
mbox
->
messages_count
)
if
(
msgno
<
mbox
->
messages_count
)
lines
=
mbox
->
umessages
[
msgno
]
->
header
.
lines
;
}
if
(
plines
)
...
...
mailbox2/mbox/mbox_hsize.c
View file @
b7a718c
...
...
@@ -30,8 +30,9 @@ mbox_get_hsize (mbox_t mbox, unsigned int msgno, unsigned int *psize)
if
(
mbox
&&
msgno
)
{
msgno
--
;
if
(
msgno
>=
mbox
->
messages_count
)
size
=
mbox
->
umessages
[
msgno
]
->
header
.
size
;
if
(
msgno
<
mbox
->
messages_count
)
size
=
mbox
->
umessages
[
msgno
]
->
header
.
end
-
mbox
->
umessages
[
msgno
]
->
header
.
start
;
}
if
(
psize
)
*
psize
=
size
;
...
...
mailbox2/mbox/mbox_scan.c
View file @
b7a718c
...
...
@@ -61,6 +61,39 @@
static
int
mbox_parse_status
(
mbox_message_t
mum
,
char
*
buf
,
size_t
n
)
{
char
*
s
=
memchr
(
buf
,
':'
,
n
);
if
(
s
)
{
s
++
;
for
(;
*
s
;
s
++
)
{
switch
(
*
s
)
{
case
'r'
:
case
'R'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_READ
;
break
;
case
'O'
:
case
'o'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_SEEN
;
break
;
case
'a'
:
case
'A'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_ANSWERED
;
break
;
case
'd'
:
case
'D'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_DELETED
;
break
;
}
}
}
return
0
;
}
static
int
mbox_alloc_umessages
(
mbox_t
mbox
)
{
mbox_message_t
mum
;
...
...
@@ -82,34 +115,11 @@ mbox_alloc_umessages (mbox_t mbox)
return
MU_ERROR_NO_MEMORY
;
}
}
if
(
mbox
->
messages_count
)
msgno
=
mbox
->
messages_count
-
1
;
mum
=
mbox
->
umessages
[
msgno
];
mum
->
from_
=
0
;
if
(
mum
->
separator
)
free
(
mum
->
separator
);
mum
->
separator
=
0
;
mbox_hcache_free
(
mbox
,
msgno
+
1
);
if
(
mum
->
header
.
stream
)
stream_destroy
(
&
mum
->
header
.
stream
);
mum
->
header
.
lines
=
0
;
mum
->
header
.
size
=
0
;
mum
->
header
.
start
=
0
;
mum
->
header
.
end
=
0
;
if
(
mum
->
body
.
stream
)
stream_destroy
(
&
mum
->
body
.
stream
);
mum
->
body
.
lines
=
0
;
mum
->
body
.
size
=
0
;
mum
->
body
.
start
=
0
;
mum
->
body
.
end
=
0
;
mum
->
uid
=
0
;
mum
->
attr_flags
=
0
;
if
(
mum
->
attribute
)
attribute_destroy
(
&
mum
->
attribute
);
return
0
;
}
...
...
@@ -138,6 +148,9 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
int
zn
,
isfrom
=
0
;
char
*
temp
;
if
(
mbox
==
NULL
)
return
MU_ERROR_INVALID_PARAMETER
;
/* Save the timestamp. */
status
=
stream_get_fd
(
mbox
->
carrier
,
&
fd
);
if
(
status
==
0
)
...
...
@@ -155,6 +168,10 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
status
=
MU_ERROR_IO
;
}
/* Move along, move along nothing to see. */
if
(
!
mbox_has_newmail
(
mbox
)
&&
mbox
->
size
==
file_size
)
return
0
;
/* Bailout early on error. */
if
(
status
!=
0
)
return
status
;
...
...
@@ -180,6 +197,7 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
newline
=
1
;
errno
=
lines
=
inheader
=
inbody
=
0
;
mum
=
NULL
;
status
=
stream_seek
(
mbox
->
carrier
,
total
,
MU_STREAM_WHENCE_SET
);
if
(
status
!=
0
)
...
...
@@ -189,7 +207,7 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
}
while
((
status
=
stream_readline
(
mbox
->
carrier
,
buf
,
sizeof
buf
,
&
n
))
==
0
&&
n
!=
0
)
&&
n
>
0
)
{
int
nl
;
total
+=
n
;
...
...
@@ -213,7 +231,7 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
/* Signal the end of the previous body. */
if
(
mum
&&
!
mum
->
body
.
end
)
{
mum
->
body
.
end
=
total
-
n
-
newline
;
mum
->
body
.
end
=
total
-
n
;
mum
->
body
.
lines
=
--
lines
-
newline
;
/* DISPATCH_ADD_MSG(mbox); */
if
(
do_notif
)
...
...
@@ -244,33 +262,7 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
}
else
if
(
ISSTATUS
(
buf
))
{
char
*
s
=
memchr
(
buf
,
':'
,
n
);
if
(
s
)
{
s
++
;
for
(;
*
s
;
s
++
)
{
switch
(
*
s
)
{
case
'r'
:
case
'R'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_READ
;
break
;
case
'O'
:
case
'o'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_SEEN
;
break
;
case
'a'
:
case
'A'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_ANSWERED
;
break
;
case
'd'
:
case
'D'
:
mum
->
attr_flags
|=
MU_ATTRIBUTE_DELETED
;
break
;
}
}
}
mbox_parse_status
(
mum
,
buf
,
n
);
}
else
if
(
ISX_IMAPBASE
(
buf
))
{
...
...
@@ -293,6 +285,8 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
}
else
if
(
sfield
&&
(
buf
[
0
]
==
' '
||
buf
[
0
]
==
'\t'
))
{
if
(
buf
[
n
-
1
]
==
'\n'
)
buf
[
n
-
1
]
=
0
;
mbox_hcache_append
(
mbox
,
mbox
->
messages_count
,
sfield
,
buf
);
}
else
...
...
@@ -305,6 +299,8 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
{
*
s
=
'\0'
;
s
++
;
if
(
buf
[
n
-
1
]
==
'\n'
)
buf
[
n
-
1
]
=
0
;
mbox_hcache_append
(
mbox
,
mbox
->
messages_count
,
buf
,
s
);
sfield
=
strdup
(
buf
);
}
...
...
@@ -318,6 +314,7 @@ mbox_scan (mbox_t mbox, unsigned int msgno, unsigned int *pcount, int do_notif)
if
(
mum
&&
!
mum
->
body
.
start
)
{
mum
->
body
.
start
=
total
-
n
+
nl
;
mum
->
header
.
end
=
total
-
n
+
nl
;
mum
->
header
.
lines
=
lines
;
lines
=
0
;
}
...
...
mailbox2/mbox/mbox_separator.c
View file @
b7a718c
...
...
@@ -25,6 +25,9 @@
#include <mailutils/error.h>
#include <mailutils/sys/mbox.h>
/* Each message starts with a line that contaings three of four fieds:
"From" SP evelope-sender SP date [SP moreinfo]
*/
int
mbox_get_separator
(
mbox_t
mbox
,
unsigned
int
msgno
,
char
**
psep
)
{
...
...
@@ -65,9 +68,14 @@ mbox_get_separator (mbox_t mbox, unsigned int msgno, char **psep)
}
p
=
s
;
stream_readline
(
mbox
->
carrier
,
p
+
strlen
(
p
),
len
,
&
n
);
}
while
(
n
&&
p
[
n
-
1
]
==
'\n'
);
n
=
strlen
(
p
);
}
while
(
n
&&
p
[
n
-
1
]
!=
'\n'
);
if
(
n
&&
p
[
n
-
1
]
==
'\n'
)
p
[
n
-
1
]
=
'\0'
;
*
psep
=
strdup
(
p
);
mbox
->
umessages
[
msgno
]
->
separator
=
strdup
(
p
);
free
(
p
);
}
return
0
;
...
...
mailbox2/mbox/mbox_stream.c
View file @
b7a718c
...
...
@@ -106,8 +106,12 @@ _stream_mbox_read (stream_t stream, void *buf, size_t buflen, size_t *pnread)
{
size_t
n
=
min
((
size_t
)
ln
,
buflen
);
/* Position the file pointer. */
status
=
stream_seek
(
ms
->
mbox
->
carrier
,
ms
->
offset
,
MU_STREAM_WHENCE_SET
);
if
(
ms
->
is_header
)
status
=
stream_seek
(
ms
->
mbox
->
carrier
,
umessage
->
header
.
start
+
ms
->
offset
,
MU_STREAM_WHENCE_SET
);
else
status
=
stream_seek
(
ms
->
mbox
->
carrier
,
umessage
->
body
.
start
+
ms
->
offset
,
MU_STREAM_WHENCE_SET
);
if
(
status
==
0
)
{
status
=
stream_read
(
ms
->
mbox
->
carrier
,
buf
,
n
,
&
nread
);
...
...
@@ -149,8 +153,12 @@ _stream_mbox_readline (stream_t stream, char *buf, size_t buflen,
{
size_t
n
=
min
((
size_t
)
ln
,
buflen
);
/* Position the stream. */
status
=
stream_seek
(
ms
->
mbox
->
carrier
,
ms
->
offset
,
MU_STREAM_WHENCE_SET
);
if
(
ms
->
is_header
)
status
=
stream_seek
(
ms
->
mbox
->
carrier
,
umessage
->
header
.
start
+
ms
->
offset
,
MU_STREAM_WHENCE_SET
);
else
status
=
stream_seek
(
ms
->
mbox
->
carrier
,
umessage
->
body
.
start
+
ms
->
offset
,
MU_STREAM_WHENCE_SET
);
if
(
status
==
0
)
{
status
=
stream_readline
(
ms
->
mbox
->
carrier
,
buf
,
n
,
&
nread
);
...
...
Please
register
or
sign in
to post a comment