distroquery.cpp: realign main code

This commit is contained in:
Silvan Calarco 2024-05-30 13:15:44 +02:00
parent 659b2ba778
commit 6732bdccfe

View File

@ -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<distroquery>");
else
printf("Content-Type: text/html;charset=utf-8\n\n");
if (!reply_plain)
printf("Content-Type: text/xml;charset=utf-8\n\n<distroquery>");
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("</distroquery>\n");
exit(0);
if (!reply_plain) printf("</distroquery>\n");
exit(0);
}