+
+static void stdout_default_event_handler(struct task *t)
+{
+ PARA_NOTICE_LOG("%p: %s\n", t, PARA_STRERROR(-t->ret));
+ unregister_task(t);
+}
+
+/**
+ * initialize a stdout task structure with default values
+ *
+ * \param sot the stdout task structure
+ *
+ * This fills in the pre/post select function poinzters of the task structure
+ * given by \a sot. It also sets up a default error handler which unregisters
+ * the task on errors and clears the eof flag of \a sot.
+ */
+void stdout_set_defaults(struct stdout_task *sot)
+{
+ sot->task.private_data = sot;
+ sot->task.pre_select = stdout_pre_select;
+ sot->task.post_select = stdout_post_select;
+ sot->task.event_handler = stdout_default_event_handler;
+ sot->error = 0;
+ mark_fd_nonblocking(STDOUT_FILENO);
+ sprintf(sot->task.status, "stdout writer");
+}