Back to index

avfs  1.0.1
filebuf.h
Go to the documentation of this file.
00001 /*
00002     AVFS: A Virtual File System Library
00003     Copyright (C) 1998-2001  Miklos Szeredi <miklos@szeredi.hu>
00004 
00005     This program can be distributed under the terms of the GNU GPL.
00006     See the file COPYING.
00007 */
00008 
00009 #include "avfs.h"
00010 
00011 #define FILEBUF_NONBLOCK (1 << 0)
00012 #define FILEBUF_WRITE    (1 << 1)
00013 
00014 struct filebuf;
00015 
00016 struct filebuf *av_filebuf_new(int fd, int flags);
00017 int av_filebuf_eof(struct filebuf *fb);
00018 int av_filebuf_check(struct filebuf *fbs[], unsigned int numfbs,
00019                      long timeoutms);
00020 
00021 int av_filebuf_readline(struct filebuf *fb, char **linep);
00022 int av_filebuf_getline(struct filebuf *fb, char **linep, long timeoutms);
00023 avssize_t av_filebuf_read(struct filebuf *fb, char *buf, avsize_t nbytes);
00024 avssize_t av_filebuf_write(struct filebuf *fb, const char *buf,
00025                            avsize_t nbytes);
00026 
00027 
00028 /* av_filebuf_getline() will return:
00029    1 and *linep != NULL  -- success
00030    1 and *linep == NULL  -- eof
00031    0                     -- timeout
00032    < 0                   -- read error
00033 */