Skip to content

Commit bd9c8e7

Browse files
committed
Move long_options structures to the top of main() functions, for
consistency. Per suggestion from Tom.
1 parent da63fec commit bd9c8e7

File tree

6 files changed

+37
-34
lines changed

6 files changed

+37
-34
lines changed

contrib/pg_test_fsync/pg_test_fsync.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ handle_args(int argc, char *argv[])
140140
{"secs-per-test", required_argument, NULL, 's'},
141141
{NULL, 0, NULL, 0}
142142
};
143+
143144
int option; /* Command line option */
144145
int optindex = 0; /* used by getopt_long */
145146

contrib/pg_test_timing/pg_test_timing.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ handle_args(int argc, char *argv[])
4343
{"duration", required_argument, NULL, 'd'},
4444
{NULL, 0, NULL, 0}
4545
};
46+
4647
int option; /* Command line option */
4748
int optindex = 0; /* used by getopt_long */
4849

contrib/pgbench/pgbench.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,15 @@ printResults(int ttype, int normal_xacts, int nclients,
19151915
int
19161916
main(int argc, char **argv)
19171917
{
1918+
static struct option long_options[] = {
1919+
{"foreign-keys", no_argument, &foreign_keys, 1},
1920+
{"index-tablespace", required_argument, NULL, 3},
1921+
{"tablespace", required_argument, NULL, 2},
1922+
{"unlogged-tables", no_argument, &unlogged_tables, 1},
1923+
{"sampling-rate", required_argument, NULL, 4},
1924+
{NULL, 0, NULL, 0}
1925+
};
1926+
19181927
int c;
19191928
int nclients = 1; /* default number of simulated clients */
19201929
int nthreads = 1; /* default number of threads */
@@ -1937,15 +1946,6 @@ main(int argc, char **argv)
19371946

19381947
int i;
19391948

1940-
static struct option long_options[] = {
1941-
{"foreign-keys", no_argument, &foreign_keys, 1},
1942-
{"index-tablespace", required_argument, NULL, 3},
1943-
{"tablespace", required_argument, NULL, 2},
1944-
{"unlogged-tables", no_argument, &unlogged_tables, 1},
1945-
{"sampling-rate", required_argument, NULL, 4},
1946-
{NULL, 0, NULL, 0}
1947-
};
1948-
19491949
#ifdef HAVE_GETRLIMIT
19501950
struct rlimit rlim;
19511951
#endif

src/bin/pg_basebackup/pg_receivexlog.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ main(int argc, char **argv)
315315
{"verbose", no_argument, NULL, 'v'},
316316
{NULL, 0, NULL, 0}
317317
};
318+
318319
int c;
319320
int option_index;
320321

src/bin/pg_dump/pg_dumpall.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,24 +82,6 @@ static char *filename = NULL;
8282
int
8383
main(int argc, char *argv[])
8484
{
85-
char *pghost = NULL;
86-
char *pgport = NULL;
87-
char *pguser = NULL;
88-
char *pgdb = NULL;
89-
char *use_role = NULL;
90-
enum trivalue prompt_password = TRI_DEFAULT;
91-
bool data_only = false;
92-
bool globals_only = false;
93-
bool output_clean = false;
94-
bool roles_only = false;
95-
bool tablespaces_only = false;
96-
PGconn *conn;
97-
int encoding;
98-
const char *std_strings;
99-
int c,
100-
ret;
101-
int optindex;
102-
10385
static struct option long_options[] = {
10486
{"data-only", no_argument, NULL, 'a'},
10587
{"clean", no_argument, NULL, 'c'},
@@ -142,6 +124,24 @@ main(int argc, char *argv[])
142124
{NULL, 0, NULL, 0}
143125
};
144126

127+
char *pghost = NULL;
128+
char *pgport = NULL;
129+
char *pguser = NULL;
130+
char *pgdb = NULL;
131+
char *use_role = NULL;
132+
enum trivalue prompt_password = TRI_DEFAULT;
133+
bool data_only = false;
134+
bool globals_only = false;
135+
bool output_clean = false;
136+
bool roles_only = false;
137+
bool tablespaces_only = false;
138+
PGconn *conn;
139+
int encoding;
140+
const char *std_strings;
141+
int c,
142+
ret;
143+
int optindex;
144+
145145
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_dump"));
146146

147147
progname = get_progname(argv[0]);

src/test/regress/pg_regress.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,13 +1906,6 @@ help(void)
19061906
int
19071907
regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc)
19081908
{
1909-
_stringlist *sl;
1910-
int c;
1911-
int i;
1912-
int option_index;
1913-
char buf[MAXPGPATH * 4];
1914-
char buf2[MAXPGPATH * 4];
1915-
19161909
static struct option long_options[] = {
19171910
{"help", no_argument, NULL, 'h'},
19181911
{"version", no_argument, NULL, 'V'},
@@ -1941,6 +1934,13 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
19411934
{NULL, 0, NULL, 0}
19421935
};
19431936

1937+
_stringlist *sl;
1938+
int c;
1939+
int i;
1940+
int option_index;
1941+
char buf[MAXPGPATH * 4];
1942+
char buf2[MAXPGPATH * 4];
1943+
19441944
progname = get_progname(argv[0]);
19451945
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_regress"));
19461946

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy