From bf2a115f2f0d103dc4299c6ee2ce1936aa1d7f64 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Fri, 4 Jun 2004 04:05:36 +0000
Subject: [PATCH] Remove dash in pg_ctl signal name.  It broke with getopt_long
 dash reorganization processing, and it is clearer without the dash anyway.

---
 doc/src/sgml/ref/pg_ctl-ref.sgml |  5 +++--
 src/bin/pg_ctl/pg_ctl.c          | 24 ++++++++++++------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml
index 1987e7a2738..6e0458e8238 100644
--- a/doc/src/sgml/ref/pg_ctl-ref.sgml
+++ b/doc/src/sgml/ref/pg_ctl-ref.sgml
@@ -1,5 +1,5 @@
 <!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.27 2004/05/27 03:50:25 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.28 2004/06/04 04:05:36 momjian Exp $
 PostgreSQL documentation
 -->
 
@@ -140,7 +140,8 @@ PostgreSQL documentation
   <para>
    <option>kill</option> mode allows you to send a signal to a specified
     process.  This is particularly valuable for <productname>MS Windows</>
-    which does not have a <application>kill</> command.
+    which does not have a <application>kill</> command.  Use 
+    <literal>--help</> to see a list of supported signal names.
   </para>
  </refsect1>
 
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 9b817ea4902..23b7df59de2 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -4,7 +4,7 @@
  *
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.6 2004/06/03 00:07:36 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.7 2004/06/04 04:05:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -730,7 +730,7 @@ do_help(void)
 	printf(_("Options for stop or restart:\n"));
 	printf(_("  -m SHUTDOWN-MODE   may be 'smart', 'fast', or 'immediate'\n\n"));
 	printf(_("Allowed signal names for kill:\n"));
-	printf(_("  -HUP -INT -QUIT -ABRT -TERM -USR1 -USR2\n\n"));
+	printf(_("  HUP INT QUIT ABRT TERM USR1 USR2\n\n"));
 	printf(_("Shutdown modes are:\n"));
 	printf(_("  smart       quit after all clients have disconnected\n"));
 	printf(_("  fast        quit directly, with proper shutdown\n"));
@@ -771,25 +771,25 @@ set_mode(char *modeopt)
 static void
 set_sig(char *signame)
 {
-	if (!strcmp(signame, "-HUP"))
+	if (!strcmp(signame, "HUP"))
 		sig = SIGHUP;
-	else if (!strcmp(signame, "-INT"))
+	else if (!strcmp(signame, "INT"))
 		sig = SIGINT;
-	else if (!strcmp(signame, "-QUIT"))
+	else if (!strcmp(signame, "QUIT"))
 		sig = SIGQUIT;
-	else if (!strcmp(signame, "-ABRT"))
+	else if (!strcmp(signame, "ABRT"))
 		sig = SIGABRT;
 
 	/*
 	 * probably should NOT provide SIGKILL
 	 *
-	 * else if (!strcmp(signame,"-KILL")) sig = SIGKILL;
+	 * else if (!strcmp(signame,"KILL")) sig = SIGKILL;
 	 */
-	else if (!strcmp(signame, "-TERM"))
+	else if (!strcmp(signame, "TERM"))
 		sig = SIGTERM;
-	else if (!strcmp(signame, "-USR1"))
+	else if (!strcmp(signame, "USR1"))
 		sig = SIGUSR1;
-	else if (!strcmp(signame, "-USR2"))
+	else if (!strcmp(signame, "USR2"))
 		sig = SIGUSR2;
 	else
 	{
@@ -936,8 +936,8 @@ main(int argc, char **argv)
 					exit(1);
 				}
 				ctl_command = KILL_COMMAND;
-				set_sig(argv[optind + 1]);
-				killproc = atol(argv[optind + 2]);
+				set_sig(argv[++optind]);
+				killproc = atol(argv[++optind]);
 			}
 			else
 			{
-- 
GitLab