1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## getopt.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
4
## All lines beginning with `## DP:' are a description of the patch.
8
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' postgis-1.5.1~/loader/getopt.c postgis-1.5.1/loader/getopt.c
9
--- postgis-1.5.1~/loader/getopt.c 2010-02-01 18:35:55.000000000 +0100
10
+++ postgis-1.5.1/loader/getopt.c 2010-05-22 19:10:55.000000000 +0200
18
errbuf[0] = (char)c; errbuf[1] = '\n';\
19
(void) write(2, argv[0], (unsigned)strlen(argv[0]));\
21
(void) write(2, errbuf, 2);\
34
pgis_getopt(int argc, char **argv, char *opts)
39
- if (optind >= argc ||
40
- argv[optind][0] != '-' /* && argv[optind][0] != '/' */ ||
41
- argv[optind][1] == '\0')
42
+ if (pgis_optind >= argc ||
43
+ argv[pgis_optind][0] != '-' /* && argv[pgis_optind][0] != '/' */ ||
44
+ argv[pgis_optind][1] == '\0')
48
- else if (strcmp(argv[optind], "--") == 0)
49
+ else if (strcmp(argv[pgis_optind], "--") == 0)
56
- optopt = c = argv[optind][sp];
57
+ pgis_optopt = c = argv[pgis_optind][sp];
58
if (c == ':' || (cp=strchr(opts, c)) == 0)
60
ERR(": illegal option -- ", c);
61
- if (argv[optind][++sp] == '\0')
62
+ if (argv[pgis_optind][++sp] == '\0')
72
- if (argv[optind][sp+1] != '\0')
73
- optarg = &argv[optind++][sp+1];
74
- else if (++optind >= argc)
75
+ if (argv[pgis_optind][sp+1] != '\0')
76
+ pgis_optarg = &argv[pgis_optind++][sp+1];
77
+ else if (++pgis_optind >= argc)
79
ERR(": option requires an argument -- ", c);
84
- optarg = argv[optind++];
85
+ pgis_optarg = argv[pgis_optind++];
90
- if (argv[optind][++sp] == '\0')
91
+ if (argv[pgis_optind][++sp] == '\0')
102
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' postgis-1.5.1~/loader/getopt.h postgis-1.5.1/loader/getopt.h
103
--- postgis-1.5.1~/loader/getopt.h 2009-12-19 04:56:06.000000000 +0100
104
+++ postgis-1.5.1/loader/getopt.h 2010-05-22 19:10:55.000000000 +0200
106
/* declarations for getopt and envargs */
111
-extern char *optarg;
112
+extern int pgis_opterr;
113
+extern int pgis_optind;
114
+extern int pgis_optopt;
115
+extern char *pgis_optarg;
117
extern int pgis_getopt(int argc, char **argv, char *opts);
118
extern void envargs(int *pargc, char ***pargv, char *envstr);
119
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' postgis-1.5.1~/loader/pgsql2shp.c postgis-1.5.1/loader/pgsql2shp.c
120
--- postgis-1.5.1~/loader/pgsql2shp.c 2010-02-01 18:35:55.000000000 +0100
121
+++ postgis-1.5.1/loader/pgsql2shp.c 2010-05-22 19:12:46.000000000 +0200
122
@@ -1307,10 +1307,10 @@
127
+ shp_file = pgis_optarg;
130
- snprintf(buf + strlen(buf), 255, "host=%s ", optarg);
131
+ snprintf(buf + strlen(buf), 255, "host=%s ", pgis_optarg);
135
@@ -1321,16 +1321,16 @@
139
- snprintf(buf + strlen(buf), 255, "user=%s ", optarg);
140
+ snprintf(buf + strlen(buf), 255, "user=%s ", pgis_optarg);
143
- snprintf(buf + strlen(buf), 255, "port=%s ", optarg);
144
+ snprintf(buf + strlen(buf), 255, "port=%s ", pgis_optarg);
147
- snprintf(buf + strlen(buf), 255, "password=%s ", optarg);
148
+ snprintf(buf + strlen(buf), 255, "password=%s ", pgis_optarg);
151
- geo_col_name = optarg;
152
+ geo_col_name = pgis_optarg;
155
keep_fieldname_case = 1;
156
@@ -1343,15 +1343,15 @@
160
- for (; optind<ARGC; optind++)
161
+ for (; pgis_optind<ARGC; pgis_optind++)
165
- snprintf(buf + strlen(buf), 255, "dbname=%s", ARGV[optind]);
166
+ snprintf(buf + strlen(buf), 255, "dbname=%s", ARGV[pgis_optind]);
168
else if (curindex == 1)
170
- parse_table(ARGV[optind]);
171
+ parse_table(ARGV[pgis_optind]);
175
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' postgis-1.5.1~/loader/shp2pgsql-cli.c postgis-1.5.1/loader/shp2pgsql-cli.c
176
--- postgis-1.5.1~/loader/shp2pgsql-cli.c 2010-02-03 22:42:20.000000000 +0100
177
+++ postgis-1.5.1/loader/shp2pgsql-cli.c 2010-05-22 19:14:00.000000000 +0200
185
- sscanf(optarg, "%d", &(config->sr_id));
186
+ sscanf(pgis_optarg, "%d", &(config->sr_id));
194
- config->geom = optarg;
195
+ config->geom = pgis_optarg;
199
@@ -129,11 +129,11 @@
203
- config->encoding = optarg;
204
+ config->encoding = pgis_optarg;
209
+ switch (pgis_optarg[0])
212
config->null_policy = POLICY_NULL_ABORT;
213
@@ -161,10 +161,10 @@
216
/* Determine the shapefile name from the next argument, if no shape file, exit. */
218
+ if (pgis_optind < argc)
220
- config->shp_file = argv[optind];
222
+ config->shp_file = argv[pgis_optind];
227
@@ -173,25 +173,25 @@
230
/* Determine the table and schema names from the next argument */
232
+ if (pgis_optind < argc)
236
- ptr = strchr(argv[optind], '.');
237
+ ptr = strchr(argv[pgis_optind], '.');
239
/* Schema qualified table name */
242
- config->schema = malloc(strlen(argv[optind]) + 1);
243
- snprintf(config->schema, ptr - argv[optind] + 1, "%s", argv[optind]);
244
+ config->schema = malloc(strlen(argv[pgis_optind]) + 1);
245
+ snprintf(config->schema, ptr - argv[pgis_optind] + 1, "%s", argv[pgis_optind]);
247
- config->table = malloc(strlen(argv[optind]));
248
- snprintf(config->table, strlen(argv[optind]) - strlen(config->schema), "%s", ptr + 1);
249
+ config->table = malloc(strlen(argv[pgis_optind]));
250
+ snprintf(config->table, strlen(argv[pgis_optind]) - strlen(config->schema), "%s", ptr + 1);
254
- config->table = malloc(strlen(argv[optind]) + 1);
255
- strcpy(config->table, argv[optind]);
256
+ config->table = malloc(strlen(argv[pgis_optind]) + 1);
257
+ strcpy(config->table, argv[pgis_optind]);
261
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' postgis-1.5.1~/loader/shp2pgsql-gui.c postgis-1.5.1/loader/shp2pgsql-gui.c
262
--- postgis-1.5.1~/loader/shp2pgsql-gui.c 2010-02-01 18:35:55.000000000 +0100
263
+++ postgis-1.5.1/loader/shp2pgsql-gui.c 2010-05-22 19:15:14.000000000 +0200
264
@@ -1212,19 +1212,19 @@
268
- conn->username = optarg;
269
+ conn->username = pgis_optarg;
272
- conn->port = optarg;
273
+ conn->port = pgis_optarg;
276
- conn->password = optarg;
277
+ conn->password = pgis_optarg;
280
- conn->database = optarg;
281
+ conn->database = pgis_optarg;
284
- conn->host = optarg;
285
+ conn->host = pgis_optarg;