bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] getopt?


From: Paul Eggert
Subject: Re: [Bug-gnulib] getopt?
Date: Sat, 20 Nov 2004 21:11:09 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> ld: Undefined symbols:
> ___GETOPT_PREFIXgetopt_long

Sorry, I messed up with the semantics of ##.  I installed the
following to fix this.  Does it resolve your problems?

I'm a bit puzzled, because (as far as I can tell) the bug should
merely have caused getopt_long to be called
___GETOPT_PREFIXgetopt_long uniformly (instead of rpl_getopt_long
uniformly, which is what was intended) but it still should have
worked.

2004-11-20  Paul Eggert  <address@hidden>

        * getopt_.h (__CONCAT): New macro.
        (getopt, getopt_long, getopt_long_only, optarg, opterr, optind,
        optopt): Use it instead of invoking ## directly; otherwise, the
        symbols will be __GETOPT_PREFIXgetopt rather than rpl_getopt.

Index: getopt_.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getopt_.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -p -u -r1.5 -r1.6
--- getopt_.h   17 Nov 2004 01:53:27 -0000      1.5
+++ getopt_.h   21 Nov 2004 05:10:10 -0000      1.6
@@ -44,13 +44,16 @@
 # undef opterr
 # undef optind
 # undef optopt
-# define getopt __GETOPT_PREFIX##getopt
-# define getopt_long __GETOPT_PREFIX##getopt_long
-# define getopt_long_only __GETOPT_PREFIX##getopt_long_only
-# define optarg __GETOPT_PREFIX##optarg
-# define opterr __GETOPT_PREFIX##opterr
-# define optind __GETOPT_PREFIX##optind
-# define optopt __GETOPT_PREFIX##optopt
+# ifndef __CONCAT
+#  define __CONCAT(x, y) x ## y
+# endif
+# define getopt __CONCAT (__GETOPT_PREFIX, getopt)
+# define getopt_long __CONCAT (__GETOPT_PREFIX, getopt_long)
+# define getopt_long_only __CONCAT (__GETOPT_PREFIX, getopt_long_only)
+# define optarg __CONCAT (__GETOPT_PREFIX, optarg)
+# define opterr __CONCAT (__GETOPT_PREFIX, opterr)
+# define optind __CONCAT (__GETOPT_PREFIX, optind)
+# define optopt __CONCAT (__GETOPT_PREFIX, optopt)
 #endif
 
 /* Standalone applications get correct prototypes for getopt_long and




reply via email to

[Prev in Thread] Current Thread [Next in Thread]