diff options
author | FreeArtMan <dos21h@gmail.com> | 2019-05-12 15:36:00 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2019-05-12 15:36:00 +0100 |
commit | 709c4bd0e02a0dcb609b841053da9624f41440cc (patch) | |
tree | 628518c61a3acdf5f5be83e0301e0fe641013efe /test_line.c | |
parent | 082dee0658b67744ab3428eea964f375f7aab9dc (diff) | |
download | libbuf-709c4bd0e02a0dcb609b841053da9624f41440cc.tar.gz libbuf-709c4bd0e02a0dcb609b841053da9624f41440cc.zip |
Added to BufLine new line detection
Diffstat (limited to 'test_line.c')
-rw-r--r-- | test_line.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test_line.c b/test_line.c index 3c3ccab..c001cc5 100644 --- a/test_line.c +++ b/test_line.c @@ -28,6 +28,14 @@ void error_is_good(int err) } #define E(X) error_is_good(X); +void print_s(char *str, int sz) +{ + int i = 0; + for (i=0;i<sz;i++) + printf("%c",str[i]); + fflush(stdout); +} + int main() { Buf *b1=NULL, *b2=NULL, *b3=NULL; @@ -58,6 +66,12 @@ int main() bline->add(b2); bline->print(); printf("\n"); printf("Get line\n"); + int sz=-1; + char *getline=NULL; + if (0==bline->pop_line(&getline,&sz)) + { + printf("[");print_s(getline,sz); printf("]\n"); + } printf("End test\n"); |