Hi Stephane!

On Wed, 12 Mar 2003, Stephane Letz wrote:

> I'm porting a software that need the getopt_long function.
> 
> I installed the Fink gengetopt package but it seems that this package does
> not provide a library for the needed function.
> 
This might not be what you want, however, I worked around this with the 
following code:

/* getopt_long is not available on some systems, even if they have glibc2.2 */
#if HAVE_GETOPT_H

#include <getopt.h>

#else

#include <unistd.h>
#define getopt_long(a,b,c,d,e) getopt(a,b,c)
struct option {
  const char         *name;
  enum { required_argument, no_argument } arg;
  void               *unused;
  char                val;
};

#endif

This worked for me, because the returned val is the same in both cases. (Of 
course I added getopt.h to AC_CHECK_HEADERS.)

BTW: does anybody have an idea why this acclaimed GLIBC2.2 of the Developer 
Tools doesn't have getopt_long? Or is it an addition in Linux only, that is not 
even "GNU standard"?

Ciao,
                                        Roland

+---------------------------+-------------------------+
|    TU Muenchen            |                         |
|    Physik-Department E18  |  Raum    3558           |
|    James-Franck-Str.      |  Telefon 089/289-12592  |
|    85747 Garching         |                         |
+---------------------------+-------------------------+

"If you think NT is the answer, you didn't understand the question."
                                                - Paul Stephens



-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to