From 6732bdccfea5cf8117082976e9b1d1ab65d04459 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 30 May 2024 13:15:44 +0200 Subject: [PATCH] distroquery.cpp: realign main code --- src/distroquery.cpp | 76 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/distroquery.cpp b/src/distroquery.cpp index 4e1d7ff..22fcd73 100644 --- a/src/distroquery.cpp +++ b/src/distroquery.cpp @@ -1608,52 +1608,52 @@ void parse_request_variables(char *data) { int main(int argc, char *argv[]) { + char *data; + int responsed = 0; - char *data; - int responsed = 0; + // install backtrace handler + signal(SIGSEGV, backtraceHandler); - // install backtrace handler - signal(SIGSEGV, backtraceHandler); + firstconfigtag = read_configuration(DEFAULT_CONFIGFILE); + if (!firstconfigtag) { + fprintf(stderr, "Fatal error while parsing config file " DEFAULT_CONFIGFILE "; aborting.\n"); + exit(1); + } - firstconfigtag = read_configuration(DEFAULT_CONFIGFILE); - if (!firstconfigtag) { - fprintf(stderr, "Fatal error while parsing config file " DEFAULT_CONFIGFILE "; aborting.\n"); - exit(1); - } + data = getenv("QUERY_STRING"); + if (data && strlen(data)) { + parse_request_variables(data); + } - data = getenv("QUERY_STRING"); - if (data && strlen(data)) { - parse_request_variables(data); - } - if (!reply_plain) - printf("Content-Type: text/xml;charset=utf-8\n\n"); - else - printf("Content-Type: text/html;charset=utf-8\n\n"); + if (!reply_plain) + printf("Content-Type: text/xml;charset=utf-8\n\n"); + else + printf("Content-Type: text/html;charset=utf-8\n\n"); - setlocale(LC_ALL, lang); - bindtextdomain(PACKAGE, LOCALEDIR); + setlocale(LC_ALL, lang); + bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); + textdomain(PACKAGE); - if (query_package && strlen(query_package)) { - if (query_arch) - printPackageData(); - else - printSourcePackageData(); - responsed = 1; - } else if (query && strlen(query)) { - if (query[0] == '$') - printSpecialQueryResponse(); - else - printQueryResponse(); - responsed = 1; - } else if (query_path) { - printFileBrowser(); - } + if (query_package && strlen(query_package)) { + if (query_arch) + printPackageData(); + else + printSourcePackageData(); + responsed = 1; + } else if (query && strlen(query)) { + if (query[0] == '$') + printSpecialQueryResponse(); + else + printQueryResponse(); + responsed = 1; + } else if (query_path) { + printFileBrowser(); + } - if (!responsed || (responsed && searchbox)) printInputForm(); + if (!responsed || (responsed && searchbox)) printInputForm(); - if (!reply_plain) printf("\n"); - exit(0); + if (!reply_plain) printf("\n"); + exit(0); }