kgio.git  about / heads / tags
kinder, gentler I/O for Ruby
blob 6dbd08365d6dd6c8be77cce2c2b1bac6cc808952 343 bytes (raw)
$ git show HEAD:ext/kgio/my_fileno.h	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
#include <ruby.h>
#include <ruby/io.h>

static int my_fileno(VALUE io)
{
#ifdef HAVE_RB_IO_DESCRIPTOR
	if (TYPE(io) != T_FILE)
		io = rb_io_get_io(io);

	return rb_io_descriptor(io);
#else
	rb_io_t *fptr;
	int fd;

	if (TYPE(io) != T_FILE)
		io = rb_io_get_io(io);
	GetOpenFile(io, fptr);
	rb_io_check_closed(fptr);
	return fptr->fd;
#endif
}

git clone git://yhbt.net/kgio.git
git clone https://yhbt.net/kgio.git