Remove dash in pg_ctl signal name. It broke with getopt_long dash
authorBruce Momjian <bruce@momjian.us>
Fri, 4 Jun 2004 04:05:36 +0000 (04:05 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 4 Jun 2004 04:05:36 +0000 (04:05 +0000)
reorganization processing, and it is clearer without the dash anyway.

doc/src/sgml/ref/pg_ctl-ref.sgml
src/bin/pg_ctl/pg_ctl.c

index 1987e7a27385555f721e059c4245b910c53e8406..6e0458e8238c874571589bce84320d54ec0a92fa 100644 (file)
@@ -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>
 
index 9b817ea490204bf98b115135680d254213200bfc..23b7df59de23c0b9236eb12c6291a72668fce497 100644 (file)
@@ -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
                        {