]> granicus.if.org Git - postgresql/commitdiff
Move long_options structures to the top of main() functions, for
authorBruce Momjian <bruce@momjian.us>
Fri, 30 Nov 2012 19:49:55 +0000 (14:49 -0500)
committerBruce Momjian <bruce@momjian.us>
Fri, 30 Nov 2012 19:49:55 +0000 (14:49 -0500)
consistency.

Per suggestion from Tom.

contrib/pg_test_fsync/pg_test_fsync.c
contrib/pg_test_timing/pg_test_timing.c
contrib/pgbench/pgbench.c
src/bin/pg_basebackup/pg_receivexlog.c
src/bin/pg_dump/pg_dumpall.c
src/test/regress/pg_regress.c

index efa1b3284ec7798c689b36df23c2f62b58499a1b..ec4b90c7974ed8be6405fb160cfebb7a0abb81dc 100644 (file)
@@ -140,6 +140,7 @@ handle_args(int argc, char *argv[])
                {"secs-per-test", required_argument, NULL, 's'},
                {NULL, 0, NULL, 0}
        };
+
        int                     option;                 /* Command line option */
        int                     optindex = 0;   /* used by getopt_long */
 
index 8d79c7bd74f7531114be794d412a5f6e0b16bbb6..191c621376ef0e2b6ff444c25948e43a7d5eab26 100644 (file)
@@ -43,6 +43,7 @@ handle_args(int argc, char *argv[])
                {"duration", required_argument, NULL, 'd'},
                {NULL, 0, NULL, 0}
        };
+
        int                     option;                 /* Command line option */
        int                     optindex = 0;   /* used by getopt_long */
 
index 090c21019e6dc56d44883284f556fddd8525f332..e3764522280bc82566d30da98e65e072df8d285a 100644 (file)
@@ -1915,6 +1915,15 @@ printResults(int ttype, int normal_xacts, int nclients,
 int
 main(int argc, char **argv)
 {
+       static struct option long_options[] = {
+               {"foreign-keys", no_argument, &foreign_keys, 1},
+               {"index-tablespace", required_argument, NULL, 3},
+               {"tablespace", required_argument, NULL, 2},
+               {"unlogged-tables", no_argument, &unlogged_tables, 1},
+               {"sampling-rate", required_argument, NULL, 4},
+               {NULL, 0, NULL, 0}
+       };
+
        int                     c;
        int                     nclients = 1;   /* default number of simulated clients */
        int                     nthreads = 1;   /* default number of threads */
@@ -1937,15 +1946,6 @@ main(int argc, char **argv)
 
        int                     i;
 
-       static struct option long_options[] = {
-               {"foreign-keys", no_argument, &foreign_keys, 1},
-               {"index-tablespace", required_argument, NULL, 3},
-               {"tablespace", required_argument, NULL, 2},
-               {"unlogged-tables", no_argument, &unlogged_tables, 1},
-               {"sampling-rate", required_argument, NULL, 4},
-               {NULL, 0, NULL, 0}
-       };
-
 #ifdef HAVE_GETRLIMIT
        struct rlimit rlim;
 #endif
index 843fc69294d18302b28e8bb12b461885d48b3b30..54524834f755ee1369f6ebf9fe550dacb1109fef 100644 (file)
@@ -315,6 +315,7 @@ main(int argc, char **argv)
                {"verbose", no_argument, NULL, 'v'},
                {NULL, 0, NULL, 0}
        };
+
        int                     c;
        int                     option_index;
 
index ca95bad1cc002288ea3f0c6484e71f26f54a0cee..77dfbc282f7b79e99a4eec1cd5e10889ff35f15b 100644 (file)
@@ -82,24 +82,6 @@ static char *filename = NULL;
 int
 main(int argc, char *argv[])
 {
-       char       *pghost = NULL;
-       char       *pgport = NULL;
-       char       *pguser = NULL;
-       char       *pgdb = NULL;
-       char       *use_role = NULL;
-       enum trivalue prompt_password = TRI_DEFAULT;
-       bool            data_only = false;
-       bool            globals_only = false;
-       bool            output_clean = false;
-       bool            roles_only = false;
-       bool            tablespaces_only = false;
-       PGconn     *conn;
-       int                     encoding;
-       const char *std_strings;
-       int                     c,
-                               ret;
-       int                     optindex;
-
        static struct option long_options[] = {
                {"data-only", no_argument, NULL, 'a'},
                {"clean", no_argument, NULL, 'c'},
@@ -142,6 +124,24 @@ main(int argc, char *argv[])
                {NULL, 0, NULL, 0}
        };
 
+       char       *pghost = NULL;
+       char       *pgport = NULL;
+       char       *pguser = NULL;
+       char       *pgdb = NULL;
+       char       *use_role = NULL;
+       enum trivalue prompt_password = TRI_DEFAULT;
+       bool            data_only = false;
+       bool            globals_only = false;
+       bool            output_clean = false;
+       bool            roles_only = false;
+       bool            tablespaces_only = false;
+       PGconn     *conn;
+       int                     encoding;
+       const char *std_strings;
+       int                     c,
+                               ret;
+       int                     optindex;
+
        set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_dump"));
 
        progname = get_progname(argv[0]);
index 81e7b69231b3ccab91637debfb4fbcf50a5e4f3d..5a656f2e52d1c1b6e6f94dae1aefccdde646b947 100644 (file)
@@ -1906,13 +1906,6 @@ help(void)
 int
 regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc)
 {
-       _stringlist *sl;
-       int                     c;
-       int                     i;
-       int                     option_index;
-       char            buf[MAXPGPATH * 4];
-       char            buf2[MAXPGPATH * 4];
-
        static struct option long_options[] = {
                {"help", no_argument, NULL, 'h'},
                {"version", no_argument, NULL, 'V'},
@@ -1941,6 +1934,13 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
                {NULL, 0, NULL, 0}
        };
 
+       _stringlist *sl;
+       int                     c;
+       int                     i;
+       int                     option_index;
+       char            buf[MAXPGPATH * 4];
+       char            buf2[MAXPGPATH * 4];
+
        progname = get_progname(argv[0]);
        set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_regress"));