- f = xmalloc(sizeof(struct cgit_filter));
- memset(f, 0, sizeof(struct cgit_filter));
+int cgit_close_filter(struct cgit_filter *filter)
+{
+ return filter->close(filter);
+}
+
+void cgit_fprintf_filter(struct cgit_filter *filter, FILE *f, const char *prefix)
+{
+ filter->fprintf(filter, f, prefix);
+}
+
+void cgit_exec_filter_init(struct cgit_exec_filter *filter, char *cmd, char **argv)
+{
+ memset(filter, 0, sizeof(*filter));
+ filter->base.open = open_exec_filter;
+ filter->base.close = close_exec_filter;
+ filter->base.fprintf = fprintf_exec_filter;
+ filter->cmd = cmd;
+ filter->argv = argv;
+}
+
+static struct cgit_filter *new_exec_filter(const char *cmd, filter_type filtertype)
+{
+ struct cgit_exec_filter *f;
+ int args_size = 0;
+
+ f = xmalloc(sizeof(*f));
+ /* We leave argv for now and assign it below. */
+ cgit_exec_filter_init(f, xstrdup(cmd), NULL);