]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
scan-tree: split the pw_gecos field at the ',' to get the real name
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index a92383d520d79ec1e590504766436f448884fa98..b0e1c44366cda6e9af2951561e092cba91959b14 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -177,6 +177,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);
@@ -233,7 +236,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->cfg.cache_root_ttl = 5;
        ctx->cfg.cache_static_ttl = -1;
        ctx->cfg.css = "/cgit.css";
-       ctx->cfg.logo = "/git-logo.png";
+       ctx->cfg.logo = "/cgit.png";
        ctx->cfg.local_time = 0;
        ctx->cfg.max_repo_count = 50;
        ctx->cfg.max_commit_count = 50;
@@ -253,6 +256,7 @@ static void prepare_context(struct cgit_context *ctx)
        ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG"));
        ctx->env.http_host = xstrdupn(getenv("HTTP_HOST"));
        ctx->env.https = xstrdupn(getenv("HTTPS"));
+       ctx->env.no_http = xstrdupn(getenv("NO_HTTP"));
        ctx->env.path_info = xstrdupn(getenv("PATH_INFO"));
        ctx->env.query_string = xstrdupn(getenv("QUERY_STRING"));
        ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD"));
@@ -445,6 +449,9 @@ static void cgit_parse_args(int argc, const char **argv)
                if (!strcmp(argv[i], "--nocache")) {
                        ctx.cfg.nocache = 1;
                }
+               if (!strcmp(argv[i], "--nohttp")) {
+                       ctx.env.no_http = "1";
+               }
                if (!strncmp(argv[i], "--query=", 8)) {
                        ctx.qry.raw = xstrdup(argv[i]+8);
                }
@@ -532,7 +539,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);
        }