You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Mattias Engdegård <ma...@bredband.net> on 2013/12/07 21:21:29 UTC

[PATCH] getopt error codes

The error messages of getopt are tricky to localise properly, since  
they are served as fprintf-like function invocations only. Since there  
is only very few distinct messages, the best solution is to introduce  
some sort of codes that the application can do whatever it wants with.

Here is a patch that does exactly that. It is entirely source and, by  
virtue of a slightly sleazy hack, binary compatible. That hack can be  
eliminated if we get to break binary compatibility; source  
compatibility would still be retained. I'd suggest using the hack in  
1.x and doing it cleanly (by adding a apr_getopt_t member) in 2.x.

The getopt code is ancient and it shows: nobody would have exposed a  
struct like that in an API design today, but it's what we have to work  
with.

Please review, and tell me if I should supply a commit message,  
CHANGES addition and so on. The patch is against trunk.


Re: [PATCH] getopt error codes

Posted by Mattias Engdegård <ma...@bredband.net>.
Has anyone had time to look at the patch yet? Please tell me if this  
was not the right place for submission, or if I should do something  
else to make it easier to be reviewed and accepted.

7 dec 2013 kl. 21.21 skrev Mattias Engdegård:

> The error messages of getopt are tricky to localise properly, since  
> they are served as fprintf-like function invocations only. Since  
> there is only very few distinct messages, the best solution is to  
> introduce some sort of codes that the application can do whatever it  
> wants with.
[...]
> Please review, and tell me if I should supply a commit message,  
> CHANGES addition and so on. The patch is against trunk.