69 |
|
char *size_conv(long long number){ |
70 |
|
char type[] = {'B', 'K', 'M', 'G', 'T'}; |
71 |
|
int x=0; |
72 |
+ |
int sign=1; |
73 |
|
static char string[10]; |
74 |
|
|
75 |
+ |
if(number < 0){ |
76 |
+ |
sign=-1; |
77 |
+ |
number=-number; |
78 |
+ |
} |
79 |
+ |
|
80 |
|
for(;x<5;x++){ |
81 |
|
if( (number/1024) < (100)) { |
82 |
|
break; |
84 |
|
number = (number/1024); |
85 |
|
} |
86 |
|
|
87 |
< |
snprintf(string, 10, "%lld%c", number, type[x]); |
87 |
> |
number = number*sign; |
88 |
> |
|
89 |
> |
snprintf(string, 10, "%lld%c", number, type[x]); |
90 |
|
return string; |
91 |
|
|
92 |
|
} |
385 |
|
move(line, 62); |
386 |
|
printw("%7s", size_conv(disk_stat_ptr->avail)); |
387 |
|
move(line, 73); |
388 |
< |
printw("%5.2f%%", 100.00 * ((float) disk_stat_ptr->used / (float) (disk_stat_ptr->used + disk_stat_ptr->avail))); |
388 |
> |
printw("%6.2f%%", 100.00 * ((float) disk_stat_ptr->used / (float) (disk_stat_ptr->used + disk_stat_ptr->avail))); |
389 |
|
disk_stat_ptr++; |
390 |
|
line++; |
391 |
|
} |
394 |
|
refresh(); |
395 |
|
} |
396 |
|
|
397 |
< |
void sig_winch_handler(int sig){ |
397 |
> |
void sig_winch_handler(int dummy){ |
398 |
|
clear(); |
399 |
|
display_headings(); |
400 |
|
display_data(); |