- size_t min_written = 0;
-
- FOR_EACH_WRITER_NODE(i, g) {
- struct writer_node *wn = &g->writer_nodes[i];
- t->ret = wn->task.ret;
- if (t->ret < 0) {
- g->eof = 1;
- return;
+
+ FOR_EACH_WRITER(i)
+ writers[i].init(&writers[i]);
+}
+/**
+ * Check if given string is a valid command line for any writer.
+ *
+ * \param \wa String of the form writer_name:options.
+ * \param writer_num Contains the number of the writer upon success.
+ *
+ * This function checks whether \a wa starts with the name of a supported
+ * paraslash writer, optionally followed by a colon and any options for that
+ * writer. If a valid writer name was found and further are present, the
+ * remaining part of \a wa is passed to that writer's config parser.
+ *
+ * \return On success, a pointer to the gengetopt args info struct is returned
+ * and \a writer_num contains the number of the writer. Otherwise this function
+ * prints an error message and calls exit().
+ */
+void *check_writer_arg_or_die(const char *wa, int *writer_num)
+{
+ int i, ret, argc;
+ const char *cmdline;
+ char **argv;
+ void *conf;
+
+ if (!wa || !*wa) {
+ i = DEFAULT_WRITER;
+ cmdline = NULL;
+ goto check;
+ }
+ PARA_INFO_LOG("checking %s\n", wa);
+ FOR_EACH_WRITER(i) {
+ const char *name = writer_names[i];
+ size_t len = strlen(name);
+ char c;
+
+ if (strlen(wa) < len)
+ continue;
+ if (strncmp(name, wa, len))
+ continue;
+ c = wa[len];
+ if (!c || c == ' ') {
+ cmdline = c? wa + len + 1 : NULL;
+ goto check;