getopt_long behavior

Charles Wilson cwilson@ece.gatech.edu
Thu Jan 30 13:28:00 GMT 2003



Christopher Faylor wrote:
> On Wed, Jan 29, 2003 at 04:29:47PM -0500, Chris Morgan wrote:
> 
>>I orginally posted this message some time ago.  Having all of
>>the cygwin tools lacking the ability to accept arguments in
>>arbirtary order makes it more difficult to use them(I often do
>>grep "string" *.c and then rerun with -i at the end).  Is
>>there anyway to get around this without recompiling the whole
>>cygwin suite from source code?
> 
> 
> No.

Not entirely correct, Chris.  One may simply link a static copy of the 
[getopt.c  getopt.h  getopt1.c] files to the desired executable.  That's 
what I did with the gettext library, because gettext's selftests depend 
on non-POSIXLY-correct commandlines (and reordering the tests wouldn't 
have worked).

So, if you want a "foo.exe" that allows argument re-ordering, rebuild 
foo and add getopt.o & getopt1.o to the link command.  Or build a 
**static** library "libmygetopt" from those two .o's, and use 
-lmygetopt.  And no recompiling of the cygwin kernel needed.

--Chuck





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list