Commit 34c83516 authored by Niels Möller's avatar Niels Möller
Browse files

* src/io.c (io_read_file): New function.

Rev: src/io.c:1.82
Rev: src/io.h:1.51
parent 14047d99
......@@ -1252,3 +1252,15 @@ io_write_file(struct io_backend *backend,
return io_write(make_io_fd(backend, fd, e), block_size, c);
}
struct io_fd *
io_read_file(struct io_backend *backend,
const char *fname,
struct exception_handler *e)
{
int fd = open(fname, O_RDONLY);
if (fd < 0)
return NULL;
return make_io_fd(backend, fd, e);
}
......@@ -371,4 +371,9 @@ struct io_fd *io_write_file(struct io_backend *backend,
struct close_callback *c,
struct exception_handler *e);
struct io_fd *
io_read_file(struct io_backend *backend,
const char *fname,
struct exception_handler *e);
#endif /* LSH_IO_H_INCLUDED */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment