Annotation of libelwix/example/test.c, revision 1.4

1.1       misho       1: #include <stdio.h>
                      2: #include <string.h>
                      3: #include <elwix.h>
                      4: 
                      5: 
                      6: int main(int argc, char **argv)
                      7: {
1.4     ! misho       8:        int ret, len;
1.1       misho       9:        char str[256], *s, s0[2][256];
                     10:        ait_val_t *v;
1.4     ! misho      11:        char *bp, *sp, szBuffer[BUFSIZ] = "1.1.1.1 0 idx=0\n"
        !            12:                                                "2.2.2.2 0 idx=1\n"
        !            13:                                                "3.3.3.3 1 idx=2\n"
        !            14:                                                "4.4.4.4 0 idx=3\n";
1.1       misho      15: 
1.2       misho      16:        printf("ELWIX byte order is %d == %s endian\n", elwix_byteOrder(), 
                     17:                        elwix_byteOrder() ? "little" : "big");
                     18: 
1.1       misho      19:        if (argc < 2) {
                     20:                printf("regex:: regex_Verify([0-9]+) -> %s\n", 
                     21:                                regex_Verify("[0-9]+", "shmink132sdf09", NULL, NULL));
                     22:                printf("regex:: %s regex_Get([0-9]+) -> %d\n", str, 
                     23:                                regex_Get("[0-9]+", "shmink132sdf09", str, sizeof str));
                     24:                printf("regex:: %s not match regex_Get([ab]+) -> %d\n", str, 
                     25:                                regex_Get("[ab]+", "shmink132sdf09", str, sizeof str));
                     26: 
                     27:                s = regex_Replace("[0-9]+", "0shmink132sdf09", "XXX");
                     28:                printf("regex:: regex_Replace([0-9]+) -> %s with XXX\n", s);
                     29:                e_free(s);
                     30:                s = regex_Replace("[0-9]+", "shmink132sdf09", NULL);
                     31:                printf("regex:: regex_Replace([0-9]+) -> %s clear!\n", s);
                     32:                e_free(s);
                     33:        }
                     34: 
                     35:        if (argc > 2) {
                     36:                char *s2;
                     37: 
                     38:                v = str_Hex2Dig("PIUK_GN IAH");
                     39:                printf("S1=%s\n", AIT_GET_LIKE(v, char*));
                     40:                ait_freeVar(&v);
                     41:                v = str_Hex2Dig(argv[1]);
                     42:                printf("%s S1=%s\n", argv[1], AIT_GET_LIKE(v, char*));
                     43:                s2 = str_Dig2Hex(v);
                     44:                printf("S2=%s\n", s2);
                     45:                if (s2)
                     46:                        e_free(s2);
                     47:                ait_freeVar(&v);
                     48: 
                     49:                printf( "1=%d\n", str_LTrim(argv[1]));
                     50:                printf( "2=%d\n", str_RTrim(argv[2]));
                     51:                printf( "3=%d\n", str_Trim(argv[3]));
                     52:                printf("'%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
                     53:                printf("test p=%s f=%s path2file=%d\n", s0[0], s0[1], 
                     54:                                av_Path2File(argv[2], s0[0], 256, s0[1], 256));
1.3       misho      55: 
                     56:                printf("'%s' ret=%d\n", argv[3], str_getString2(argv[3], strlen(argv[3]), ',', NULL));
1.4     ! misho      57:                for (bp = szBuffer; (len = str_getString2(bp, strlen(bp), '\n', &sp)) > 0; bp = sp)
        !            58:                        printf("len=%d bp=%s\n", len, bp);
1.1       misho      59:                return 0;
                     60:        }
                     61: 
                     62:        return 0;
                     63: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>