aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-01-28 16:45:04 +0000
committerJason Woodward2005-01-28 16:45:04 +0000
commitf058bc2949c945af1796cd3b7842196a320c654a (patch)
tree9f7f8403831b92ff3d4c05ec6e81d34b4b9d8441 /src
parentae8fc4321869b9fbabf6f2e6168a94fb485d5efa (diff)
downloadslapt-get-f058bc2949c945af1796cd3b7842196a320c654a.tar.gz
transaction report now reports sizes in K or in M
Diffstat (limited to 'src')
-rw-r--r--src/curl.c14
-rw-r--r--src/transaction.c26
2 files changed, 31 insertions, 9 deletions
diff --git a/src/curl.c b/src/curl.c
index 16c70d0..67ccb7d 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -181,9 +181,19 @@ int download_pkg(const rc_config *global_config,pkg_info_t *pkg){
f_size = get_pkg_file_size(global_config,pkg);
if( global_config->dl_stats == TRUE ){
- printf(_("Downloading %s %s %s [%dK]...\n"),pkg->mirror,pkg->name,pkg->version,pkg->size_c - (f_size/1024));
+ int dl_total_size = pkg->size_c - (f_size/1024);
+ printf(_("Downloading %s %s %s [%0.1d%c]...\n"),
+ pkg->mirror,pkg->name,pkg->version,
+ ( dl_total_size > 1024 ) ? dl_total_size / 1024 : dl_total_size,
+ ( dl_total_size > 1024 ) ? 'M' : 'K'
+ );
}else{
- printf(_("Downloading %s %s %s [%dK]..."),pkg->mirror,pkg->name,pkg->version,pkg->size_c - (f_size/1024));
+ int dl_total_size = pkg->size_c - (f_size/1024);
+ printf(_("Downloading %s %s %s [%0.1d%c]..."),
+ pkg->mirror,pkg->name,pkg->version,
+ ( dl_total_size > 1024 ) ? dl_total_size / 1024 : dl_total_size,
+ ( dl_total_size > 1024 ) ? 'M' : 'K'
+ );
}
/* open the file to write, append if already present */
diff --git a/src/transaction.c b/src/transaction.c
index 955091f..b41a88c 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -178,11 +178,18 @@ int handle_transaction(const rc_config *global_config, transaction_t *tran){
}
if( already_download_size > 0 ){
- printf(_("Need to get %dK/%dK of archives.\n"),
- need_to_download_size, download_size
+ printf(_("Need to get %0.1d%c/%0.1d%c of archives.\n"),
+ (need_to_download_size > 1024 ) ? need_to_download_size / 1024
+ : need_to_download_size,
+ (need_to_download_size > 1024 ) ? 'M' : 'K',
+ (download_size > 1024 ) ? download_size / 1024 : download_size,
+ (download_size > 1024 ) ? 'M' : 'K'
);
}else{
- printf(_("Need to get %dK of archives.\n"), download_size );
+ printf(_("Need to get %0.1d%c of archives.\n"),
+ (download_size > 1024 ) ? download_size / 1024 : download_size,
+ (download_size > 1024 ) ? 'M' : 'K'
+ );
}
}
@@ -191,12 +198,17 @@ int handle_transaction(const rc_config *global_config, transaction_t *tran){
if( global_config->download_only == FALSE ){
if( (int)uncompressed_size < 0 ){
- printf(_("After unpacking %dK disk space will be freed.\n"),
- uncompressed_size * -1
+ uncompressed_size *= -1;
+ printf(_("After unpacking %0.1d%c disk space will be freed.\n"),
+ (uncompressed_size > 1024 ) ? uncompressed_size / 1024
+ : uncompressed_size,
+ (uncompressed_size > 1024 ) ? 'M' : 'K'
);
}else{
- printf(_("After unpacking %dK of additional disk space will be used.\n"),
- uncompressed_size
+ printf(_("After unpacking %0.1d%c of additional disk space will be used.\n"),
+ (uncompressed_size > 1024 ) ? uncompressed_size / 1024
+ : uncompressed_size,
+ (uncompressed_size > 1024 ) ? 'M' : 'K'
);
}
}