File:
[ELWIX - Embedded LightWeight unIX -] /
libelwix /
example /
test.c
Revision
1.4:
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Jun 26 14:39:13 2018 UTC (6 years, 4 months ago) by
misho
Branches:
MAIN
CVS tags:
elwix6_6,
elwix6_5,
elwix6_4,
elwix6_3,
elwix6_2,
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,
elwix4_26,
elwix4_25,
elwix4_24,
elwix4_23,
elwix4_22,
elwix4_21,
elwix4_20,
elwix4_19,
elwix4_18,
elwix4_17,
elwix4_16,
HEAD,
ELWIX6_5,
ELWIX6_4,
ELWIX6_2,
ELWIX6_1,
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,
ELWIX4_25,
ELWIX4_24,
ELWIX4_23,
ELWIX4_22,
ELWIX4_21,
ELWIX4_20,
ELWIX4_19,
ELWIX4_18,
ELWIX4_17,
ELWIX4_16,
ELWIX4_15
adds new function in json support
#include <stdio.h>
#include <string.h>
#include <elwix.h>
int main(int argc, char **argv)
{
int ret, len;
char str[256], *s, s0[2][256];
ait_val_t *v;
char *bp, *sp, szBuffer[BUFSIZ] = "1.1.1.1 0 idx=0\n"
"2.2.2.2 0 idx=1\n"
"3.3.3.3 1 idx=2\n"
"4.4.4.4 0 idx=3\n";
printf("ELWIX byte order is %d == %s endian\n", elwix_byteOrder(),
elwix_byteOrder() ? "little" : "big");
if (argc < 2) {
printf("regex:: regex_Verify([0-9]+) -> %s\n",
regex_Verify("[0-9]+", "shmink132sdf09", NULL, NULL));
printf("regex:: %s regex_Get([0-9]+) -> %d\n", str,
regex_Get("[0-9]+", "shmink132sdf09", str, sizeof str));
printf("regex:: %s not match regex_Get([ab]+) -> %d\n", str,
regex_Get("[ab]+", "shmink132sdf09", str, sizeof str));
s = regex_Replace("[0-9]+", "0shmink132sdf09", "XXX");
printf("regex:: regex_Replace([0-9]+) -> %s with XXX\n", s);
e_free(s);
s = regex_Replace("[0-9]+", "shmink132sdf09", NULL);
printf("regex:: regex_Replace([0-9]+) -> %s clear!\n", s);
e_free(s);
}
if (argc > 2) {
char *s2;
v = str_Hex2Dig("PIUK_GN IAH");
printf("S1=%s\n", AIT_GET_LIKE(v, char*));
ait_freeVar(&v);
v = str_Hex2Dig(argv[1]);
printf("%s S1=%s\n", argv[1], AIT_GET_LIKE(v, char*));
s2 = str_Dig2Hex(v);
printf("S2=%s\n", s2);
if (s2)
e_free(s2);
ait_freeVar(&v);
printf( "1=%d\n", str_LTrim(argv[1]));
printf( "2=%d\n", str_RTrim(argv[2]));
printf( "3=%d\n", str_Trim(argv[3]));
printf("'%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
printf("test p=%s f=%s path2file=%d\n", s0[0], s0[1],
av_Path2File(argv[2], s0[0], 256, s0[1], 256));
printf("'%s' ret=%d\n", argv[3], str_getString2(argv[3], strlen(argv[3]), ',', NULL));
for (bp = szBuffer; (len = str_getString2(bp, strlen(bp), '\n', &sp)) > 0; bp = sp)
printf("len=%d bp=%s\n", len, bp);
return 0;
}
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>