~ubuntu-branches/ubuntu/oneiric/postgis/oneiric-proposed

« back to all changes in this revision

Viewing changes to debian/patches/getopt.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Alan Boudreault
  • Date: 2010-09-29 09:16:10 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20100929091610-vj4efw8woq34hdn7
Tags: 1.5.2-1
* New upstream release, with a few bug fixes.
* Added shp2pgsql-gui binary.
* Removed patches, applied upstream: getopt.    

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## getopt.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: No description.
6
 
 
7
 
@DPATCH@
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
11
 
@@ -31,7 +31,7 @@
12
 
  */
13
 
 
14
 
 #define ERR(s, c)\
15
 
-  if(opterr){\
16
 
+  if(pgis_opterr){\
17
 
         char errbuf[2];\
18
 
         errbuf[0] = (char)c; errbuf[1] = '\n';\
19
 
         (void) write(2, argv[0], (unsigned)strlen(argv[0]));\
20
 
@@ -39,10 +39,10 @@
21
 
         (void) write(2, errbuf, 2);\
22
 
   }
23
 
 
24
 
-int     opterr = 1;
25
 
-int     optind = 1;
26
 
-int     optopt;
27
 
-char    *optarg;
28
 
+int     pgis_opterr = 1;
29
 
+int     pgis_optind = 1;
30
 
+int     pgis_optopt;
31
 
+char    *pgis_optarg;
32
 
 
33
 
 int
34
 
 pgis_getopt(int argc, char **argv, char *opts)
35
 
@@ -53,51 +53,51 @@
36
 
 
37
 
        if (sp == 1)
38
 
        {
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')
45
 
                {
46
 
                        return(EOF);
47
 
                }
48
 
-               else if (strcmp(argv[optind], "--") == 0)
49
 
+               else if (strcmp(argv[pgis_optind], "--") == 0)
50
 
                {
51
 
-                       optind++;
52
 
+                       pgis_optind++;
53
 
                        return(EOF);
54
 
                }
55
 
        }
56
 
-       optopt = c = argv[optind][sp];
57
 
+       pgis_optopt = c = argv[pgis_optind][sp];
58
 
        if (c == ':' || (cp=strchr(opts, c)) == 0)
59
 
        {
60
 
                ERR(": illegal option -- ", c);
61
 
-               if (argv[optind][++sp] == '\0')
62
 
+               if (argv[pgis_optind][++sp] == '\0')
63
 
                {
64
 
-                       optind++;
65
 
+                       pgis_optind++;
66
 
                        sp = 1;
67
 
                }
68
 
                return('?');
69
 
        }
70
 
        if (*++cp == ':')
71
 
        {
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)
78
 
                {
79
 
                        ERR(": option requires an argument -- ", c);
80
 
                        sp = 1;
81
 
                        return('?');
82
 
                }
83
 
                else
84
 
-                       optarg = argv[optind++];
85
 
+                       pgis_optarg = argv[pgis_optind++];
86
 
                sp = 1;
87
 
        }
88
 
        else
89
 
        {
90
 
-               if (argv[optind][++sp] == '\0')
91
 
+               if (argv[pgis_optind][++sp] == '\0')
92
 
                {
93
 
                        sp = 1;
94
 
-                       optind++;
95
 
+                       pgis_optind++;
96
 
                }
97
 
-               optarg = NULL;
98
 
+               pgis_optarg = NULL;
99
 
        }
100
 
        return(c);
101
 
 }
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
105
 
@@ -1,9 +1,9 @@
106
 
 /* declarations for getopt and envargs */
107
 
 
108
 
-extern int opterr;
109
 
-extern int optind;
110
 
-extern int optopt;
111
 
-extern char *optarg;
112
 
+extern int pgis_opterr;
113
 
+extern int pgis_optind;
114
 
+extern int pgis_optopt;
115
 
+extern char *pgis_optarg;
116
 
 
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 @@
123
 
                        binary = 1;
124
 
                        break;
125
 
                case 'f':
126
 
-                       shp_file = optarg;
127
 
+                       shp_file = pgis_optarg;
128
 
                        break;
129
 
                case 'h':
130
 
-                       snprintf(buf + strlen(buf), 255, "host=%s ", optarg);
131
 
+                       snprintf(buf + strlen(buf), 255, "host=%s ", pgis_optarg);
132
 
                        break;
133
 
                case 'd':
134
 
                        dswitchprovided = 1;
135
 
@@ -1321,16 +1321,16 @@
136
 
                        unescapedattrs = 1;
137
 
                        break;
138
 
                case 'u':
139
 
-                       snprintf(buf + strlen(buf), 255, "user=%s ", optarg);
140
 
+                       snprintf(buf + strlen(buf), 255, "user=%s ", pgis_optarg);
141
 
                        break;
