]> granicus.if.org Git - postgresql/commitdiff
Display -? as -\? under unix for psql.
authorBruce Momjian <bruce@momjian.us>
Thu, 11 May 2000 03:14:19 +0000 (03:14 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 11 May 2000 03:14:19 +0000 (03:14 +0000)
src/bin/psql/startup.c

index a886782c8a4ab74feb4df86a29f3fd300c29975c..252caa2ff67bb8c5a6f1c08e4d31c8df42d1b24a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.30 2000/05/11 01:37:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.31 2000/05/11 03:14:19 momjian Exp $
  */
 #include "postgres.h"
 
@@ -82,7 +82,8 @@ static void
 static void
                        showVersion(void);
 
-
+static void
+                       explain_help_and_exit(void);
 
 /*
  *
@@ -513,8 +514,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
                                /* unknown option reported by getopt */
                                else
                                {
-                                       fputs("Try -? for help.\n", stderr);
-                                       exit(EXIT_FAILURE);
+                                       explain_help_and_exit();
                                }
                                break;
 #ifndef HAVE_GETOPT_LONG
@@ -525,8 +525,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
                                break;
 #endif
                        default:
-                               fputs("Try -? for help.\n", stderr);
-                               exit(EXIT_FAILURE);
+                               explain_help_and_exit();
                                break;
                }
        }
@@ -640,3 +639,17 @@ showVersion(void)
        puts("Read the file COPYRIGHT or use the command \\copyright to see the");
        puts("usage and distribution terms.");
 }
+
+static void
+explain_help_and_exit(void)
+{
+
+#ifdef WIN32
+       fputs("Try -? for help.\n", stderr);
+#else /* !WIN32 */
+       fputs("Try -\\? for help.\n", stderr);
+#endif /* WIN32 */
+
+       exit(EXIT_FAILURE);
+}
+