mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Include current buffered offset in file-position for output ports.
Fixes issue #273.
This commit is contained in:
parent
64f3e0fc56
commit
8ea51a77ce
1 changed files with 2 additions and 0 deletions
|
@ -417,6 +417,8 @@ sexp sexp_seek (sexp ctx, sexp self, sexp x, off_t offset, int whence) {
|
||||||
res = lseek(sexp_fileno_fd(sexp_port_fd(x)), offset, whence);
|
res = lseek(sexp_fileno_fd(sexp_port_fd(x)), offset, whence);
|
||||||
if (res >= 0 && !(whence == SEEK_CUR && offset == 0))
|
if (res >= 0 && !(whence == SEEK_CUR && offset == 0))
|
||||||
sexp_port_offset(x) = 0;
|
sexp_port_offset(x) = 0;
|
||||||
|
else if (sexp_oportp(x))
|
||||||
|
res += sexp_port_offset(x);
|
||||||
return sexp_make_integer(ctx, res);
|
return sexp_make_integer(ctx, res);
|
||||||
}
|
}
|
||||||
if (sexp_stream_portp(x))
|
if (sexp_stream_portp(x))
|
||||||
|
|
Loading…
Add table
Reference in a new issue