#include <stdio.h>
#include <elwix.h>
int
main(int argc, char **argv)
{
char szStr[BUFSIZ];
ait_val_t *s;
if (argc < 2) {
printf("Syntax: %s <var (like {99999[:9:9]})>\n", argv[0]);
return 1;
}
s = str_Ast(argv[1]);
if (!s) {
printf("#%d - %s\n", elwix_GetErrno(), elwix_GetError());
return 1;
}
printf(">>> %s\n", AIT_GET_STR(s));
if (av_Save(NULL, "test_av", AIT_GET_STR(s), 0, 0) == -1) {
printf("#%d - %s\n", elwix_GetErrno(), elwix_GetError());
ait_freeVar(&s);
return 2;
}
if (av_Save(NULL, "test_av", AIT_GET_STR(s), 42, 0) == -1) {
printf("#%d - %s\n", elwix_GetErrno(), elwix_GetError());
ait_freeVar(&s);
return 3;
}
ait_freeVar(&s);
if (av_Load(NULL, "test_av", szStr, sizeof szStr, 0) == -1) {
printf("#%d - %s\n", elwix_GetErrno(), elwix_GetError());
return 4;
} else
printf(">>> %s\n", szStr);
if (av_Load(NULL, "test_av", szStr, sizeof szStr, 42) == -1) {
printf("#%d - %s\n", elwix_GetErrno(), elwix_GetError());
return 5;
} else
printf(">>> %s\n", szStr);
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>