File:  [ELWIX - Embedded LightWeight unIX -] / libaitio / example / Attic / astvar.c
Revision 1.3.32.1: download - view: text, annotated - select for diffs - revision graph
Wed Dec 19 11:02:29 2012 UTC (11 years, 6 months ago) by misho
Branches: io4_0
Diff to: branchpoint 1.3: preferred, colored
added new Attribute/Value API calls

#include <stdio.h>
#include <aitio.h>

int
main(int argc, char **argv)
{
	char *str, szStr[BUFSIZ];

	if (argc < 2) {
		printf("Syntax: %s <var (like {99999[:9:9]})>\n", argv[0]);
		return 1;
	}

	str = ioStrAst(argv[1]);
	if (!str) {
		printf("#%d - %s\n", io_GetErrno(), io_GetError());
		return 1;
	}

	printf(">>> %s\n", str);

	if (io_AV2Path(NULL, "test_av", str, 0, 0) == -1) {
		printf("#%d - %s\n", io_GetErrno(), io_GetError());
		free(str);
		return 2;
	}
	if (io_AV2Path(NULL, "test_av", str, 42, 0) == -1) {
		printf("#%d - %s\n", io_GetErrno(), io_GetError());
		free(str);
		return 3;
	}

	free(str);

	if (io_Path2AV(NULL, "test_av", szStr, sizeof szStr, 0) == -1) {
		printf("#%d - %s\n", io_GetErrno(), io_GetError());
		return 4;
	} else
		printf(">>> %s\n", szStr);
	if (io_Path2AV(NULL, "test_av", szStr, sizeof szStr, 42) == -1) {
		printf("#%d - %s\n", io_GetErrno(), io_GetError());
		return 5;
	} else
		printf(">>> %s\n", szStr);

	return 0;
}

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