Home | History | Annotate | Download | only in gpxe
      1 #ifndef _GPXE_LINEBUF_H
      2 #define _GPXE_LINEBUF_H
      3 
      4 /** @file
      5  *
      6  * Line buffering
      7  *
      8  */
      9 
     10 FILE_LICENCE ( GPL2_OR_LATER );
     11 
     12 #include <stdint.h>
     13 #include <stddef.h>
     14 
     15 /** A line buffer */
     16 struct line_buffer {
     17 	/** Current string in the buffer */
     18 	char *data;
     19 	/** Length of current string, excluding the terminating NUL */
     20 	size_t len;
     21 	/** String is ready to read */
     22 	int ready;
     23 };
     24 
     25 extern char * buffered_line ( struct line_buffer *linebuf );
     26 extern ssize_t line_buffer ( struct line_buffer *linebuf,
     27 			     const char *data, size_t len );
     28 extern void empty_line_buffer ( struct line_buffer *linebuf );
     29 
     30 #endif /* _GPXE_LINEBUF_H */
     31