Annotation of libaitio/example/astvar.c, revision 1.3.32.1

1.2       misho       1: #include <stdio.h>
                      2: #include <aitio.h>
                      3: 
                      4: int
                      5: main(int argc, char **argv)
                      6: {
1.3.32.1! misho       7:        char *str, szStr[BUFSIZ];
1.2       misho       8: 
                      9:        if (argc < 2) {
                     10:                printf("Syntax: %s <var (like {99999[:9:9]})>\n", argv[0]);
                     11:                return 1;
                     12:        }
                     13: 
1.3       misho      14:        str = ioStrAst(argv[1]);
1.2       misho      15:        if (!str) {
                     16:                printf("#%d - %s\n", io_GetErrno(), io_GetError());
                     17:                return 1;
                     18:        }
                     19: 
                     20:        printf(">>> %s\n", str);
                     21: 
1.3.32.1! misho      22:        if (io_AV2Path(NULL, "test_av", str, 0, 0) == -1) {
        !            23:                printf("#%d - %s\n", io_GetErrno(), io_GetError());
        !            24:                free(str);
        !            25:                return 2;
        !            26:        }
        !            27:        if (io_AV2Path(NULL, "test_av", str, 42, 0) == -1) {
        !            28:                printf("#%d - %s\n", io_GetErrno(), io_GetError());
        !            29:                free(str);
        !            30:                return 3;
        !            31:        }
        !            32: 
1.2       misho      33:        free(str);
1.3.32.1! misho      34: 
        !            35:        if (io_Path2AV(NULL, "test_av", szStr, sizeof szStr, 0) == -1) {
        !            36:                printf("#%d - %s\n", io_GetErrno(), io_GetError());
        !            37:                return 4;
        !            38:        } else
        !            39:                printf(">>> %s\n", szStr);
        !            40:        if (io_Path2AV(NULL, "test_av", szStr, sizeof szStr, 42) == -1) {
        !            41:                printf("#%d - %s\n", io_GetErrno(), io_GetError());
        !            42:                return 5;
        !            43:        } else
        !            44:                printf(">>> %s\n", szStr);
        !            45: 
1.2       misho      46:        return 0;
                     47: }

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