- sprintf(t->status,
- "%p stdin reader: loaded = %d, ret = %d",
- sit, sit->loaded, t->ret);
+}
+
+/**
+ * Initialize a stdin task structure with default values.
+ *
+ * \param sit The stdin task structure.
+ *
+ * This fills in the pre/post select function poinzters of the task structure
+ * given by \a sit. It also sets up a default error handler which unregisters
+ * the task. Moreover, \a loaded and \a eof are set to zero and \a bufsize is
+ * initialized to 16 KB (but no buffer is allocated).
+ */
+void stdin_set_defaults(struct stdin_task *sit)
+{
+ sit->bufsize = 16 * 1024,
+ sit->loaded = 0,
+ sit->eof = 0,
+ sit->task.pre_select = stdin_pre_select;
+ sit->task.post_select = stdin_post_select;
+ sit->task.event_handler = stdin_default_event_handler;
+ sit->task.private_data = sit;
+ mark_fd_nonblocking(STDIN_FILENO);
+ sprintf(sit->task.status, "stdin reader");