summaryrefslogtreecommitdiffstats
path: root/hw2/xwrap.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw2/xwrap.h')
-rw-r--r--hw2/xwrap.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/hw2/xwrap.h b/hw2/xwrap.h
index 7759ae9..05504c3 100644
--- a/hw2/xwrap.h
+++ b/hw2/xwrap.h
@@ -31,4 +31,19 @@ static inline int xmin (int a, int b) {
return a < b ? a : b;
}
+#define XBUFSIZ 512
+
+typedef struct {
+ char buf[XBUFSIZ];
+ off_t buf_start;
+ off_t buf_len;
+ char* buf_line;
+ ssize_t buf_line_len;
+ int buf_error : 1;
+ int buf_eof : 1;
+} XBuf;
+
+void xbufinit (XBuf* buf);
+char* xgetline (int fd, XBuf* buf, int delim);
+
#endif /* X_GENERAL_WRAPPER */