You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

linebuf.h 598B

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