File: filebuf.h

package info (click to toggle)
avfs 1.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,916 kB
  • sloc: ansic: 31,364; sh: 6,482; perl: 1,916; makefile: 351
file content (33 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
    AVFS: A Virtual File System Library
    Copyright (C) 1998-2001  Miklos Szeredi <miklos@szeredi.hu>

    This program can be distributed under the terms of the GNU GPL.
    See the file COPYING.
*/

#include "avfs.h"

#define FILEBUF_NONBLOCK (1 << 0)
#define FILEBUF_WRITE    (1 << 1)

struct filebuf;

struct filebuf *av_filebuf_new(int fd, int flags);
int av_filebuf_eof(struct filebuf *fb);
int av_filebuf_check(struct filebuf *fbs[], unsigned int numfbs,
                     long timeoutms);

int av_filebuf_readline(struct filebuf *fb, char **linep);
int av_filebuf_getline(struct filebuf *fb, char **linep, long timeoutms);
avssize_t av_filebuf_read(struct filebuf *fb, char *buf, avsize_t nbytes);
avssize_t av_filebuf_write(struct filebuf *fb, const char *buf,
                           avsize_t nbytes);


/* av_filebuf_getline() will return:
   1 and *linep != NULL  -- success
   1 and *linep == NULL  -- eof
   0                     -- timeout
   < 0                   -- read error
*/