[Nut-upsdev] zero-prepended values - why oh why?

Charles Lepple clepple at gmail.com
Thu Feb 23 16:03:35 UTC 2006


On 2/23/06, Niklas Edmundsson <nikke at acc.umu.se> wrote:
> Can somebody please explain why values are 0-prepended in almost every
> driver? Since it's done almost everywhere I suspect it's due to some
> old policy.

I don't have time at the moment to look into this, but this probably
started because some of the older UPSes actually returned values
padded with zeroes. Other people probably looked at the driver output
and made their code output similar values.

You should probably check with Arnaud to see whether clients are
counting on certain widths for their numbers. I agree in principle
that a '0' prefix should only be used for octal numbers, but then
again, the only bases that you generally see with UPS protocols are 2,
10, and 16.

--
- Charles Lepple



More information about the Nut-upsdev mailing list