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 631B

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