142
 
                case 'p':
143
 
-                       snprintf(buf + strlen(buf), 255, "port=%s ", optarg);
144
 
+                       snprintf(buf + strlen(buf), 255, "port=%s ", pgis_optarg);
145
 
                        break;
146
 
                case 'P':
147
 
-                       snprintf(buf + strlen(buf), 255, "password=%s ", optarg);
148
 
+                       snprintf(buf + strlen(buf), 255, "password=%s ", pgis_optarg);
149
 
                        break;
150
 
                case 'g':
151
 
-                       geo_col_name = optarg;
152
 
+                       geo_col_name = pgis_optarg;
153
 
                        break;
154
 
                case 'k':
155
 
                        keep_fieldname_case = 1;
156
 
@@ -1343,15 +1343,15 @@
157
 
        }
158
 
 
159
 
        curindex=0;
160
 
-       for (; optind<ARGC; optind++)
161
 
+       for (; pgis_optind<ARGC; pgis_optind++)
162
 
        {
163
 
                if (curindex == 0)
164
 
                {
165
 
-                       snprintf(buf + strlen(buf), 255, "dbname=%s", ARGV[optind]);
166
 
+                       snprintf(buf + strlen(buf), 255, "dbname=%s", ARGV[pgis_optind]);
167
 
                }
168
 
                else if (curindex == 1)
169
 
                {
170
 
-                       parse_table(ARGV[optind]);
171
 
+                       parse_table(ARGV[pgis_optind]);
172
 
 
173
 
                }
174
 
                curindex++;
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
178
 
@@ -92,9 +92,9 @@
179
 
                        break;
180
 
 
181
 
                case 's':
182
 
-                       if (optarg)
183
 
+                       if (pgis_optarg)
184
 
                        {
185
 
-                               sscanf(optarg, "%d", &(config->sr_id));
186
 
+                               sscanf(pgis_optarg, "%d", &(config->sr_id));
187
 
                        }
188
 
                        else
189
 
                        {
190
 
@@ -105,7 +105,7 @@
191
 
                        break;
192
 
 
193
 
                case 'g':
194
 
-                       config->geom = optarg;
195
 
+                       config->geom = pgis_optarg;
196
 
                        break;
197
 
 
198
 
                case 'k':
199
 
@@ -129,11 +129,11 @@
200
 
                        break;
201
 
 
202
 
                case 'W':
203
 
-                       config->encoding = optarg;
204
 
+                       config->encoding = pgis_optarg;
205
 
                        break;
206
 
 
207
 
                case 'N':
208
 
-                       switch (optarg[0])
209
 
+                       switch (pgis_optarg[0])
210
 
                        {
211
 
                        case 'a':
212
 
                                config->null_policy = POLICY_NULL_ABORT;
213
 
@@ -161,10 +161,10 @@
214
 
        }
215
 
 
216
 
        /* Determine the shapefile name from the next argument, if no shape file, exit. */
217
 
-       if (optind < argc)
218
 
+       if (pgis_optind < argc)
219
 
        {
220
 
-               config->shp_file = argv[optind];
221
 
-               optind++;
222
 
+               config->shp_file = argv[pgis_optind];
223
 
+               pgis_optind++;
224
 
        }
225
 
        else
226
 
        {
227
 
@@ -173,25 +173,25 @@
228
 
        }
229
 
 
230
 
        /* Determine the table and schema names from the next argument */
231
 
-       if (optind < argc)
232
 
+       if (pgis_optind < argc)
233
 
        {
234
 
                char *ptr;
235
 
 
236
 
-               ptr = strchr(argv[optind], '.');
237
 
+               ptr = strchr(argv[pgis_optind], '.');
238
 
 
239
 
                /* Schema qualified table name */
240
 
                if (ptr)
241
 
                {
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]);
246
 
 
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);
251
 
                }
252
 
                else
253
 
                {
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]);
258
 
                }
259
 
        }
260
 
 
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 @@
265
 
                switch (c)
266
 
                {
267
 
                case 'U':
268
 
-                       conn->username = optarg;
269
 
+                       conn->username = pgis_optarg;
270
 
                        break;
271
 
                case 'p':
272
 
-                       conn->port = optarg;
273
 
+                       conn->port = pgis_optarg;
274
 
                        break;
275
 
                case 'W':
276
 
-                       conn->password = optarg;
277
 
+                       conn->password = pgis_optarg;
278
 
                        break;
279
 
                case 'd':
280
 
-                       conn->database = optarg;
281
 
+                       conn->database = pgis_optarg;
282
 
                        break;
283
 
                case 'h':
284
 
-                       conn->host = optarg;
285
 
+                       conn->host = pgis_optarg;
286
 
                        break;
287
 
                default:
288
 
                        usage();