Display -? as -\? under unix for psql.

This commit is contained in:
Bruce Momjian 2000-05-11 03:14:19 +00:00
parent 0fbde5d928
commit e10c5597b7

View File

@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * 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" #include "postgres.h"
@ -82,7 +82,8 @@ static void
static void static void
showVersion(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 */ /* unknown option reported by getopt */
else else
{ {
fputs("Try -? for help.\n", stderr); explain_help_and_exit();
exit(EXIT_FAILURE);
} }
break; break;
#ifndef HAVE_GETOPT_LONG #ifndef HAVE_GETOPT_LONG
@ -525,8 +525,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
break; break;
#endif #endif
default: default:
fputs("Try -? for help.\n", stderr); explain_help_and_exit();
exit(EXIT_FAILURE);
break; break;
} }
} }
@ -640,3 +639,17 @@ showVersion(void)
puts("Read the file COPYRIGHT or use the command \\copyright to see the"); puts("Read the file COPYRIGHT or use the command \\copyright to see the");
puts("usage and distribution terms."); 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);
}