From ece2fe900bda084db33547d89a13ed7a7cfb4578 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 27 Jun 2020 16:30:53 +0200 Subject: [PATCH] distroquery: various fixes --- src/CMakeLists.txt | 3 ++- src/distromatic.c | 2 +- src/distroquery.c | 57 +++++++++++++++++++++++----------------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c5ad379..7869e53 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,8 @@ list(GET VERSION_LIST 1 RPM_VERSION_MINOR) list(GET VERSION_LIST 2 RPM_VERSION_MICRO) add_compile_definitions( - PACKAGE="Distromatic" + PACKAGE="distromatic" + PACKAGE_NAME="Distromatic" PACKAGE_VERSION="1.5.0" DEFAULT_CONFIGFILE="/etc/distromatic.conf" off64_t=__off64_t diff --git a/src/distromatic.c b/src/distromatic.c index b83e44c..a785baf 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -112,7 +112,7 @@ int compareRequiredList(const void *ptr1, const void *ptr2); int handleObsoletedPackages(struct configTag *ct, int arch); static const char *copyright[] = { -PACKAGE " version " PACKAGE_VERSION, +PACKAGE_NAME " version " PACKAGE_VERSION, "Copyright (C) 2004-2020 by Silvan Calarco ", "Copyright (C) 2006 by Davide Madrisan ", (char *)0 diff --git a/src/distroquery.c b/src/distroquery.c index bd1569d..8b56e69 100644 --- a/src/distroquery.c +++ b/src/distroquery.c @@ -93,12 +93,12 @@ char query_next[PATH_MAX] = ""; char *reply_xmltag = "queryreply"; int reply_plain = 0; char *lang = ""; -int query_archs[ARCHS_MAX] = { 1, 0, 0, 0, 0 }; +int query_archs[ARCHS_MAX] = { 0, 1, 0, 0, 0 }; char *query_path = NULL; struct configTag *query_repositories[100]; -int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 1, search_devel = 1; +int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 0, search_devel = 1; int search_sources = 0, searchbox = 0; int search_files = 0; @@ -186,12 +186,12 @@ void printRPMFlags(int flags) { void printTagsLine(const char* arch, const char* tag, const char* group, const char* license) { if (!arch) - printf("
%s
 ", _("Source")); + printf("
%s
 ", _("Source")); else - printf("
%s
 ", arch); - printf("
%s
 " - "
 %s 
 " - "
 %s 
", + printf("
%s
 ", arch); + printf("
%s
 " + "
%s
 " + "
%s
", tag, group, license); } @@ -442,7 +442,7 @@ void printFileBrowser() { snprintf(sql, PATH_MAX, "SELECT * FROM files WHERE" " parent=%d" " ORDER BY name", startid); - printf(""); + printf("
"); if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) { while (sqlite3_step(stmt1) == SQLITE_ROW) { snprintf(sql, PATH_MAX, "SELECT * FROM packages_files_rel,fileusers,filegroups WHERE" @@ -456,21 +456,18 @@ void printFileBrowser() { cnt++; flags = sqlite3_column_int(stmt2,sqlite3_find_column_id(stmt2, "packages_files_rel", "flags")); if (flags >> 12 & 4) { - printf("" - "" - "", + expandFileFlags(flags, sql), sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")), sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")), - expandFileFlags(flags, sql), query_repository, query_arch, query_path, sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")), sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name"))); } else { - printf("" - "", + printf("", sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")), sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")), expandFileFlags(flags, sql), @@ -485,8 +482,8 @@ void printFileBrowser() { sqlite3_finalize(stmt2); } if (cnt == 0) { - printf("" - "" + printf("" "", query_repository, query_arch, @@ -584,7 +581,7 @@ void printQueryResponse() { query_repositories[i]->tag, (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")), (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "license"))); - printf("
 ", buffer); + printf("

 ", buffer); sqlite3_finalize(stmt1); } if (query_compact) { @@ -618,9 +615,10 @@ void printQueryResponse() { sqlite3_column_text(statement,6), sqlite3_column_text(statement,1));*/ + printf("
"); /* download */ if (!query_repositories[i]->arch[a]) { - printf("
" + printf("
" " %s 
", query_repositories[i]->download_prefix, query_repositories[i]->download_dir, @@ -629,10 +627,11 @@ void printQueryResponse() { sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")), _("Download")); } else { - printf("
" - " %s 
", + printf("
" + " %s 
", query_repositories[i]->download_prefix, query_repositories[i]->download_dir, + query_repositories[i]->arch[a], sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")), @@ -641,7 +640,7 @@ void printQueryResponse() { } /* details */ - printf(" 
" + printf(" 
" " %s 
", query_repositories[i]->tag, @@ -1153,7 +1152,7 @@ void printPackageData() { htmlclean((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX)); /* download */ - printf("
" + printf("
" " %s 
", ct->download_prefix, ct->download_dir, @@ -1164,7 +1163,7 @@ void printPackageData() { query_arch, _("Download")); - printf("

%s:",_("Developers details")); + printf("



%s:",_("Developers details")); printf("
%s:", _("Source package")); printf(" %s", @@ -1317,17 +1316,17 @@ void printPackageData() { /* files list */ snprintf(dbname, PATH_MAX, "%s%s-%s-files.db", ct->repository_dir, ct->tag, query_arch); if (!sqlite3_open_v2(dbname, &dbf, SQLITE_OPEN_READONLY, NULL)) { - printf("

%s:
%s%s%s" + printf("
%s%s%s" "%s
%s%s%s%s
%s%s%s%s
%s
" + "%s
", _("Files list")); + printf("

%s:
", _("Files list")); snprintf(sql, PATH_MAX, "SELECT * FROM packages_files_rel,fileusers,filegroups WHERE" " packages_files_rel.name='%s' AND" " packages_files_rel.id_user=fileusers.id AND " " packages_files_rel.id_group=filegroups.id", query_package); if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) { while (sqlite3_step(stmt1) == SQLITE_ROW) { - printf("", + printf("", + expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql), sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "fileusers", "name")), sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "filegroups", "name")), - expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql), resolveFilePath(dbf, sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "id_file")), buffer)); } sqlite3_finalize(stmt1); @@ -1422,7 +1421,7 @@ void printSourcePackageData() { htmlclean((char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX)); /* download */ - printf("
" + printf("
" " %s 
", ct->download_prefix, ct->download_dir, @@ -1431,7 +1430,7 @@ void printSourcePackageData() { (char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")), _("Download")); - printf("

%s:", _("Developers details")); + printf("



%s:", _("Developers details")); printf("
%s: %s", _("Maintainer"), (char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name"))); printf("
%s: %s", _("Build date"), @@ -1626,7 +1625,6 @@ main(int argc, char *argv[]) // 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"); @@ -1645,6 +1643,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, lang); bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); if (query_package && strlen(query_package)) {
%s%s%s%s
%s%s%s%s