Date: Mon, 12 Jan 1998 19:24:29 +0200 (IST) From: Eli Zaretskii To: Peter Palotas cc: djgpp AT delorie DOT com Subject: Re: getopt() and ANSI? In-Reply-To: <3.0.16.19980112152740.3b0fb2e4@hem1.passagen.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 12 Jan 1998, Peter Palotas wrote: > Is getopt ANSI C? No. It's POSIX. > If not, how would I go about to make my program which > uses getopt to be ANSI compliant? Would it be a good idea, simply to > include the GNU getopt.c and getopt.h files? Yes, but: (1) using GNU `getopt' makes your program GPL; and (2) nobody said that GNU getopt sources are strict ANSI (I think they are not). The best alternative would be to roll your own version, but it's a lot of work... > Wouldn't there be a conflict when linking since getopt is included in > the C library somewhere as I've understood it!? Of course, there will be no conflict. Otherwise, how would we be able to link all the GNU packages that use their `getopt'? (We do *not* use ours instead, if that's what you were thinking, because DJGPP's version doesn't support long options and other GNU goodies.) Since getopt.o (fgrom GNU) is mentioned on the link command line *before* libc.a, it gets linked instead of the DJGPP version. And the interface is compatible, so no conflict here. > And should I use the DJGPP getopt, which by the way goes > under COPYING.DJ, which is not the same thing as GPL, or the one the comes > ex. with the GNU-Hello package? DJGPP's `getopt' is slightly non-ANSI (it includes non-ANSI headers).