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
5ccdea07
...
5ccdea07bf2b7f97d015b8010774c567a22edfc7
authored
2003-02-13 16:31:09 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(stream_seek): New function.
1 parent
100ab145
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
include/mailutils/stream.h
mailbox/stream.c
include/mailutils/stream.h
View file @
5ccdea0
...
...
@@ -139,6 +139,7 @@ extern int stream_sequential_readline __P((stream_t stream,
extern
int
stream_sequential_write
__P
((
stream_t
stream
,
char
*
buf
,
size_t
size
));
extern
int
stream_seek
__P
((
stream_t
stream
,
off_t
off
,
int
whence
));
extern
int
stream_strerror
__P
((
stream_t
stream
,
char
**
p
));
...
...
mailbox/stream.c
View file @
5ccdea0
...
...
@@ -110,6 +110,9 @@ stream_close (stream_t stream)
{
if
(
stream
==
NULL
)
return
EINVAL
;
if
(
stream
->
state
==
MU_STREAM_STATE_CLOSE
)
return
0
;
stream
->
state
=
MU_STREAM_STATE_CLOSE
;
/* Clear the buffer of any residue left. */
if
(
stream
->
rbuffer
.
base
)
...
...
@@ -704,6 +707,41 @@ stream_sequential_write (stream_t stream, char *buf, size_t size)
}
int
stream_seek
(
stream_t
stream
,
off_t
off
,
int
whence
)
{
size_t
size
=
0
;
size_t
pos
;
int
rc
;
if
((
rc
=
stream_size
(
stream
,
&
size
)))
return
rc
;
switch
(
whence
)
{
case
SEEK_SET
:
pos
=
off
;
break
;
case
SEEK_CUR
:
pos
=
off
+
stream
->
offset
;
break
;
case
SEEK_END
:
pos
=
size
+
off
;
break
;
default:
return
EINVAL
;
}
if
(
pos
>
size
)
return
EIO
;
stream
->
offset
=
pos
;
return
0
;
}
int
stream_strerror
(
stream_t
stream
,
char
**
p
)
{
if
(
stream
==
NULL
)
...
...
Please
register
or
sign in
to post a comment