Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30a800a

Browse files
committed
Update for new we-always-have-getopt_long approach.
1 parentb4b62cf commit30a800a

File tree

2 files changed

+12
-42
lines changed

2 files changed

+12
-42
lines changed

‎contrib/pg_dumplo/main.c

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -------------------------------------------------------------------------
22
* pg_dumplo
33
*
4-
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.13 2002/10/18 18:41:20 momjian Exp $
4+
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.14 2003/01/07 21:42:38 tgl Exp $
55
*
66
*Karel Zak 1999-2000
77
* -------------------------------------------------------------------------
@@ -17,13 +17,14 @@
1717

1818
#include"pg_dumplo.h"
1919

20-
#ifdefHAVE_GETOPT_LONG
21-
#include<getopt.h>
22-
#defineno_argument 0
23-
#definerequired_argument 1
20+
#ifndefHAVE_STRDUP
21+
#include"strdup.h"
2422
#endif
2523

26-
externinterrno;
24+
#ifndefHAVE_GETOPT_LONG
25+
#include"getopt_long.h"
26+
intoptreset;
27+
#endif
2728

2829
char*progname=NULL;
2930

@@ -67,8 +68,6 @@ main(int argc, char **argv)
6768
{
6869
intarg;
6970
externintoptind;
70-
71-
#ifdefHAVE_GETOPT_LONG
7271
intl_index=0;
7372
staticstructoptionl_opt[]= {
7473
{"help",no_argument,0,'h'},
@@ -89,10 +88,6 @@ main(int argc, char **argv)
8988

9089
while ((arg=getopt_long(argc,argv,"?aeho:u:p:qd:l:t:irs:w",l_opt,&l_index))!=-1)
9190
{
92-
#else
93-
while ((arg=getopt(argc,argv,"?aeho:u:p:qd:l:t:irs:w"))!=-1)
94-
{
95-
#endif
9691
switch (arg)
9792
{
9893
case'?':
@@ -272,11 +267,8 @@ parse_lolist(LODumpMaster * pgLO)
272267
staticvoid
273268
usage()
274269
{
275-
printf("\npg_dumplo %s - PostgreSQL large objects dump\n",VERSION);
270+
printf("\npg_dumplo %s - PostgreSQL large objects dump\n",PG_VERSION);
276271
puts("pg_dumplo [option]\n\n"
277-
278-
#ifdefHAVE_GETOPT_LONG
279-
280272
"-h --help this help\n"
281273
"-u --user=<username> username for connection to server\n"
282274
"-p --password=<password> password for connection to server\n"
@@ -291,34 +283,14 @@ usage()
291283
"-r --remove if is set '-i' try remove old LO\n"
292284
"-q --quiet run quietly\n"
293285
"-w --show not dump, but show all LO in DB\n"
294-
);/* puts() */
295-
296-
#else
297-
"-h this help\n"
298-
"-u <username> username for connection to server\n"
299-
"-p <password> password for connection to server\n"
300-
"-d <database> database name\n"
301-
"-t <hostname> server hostname\n"
302-
"-o <port> database server port (default: 5432)\n"
303-
"-s <dir> directory with dump tree (for export/import)\n"
304-
"-i import large obj dump tree to DB\n"
305-
"-e export (dump) large obj to dump tree\n"
306-
"-l <table.attr ...> dump attribute (columns) with LO to dump tree\n"
307-
"-a dump all LO in DB (default)\n"
308-
"-r if is set '-i' try remove old LO\n"
309-
"-q run quietly\n"
310-
"-w not dump, but show all LO in DB\n"
311-
);/* puts() */
312-
#endif
313-
314-
puts(
286+
"\n"
315287
"Example (dump): pg_dumplo -d my_db -s /my_dump/dir -l t1.a t1.b t2.a\n"
316288
" pg_dumplo -a -d my_db -s /my_dump/dir\n"
317289
"Example (import): pg_dumplo -i -d my_db -s /my_dump/dir\n"
318290
"Example (show): pg_dumplo -w -d my_db\n\n"
319291
"Note: * option '-l' must be last option!\n"
320292
" * option '-i' without option '-r' make new large obj in DB\n"
321293
" not rewrite old, the '-i' UPDATE oid numbers in table.attr only!\n"
322-
" * if is not set option -s, thepg_dumplouse $PWD\n"
294+
" * ifoption -sis not set,pg_dumplouses $PWD\n"
323295
);/* puts() */
324296
}

‎contrib/pg_dumplo/pg_dumplo.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -------------------------------------------------------------------------
2-
* pg_dumplo
2+
* pg_dumplo.h
33
*
4-
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.8 2001/11/12 17:44:14 momjian Exp $
4+
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.9 2003/01/07 21:42:38 tgl Exp $
55
*
66
*Karel Zak 1999-2000
77
* -------------------------------------------------------------------------
@@ -12,8 +12,6 @@
1212

1313
#include"postgres_ext.h"
1414

15-
#defineVERSION "7.1.0"
16-
1715
/* ----------
1816
* Define
1917
* ----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp