]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Add generic filter/plugin infrastructure
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 2039ab1de53699b6d29a23f1409461386589a227..779a4643abb87e84aef93dc40239c26a4a17d63b 100644 (file)
--- a/cgit.c
+++ b/cgit.c
 
 const char *cgit_version = CGIT_VERSION;
 
+struct cgit_filter *new_filter(const char *cmd, int extra_args)
+{
+       struct cgit_filter *f;
+
+       if (!cmd)
+               return NULL;
+
+       f = xmalloc(sizeof(struct cgit_filter));
+       f->cmd = xstrdup(cmd);
+       f->argv = xmalloc((2 + extra_args) * sizeof(char *));
+       f->argv[0] = f->cmd;
+       f->argv[1] = NULL;
+       return f;
+}
+
 void config_cb(const char *name, const char *value)
 {
        if (!strcmp(name, "root-title"))