]> granicus.if.org Git - postgis/commitdiff
substituted setenv() calls with putenv() for Solaris support
authorSandro Santilli <strk@keybit.net>
Fri, 19 Dec 2003 18:55:46 +0000 (18:55 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 19 Dec 2003 18:55:46 +0000 (18:55 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@413 b70326c6-7e19-0410-871a-916f4a2858ee

loader/pgsql2shp.c

index fa57623c85fb6beff914928f9c1d199474b86863..b2c181a75ad961ae6ff6084c5dce08d1872af15b 100644 (file)
@@ -10,6 +10,9 @@
  * 
  **********************************************************************
  * $Log$
+ * Revision 1.39  2003/12/19 18:55:46  strk
+ * substituted setenv() calls with putenv() for Solaris support
+ *
  * Revision 1.38  2003/12/04 19:11:56  strk
  * code cleanup (removed useless and leaking malloc calls)
  *
@@ -2095,6 +2098,9 @@ usage(status)
 int parse_commandline(int ARGC, char **ARGV)
 {
        int c, curindex;
+       char buf[256];
+
+       buf[255] = '\0'; // just in case...
 
        /* Parse command line */
         while ((c = getopt(ARGC, ARGV, "bf:h:du:p:P:g:")) != EOF){
@@ -2106,19 +2112,27 @@ int parse_commandline(int ARGC, char **ARGV)
                     shp_file = optarg;
                     break;
                case 'h':
-                   setenv("PGHOST", optarg, 1);
+                   //setenv("PGHOST", optarg, 1);
+                   snprintf(buf, 255, "PGHOST=%s", optarg);
+                   putenv(strdup(buf));
                     break;
                case 'd':
                    is3d = 1;
                     break;               
                case 'u':
-                   setenv("PGUSER", optarg, 1);
+                   //setenv("PGUSER", optarg, 1);
+                   snprintf(buf, 255, "PGUSER=%s", optarg);
+                   putenv(strdup(buf));
                     break;
                case 'p':
-                   setenv("PGPORT", optarg, 1);
+                   //setenv("PGPORT", optarg, 1);
+                   snprintf(buf, 255, "PGPORT=%s", optarg);
+                   putenv(strdup(buf));
                     break;
               case 'P':
-                   setenv("PGPASSWORD", optarg, 1);
+                   //setenv("PGPASSWORD", optarg, 1);
+                   snprintf(buf, 255, "PGPASSWORD=%s", optarg);
+                   putenv(strdup(buf));
                    break;
               case 'g':
                    geo_col_name = optarg;
@@ -2133,7 +2147,9 @@ int parse_commandline(int ARGC, char **ARGV)
         curindex=0;
         for ( ; optind < ARGC; optind++){
                 if(curindex ==0){
-                       setenv("PGDATABASE", ARGV[optind], 1);
+                       //setenv("PGDATABASE", ARGV[optind], 1);
+                       snprintf(buf, 255, "PGDATABASE=%s", ARGV[optind]);
+                       putenv(strdup(buf));
                 }else if(curindex == 1){
                         table = ARGV[optind];
                 }