]> gitweb.ps.run Git - ps-cgit/blobdiff - shared.c
Update README with install/config information
[ps-cgit] / shared.c
index 18b795b6cdec641b6e429bf9ba4ca6a274567488..8e6df31213e89af5623d9f5c034275d9adad7308 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -25,6 +25,8 @@ int cgit_cache_dynamic_ttl     =  5;
 int cgit_cache_static_ttl      = -1;
 int cgit_cache_max_create_time =  5;
 
 int cgit_cache_static_ttl      = -1;
 int cgit_cache_max_create_time =  5;
 
+int cgit_max_msg_len = 60;
+
 char *cgit_repo_name    = NULL;
 char *cgit_repo_desc    = NULL;
 char *cgit_repo_owner   = NULL;
 char *cgit_repo_name    = NULL;
 char *cgit_repo_desc    = NULL;
 char *cgit_repo_owner   = NULL;
@@ -36,8 +38,10 @@ char *cgit_querystring  = NULL;
 char *cgit_query_repo   = NULL;
 char *cgit_query_page   = NULL;
 char *cgit_query_head   = NULL;
 char *cgit_query_repo   = NULL;
 char *cgit_query_page   = NULL;
 char *cgit_query_head   = NULL;
+char *cgit_query_search = NULL;
 char *cgit_query_sha1   = NULL;
 char *cgit_query_sha2   = NULL;
 char *cgit_query_sha1   = NULL;
 char *cgit_query_sha2   = NULL;
+char *cgit_query_path   = NULL;
 int   cgit_query_ofs    = 0;
 
 int htmlfd = 0;
 int   cgit_query_ofs    = 0;
 
 int htmlfd = 0;
@@ -68,6 +72,8 @@ void cgit_global_config_cb(const char *name, const char *value)
                cgit_cache_static_ttl = atoi(value);
        else if (!strcmp(name, "cache-dynamic-ttl"))
                cgit_cache_dynamic_ttl = atoi(value);
                cgit_cache_static_ttl = atoi(value);
        else if (!strcmp(name, "cache-dynamic-ttl"))
                cgit_cache_dynamic_ttl = atoi(value);
+       else if (!strcmp(name, "max-message-length"))
+               cgit_max_msg_len = atoi(value);
 }
 
 void cgit_repo_config_cb(const char *name, const char *value)
 }
 
 void cgit_repo_config_cb(const char *name, const char *value)
@@ -86,6 +92,8 @@ void cgit_querystring_cb(const char *name, const char *value)
                cgit_query_repo = xstrdup(value);
        } else if (!strcmp(name, "p")) {
                cgit_query_page = xstrdup(value);
                cgit_query_repo = xstrdup(value);
        } else if (!strcmp(name, "p")) {
                cgit_query_page = xstrdup(value);
+       } else if (!strcmp(name, "q")) {
+               cgit_query_search = xstrdup(value);
        } else if (!strcmp(name, "h")) {
                cgit_query_head = xstrdup(value);
                cgit_query_has_symref = 1;
        } else if (!strcmp(name, "h")) {
                cgit_query_head = xstrdup(value);
                cgit_query_has_symref = 1;
@@ -97,6 +105,8 @@ void cgit_querystring_cb(const char *name, const char *value)
                cgit_query_has_sha1 = 1;
        } else if (!strcmp(name, "ofs")) {
                cgit_query_ofs = atoi(value);
                cgit_query_has_sha1 = 1;
        } else if (!strcmp(name, "ofs")) {
                cgit_query_ofs = atoi(value);
+       } else if (!strcmp(name, "path")) {
+               cgit_query_path = xstrdup(value);
        }
 }
 
        }
 }
 
@@ -110,3 +120,16 @@ void *cgit_free_commitinfo(struct commitinfo *info)
        free(info);
        return NULL;
 }
        free(info);
        return NULL;
 }
+
+int hextoint(char c)
+{
+       if (c >= 'a' && c <= 'f')
+               return 10 + c - 'a';
+       else if (c >= 'A' && c <= 'F')
+               return 10 + c - 'A';
+       else if (c >= '0' && c <= '9')
+               return c - '0';
+       else
+               return -1;
+}
+