|
diff --git a/shared.c b/shared.c index 7eb2b0e..4fab1c9 100644 --- a/ shared.c+++ b/ shared.c |
|
@@ -41,32 +41,33 @@ int cgit_summary_log = 0; |
41 | int cgit_summary_tags = 0; |
41 | int cgit_summary_tags = 0; |
42 | int cgit_summary_branches = 0; |
42 | int cgit_summary_branches = 0; |
43 | int cgit_renamelimit = -1; |
43 | int cgit_renamelimit = -1; |
44 | |
44 | |
45 | int cgit_max_msg_len = 60; |
45 | int cgit_max_msg_len = 60; |
46 | int cgit_max_repodesc_len = 60; |
46 | int cgit_max_repodesc_len = 60; |
47 | int cgit_max_commit_count = 50; |
47 | int cgit_max_commit_count = 50; |
48 | |
48 | |
49 | int cgit_query_has_symref = 0; |
49 | int cgit_query_has_symref = 0; |
50 | int cgit_query_has_sha1 = 0; |
50 | int cgit_query_has_sha1 = 0; |
51 | |
51 | |
52 | char *cgit_querystring = NULL; |
52 | char *cgit_querystring = NULL; |
53 | char *cgit_query_repo = NULL; |
53 | char *cgit_query_repo = NULL; |
54 | char *cgit_query_page = NULL; |
54 | char *cgit_query_page = NULL; |
55 | char *cgit_query_head = NULL; |
55 | char *cgit_query_head = NULL; |
56 | char *cgit_query_search = NULL; |
56 | char *cgit_query_search = NULL; |
| |
57 | char *cgit_query_grep = NULL; |
57 | char *cgit_query_sha1 = NULL; |
58 | char *cgit_query_sha1 = NULL; |
58 | char *cgit_query_sha2 = NULL; |
59 | char *cgit_query_sha2 = NULL; |
59 | char *cgit_query_path = NULL; |
60 | char *cgit_query_path = NULL; |
60 | char *cgit_query_name = NULL; |
61 | char *cgit_query_name = NULL; |
61 | int cgit_query_ofs = 0; |
62 | int cgit_query_ofs = 0; |
62 | |
63 | |
63 | int htmlfd = 0; |
64 | int htmlfd = 0; |
64 | |
65 | |
65 | |
66 | |
66 | int cgit_get_cmd_index(const char *cmd) |
67 | int cgit_get_cmd_index(const char *cmd) |
67 | { |
68 | { |
68 | static char *cmds[] = {"log", "commit", "diff", "tree", "blob", |
69 | static char *cmds[] = {"log", "commit", "diff", "tree", "blob", |
69 | "snapshot", "tag", "refs", NULL}; |
70 | "snapshot", "tag", "refs", NULL}; |
70 | int i; |
71 | int i; |
71 | |
72 | |
72 | for(i = 0; cmds[i]; i++) |
73 | for(i = 0; cmds[i]; i++) |
@@ -219,32 +220,34 @@ void cgit_global_config_cb(const char *name, const char *value) |
219 | else |
220 | else |
220 | cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value)); |
221 | cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value)); |
221 | } else if (!strcmp(name, "include")) |
222 | } else if (!strcmp(name, "include")) |
222 | cgit_read_config(value, cgit_global_config_cb); |
223 | cgit_read_config(value, cgit_global_config_cb); |
223 | } |
224 | } |
224 | |
225 | |
225 | void cgit_querystring_cb(const char *name, const char *value) |
226 | void cgit_querystring_cb(const char *name, const char *value) |
226 | { |
227 | { |
227 | if (!strcmp(name,"r")) { |
228 | if (!strcmp(name,"r")) { |
228 | cgit_query_repo = xstrdup(value); |
229 | cgit_query_repo = xstrdup(value); |
229 | cgit_repo = cgit_get_repoinfo(value); |
230 | cgit_repo = cgit_get_repoinfo(value); |
230 | } else if (!strcmp(name, "p")) { |
231 | } else if (!strcmp(name, "p")) { |
231 | cgit_query_page = xstrdup(value); |
232 | cgit_query_page = xstrdup(value); |
232 | cgit_cmd = cgit_get_cmd_index(value); |
233 | cgit_cmd = cgit_get_cmd_index(value); |
233 | } else if (!strcmp(name, "url")) { |
234 | } else if (!strcmp(name, "url")) { |
234 | cgit_parse_url(value); |
235 | cgit_parse_url(value); |
| |
236 | } else if (!strcmp(name, "qt")) { |
| |
237 | cgit_query_grep = xstrdup(value); |
235 | } else if (!strcmp(name, "q")) { |
238 | } else if (!strcmp(name, "q")) { |
236 | cgit_query_search = xstrdup(value); |
239 | cgit_query_search = xstrdup(value); |
237 | } else if (!strcmp(name, "h")) { |
240 | } else if (!strcmp(name, "h")) { |
238 | cgit_query_head = xstrdup(value); |
241 | cgit_query_head = xstrdup(value); |
239 | cgit_query_has_symref = 1; |
242 | cgit_query_has_symref = 1; |
240 | } else if (!strcmp(name, "id")) { |
243 | } else if (!strcmp(name, "id")) { |
241 | cgit_query_sha1 = xstrdup(value); |
244 | cgit_query_sha1 = xstrdup(value); |
242 | cgit_query_has_sha1 = 1; |
245 | cgit_query_has_sha1 = 1; |
243 | } else if (!strcmp(name, "id2")) { |
246 | } else if (!strcmp(name, "id2")) { |
244 | cgit_query_sha2 = xstrdup(value); |
247 | cgit_query_sha2 = xstrdup(value); |
245 | cgit_query_has_sha1 = 1; |
248 | cgit_query_has_sha1 = 1; |
246 | } else if (!strcmp(name, "ofs")) { |
249 | } else if (!strcmp(name, "ofs")) { |
247 | cgit_query_ofs = atoi(value); |
250 | cgit_query_ofs = atoi(value); |
248 | } else if (!strcmp(name, "path")) { |
251 | } else if (!strcmp(name, "path")) { |
249 | cgit_query_path = trim_end(value, '/'); |
252 | cgit_query_path = trim_end(value, '/'); |
250 | } else if (!strcmp(name, "name")) { |
253 | } else if (!strcmp(name, "name")) { |
|