[Libreoffice] getopt in sal/osl

Kohei Yoshida kohei.yoshida at suse.com
Tue Jan 31 20:25:01 PST 2012


On Tue, 2012-01-31 at 22:14 -0600, Norbert Thiebaud wrote:
> Heads-up:
> 
> Looking at gbuildifying idlc, I noticed the glibc hack to get a getopt
> implementation on platform that don't have a native one.
> 
> so, I wrote a gnu-compatile implementation based on
> http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
> 
> and I intend to add it to osl for platform that do not define
> HAVE_GETOPT="YES" in configure.in
> 
> I still have to write some unittest to make sure I did not screw-up too much...
> 
> Usage wise, the main change to migrate from the non osl version to the
> osl-based version will be to replace
> #include <getopt.h>
> with
> #include <osl/getopt.h>
> 
> all the rest should remain untouched.
> 
> 
> If you feel strongly against that, please let me know.

So, since you've already written it, my suggestion may be a little too
little too late.  But anyways...

Boost also has program options library which provides a cross-platform
command line option parser much like getopt on GNU platforms.  I tend to
use it instead of getopt whenever I need a cross-platform command line
options parser.  I don't use getopt because it's not cross-platform.

Perhaps not useful right this moment, but just something to be aware of
in the future when similar needs arise...

And I'm all for your plan, just to be clear.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc



More information about the LibreOffice mailing list