diff --git a/src/distroquery.c b/src/distroquery.c index b20696a..ae623d8 100644 --- a/src/distroquery.c +++ b/src/distroquery.c @@ -363,9 +363,10 @@ void printPackageData() { int a, i, j, k; char dbname[PATH_MAX]; - sqlite3 *db, *dbs; - sqlite3_stmt *statement, *stmt1; + sqlite3 *db, *dbs, *dba; + sqlite3_stmt *statement, *stmt1, *stmt2; char sql[PATH_MAX]; + char buffer[PATH_MAX]; struct configTag* ct = findRepositoryByTag(query_repository); sizeString strsize; @@ -395,7 +396,7 @@ void printPackageData() { "
%s
 " "
 %s 
 " "
 %s 


" - "

%s - %s

Version: %s-%s
Size: %s", + "

%s - %s

Version: %s-%s
URL: %s
Size: %s", query_arch, ct->tag, sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")), @@ -404,10 +405,25 @@ void printPackageData() { sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")), + sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")), + sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")), humanSize(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "size")), &strsize)); + printf("
Related packages:"); + snprintf(sql, PATH_MAX, "SELECT * FROM packages WHERE id_source=%d AND NOT id=%d", + sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id_source")), + sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id"))); + if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt2, NULL) == SQLITE_OK) + while (sqlite3_step(stmt2) == SQLITE_ROW) + printf(" %s(%s)", + ct->tag, + sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")), + query_arch, + sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")), + query_arch); + printf("

%s

", - sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description"))); + htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX)); printf("
Developers details:"); @@ -473,6 +489,7 @@ void printSourcePackageData() { sqlite3 *db, *dba; sqlite3_stmt *statement, *stmt1; char sql[PATH_MAX]; + char buffer[PATH_MAX]; struct configTag* ct = findRepositoryByTag(query_repository); humanDate strdate; sizeString strsize; @@ -528,10 +545,10 @@ void printSourcePackageData() { } printf("

%s

", - sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description"))); + htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX)); printf("
Developers details:"); - printf("

Maintainer: %s", sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name"))); + printf("
Maintainer: %s", sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name"))); printf("
Build date: %s", simpleTimeToHuman(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime")), (humanDate *) & strdate));