summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/linebuf.h
diff options
context:
space:
mode:
authorMichael Brown2007-01-12 18:08:37 +0100
committerMichael Brown2007-01-12 18:08:37 +0100
commit996b091b50ccdc317b2a7501dd2fe18b0a3d421a (patch)
tree8751c8b77d43a7697dbaec151fe1d013cef97313 /src/include/gpxe/linebuf.h
parentPlace multiboot tables in base memory; at least some OSes won't see it (diff)
downloadipxe-996b091b50ccdc317b2a7501dd2fe18b0a3d421a.tar.gz
ipxe-996b091b50ccdc317b2a7501dd2fe18b0a3d421a.tar.xz
ipxe-996b091b50ccdc317b2a7501dd2fe18b0a3d421a.zip
Added generic line-buffering code (a la stdio)
Diffstat (limited to 'src/include/gpxe/linebuf.h')
-rw-r--r--src/include/gpxe/linebuf.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/include/gpxe/linebuf.h b/src/include/gpxe/linebuf.h
new file mode 100644
index 00000000..72b47752
--- /dev/null
+++ b/src/include/gpxe/linebuf.h
@@ -0,0 +1,37 @@
+#ifndef _GPXE_LINEBUF_H
+#define _GPXE_LINEBUF_H
+
+/** @file
+ *
+ * Line buffering
+ *
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+
+/** A line buffer */
+struct line_buffer {
+ /** Current data in the buffer */
+ char *data;
+ /** Length of current data */
+ size_t len;
+ /** Bitmask of terminating characters to skip over */
+ unsigned int skip_terminators;
+};
+
+/**
+ * Retrieve buffered-up line
+ *
+ * @v linebuf Line buffer
+ * @ret line Buffered line, or NULL if no line present
+ */
+static inline char * buffered_line ( struct line_buffer *linebuf ) {
+ return linebuf->data;
+}
+
+extern int line_buffer ( struct line_buffer *linebuf, const char *data,
+ size_t len );
+extern void empty_line_buffer ( struct line_buffer *linebuf );
+
+#endif /* _GPXE_LINEBUF_H */