From c7f47f3adfa3a039c77a2fb855bb9d4640dd38ae Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 29 Mar 2015 23:45:03 +0200 Subject: [PATCH] distroquery: make prefix to search page configurable (URL_SEARCH_PREFIX) --- src/distroquery.c | 12 ++++++++---- src/functions.c | 3 +++ src/include/distromatic.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/distroquery.c b/src/distroquery.c index d0405fd..24f15b8 100644 --- a/src/distroquery.c +++ b/src/distroquery.c @@ -585,9 +585,10 @@ void printQueryResponse() { sqlite3_finalize(stmt1); } if (query_compact) { - printf("" "%s %s-%s - %s
", + query_repositories[i]->configdefaults->url_search_prefix, query_repositories[i]->tag, (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), query_repositories[i]->arch[a], @@ -660,9 +661,10 @@ void printQueryResponse() { if (query_compact) { - printf("" "%s (%s-%s) %s %s
", + query_repositories[i]->configdefaults->url_search_prefix, query_repositories[i]->tag, sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packages", "name")), query_repositories[i]->arch[a], @@ -775,9 +777,10 @@ void printQueryResponse() { printf("
 ", buffer); if (query_compact) { - printf("" "%s %s-%s - %s
", + query_repositories[i]->configdefaults->url_search_prefix, query_repositories[i]->tag, (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), @@ -1015,9 +1018,10 @@ void printSpecialQueryResponse() { } printf("%s  ", strdate, buffer); - printf("" "%s %s-%s", + query_repositories[i]->configdefaults->url_search_prefix, ct->tag, (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX), diff --git a/src/functions.c b/src/functions.c index dcffa4a..2bd1015 100644 --- a/src/functions.c +++ b/src/functions.c @@ -249,6 +249,9 @@ struct configTag* read_configuration(const char *confFile) } else if (!strcmp(vartok, "URL_PREFIX")) { configdefaults.url_prefix = (char *) strdup(valuetok); + } else if (!strcmp(vartok, "URL_SEARCH_PREFIX")) { + configdefaults.url_search_prefix = + (char *) strdup(valuetok); } else if (!strcmp(vartok, "URL_DIR")) { configdefaults.url_dir = (char *) strdup(valuetok); diff --git a/src/include/distromatic.h b/src/include/distromatic.h index cc7c081..c58bea4 100644 --- a/src/include/distromatic.h +++ b/src/include/distromatic.h @@ -16,6 +16,7 @@ struct configDefaults { char *distribution_name; char *url_address; char *url_prefix; + char *url_search_prefix; char *url_dir; char *arch[ARCHS_MAX]; };