]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Do an explicit fflush after writing a progress message with puts.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 1 Jan 2004 19:27:15 +0000 (19:27 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 1 Jan 2004 19:27:15 +0000 (19:27 +0000)
This ensures stdout is kept in sync with messages on stderr.
Per report from Olaf Ferger.

src/bin/scripts/clusterdb.c
src/bin/scripts/createdb.c
src/bin/scripts/createuser.c
src/bin/scripts/dropdb.c
src/bin/scripts/dropuser.c
src/bin/scripts/vacuumdb.c

index d5ed4fcfedf1140f252bce3a36ad436418d388cc..6518e010b7d6576624c725e9e4aac124d12b327b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.4 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.5 2004/01/01 19:27:15 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "dumputils.h"
 
 
-static
-void
+static void
 cluster_one_database(const char *dbname, const char *table,
- const char *host, const char *port, const char *username, bool password,
+                                        const char *host, const char *port,
+                                        const char *username, bool password,
                                         const char *progname, bool echo, bool quiet);
-static
-void
-cluster_all_databases(const char *host, const char *port, const char *username, bool password,
+static void
+cluster_all_databases(const char *host, const char *port,
+                                         const char *username, bool password,
                                          const char *progname, bool echo, bool quiet);
 
 static void help(const char *progname);
@@ -151,10 +151,10 @@ main(int argc, char *argv[])
 }
 
 
-static
-void
+static void
 cluster_one_database(const char *dbname, const char *table,
- const char *host, const char *port, const char *username, bool password,
+                                        const char *host, const char *port,
+                                        const char *username, bool password,
                                         const char *progname, bool echo, bool quiet)
 {
        PQExpBufferData sql;
@@ -192,13 +192,16 @@ cluster_one_database(const char *dbname, const char *table,
        termPQExpBuffer(&sql);
 
        if (!quiet)
+       {
                puts("CLUSTER");
+               fflush(stdout);
+       }
 }
 
 
-static
-void
-cluster_all_databases(const char *host, const char *port, const char *username, bool password,
+static void
+cluster_all_databases(const char *host, const char *port,
+                                         const char *username, bool password,
                                          const char *progname, bool echo, bool quiet)
 {
        PGconn     *conn;
index e3f40971520df88831b413750d3a430aa7a1d75a..005c942cca3a1b6f89458338cb0af4eee735bbf6 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.6 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.7 2004/01/01 19:27:15 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -177,7 +177,10 @@ main(int argc, char *argv[])
        PQfinish(conn);
 
        if (!quiet)
+       {
                puts("CREATE DATABASE");
+               fflush(stdout);
+       }
 
        if (comment)
        {
@@ -200,7 +203,10 @@ main(int argc, char *argv[])
 
                PQfinish(conn);
                if (!quiet)
+               {
                        puts("COMMENT");
+                       fflush(stdout);
+               }
        }
 
        exit(0);
index 2a68b6b438ebf6288e4b065ae19274392ddcfb26..021decf4bdb190471a035e57774037c3a6fe8ac4 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.7 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.8 2004/01/01 19:27:15 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -224,7 +224,10 @@ main(int argc, char *argv[])
 
        PQfinish(conn);
        if (!quiet)
+       {
                puts("CREATE USER");
+               fflush(stdout);
+       }
        exit(0);
 }
 
index 51220fe28cc0ca15186f49dc3a3e4765610666dc..91ad090f42aae0374194901af38b3574d22d08f2 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.7 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.8 2004/01/01 19:27:15 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -131,7 +131,10 @@ main(int argc, char *argv[])
 
        PQfinish(conn);
        if (!quiet)
+       {
                puts("DROP DATABASE");
+               fflush(stdout);
+       }
        exit(0);
 }
 
index b5b5439f8a2b9d97071f974d1d82d1a86c30b055..b0dc5a7d7c3472bc014633addfba9587eddec5a5 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.6 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.7 2004/01/01 19:27:15 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -131,7 +131,10 @@ main(int argc, char *argv[])
 
        PQfinish(conn);
        if (!quiet)
+       {
                puts("DROP USER");
+               fflush(stdout);
+       }
        exit(0);
 }
 
index eaac650ee06a9dcbd3ab398ff3d70ab6017341b9..cc9d8be1396ed34140cf6b70a120cf3ba89b1ae7 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.4 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.5 2004/01/01 19:27:15 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "common.h"
 
 
-static
-void
-vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, const char *table,
- const char *host, const char *port, const char *username, bool password,
+static void
+vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
+                                       const char *table,
+                                       const char *host, const char *port,
+                                       const char *username, bool password,
                                        const char *progname, bool echo, bool quiet);
-static
-void
+static void
 vacuum_all_databases(bool full, bool verbose, bool analyze,
- const char *host, const char *port, const char *username, bool password,
+                                        const char *host, const char *port,
+                                        const char *username, bool password,
                                         const char *progname, bool echo, bool quiet);
 
 static void help(const char *progname);
@@ -168,10 +169,11 @@ main(int argc, char *argv[])
 }
 
 
-static
-void
-vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, const char *table,
- const char *host, const char *port, const char *username, bool password,
+static void
+vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
+                                       const char *table,
+                                       const char *host, const char *port,
+                                       const char *username, bool password,
                                        const char *progname, bool echo, bool quiet)
 {
        PQExpBufferData sql;
@@ -215,14 +217,17 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, c
        termPQExpBuffer(&sql);
 
        if (!quiet)
+       {
                puts("VACUUM");
+               fflush(stdout);
+       }
 }
 
 
-static
-void
+static void
 vacuum_all_databases(bool full, bool verbose, bool analyze,
- const char *host, const char *port, const char *username, bool password,
+                                        const char *host, const char *port,
+                                        const char *username, bool password,
                                         const char *progname, bool echo, bool quiet)
 {
        PGconn     *conn;