[postgis-commits] svn - r2758 - in trunk: . loader

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Mon Apr 7 13:09:48 PDT 2008


Author: pramsey
Date: 2008-04-07 13:09:48 -0700 (Mon, 07 Apr 2008)
New Revision: 2758

Modified:
   trunk/ChangeLog
   trunk/loader/getopt.c
   trunk/loader/getopt.h
   trunk/loader/pgsql2shp.c
   trunk/loader/shp2pgsql.c
Log:
Rename all occurances of getopt to pgis_getopt to work around
OS/X 10.5 system function name collision.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-07 19:47:21 UTC (rev 2757)
+++ trunk/ChangeLog	2008-04-07 20:09:48 UTC (rev 2758)
@@ -1,3 +1,11 @@
+2008-04-07 Paul Ramsey <pramsey at cleverelephant.ca>
+
+        * loader/shp2pgsql.c, pgsql2shp.c, getopt.c, getopt.h
+          Renamed all instances of getopt to pgis_gettop to avoid 
+          collision with system getopt.  To do: return to using
+          system getopt and drop our version?  Understand the 
+          actions of the platform #defines in getopt.h?
+
 2008-03-28 Paul Ramsey <pramsey at cleverelephant.ca>
 
         * lwgeom/lwgeom_kml.c, lwgeom/lwpostgis.sql.in

Modified: trunk/loader/getopt.c
===================================================================
--- trunk/loader/getopt.c	2008-04-07 19:47:21 UTC (rev 2757)
+++ trunk/loader/getopt.c	2008-04-07 20:09:48 UTC (rev 2758)
@@ -264,7 +264,7 @@
    long-named options.  */
 
 int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+_pgis_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
      int argc;
      char *const *argv;
      const char *optstring;
@@ -598,26 +598,26 @@
 }
 
 int
-getopt (argc, argv, optstring)
+pgis_getopt (argc, argv, optstring)
      int argc;
      char *const *argv;
      const char *optstring;
 {
-  return _getopt_internal (argc, argv, optstring,
+  return _pgis_getopt_internal (argc, argv, optstring,
 			   (const struct option *) 0,
 			   (int *) 0,
 			   0);
 }
 
 int
-getopt_long (argc, argv, options, long_options, opt_index)
+pgis_getopt_long (argc, argv, options, long_options, opt_index)
      int argc;
      char *const *argv;
      const char *options;
      const struct option *long_options;
      int *opt_index;
 {
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+  return _pgis_getopt_internal (argc, argv, options, long_options, opt_index, 0);
 }
 
 /* #endif	  _LIBC or not __GNU_LIBRARY__.  */
@@ -639,7 +639,7 @@
     {
       int this_option_optind = optind ? optind : 1;
 
-      c = getopt (argc, argv, "abc:d:0123456789");
+      c = pgis_getopt (argc, argv, "abc:d:0123456789");
       if (c == EOF)
 	break;
 

Modified: trunk/loader/getopt.h
===================================================================
--- trunk/loader/getopt.h	2008-04-07 19:47:21 UTC (rev 2757)
+++ trunk/loader/getopt.h	2008-04-07 20:09:48 UTC (rev 2758)
@@ -99,25 +99,25 @@
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
-extern int getopt (int argc, char *const *argv, const char *shortopts);
+extern int pgis_getopt (int argc, char *const *argv, const char *shortopts);
 #endif /* not __GNU_LIBRARY__ */
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+extern int pgis_getopt_long (int argc, char *const *argv, const char *shortopts,
 		        const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
+extern int pgis_getopt_long_only (int argc, char *const *argv,
 			     const char *shortopts,
 		             const struct option *longopts, int *longind);
 
 /* Internal only.  Users should not call this directly.  */
-extern int _getopt_internal (int argc, char *const *argv,
+extern int _pgis_getopt_internal (int argc, char *const *argv,
 			     const char *shortopts,
 		             const struct option *longopts, int *longind,
 			     int long_only);
 #else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
+extern int pgis_getopt ();
+extern int pgis_getopt_long ();
+extern int pgis_getopt_long_only ();
 
-extern int _getopt_internal ();
+extern int _pgis_getopt_internal ();
 #endif /* not __STDC__ */
 
 #ifdef	__cplusplus

Modified: trunk/loader/pgsql2shp.c
===================================================================
--- trunk/loader/pgsql2shp.c	2008-04-07 19:47:21 UTC (rev 2757)
+++ trunk/loader/pgsql2shp.c	2008-04-07 20:09:48 UTC (rev 2758)
@@ -2345,7 +2345,7 @@
 	memset(buf, 0, 2048); /* just in case... */
 
 	/* Parse command line */
-        while ((c = getopt(ARGC, ARGV, "bf:h:du:p:P:g:rk")) != EOF){
+        while ((c = pgis_getopt(ARGC, ARGV, "bf:h:du:p:P:g:rk")) != EOF){
 		switch (c) {
 			case 'b':
 				binary = 1;

Modified: trunk/loader/shp2pgsql.c
===================================================================
--- trunk/loader/shp2pgsql.c	2008-04-07 19:47:21 UTC (rev 2757)
+++ trunk/loader/shp2pgsql.c	2008-04-07 20:09:48 UTC (rev 2758)
@@ -1273,7 +1273,7 @@
                 usage(ARGV[0], 0, stdout);
         }
 
-	while ((c = getopt(ARGC, ARGV, "kcdapDs:Sg:iW:wIN:")) != EOF){
+	while ((c = pgis_getopt(ARGC, ARGV, "kcdapDs:Sg:iW:wIN:")) != EOF){
                switch (c) {
                case 'c':
                     if (opt == ' ')



More information about the postgis-commits mailing list