4 #include <gpxe/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 if ( ( rc = line_buffer ( &linebuf, &data, &len ) ) != 0 ) {
23 printf ( "line_buffer() failed: %s\n",
27 if ( ( line = buffered_line ( &linebuf ) ) )
28 printf ( "\"%s\"\n", line );
31 empty_line_buffer ( &linebuf );