File:  [ELWIX - Embedded LightWeight unIX -] / libaitio / example / test_exec.c
Revision 1.1.2.5: download - view: text, annotated - select for diffs - revision graph
Thu Dec 5 16:57:08 2013 UTC (10 years, 7 months ago) by misho
Branches: io6_7
add new api

#include <stdio.h>
#include <aitio.h>
#include <sys/wait.h>


int
main(int argc, char **argv)
{
	prog_t *p;
	int ret = 0;

	if (argc < 2)
		return 1;

	p = io_progInit(argv[1], 3, 10);
	if (!p) {
		ELIBERR(io);
		return 2;
	} else if ((ret = io_progCheck(p))) {
		printf("0.exited procs=%d\n", ret);
		goto end;
	} else {
		printf("wait for keystroke %p ", p);
		getchar();
	}

	ret = io_progCheck(p);
	if (ret) {
		printf("1.exited procs=%d\n", ret);
		goto end;
	}

	printf("last=%d\n", array_Last(p->prog_fds));

	ret = io_progOpen(p, 8);
	printf("+progs=%d\n", ret);

	printf("wait for keystroke %p ", p);
	getchar();
end:
	io_progDestroy(&p);
	return ret;
}

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