File:  [ELWIX - Embedded LightWeight unIX -] / libaitio / example / Attic / astvar.c
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Wed Dec 19 11:03:04 2012 UTC (11 years, 8 months ago) by misho
Branches: MAIN
CVS tags: io5_0, io4_1, IO4_1, IO4_0, HEAD
version 4.0

    1: #include <stdio.h>
    2: #include <aitio.h>
    3: 
    4: int
    5: main(int argc, char **argv)
    6: {
    7: 	char *str, szStr[BUFSIZ];
    8: 
    9: 	if (argc < 2) {
   10: 		printf("Syntax: %s <var (like {99999[:9:9]})>\n", argv[0]);
   11: 		return 1;
   12: 	}
   13: 
   14: 	str = ioStrAst(argv[1]);
   15: 	if (!str) {
   16: 		printf("#%d - %s\n", io_GetErrno(), io_GetError());
   17: 		return 1;
   18: 	}
   19: 
   20: 	printf(">>> %s\n", str);
   21: 
   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: 
   33: 	free(str);
   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: 
   46: 	return 0;
   47: }

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