aboutsummaryrefslogtreecommitdiff
path: root/fbuf.h
blob: 212979b8e6581e4073c65a5015f342708d90eef0 (plain)
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
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/*Oh boy, CS101 linked lists*/
struct LLNode{
	size_t length;
	char* data;
	struct LLNode* next;
};

struct TMPL_buf{
	size_t total_len;
	struct LLNode* head;
	struct LLNode* tail;
};

void bputs(struct TMPL_buf* b, char* s);
void bputsn(struct TMPL_buf* b, char* s, size_t size);

void bputc(struct TMPL_buf* b, char s);

struct TMPL_buf* alloc_tmpl_buf(void);

void free_tmpl_buf(struct TMPL_buf* b);

char* bstringify(struct TMPL_buf* b, size_t* size);

void bprint(struct TMPL_buf* b);