mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-14 08:27:34 +02:00
Making port-fileno support non-stream ports.
This commit is contained in:
parent
a6e71e47b8
commit
a32edf7138
1 changed files with 4 additions and 2 deletions
6
eval.c
6
eval.c
|
@ -1180,9 +1180,11 @@ sexp sexp_set_port_line_op (sexp ctx, sexp self, sexp_sint_t n, sexp port, sexp
|
||||||
|
|
||||||
#ifndef PLAN9
|
#ifndef PLAN9
|
||||||
sexp sexp_get_port_fileno (sexp ctx, sexp self, sexp_sint_t n, sexp port) {
|
sexp sexp_get_port_fileno (sexp ctx, sexp self, sexp_sint_t n, sexp port) {
|
||||||
|
int fd;
|
||||||
sexp_assert_type(ctx, sexp_portp, SEXP_IPORT, port);
|
sexp_assert_type(ctx, sexp_portp, SEXP_IPORT, port);
|
||||||
if (sexp_port_stream(port) && sexp_port_fileno(port) >= 0)
|
fd = sexp_port_fileno(port);
|
||||||
return sexp_make_fixnum(sexp_port_fileno(port));
|
if (fd >= 0)
|
||||||
|
return sexp_make_fixnum(fd);
|
||||||
return SEXP_FALSE;
|
return SEXP_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue