aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-01-18 17:30:35 +0000
committerJason Woodward2005-01-18 17:30:35 +0000
commitd2cf54bbcfcb3f325610df64c1cc6c362fcb20c3 (patch)
tree1cebedf32e4611a3a007af78a3e95b7767690aed /src
parent7ef9e49f07676226af72501d96364c7aaa07057d (diff)
downloadslapt-get-d2cf54bbcfcb3f325610df64c1cc6c362fcb20c3.tar.gz
formatted transaction report so that package names wrap at 80 chars
Diffstat (limited to 'src')
-rw-r--r--src/transaction.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/transaction.c b/src/transaction.c
index d71ea35..807a746 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -59,10 +59,17 @@ int handle_transaction(const rc_config *global_config, transaction_t *tran){
/* show pkgs to install */
if( tran->install_pkgs->pkg_count > 0 ){
+ int len = 0;
printf(_("The following NEW packages will be installed:\n"));
printf(" ");
for(i = 0; i < tran->install_pkgs->pkg_count;i++){
- printf("%s ",tran->install_pkgs->pkgs[i]->name);
+ if( len + strlen(tran->install_pkgs->pkgs[i]->name) + 1 < 80 ){
+ printf("%s ",tran->install_pkgs->pkgs[i]->name);
+ len += strlen(tran->install_pkgs->pkgs[i]->name) + 1;
+ }else{
+ printf("\n %s ",tran->install_pkgs->pkgs[i]->name);
+ len = strlen(tran->install_pkgs->pkgs[i]->name) + 3;
+ }
already_download_size += get_pkg_file_size(
global_config,tran->install_pkgs->pkgs[i]
) / 1024;
@@ -74,10 +81,17 @@ int handle_transaction(const rc_config *global_config, transaction_t *tran){
/* show pkgs to remove */
if( tran->remove_pkgs->pkg_count > 0 ){
+ int len = 0;
printf(_("The following packages will be REMOVED:\n"));
printf(" ");
for(i = 0; i < tran->remove_pkgs->pkg_count;i++){
- printf("%s ",tran->remove_pkgs->pkgs[i]->name);
+ if( len + strlen(tran->remove_pkgs->pkgs[i]->name) + 1 < 80 ){
+ printf("%s ",tran->remove_pkgs->pkgs[i]->name);
+ len += strlen(tran->remove_pkgs->pkgs[i]->name) + 1;
+ }else{
+ printf("\n %s ",tran->remove_pkgs->pkgs[i]->name);
+ len = strlen(tran->remove_pkgs->pkgs[i]->name) + 3;
+ }
uncompressed_size -= tran->remove_pkgs->pkgs[i]->size_u;
}
printf("\n");
@@ -85,10 +99,17 @@ int handle_transaction(const rc_config *global_config, transaction_t *tran){
/* show pkgs to upgrade */
if( tran->upgrade_pkgs->pkg_count > 0 ){
+ int len = 0;
printf(_("The following packages will be upgraded:\n"));
printf(" ");
for(i = 0; i < tran->upgrade_pkgs->pkg_count;i++){
- printf("%s ",tran->upgrade_pkgs->pkgs[i]->upgrade->name);
+ if( len + strlen(tran->upgrade_pkgs->pkgs[i]->upgrade->name) + 1 < 80 ){
+ printf("%s ",tran->upgrade_pkgs->pkgs[i]->upgrade->name);
+ len += strlen(tran->upgrade_pkgs->pkgs[i]->upgrade->name) + 1;
+ }else{
+ printf("\n %s ",tran->upgrade_pkgs->pkgs[i]->upgrade->name);
+ len = strlen(tran->upgrade_pkgs->pkgs[i]->upgrade->name) + 3;
+ }
already_download_size += get_pkg_file_size(
global_config,tran->upgrade_pkgs->pkgs[i]->upgrade
) / 1024;