]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Add 'linenumbers' config option
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 66dd1402c23185154f67f55e41506e16a3152682..a4788cbb34b2ac198dbdcb9d49a4e4d0d96f8ea9 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -66,6 +66,8 @@ void config_cb(const char *name, const char *value)
                ctx.cfg.index_info = xstrdup(value);
        else if (!strcmp(name, "logo-link"))
                ctx.cfg.logo_link = xstrdup(value);
+       else if (!strcmp(name, "linenumbers"))
+               ctx.cfg.linenumbers = atoi(value);
        else if (!strcmp(name, "module-link"))
                ctx.cfg.module_link = xstrdup(value);
        else if (!strcmp(name, "virtual-root")) {
@@ -177,6 +179,9 @@ void config_cb(const char *name, const char *value)
 
 static void querystring_cb(const char *name, const char *value)
 {
+       if (!value)
+               value = "";
+
        if (!strcmp(name,"r")) {
                ctx.qry.repo = xstrdup(value);
                ctx.repo = cgit_get_repoinfo(value);
@@ -536,7 +541,7 @@ int main(int argc, const char **argv)
                        ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry));
                        free(qry);
                } else
-                       ctx.qry.raw = ctx.qry.url;
+                       ctx.qry.raw = xstrdup(ctx.qry.url);
                cgit_parse_url(ctx.qry.url);
        }