#include <stdint.h>#include <string.h>#include <stdio.h>#include <gpxe/linebuf.h>Go to the source code of this file.
Functions | |
| void | linebuf_test (void) |
Variables | |
| static const char | data1 [] |
| void linebuf_test | ( | void | ) |
Definition at line 13 of file linebuf_test.c.
References buffered_line(), line_buffer::data, data1, empty_line_buffer(), line_buffer::len, line_buffer(), memset(), printf(), and strerror().
00013 { 00014 struct line_buffer linebuf; 00015 const char *data = data1; 00016 size_t len = ( sizeof ( data1 ) - 1 /* be mean; strip the NUL */ ); 00017 ssize_t frag_len; 00018 char *line; 00019 00020 memset ( &linebuf, 0, sizeof ( linebuf ) ); 00021 while ( len ) { 00022 frag_len = line_buffer ( &linebuf, data, len ); 00023 if ( frag_len < 0 ) { 00024 printf ( "line_buffer() failed: %s\n", 00025 strerror ( frag_len ) ); 00026 return; 00027 } 00028 data += frag_len; 00029 len -= frag_len; 00030 if ( ( line = buffered_line ( &linebuf ) ) ) 00031 printf ( "\"%s\"\n", line ); 00032 } 00033 00034 empty_line_buffer ( &linebuf ); 00035 }
const char data1[] [static] |
Initial value:
"Hello world\r\n" "This is a reasonably nice set of lines\n" "with not many different terminators\r\n\r\n" "There should be exactly one blank line above\n" "and this line should never appear at all since it has no terminator"
Definition at line 6 of file linebuf_test.c.
Referenced by __vxge_hw_vpath_addr_get(), __vxge_hw_vpath_card_info_get(), __vxge_hw_vpath_fw_ver_get(), ath5k_hw_rf5111_channel(), ath5k_hw_rf5112_channel(), and linebuf_test().
1.5.7.1