- size_t min_written = 0;
-
- FOR_EACH_WRITER_NODE(i, g) {
- struct writer_node *wn = &g->writer_nodes[i];
- t->ret = wn->writer->post_select(s, wn);
- if (t->ret < 0) {
- g->eof = 1;
- return;
- }
- if (!i)
- min_written = wn->written;
- else
- min_written = PARA_MIN(min_written, wn->written);
- }
-// PARA_INFO_LOG("loaded: %zd, min_written: %zd bytes\n", *g->loaded, min_written);
- if (min_written) {
- *g->loaded -= min_written;
- FOR_EACH_WRITER_NODE(i, g)
- g->writer_nodes[i].written -= min_written;
- }
- if (!*g->loaded && *g->input_eof) {
- g->eof = 1;
- t->ret = -E_WNG_EOF;
- return;
- }
- t->ret = 1;
- if (*g->loaded && min_written) {
-// PARA_INFO_LOG("moving %zd bytes\n", *g->loaded);
- memmove(g->buf, g->buf + min_written, *g->loaded);
+
+ *writer_num = -E_WRITE_COMMON_SYNTAX;
+ 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 != ' ')
+ continue;
+ *writer_num = i;
+ return writers[i].parse_config_or_die(c? wa + len + 1 : "");