[Nut-upsdev] Re: [nut-commits] svn commit r755 - in trunk: . clients

Arjen de Korte nut+devel at de-korte.org
Fri Jan 19 09:45:31 CET 2007


> * are you sure you want to use fprintf(stderr, ...) in a library?
>   This doesn't seem like a good idea to me. Wouldn't it be more
>   consistent to extend upscli_errlist[] ?

Errorcodes are passed in 'ups->upserror' (and 'ups->syserrno'). Uh oh, we
don't have a connection to an UPS yet when we call upscli_splitname() or
upscli_splitaddr(). The upscli_strerror() function that is used to return
the message in upscli_errlist[] needs a pointer to a UPSCONN structure
also. The upscli_errlist[] is static, so there is no way to get to the
messages without calling upscli_strerror().

The reality is, that this is how it has been for a *very* long time, I
didn't invent this. The oldest version in SVN I could find (revision 2)
uses fprintf(stderr, ...) also and I doubt that it has been different
before that. Maybe you're right, but it would require some drastic changes
to the API, that I'm not prepared to make right now.

Best regards, Arjen
-- 
Eindhoven - The Netherlands
Key fingerprint - 66 4E 03 2C 9D B5 CB 9B  7A FE 7E C1 EE 88 BC 57




More information about the Nut-upsdev mailing list