-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinebuffer.h
More file actions
27 lines (18 loc) · 824 Bytes
/
linebuffer.h
File metadata and controls
27 lines (18 loc) · 824 Bytes
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
#ifndef LINEBUFFER_H
#define LINEBUFFER_H
#define LINEBUFFERSIZE 1024
typedef struct lbuf {
int descriptor; /* Eingabe-Descriptor */
const char *linesep; /* Zeilentrenner, C-String */
unsigned lineseplen; /* Länge des Zeilentrenners in Bytes*/
char buffer[LINEBUFFERSIZE];/* Lesebuffer */
unsigned bytesread; /* Anzahl bereits von descriptor gelesener Bytes */
unsigned here; /* aktuelle Verarbeitungsposition im Lesebuffer */
unsigned end; /* Anzahl belegter Bytes im Lesebuffer */
} LineBuffer;
LineBuffer *buf_new(int descriptor, const char *linesep);
void buf_dispose(LineBuffer *b);
int buf_readline(LineBuffer *b, char *line, int linemax);
int buf_where(LineBuffer *b);
int buf_seek(LineBuffer *b, int seekpos);
#endif