Commit 306c44ee authored by Peter Eisentraut's avatar Peter Eisentraut

Add -V option to backend, to show version, since --version doesn't seem

to work everywhere.  Also, on FreeBSD you need to set the optreset variable
to 1 before parsing the command line a second time with getopt().
parent 6f2f1690
This diff is collapsed.
...@@ -936,6 +936,16 @@ PGAC_ARG_BOOL(enable, syslog, no, [ --enable-syslog enable logging to s ...@@ -936,6 +936,16 @@ PGAC_ARG_BOOL(enable, syslog, no, [ --enable-syslog enable logging to s
[AC_MSG_ERROR([no syslog interface found])])]) [AC_MSG_ERROR([no syslog interface found])])])
AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
[AC_TRY_LINK([#include <unistd.h>],
[extern int optreset; optreset = 1;],
[pgac_cv_var_int_optreset=yes],
[pgac_cv_var_int_optreset=no])])
if test x"$pgac_cv_var_int_optreset" = x"yes"; then
AC_DEFINE(HAVE_INT_OPTRESET, 1)
fi
dnl Check to see if we have a working 64-bit integer type. dnl Check to see if we have a working 64-bit integer type.
dnl This breaks down into two steps: dnl This breaks down into two steps:
dnl (1) figure out if the compiler has a 64-bit int type with working dnl (1) figure out if the compiler has a 64-bit int type with working
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.178 2000/11/04 12:43:23 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.179 2000/11/06 22:18:06 petere Exp $
* *
* NOTES * NOTES
* *
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#endif #endif
#ifdef HAVE_GETOPT_H #ifdef HAVE_GETOPT_H
#include "getopt.h" #include <getopt.h>
#endif #endif
#include "catalog/pg_database.h" #include "catalog/pg_database.h"
...@@ -372,7 +372,7 @@ PostmasterMain(int argc, char *argv[]) ...@@ -372,7 +372,7 @@ PostmasterMain(int argc, char *argv[])
* will occur. * will occur.
*/ */
opterr = 1; opterr = 1;
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:?")) != EOF) while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:SsV-:?")) != EOF)
{ {
switch(opt) switch(opt)
{ {
...@@ -380,6 +380,10 @@ PostmasterMain(int argc, char *argv[]) ...@@ -380,6 +380,10 @@ PostmasterMain(int argc, char *argv[])
potential_DataDir = optarg; potential_DataDir = optarg;
break; break;
case 'V':
puts("postmaster (PostgreSQL) " PG_VERSION);
exit(0);
case '-': case '-':
{ {
char *name, *value; char *name, *value;
...@@ -421,7 +425,10 @@ PostmasterMain(int argc, char *argv[]) ...@@ -421,7 +425,10 @@ PostmasterMain(int argc, char *argv[])
IgnoreSystemIndexes(false); IgnoreSystemIndexes(false);
optind = 1; /* start over */ optind = 1; /* start over */
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:Ss-:?")) != EOF) #ifdef HAVE_INT_OPTRESET
optreset = 1;
#endif
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:SsV-:?")) != EOF)
{ {
switch (opt) switch (opt)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.185 2000/11/04 12:43:24 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.186 2000/11/06 22:18:08 petere Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -1112,7 +1112,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1112,7 +1112,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
optind = 1; /* reset after postmaster's usage */ optind = 1; /* reset after postmaster's usage */
while ((flag = getopt(argc, argv, "A:B:CD:d:Eef:FiLNOPo:p:S:st:v:W:x:-:?")) != EOF) while ((flag = getopt(argc, argv, "A:B:CD:d:Eef:FiLNOPo:p:S:st:v:VW:x:-:?")) != EOF)
switch (flag) switch (flag)
{ {
case 'A': case 'A':
...@@ -1338,6 +1338,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1338,6 +1338,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
FrontendProtocol = (ProtocolVersion) atoi(optarg); FrontendProtocol = (ProtocolVersion) atoi(optarg);
break; break;
case 'V':
puts("postgres (PostgreSQL) " PG_VERSION);
exit(0);
case 'W': case 'W':
/* ---------------- /* ----------------
* wait N seconds to allow attach from a debugger * wait N seconds to allow attach from a debugger
...@@ -1635,7 +1639,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha ...@@ -1635,7 +1639,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface "); puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.185 $ $Date: 2000/11/04 12:43:24 $\n"); puts("$Revision: 1.186 $ $Date: 2000/11/06 22:18:08 $\n");
} }
/* /*
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.110 2000/11/04 12:47:48 petere Exp $ # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.111 2000/11/06 22:18:09 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -109,11 +109,11 @@ fi ...@@ -109,11 +109,11 @@ fi
if [ x"$self_path" != x"" ] \ if [ x"$self_path" != x"" ] \
&& [ -x "$self_path/postgres" ] \ && [ -x "$self_path/postgres" ] \
&& [ x"`$self_path/postgres --version 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ] && [ x"`$self_path/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
then then
PGPATH=$self_path PGPATH=$self_path
elif [ -x "$bindir/postgres" ]; then elif [ -x "$bindir/postgres" ]; then
if [ x"`$bindir/postgres --version 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ] if [ x"`$bindir/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
then then
PGPATH=$bindir PGPATH=$bindir
else else
...@@ -186,7 +186,7 @@ do ...@@ -186,7 +186,7 @@ do
usage=t usage=t
break break
;; ;;
--version) --version|-V)
echo "initdb (PostgreSQL) $VERSION" echo "initdb (PostgreSQL) $VERSION"
exit 0 exit 0
;; ;;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your * or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure. * changes will be overwritten the next time you run configure.
* *
* $Id: config.h.in,v 1.146 2000/11/03 18:43:52 petere Exp $ * $Id: config.h.in,v 1.147 2000/11/06 22:18:10 petere Exp $
*/ */
#ifndef CONFIG_H #ifndef CONFIG_H
...@@ -604,6 +604,8 @@ extern void srandom(unsigned int seed); ...@@ -604,6 +604,8 @@ extern void srandom(unsigned int seed);
/* Define if a system lib (-ldl) has dlopen() (needed for AIX) */ /* Define if a system lib (-ldl) has dlopen() (needed for AIX) */
#undef HAVE_DLOPEN #undef HAVE_DLOPEN
/* Define if you have the optreset variable */
#undef HAVE_INT_OPTRESET
/* /*
*------------------------------------------------------------------------ *------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment