示例#1
0
static int print(char *str, int nbr, int size, int neg)
{
    if (neg == 1)
        return (print_neg(str, nbr, size, neg));
    else
        return (print_pos(str, nbr, size, neg));
}
示例#2
0
int	print_digits(int value, int base, int signed_bool, int width,
		     int pad, int format)
{
  char	print_buf[4];
  register unsigned int u;
  register char *s;
  int	neg;
  int	pc;

  u = value;
  pc = 0;
  neg = 0;
  if (value == 0)
    {
      print_buf[0] = '0';
      print_buf[1] = '\0';
      return (print_string (print_buf, width, pad, 0));
    }
  if (signed_bool && base == 10 && value < 0)
    {
      neg = 1;
      u = -value;
    }
  s = print_buf - 4 + 1;
  s = convert_to_base(u, base, format, s);
  if (neg)
    s = print_neg(&width, pad, &pc, s);
  return (pc + print_string(s, width, pad, 0));
}