summaryrefslogtreecommitdiff
path: root/buffer.h
blob: ade8f3f6671219f8887b244a766c738aefb016f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef BUFFER_H
#define BUFFER_H

#include <sys/types.h>

struct buffer {
	char *addr;
	char *begin;
	char *end;
	int size;
};

void binit(struct buffer *b, size_t size);
void bfree(struct buffer *b);
int bread(struct buffer *b, int fd);
int bwrite(struct buffer *b, int fd);
int bcanfill(struct buffer *b);
int bhasdata(struct buffer *b);

int bgets(struct buffer *b, char *s, size_t len);
int bputs(struct buffer *b, char *s, size_t len);

#endif