File:  [ELWIX - Embedded LightWeight unIX -] / libaitio / example / test_exec.c
Revision 1.1.2.3: download - view: text, annotated - select for diffs - revision graph
Thu Dec 5 14:12:25 2013 UTC (11 years, 4 months ago) by misho
Branches: io6_7
add elwix replacement of popen/pclose api

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


int
main(int argc, char **argv)
{
	prog_t *p;
	int stat;

	if (argc < 2)
		return 1;

	p = io_progInit(argv[1], 3, 10);
	if (!p) {
		ELIBERR(io);
		return 2;
	} else {
		printf("wait for keystroke %p ", p);
		getchar();
	}

	printf("%d\n", waitpid(-1, &stat, WNOHANG));
	printf("%d\n", waitpid(-1, &stat, WNOHANG));
	printf("%d\n", waitpid(-1, &stat, WNOHANG));
	printf("%d\n", waitpid(-1, &stat, WNOHANG));
	printf("%d\n", waitpid(-1, &stat, WNOHANG));

	io_progDestroy(&p);
	return 0;
}

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