2021-03-03 00:09, Fujii Masao wrote:
We can simplify the code more and remove "env = user"
by just using "user" instead of "env" in the above?

Thank you for your comment.
I updated my patch and replaced "env" with "user".
Please check.

Regards.
--
Kota Miyake
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index e44120bf76..edb17ed5dc 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -133,11 +133,7 @@ usage(unsigned short int pager)
 	env = getenv("PGPORT");
 	fprintf(output, _("  -p, --port=PORT          database server port (default: \"%s\")\n"),
 			env ? env : DEF_PGPORT_STR);
-	/* Display default user */
-	env = getenv("PGUSER");
-	if (!env)
-		env = user;
-	fprintf(output, _("  -U, --username=USERNAME  database user name (default: \"%s\")\n"), env);
+	fprintf(output, _("  -U, --username=USERNAME  database user name (default: \"%s\")\n"), user);
 	fprintf(output, _("  -w, --no-password        never prompt for password\n"));
 	fprintf(output, _("  -W, --password           force password prompt (should happen automatically)\n"));
 

Reply via email to