--- libaitio/example/test_exec.c 2013/12/06 01:03:02 1.1.2.7 +++ libaitio/example/test_exec.c 2013/12/08 21:11:54 1.1.2.12 @@ -10,7 +10,7 @@ int main(int argc, char **argv) { prog_t *p; - FILE *f; + int f; int ret = 0; char str[BUFSIZ]; @@ -21,7 +21,7 @@ main(int argc, char **argv) if (!p) { ELIBERR(io); return 2; - } else if ((ret = io_progCheck(p))) { + } else if ((ret = io_progCheck(p, 0))) { printf("0.exited procs=%d\n", ret); goto end; } else { @@ -29,7 +29,7 @@ main(int argc, char **argv) getchar(); } - ret = io_progCheck(p); + ret = io_progCheck(p, 0); if (ret) { printf("1.exited procs=%d\n", ret); goto end; @@ -51,17 +51,20 @@ main(int argc, char **argv) again: f = io_progAttach(p); - printf("f=%p\n", f); - while (read(fileno(f), str, sizeof str) > 0) { + printf("f=%d\n", f); + write(f, "v\n", 1); + memset(str, 0, sizeof str); + while (read(f, str, sizeof str) > 0) { printf(">>> %s", str); - fgets(str, sizeof str, stdin); + memset(str, 0, sizeof str); + read(0, str, sizeof str); if (*str == '.') break; - write(fileno(f), str, strlen(str)); + write(f, str, strlen(str)); } io_progDetach(p, f); - printf("wait for keystroke %p ", p); + printf("(r) wait for keystroke %p ", p); if (getchar() == 'a') goto again; end: