4 #include <ipxe/linebuf.h>
6 static const char data1[] =
8 "This is a reasonably nice set of lines\n"
9 "with not many different terminators\r\n\r\n"
10 "There should be exactly one blank line above\n"
11 "and this line should never appear at all since it has no terminator";
13 void linebuf_test ( void ) {
14 struct line_buffer linebuf;
15 const char *data = data1;
16 size_t len = ( sizeof ( data1 ) - 1 /* be mean; strip the NUL */ );
20 memset ( &linebuf, 0, sizeof ( linebuf ) );
22 frag_len = line_buffer ( &linebuf, data, len );
24 printf ( "line_buffer() failed: %s\n",
25 strerror ( frag_len ) );
30 if ( ( line = buffered_line ( &linebuf ) ) )
31 printf ( "\"%s\"\n", line );
34 empty_line_buffer ( &linebuf );