~fta/+junk/mediadb

« back to all changes in this revision

Viewing changes to fio.h

  • Committer: Fabien Tassin
  • Date: 2008-08-14 19:36:43 UTC
  • Revision ID: fta@sofaraway.org-20080814193643-pop12h3olx7azk41
* Initial revision, just the C code leading to identcd. The full PHP mediadb
  is not included, nor are all the data test files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* fio.h: File IO header file */
 
2
/* Copyright (c) 2000-2001 Fabien Tassin <fta@sofaraway.org> */
 
3
 
 
4
#ifndef _FIO_H_
 
5
#define _FIO_H_
 
6
 
 
7
typedef struct _FIO {
 
8
  int   fh;
 
9
  char *buffer;
 
10
  char *start;
 
11
  char *end;
 
12
  int   size;
 
13
  int   status;
 
14
  int   debug;
 
15
} FIO;
 
16
 
 
17
#define FIO_BUFFER  8192
 
18
 
 
19
#define FIO_OK         0
 
20
#define FIO_ERROR      1
 
21
#define FIO_TOOLONG    2
 
22
 
 
23
/* initialize a FIO struct given an already openned file */
 
24
FIO* FIO_init(int fh);
 
25
 
 
26
void FIO_free(FIO *fio);
 
27
 
 
28
/* read a line in the given socket */
 
29
char *FIO_readline(FIO* fio);
 
30
 
 
31
/* write the buffer into the filehandle ('\r\n' added) */
 
32
int FIO_writeline(FIO *fio, char* buf);
 
33
 
 
34
/* write the buffer into the filehandle (no '\r\n' added) */
 
35
int FIO_write(FIO *fio, char* buf);
 
36
 
 
37
#define FIO_error(fio)   ((fio)->status > 0)
 
38
#define FIO_toolong(fio) ((fio)->status == FIO_TOOLONG)
 
39
 
 
40
#endif /* _FIO_H_ */