4747 * Cleaned up code for reconnecting to database.
4848 * Force a reconnect as superuser before enabling/disabling triggers.
4949 *
50+ * Modifications - 6-Mar-2001 - pjw@rhyme.com.au
51+ * Change -U option to -L to allow -U to specify username in future.
52+ *
5053 *-------------------------------------------------------------------------
5154 */
5255
@@ -100,7 +103,7 @@ struct option cmdopts[] = {
100103 { "superuser" , 1 , NULL , 'S' },
101104 { "table" , 2 , NULL , 't' },
102105 { "trigger" , 2 , NULL , 'T' },
103- { "use-list" , 1 , NULL , 'U ' },
106+ { "use-list" , 1 , NULL , 'L ' },
104107 { "verbose" , 0 , NULL , 'v' },
105108 { NULL , 0 , NULL , 0 }
106109 };
@@ -135,9 +138,9 @@ int main(int argc, char **argv)
135138 }
136139
137140#ifdef HAVE_GETOPT_LONG
138- while ((c = getopt_long (argc , argv , "acCd:f:F:h:i:lNoOp: P:rRsS:t:T:uU:vx " , cmdopts , NULL )) != EOF )
141+ while ((c = getopt_long (argc , argv , "acCd:f:F:h:i:lL:NoOp: P:rRsS:t:T:uvx " , cmdopts , NULL )) != EOF )
139142#else
140- while ((c = getopt (argc , argv , "acCd:f:F:h:i:lNoOp: P:rRsS:t:T:uU:vx " )) != -1 )
143+ while ((c = getopt (argc , argv , "acCd:f:F:h:i:lL:NoOp: P:rRsS:t:T:uvx " )) != -1 )
141144#endif
142145 {
143146 switch (c )
@@ -173,6 +176,15 @@ int main(int argc, char **argv)
173176 case 'i' :
174177 opts -> ignoreVersion = 1 ;
175178 break ;
179+
180+ case 'l' : /* Dump the TOC summary */
181+ opts -> tocSummary = 1 ;
182+ break ;
183+
184+ case 'L' : /* input TOC summary file name */
185+ opts -> tocFile = strdup (optarg );
186+ break ;
187+
176188 case 'N' :
177189 opts -> origOrder = 1 ;
178190 break ;
@@ -219,18 +231,11 @@ int main(int argc, char **argv)
219231 opts -> selTable = 1 ;
220232 opts -> tableNames = _cleanupName (optarg );
221233 break ;
222- case 'l' : /* Dump the TOC summary */
223- opts -> tocSummary = 1 ;
224- break ;
225234
226235 case 'u' :
227236 opts -> requirePassword = 1 ;
228237 break ;
229238
230- case 'U' : /* input TOC summary file name */
231- opts -> tocFile = strdup (optarg );
232- break ;
233-
234239 case 'v' : /* verbose */
235240 opts -> verbose = 1 ;
236241 break ;
@@ -251,29 +256,29 @@ int main(int argc, char **argv)
251256
252257 if (opts -> formatName ) {
253258
254- switch (opts -> formatName [0 ]) {
259+ switch (opts -> formatName [0 ]) {
255260
256- case 'c' :
257- case 'C' :
258- opts -> format = archCustom ;
259- break ;
261+ case 'c' :
262+ case 'C' :
263+ opts -> format = archCustom ;
264+ break ;
260265
261- case 'f' :
262- case 'F' :
263- opts -> format = archFiles ;
264- break ;
266+ case 'f' :
267+ case 'F' :
268+ opts -> format = archFiles ;
269+ break ;
265270
266- case 't' :
267- case 'T' :
268- opts -> format = archTar ;
269- break ;
271+ case 't' :
272+ case 'T' :
273+ opts -> format = archTar ;
274+ break ;
270275
271- default :
272- fprintf (stderr , "%s: Unknown archive format '%s', please specify 't' or 'c'\n" ,
273- progname , opts -> formatName );
274- exit (1 );
275- }
276- }
276+ default :
277+ fprintf (stderr , "%s: Unknown archive format '%s', please specify 't' or 'c'\n" ,
278+ progname , opts -> formatName );
279+ exit (1 );
280+ }
281+ }
277282
278283 AH = OpenArchive (fileSpec , opts -> format );
279284
@@ -329,6 +334,8 @@ static void usage(const char *progname)
329334 " -h, --host HOSTNAME server host name\n"
330335 " -i, --index[=NAME] dump indexes or named index\n"
331336 " -l, --list dump summarized TOC for this file\n"
337+ " -L, --use-list=FILENAME use specified table of contents for ordering\n"
338+ " output from this file\n"
332339 " -N, --orig-order dump in original dump order\n"
333340 " -o, --oid-order dump in oid order\n"
334341 " -O, --no-owner do not output reconnect to database to match\n"
@@ -343,8 +350,6 @@ static void usage(const char *progname)
343350 " -t [TABLE], --table[=TABLE] dump for this table only\n"
344351 " -T, --trigger[=NAME] dump triggers or named trigger\n"
345352 " -u, --password use password authentication\n"
346- " -U, --use-list=FILENAME use specified table of contents for ordering\n"
347- " output from this file\n"
348353 " -v, --verbose verbose\n"
349354 " -x, --no-acl skip dumping of ACLs (grant/revoke)\n" );
350355
@@ -360,6 +365,8 @@ static void usage(const char *progname)
360365 " -h HOSTNAME server host name\n"
361366 " -i NAME dump indexes or named index\n"
362367 " -l dump summarized TOC for this file\n"
368+ " -L FILENAME use specified table of contents for ordering\n"
369+ " output from this file\n"
363370 " -N dump in original dump order\n"
364371 " -o dump in oid order\n"
365372 " -O do not output reconnect to database to match\n"
@@ -374,8 +381,6 @@ static void usage(const char *progname)
374381 " -t NAME dump for this table only\n"
375382 " -T NAME dump triggers or named trigger\n"
376383 " -u use password authentication\n"
377- " -U FILENAME use specified table of contents for ordering\n"
378- " output from this file\n"
379384 " -v verbose\n"
380385 " -x skip dumping of ACLs (grant/revoke)\n" );
381386#endif
0 commit comments