putdec.c 637 Bytes
#include "libfb.h"
/*---------------------------------------------------------------------
                  Display dec-data on the screen
  ---------------------------------------------------------------------*/
void
fbPutDec(u16 color, int curs_x, int curs_y, int i)
{
  char	c;
  int	j;
    
  if (i >= 0) {
    c = ' ';
    j = i;
  } else {
    c = '-';
    j = -i;
  }
  
  do {
    fbPutChar(color, curs_x--, curs_y, (j % 10) + '0');
    j /= 10;
  } while (j > 0);

  fbPutChar(color, curs_x-1, curs_y, ' ');
  fbPutChar(color, curs_x, curs_y, c); 

  if (i > -10 && i < 10){
    fbPutChar(color, curs_x-2, curs_y, ' '); 
  }
}