- open_filters();
- ib = fc->inbuf;
- ob = fc->outbuf;
- il = fc->in_loaded;
- ol = fc->out_loaded;
- PARA_DEBUG_LOG("ib %p in, ob: %p\n", ib, ob);
-again:
- if (*il < INBUF_SIZE && !eof) {
- ret = read(STDIN_FILENO, ib + *il, INBUF_SIZE - *il);
- PARA_DEBUG_LOG("read %d/%zd\n", ret, INBUF_SIZE - *il);
- if (ret < 0)
- goto out;
- if (!ret)
- eof = 1;
- *il += ret;
- }
- ret = filter_io(fc);
- if (ret < 0)
- goto out;
- converted = ret;
- if (*ol) {
- ret = write(STDOUT_FILENO, ob, *ol);
- PARA_DEBUG_LOG("wrote %d/%zd\n", ret, *ol);
- if (ret <= 0)
- goto out;
- *ol -= ret;
- if (*ol) {
- PARA_NOTICE_LOG("short write: %zd bytes left\n", *ol);
- memmove(ob, ob + ret, *ol);
- }
- }
- if (!eof || converted)
- goto again;
- ret = 0;
+
+ stdout_set_defaults(sot);
+ sot->buf = fc->outbuf;
+ sot->loaded = fc->out_loaded;
+ sot->eof = &fc->eof;
+
+ register_task(&sot->task);
+ register_task(&fc->task);
+ register_task(&sit->task);
+ s.default_timeout.tv_sec = 1;
+ s.default_timeout.tv_usec = 0;
+ ret = sched(&s);