torrent-stats/linebuffer.h

31 lines
838 B
C
Raw Permalink Normal View History

2007-05-15 17:39:34 +02:00
#ifndef _LINEBUFFER_H_
#define _LINEBUFFER_H_
2007-07-14 15:43:35 +02:00
#include <stdarg.h>
2007-05-15 17:39:34 +02:00
struct linebuffer {
2007-06-19 15:20:31 +02:00
unsigned int size;
unsigned int pos;
2007-05-15 17:39:34 +02:00
2007-06-19 15:20:31 +02:00
char *newline;
char *data;
2007-05-15 17:39:34 +02:00
};
struct linebuffer * create_linebuffer(int size);
2007-06-19 15:20:31 +02:00
void linebuffer_free(struct linebuffer *buf);
2007-05-15 17:39:34 +02:00
2007-06-19 15:20:31 +02:00
int linebuffer_clear(struct linebuffer *buf);
2007-05-15 17:39:34 +02:00
2007-06-19 15:20:31 +02:00
int linebuffer_readfd(struct linebuffer *buf, int fd);
int linebuffer_parsefd(struct linebuffer *buf, int fd);
2007-06-19 15:44:57 +02:00
int linebuffer_writefd(struct linebuffer *buf, int fd);
int linebuffer_put(struct linebuffer *buf, const char *src, unsigned int size);
2007-07-14 15:43:35 +02:00
int linebuffer_vprintf(struct linebuffer *buf, const char *fmt, va_list ap);
2007-06-19 15:20:31 +02:00
int linebuffer_printf(struct linebuffer *buf, const char *fmt, ...);
char * linebuffer_getline(struct linebuffer *buf, int *len);
int linebuffer_freeline(struct linebuffer *buf);
2007-05-15 17:39:34 +02:00
#endif /* _LINEBUFFER_H_ */