diff options
-rw-r--r-- | cgit-70.c | 23 | ||||
-rw-r--r-- | cmd_70.c | 2 | ||||
-rw-r--r-- | html.c | 1 | ||||
-rw-r--r-- | ui_70-repolist.c | 12 | ||||
-rw-r--r-- | ui_70-shared.c | 12 |
5 files changed, 36 insertions, 14 deletions
@@ -384,7 +384,7 @@ static void prepare_context(void) ctx.cfg.renamelimit = -1; ctx.cfg.remove_suffix = 0; ctx.cfg.robots = "index, nofollow"; - ctx.cfg.root_title = "Git repository browser over Gopher"; + ctx.cfg.root_title = "cgit-70 -- Git repository browser over Gopher"; ctx.cfg.root_desc = "a fast Gopher interface for the git dscm"; ctx.cfg.scan_hidden_path = 0; ctx.cfg.script_name = CGIT_SCRIPT_NAME; @@ -402,7 +402,6 @@ static void prepare_context(void) ctx.env.no_http = getenv("NO_HTTP"); ctx.env.path_info = getenv("PATH_INFO"); ctx.env.query_string = getenv("QUERY_STRING"); - fprintf(stdout, "i -- QUERY_STRING: '%s'\n", ctx.env.query_string); ctx.env.request_method = getenv("REQUEST_METHOD"); ctx.env.script_name = getenv("SCRIPT_NAME"); ctx.env.server_name = getenv("SERVER_NAME"); @@ -953,24 +952,34 @@ static void cgit_parse_args(int argc, const char **argv) switch (++argc){ case 5: ctx.env.server_port = xstrdup(argv[4]); +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- port: %s\n", ctx.env.server_port); +#endif case 4: ctx.env.server_name = xstrdup(argv[3]); +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- hostname: %s\n", ctx.env.server_name); +#endif case 3: if (strlen(argv[2])){ ctx.env.query_string = xstrdup(argv[2]); ctx.qry.raw = xstrdup(argv[2]); } +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- query_string: '%s'\n", ctx.env.query_string); +#endif case 2: if (strlen(argv[1])){ ctx.env.gopher_search = xstrdup(argv[1]); } +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- gopher_search: %s\n", ctx.env.gopher_search); +#endif case 1: ctx.env.script_name = xstrdup(argv[0]); +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- script_name: %s\n", ctx.env.script_name); +#endif } } @@ -1000,7 +1009,7 @@ static int calc_ttl(void) int cmd_main(int argc, const char **argv) { - const char *path; + /*const char *path;*/ int err, ttl; @@ -1012,10 +1021,14 @@ int cmd_main(int argc, const char **argv) cgit_parse_args(argc, argv); parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); ctx.repo = NULL; +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- cmd_main -- ctx.qry.raw: %s\n", ctx.qry.raw); +#endif http_parse_querystring(ctx.qry.raw, querystring_cb); +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- cmd_main -- got url: %s\n", ctx.qry.url); +#endif /* If virtual-root isn't specified in cgitrc, lets pretend * that virtual-root equals SCRIPT_NAME, minus any possibly @@ -1029,8 +1042,8 @@ int cmd_main(int argc, const char **argv) * urls without the need for rewriterules in the webserver (as * long as PATH_INFO is included in the cache lookup key). */ - path = ctx.env.path_info; -/* if (!ctx.qry.url && path) { +/* path = ctx.env.path_info; + if (!ctx.qry.url && path) { if (path[0] == '/') path++; ctx.qry.url = xstrdup(path); @@ -174,7 +174,9 @@ static void stats_fn(void) static void summary_fn(void) { +#ifdef DEBUG_GOPHER fprintf(stderr, " ---- selected function: cgit_print_summary\n"); +#endif cgit_print_summary(); } @@ -335,7 +335,6 @@ void http_parse_querystring(const char *txt, void (*fn)(const char *name, const while (t && *t) { char *name = url_decode_parameter_name(&t); if (*name) { - fprintf(stderr, "http_parse_querystring -- name: %s\n", name); char *value = url_decode_parameter_value(&t); fn(name, value); free(value); diff --git a/ui_70-repolist.c b/ui_70-repolist.c index fd1c0e1..40d9619 100644 --- a/ui_70-repolist.c +++ b/ui_70-repolist.c @@ -97,18 +97,21 @@ static int is_match(struct cgit_repo *repo) return 1; if (repo->owner && strcasestr(repo->owner, ctx.qry.search)) return 1; - fprintf(stdout, "i -- is_match has failed\n"); return 0; } static int is_in_url(struct cgit_repo *repo) { if (!ctx.qry.url){ +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- ctx.qry.url is NULL\n"); +#endif return 1; } if (repo->url && starts_with(repo->url, ctx.qry.url)){ +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- repo URL not in qry.url\n"); +#endif return 1; } return 0; @@ -117,11 +120,15 @@ static int is_in_url(struct cgit_repo *repo) static int is_visible(struct cgit_repo *repo) { if (repo->hide || repo->ignore){ +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- repo: '%s' is invisible or ignored", repo->name); +#endif return 0; } if (!(is_match(repo) && is_in_url(repo))){ +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- !(is_match(repo) && is_in_url(repo))\n"); +#endif return 0; } return 1; @@ -131,8 +138,9 @@ static int any_repos_visible(void) { int i; +#ifdef DEBUG_GOPHER fprintf(stdout, "i -- ctx.qry.search: %s\n", ctx.qry.search); - +#endif for (i = 0; i < cgit_repolist.count; i++) { if (is_visible(&cgit_repolist.repos[i])) return 1; diff --git a/ui_70-shared.c b/ui_70-shared.c index 02376b2..bad38a5 100644 --- a/ui_70-shared.c +++ b/ui_70-shared.c @@ -1152,17 +1152,17 @@ static void print_header(void) { if (ctx.repo) { cgit_index_link("index", NULL, NULL, NULL, NULL, 0, 1); - cgit_gopher_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); - } else - cgit_gopher_info(ctx.cfg.root_title); - if (ctx.repo) { cgit_gopher_start_selector(GOPHER_INFO); - cgit_gopher_text("Owner: "); + cgit_gopher_text("Repository: "); + cgit_gopher_text(ctx.repo->name); + cgit_gopher_text(" (owned by "); cgit_gopher_text(ctx.repo->owner); + cgit_gopher_text(")"); cgit_gopher_tab(); cgit_gopher_selector_link("Err"); cgit_gopher_end_selector(); - } + } else + cgit_gopher_info(ctx.cfg.root_title); } void cgit_print_pageheader(void) |