Fix printing of negative decimal values in Kelvin to Celsius conversion.

MFC after:	3 days
This commit is contained in:
njl 2006-07-25 02:28:43 +00:00
parent 7a331053aa
commit bfbd4eba2c

View File

@ -583,7 +583,9 @@ show_var(int *oid, int nlen)
if (*(int *)p < 0)
printf("%d", *(int *)p);
else
printf("%d.%dC", (*(int *)p - 2732) / 10, (*(int *)p - 2732) % 10);
printf("%d.%dC",
(*(int *)p - 2732) / 10,
abs((*(int *)p - 2732) % 10));
} else
printf(hflag ? "%'d" : "%d", *(int *)p);
val = " ";
@ -605,7 +607,9 @@ show_var(int *oid, int nlen)
if (*(long *)p < 0)
printf("%ld", *(long *)p);
else
printf("%ld.%ldC", (*(long *)p - 2732) / 10, (*(long *)p - 2732) % 10);
printf("%ld.%ldC",
(*(long *)p - 2732) / 10,
abs((*(long *)p - 2732) % 10));
} else
printf(hflag ? "%'ld" : "%ld", *(long *)p);
val = " ";