--- projects/libstatgrab/src/saidar/saidar.c 2004/04/07 15:50:26 1.29 +++ projects/libstatgrab/src/saidar/saidar.c 2005/01/17 16:34:26 1.33 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: saidar.c,v 1.29 2004/04/07 15:50:26 tdb Exp $ + * $Id: saidar.c,v 1.33 2005/01/17 16:34:26 tdb Exp $ */ #ifdef HAVE_CONFIG_H @@ -69,8 +69,14 @@ stats_t stats; char *size_conv(long long number){ char type[] = {'B', 'K', 'M', 'G', 'T'}; int x=0; + int sign=1; static char string[10]; + if(number < 0){ + sign=-1; + number=-number; + } + for(;x<5;x++){ if( (number/1024) < (100)) { break; @@ -78,7 +84,9 @@ char *size_conv(long long number){ number = (number/1024); } - snprintf(string, 10, "%lld%c", number, type[x]); + number = number*sign; + + snprintf(string, 10, "%lld%c", number, type[x]); return string; } @@ -377,7 +385,7 @@ void display_data(){ move(line, 62); printw("%7s", size_conv(disk_stat_ptr->avail)); move(line, 73); - printw("%5.2f%%", 100.00 * ((float) disk_stat_ptr->used / (float) (disk_stat_ptr->used + disk_stat_ptr->avail))); + printw("%6.2f%%", 100.00 * ((float) disk_stat_ptr->used / (float) (disk_stat_ptr->used + disk_stat_ptr->avail))); disk_stat_ptr++; line++; } @@ -386,7 +394,7 @@ void display_data(){ refresh(); } -void sig_winch_handler(int sig){ +void sig_winch_handler(int dummy){ clear(); display_headings(); display_data();