Hacker News new | ask | show | jobs
by AstroNoise58 1920 days ago
Not sure what problem you see with that, care to elaborate and/or open an issue?
1 comments

It never returns 1, and returns 4 in two cases. This varies from the comment before the function, which I presume documents return values (though at first glance I thought the "name(number)" format was a function call example).
Oh, ok, I guess that might be a bit confusing. :)

The comment documents the interpretation (by the UPS MIB) of possible return values. The same is true for the surrounding few functions (upsAutoRestart, upsBeeperStatus and upsOutputSource) that are similar in form and purpose. Obviously, there is no requirement that all possible output values are generated (exactly once or at all).

The function upsBatteryStatus returns 4 in two cases, because in both of those cases the battery is deemed 'depleted'. And it does not return 1 because there is no input case from upsc (that I know of, at least) where it would make sense to report the battery status as 'unknown'.