* info.c (info_show_info): Use size_trunc_len() instead of

print_bytesize().  Don't assume English word ordering.  Add
singular message when single block.
* win.c (print_bytesize): Remove.
(sprint_bytesize): Remove.
* win.h: Remove print_bytesize() and sprint_bytesize().
This commit is contained in:
Pavel Roskin 2001-08-30 16:58:40 +00:00
parent 1ef25591d2
commit 28ed7f82c0
4 changed files with 20 additions and 39 deletions

View File

@ -1,5 +1,12 @@
2001-08-30 David Martin <dmartina@excite.es>
* info.c (info_show_info): Use size_trunc_len() instead of
print_bytesize(). Don't assume English word ordering. Add
singular message when single block.
* win.c (print_bytesize): Remove.
(sprint_bytesize): Remove.
* win.h: Remove print_bytesize() and sprint_bytesize().
* util.c (size_trunc_len): Add units parameter. Change all
callers.

View File

@ -30,7 +30,7 @@
#include "dir.h" /* required by panel */
#include "panel.h" /* for the panel structure */
#include "main.h" /* opanel, cpanel definitions */
#include "win.h" /* print_bytesize */
#include "util.h" /* size_trunc_len */
#include "layout.h"
#include "key.h" /* is_idle() */
#include "x.h"
@ -110,7 +110,7 @@ info_show_info (WInfo *info)
case 16:
widget_move (&info->widget, 16, 3);
if (myfs_stats.nfree >0 || myfs_stats.nodes > 0)
printw (_("Free nodes %d (%d%%) of %d"),
printw (_("Free nodes: %d (%d%%) of %d"),
myfs_stats.nfree,
myfs_stats.total
? 100 * myfs_stats.nfree / myfs_stats.nodes : 0,
@ -121,11 +121,11 @@ info_show_info (WInfo *info)
case 15:
widget_move (&info->widget, 15, 3);
if (myfs_stats.avail > 0 || myfs_stats.total > 0){
addstr (_("Free space "));
print_bytesize (myfs_stats.avail, 1);
printw (_(" (%d%%) of "), myfs_stats.total
? 100 * myfs_stats.avail / myfs_stats.total : 0);
print_bytesize (myfs_stats.total, 1);
char buffer1 [6], buffer2[6];
size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
size_trunc_len (buffer2, 5, myfs_stats.total, 1);
printw (_("Free space: %s (%d%%) of %s"), buffer1, myfs_stats.total ?
100 * myfs_stats.avail / myfs_stats.total : 0, buffer2);
} else
addstr (_("No space information"));
@ -167,10 +167,12 @@ info_show_info (WInfo *info)
#endif
#endif
{
printw (_("Size: "));
print_bytesize (buf.st_size, 0);
char buffer[10];
size_trunc_len(buffer, 9, buf.st_size, 0);
printw (_("Size: %s"), buffer);
#ifdef HAVE_ST_BLOCKS
printw (_(" (%d blocks)"), buf.st_blocks);
printw ((buf.st_blocks==1) ?
_(" (%d block)") : _(" (%d blocks)"), buf.st_blocks);
#endif
}
@ -194,7 +196,7 @@ info_show_info (WInfo *info)
case 3:
widget_move (&info->widget, 3, 2);
/* .ado: fname is invalid if selected == 0 && ifno called from current panel */
/* .ado: fname is invalid if selected == 0 && info called from current panel */
if (cpanel->selected){
printw (file_label,
name_trunc (cpanel->dir.list [cpanel->selected].fname,

View File

@ -44,31 +44,6 @@ typedef struct Fkey_Table_List {
static Fkey_Table_List *fkey_table_list = NULL;
/* Width of output is always seven characters */
void sprint_bytesize (char *buffer, int size, int scale)
{
char scales[] = " kMGT";
if (size > 0){
while (size > 9999 && scale < sizeof (scales)){
size = (size + 512) / 1024;
scale ++;
}
}
if (scale > 0)
g_snprintf (buffer, 10, "%4d %cb", size, scales[scale]);
else
g_snprintf (buffer, 10, "%4d b ", size);
}
void print_bytesize (int size, int scale)
{
char buffer [10];
sprint_bytesize (buffer, size, scale);
printw (buffer);
}
/* Return values: 0 = not a fkey, other = was a fkey */
int check_fkeys (int c)
{

View File

@ -4,9 +4,6 @@
/* Window utilities */
#include "dlg.h"
void print_bytesize (int size, int scale);
void sprint_bytesize (char *buffer, int size, int scale);
/* Labels at the screen bottom */
/* Keys managing */