The most convenient and flexible way to accomplish this might be to add
a new
conversion specifier to printf(), sprintf(), and friends. Perhaps "%m"
and "%M"
would be good choices, indicating that we want a scaled string that
includes
*m*etric prefixes (K, M, G, etc for "%m"; Kilo, Mega, Giga, etc for "%M").
.. or taking this a step further, having scaling flag characters (s and S
maybe for scaling) which work with all of the format specifiers?
This would allow me to do both the format-command-style:
float disk_bytes;
...
printf("%S.2fB", disk_bytes);
and the prctl-style:
int nprocesses;
...
printf("%S4d", nprocesses);
without forcing a choice of one variable type or another, which seems less
restrictive (esp. given that the least common denominator IMO should be
integer rather than floating point).
- Eric
--
Eric Lowe Solaris Kernel Development Austin, Texas
Sun Microsystems. We make the net work. x40577/+1(512)366-9080
_______________________________________________
opensolaris-code mailing list
[email protected]
https://opensolaris.org:444/mailman/listinfo/opensolaris-code