version 1.1.2.5, 2013/12/05 16:57:08
|
version 1.1.2.9, 2013/12/06 01:07:40
|
Line 1
|
Line 1
|
#include <stdio.h> |
#include <stdio.h> |
|
#include <unistd.h> |
|
#include <string.h> |
|
#include <errno.h> |
#include <aitio.h> |
#include <aitio.h> |
#include <sys/wait.h> |
#include <sys/wait.h> |
|
|
Line 7 int
|
Line 10 int
|
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
prog_t *p; |
prog_t *p; |
|
int f; |
int ret = 0; |
int ret = 0; |
|
char str[BUFSIZ]; |
|
|
if (argc < 2) |
if (argc < 2) |
return 1; |
return 1; |
Line 32 main(int argc, char **argv)
|
Line 37 main(int argc, char **argv)
|
|
|
printf("last=%d\n", array_Last(p->prog_fds)); |
printf("last=%d\n", array_Last(p->prog_fds)); |
|
|
ret = io_progOpen(p, 8); | ret = io_progGrow(p, 8); |
printf("+progs=%d\n", ret); | printf("+grow_progs=%d\n", ret); |
|
|
printf("wait for keystroke %p ", p); |
printf("wait for keystroke %p ", p); |
getchar(); |
getchar(); |
|
|
|
ret = io_progVacuum(p, 5); |
|
printf("+vacuum_progs=%d\n", ret); |
|
|
|
printf("wait for keystroke %p ", p); |
|
getchar(); |
|
|
|
again: |
|
f = io_progAttach(p); |
|
printf("f=%d\n", f); |
|
write(f, "v\n", 2); |
|
while (read(f, str, sizeof str) > 0) { |
|
printf(">>> %s", str); |
|
read(0, str, sizeof str); |
|
if (*str == '.') |
|
break; |
|
write(f, str, strlen(str)); |
|
} |
|
io_progDetach(p, f); |
|
|
|
printf("wait for keystroke %p ", p); |
|
if (getchar() == 'a') |
|
goto again; |
end: |
end: |
io_progDestroy(&p); |
io_progDestroy(&p); |
return ret; |
return ret; |