david/ipxe
Archived
1
0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
ipxe/src/include/gpxe/linebuf.h

38 lines
755 B
C
Raw Normal View History

#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 */