frankzen / wbar

wbar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[PATCH] getopt_long_only not portable

GoogleCodeExporter opened this issue · comments

getopt_long_only is not very portable; please use getopt_long instead.
Suggested patch attached.

Original issue reported on code.google.com by tk@giga.or.at on 18 Jun 2011 at 1:43

Attachments:

thanks

Original comment by yadick...@gmail.com on 8 Jul 2011 at 7:47

  • Changed state: Accepted
Both getopt_long and getopt_long_only are GNU extensions to POSIX, so a system 
having such extensions will lack both of them. (I know that FreeBSD 4.x could 
be an exception having getopt_long but not getopt_long_only in its standard C 
library but it is a out-of-date now, and the problem could be solved by 
installing gnu getopt from ports anyway)
On the other hand, getopt_long_only is needed for compatibility with older wbar 
1.3.x configs (e.g., there are users who run wbar like 'wbar -above-desk  
-nofont...'), so getting rid of it will immediately break working 
configurations.

In theory, it is not too hard to check if getopt_long_only is supported by a 
system and fall back to getopt_long when building wbar, but it doesn't seem to 
worth the time at the moment, since no exact portability issues were reported.

Please feel free to reopen the ticket if you have any real-life portability 
issues to point to. A workaround will be implemented then.

Original comment by ivan.fit...@eltrino.com on 25 Dec 2011 at 7:19

  • Changed state: Invalid
You are right that both getopt_long and getopt_long_only are extensions and 
thus not portable.
However, at least NetBSD _does_ provide getopt_long (but not getopt_long_only) 
since 2000 in its standard C library.
This bug report was intended as exactly such a portability issue report. A 
patch replacing getopt_long_only with getopt_long was used when packaging wbar 
for pkgsrc, see
http://cvsweb.se.netbsd.org/cgi-bin/bsdweb.cgi/pkgsrc/wm/wbar/patches/patch-src_
utils_OptParser.cc

Original comment by tk@giga.or.at on 26 Dec 2011 at 11:52

Ok, understood, thank you.
The ticket is reopened now 

Original comment by ivan.fit...@eltrino.com on 10 Jan 2012 at 1:50

  • Changed state: Accepted

Original comment by ivan.fit...@eltrino.com on 10 Jan 2012 at 1:51

Solved issue
Apply patch
Only in trunk

Original comment by yadick...@gmail.com on 6 Mar 2012 at 11:08

Original comment by yadick...@gmail.com on 6 Mar 2012 at 11:08

  • Changed state: Fixed