tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strtonum(3) from OpenBSD?

On Jun 24, 2009, at 6:10 PM, der Mouse wrote:

As I pointed out, the API for this function, *as specified by the
manual page*, distinguishes error return cases by way of *specific
strings given in the manual page* (which is why it is not
localizable) which it does not distinguish by different errno values.

To be fair, Thor, we should note that, since those strings are not
really human-interface strings but rather a peculiar representation for members of a very small set of error conditions, localizing them is not
really relevant.  (Not unless you try to think of the string as an
error _message_ rather than a strangely-represented error code, which,
while I suppose is reasonably likely given the strings' contents and
the preponderance of English, is really a conceptual error akin to
thinking ENOTTY has something to do with tty lines merely because it
contains "TTY" in the name.)


If that's actually the case this goes back to the original objection where you can't simply switch based on the return. You have to setup if/else ladders with strcmp which to be honest is a bizarre API in that nothing else I've run into does things that way.

It's all becoming a twisty maze of things here, none of which seem to make sense. Especially for such a small function.


Home | Main Index | Thread Index | Old Index