acl/lib_acl/samples/vstring2/main.c
zsxxsz cf2528eb7c 完善了非阻塞IO的SSL功能;将 samples 移到 lib_acl 目录下
完善了非阻塞IO的SSL功能;将 acl/samples/ 下的示例分别移到 lib_acl 及 lib_protocol 目录下
2014-11-30 21:15:35 +08:00

25 lines
506 B
C

#include "lib_acl.h"
int main(void)
{
ACL_VSTRING *buf = acl_vstring_alloc(100);
const char *s = "hello world\r\nhello world1\nhello world2\r\nhello world3";
const char *p = s, *p1;
ssize_t n = (ssize_t) strlen(p);
while (n > 0) {
ACL_VSTRING_RESET(buf);
p1 = p;
if (acl_buffer_gets_nonl(buf, &p, (size_t) n) == NULL
&& ACL_VSTRING_LEN(buf) == 0)
{
break;
}
printf(">>%s\n", acl_vstring_str(buf));
n -= p - p1;
}
acl_vstring_free(buf);
return (0);
}