File:
[ELWIX - Embedded LightWeight unIX -] /
libelwix /
example /
test_iovec.c
Revision
1.2:
download - view:
text,
annotated -
select for diffs -
revision graph
Sun Mar 21 01:32:04 2021 UTC (3 years, 5 months ago) by
misho
Branches:
MAIN
CVS tags:
elwix6_1,
elwix5_9,
elwix5_8,
elwix5_7,
elwix5_6,
elwix5_5,
elwix5_4,
elwix5_3,
elwix5_2,
elwix5_12,
elwix5_11,
elwix5_10,
elwix5_1,
elwix5_0,
HEAD,
ELWIX6_0,
ELWIX5_9,
ELWIX5_8,
ELWIX5_7,
ELWIX5_6,
ELWIX5_5,
ELWIX5_4,
ELWIX5_3,
ELWIX5_2,
ELWIX5_11,
ELWIX5_10,
ELWIX5_1,
ELWIX5_0,
ELWIX4_26
ver 4.26
#include <stdio.h>
#include <elwix.h>
int
main(int argc, char **argv)
{
iovec_t *iov;
char d[BUFSIZ], n[BUFSIZ];
size_t nl, dl = sizeof d;
iov = iov_Init();
if (!iov)
return 1;
printf("iov_Insert at 0 %d\n", iov_Insert(iov, 0, "aaaaa", 6));
printf("iov_Insert at 3 %d\n", iov_Insert(iov, 3, "BBBBB", 6));
iov_Debug(iov);
printf("iov_Delete at 1 %d\n", iov_Delete(iov, 1, 42));
printf("iov_Delete at 9 %d\n", iov_Delete(iov, 9, 0));
iov_Debug(iov);
printf("iov_Delete at 3 %d\n", iov_Delete(iov, 3, 0));
printf("iov_Insert at 2 %d\n", iov_Insert(iov, 2, "bbbBB", 6));
iov_Debug(iov);
printf("iov_Push at %d\n", iov_Push(iov, "oho", 4));
printf("iov_Pop at %d\n", iov_Pop(iov, d, &dl, 0));
printf(" -> (%zu) %s\n", dl, d);
iov_Debug(iov);
printf("iov_PushPair at %d\n", iov_PushPair(iov, "pair1", "o!o", (size_t) -1));
iov_Debug(iov);
nl = sizeof n;
dl = sizeof d;
printf("iov_PopPair at %d\n", iov_PopPair(iov, n, &nl, d, &dl, 0));
printf(" -> (%zu) %s = (%zu) %s\n", nl, n, dl, d);
iov_Debug(iov);
printf("iov_PushPair at %d\n", iov_PushPair(iov, "pair1", "o!o", (size_t) -1));
printf("iov_PopPair without get data at %d\n", iov_PopPair(iov, NULL, NULL, NULL, NULL, 0));
iov_Delete(iov, 0, 0);
iov_Delete(iov, 1, 0);
printf("+iov_PopPair without get data at %d\n", iov_PopPair(iov, NULL, NULL, NULL, NULL, 0));
iov_Debug(iov);
iov_Destroy(&iov);
mpool_dump(NULL, NULL);
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>