Commit f64b8403 authored by Bryan Henderson's avatar Bryan Henderson

Remove most compile-time options, add a few runtime options to make up for it.

In particular, no more compiled-in default for PGDATA or LIBDIR.  Commands
that need them need either invocation options or environment variables.
PGPORT default is hardcoded as 5432, but overrideable with options or
environment variables.
parent 7ac541da
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Makefile for libpq subsystem (backend half of libpq interface) # Makefile for libpq subsystem (backend half of libpq interface)
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.3 1996/11/06 08:48:21 scrappy Exp $ # $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.4 1996/11/14 10:23:51 bryanh Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -16,7 +16,6 @@ INCLUDE_OPT = -I.. \ ...@@ -16,7 +16,6 @@ INCLUDE_OPT = -I.. \
-I../../include -I../../include
CFLAGS+=$(INCLUDE_OPT) CFLAGS+=$(INCLUDE_OPT)
CFLAGS+= -DPOSTPORT='"$(POSTPORT)"'
# kerberos flags # kerberos flags
ifdef KRBVERS ifdef KRBVERS
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.6 1996/11/08 05:56:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.7 1996/11/14 10:23:53 bryanh Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -140,7 +140,7 @@ pq_getport() ...@@ -140,7 +140,7 @@ pq_getport()
if (envport) if (envport)
return(atoi(envport)); return(atoi(envport));
return(atoi(POSTPORT)); return(atoi(DEF_PGPORT));
} }
/* -------------------------------- /* --------------------------------
......
...@@ -30,7 +30,6 @@ struct sembuf ...@@ -30,7 +30,6 @@ struct sembuf
#define MAXHOSTNAMELEN 12 /* where is the official definition of this? */ #define MAXHOSTNAMELEN 12 /* where is the official definition of this? */
#define MAXPATHLEN _MAX_PATH /* in winsock.h */ #define MAXPATHLEN _MAX_PATH /* in winsock.h */
#define POSTPORT "5432"
/* NT has stricmp not strcasecmp. Which is ANSI? */ /* NT has stricmp not strcasecmp. Which is ANSI? */
#define strcasecmp(a,b) _stricmp(a,b) #define strcasecmp(a,b) _stricmp(a,b)
...@@ -46,5 +45,3 @@ struct sembuf ...@@ -46,5 +45,3 @@ struct sembuf
#define GETNCNT 5 #define GETNCNT 5
#define GETVAL 6 #define GETVAL 6
#define POSTGRESDIR "d:\\pglite"
#define PGDATADIR "d:\\pglite\\data"
This diff is collapsed.
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.10 1996/11/10 03:03:28 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.11 1996/11/14 10:24:22 bryanh Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -234,7 +234,7 @@ DebugFileOpen(void) ...@@ -234,7 +234,7 @@ DebugFileOpen(void)
fd = fileno(stderr); fd = fileno(stderr);
if (fcntl(fd, F_GETFD, 0) < 0) { if (fcntl(fd, F_GETFD, 0) < 0) {
sprintf(OutputFileName, "%s/pg.errors.%d", sprintf(OutputFileName, "%s/pg.errors.%d",
GetPGData(), (int)getpid()); DataDir, (int)getpid());
fd = open(OutputFileName, O_CREAT|O_APPEND|O_WRONLY, 0666); fd = open(OutputFileName, O_CREAT|O_APPEND|O_WRONLY, 0666);
} }
#endif /* WIN32 */ #endif /* WIN32 */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Makefile for utils/init # Makefile for utils/init
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.3 1996/11/12 06:46:40 bryanh Exp $ # $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.4 1996/11/14 10:24:32 bryanh Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -16,9 +16,6 @@ INCLUDE_OPT = -I../.. \ ...@@ -16,9 +16,6 @@ INCLUDE_OPT = -I../.. \
-I../../../include -I../../../include
CFLAGS += $(INCLUDE_OPT) CFLAGS += $(INCLUDE_OPT)
# The following defines really ought to go in config.h
CFLAGS += -DPOSTGRESDIR='"$(POSTGRESDIR)"' -DPGDATADIR='"$(DATADIR)"' \
-DPOSTPORT='"$(POSTPORT)"'
OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.2 1996/11/06 10:31:54 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.3 1996/11/14 10:24:38 bryanh Exp $
* *
* NOTES * NOTES
* Globals used all over the place should be declared here and not * Globals used all over the place should be declared here and not
...@@ -99,12 +99,3 @@ char *SharedSystemRelationNames[] = { ...@@ -99,12 +99,3 @@ char *SharedSystemRelationNames[] = {
VariableRelationName, VariableRelationName,
0 0
}; };
/* set up global variables, pointers, etc. */
void InitGlobals()
{
MasterPid = getpid();
DataDir = GetPGData();
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.2 1996/11/06 10:31:57 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.3 1996/11/14 10:24:41 bryanh Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -345,35 +345,3 @@ SetUserId() ...@@ -345,35 +345,3 @@ SetUserId()
UserRelationName); UserRelationName);
UserId = (Oid) ((Form_pg_user) GETSTRUCT(userTup))->usesysid; UserId = (Oid) ((Form_pg_user) GETSTRUCT(userTup))->usesysid;
} }
/* ----------------
* GetPGHome
*
* Get POSTGRESHOME from environment, or return default.
* ----------------
*/
char *
GetPGHome()
{
#ifdef USE_ENVIRONMENT
char *h;
if ((h = getenv("POSTGRESHOME")) != (char *) NULL)
return (h);
#endif /* USE_ENVIRONMENT */
return (POSTGRESDIR);
}
char *
GetPGData()
{
#ifdef USE_ENVIRONMENT
char *p;
if ((p = getenv("PGDATA")) != (char *) NULL) {
return (p);
}
#endif /* USE_ENVIRONMENT */
return (PGDATADIR);
}
...@@ -7,21 +7,17 @@ ...@@ -7,21 +7,17 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.2 1996/11/11 13:39:34 bryanh Exp $ # $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.3 1996/11/14 10:24:45 bryanh Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
SRCDIR= ../.. SRCDIR= ../..
include ../../Makefile.global include ../../Makefile.global
SEDSCRIPT= \
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
all: createdb all: createdb
createdb: createdb: createdb.sh
sed $(SEDSCRIPT) <createdb.sh >createdb cp createdb.sh createdb
install: createdb install: createdb
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
......
...@@ -11,23 +11,10 @@ ...@@ -11,23 +11,10 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.4 1996/09/21 06:24:07 scrappy Exp $ # $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.5 1996/11/14 10:24:46 bryanh Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# ----------------
# Set paths from environment or default values.
# The _fUnKy_..._sTuFf_ gets set when the script is installed
# from the default value for this build.
# Currently the only thing we look for from the environment is
# PGDATA, PGHOST, and PGPORT
#
# ----------------
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
[ -z "$PGHOST" ] && PGHOST=localhost
BINDIR=_fUnKy_BINDIR_sTuFf_
PATH=$BINDIR:$PATH
CMDNAME=`basename $0` CMDNAME=`basename $0`
if [ -z "$USER" ]; then if [ -z "$USER" ]; then
...@@ -55,12 +42,29 @@ do ...@@ -55,12 +42,29 @@ do
shift; shift;
done done
AUTHOPT="-a $AUTHSYS" if [-z "$AUTHSYS" ]; then
[ -z "$AUTHSYS" ] && AUTHOPT="" AUTHOPT = ""
else
AUTHOPT = "-a $AUTHSYS"
fi
if [-z "$PGHOST" ]; then
PGHOSTOPT = ""
else
PGHOSTOPT = "-h $PGHOST"
fi
psql -tq $AUTHOPT -h $PGHOST -p $PGPORT -c "create database $dbname" template1 || { if [-z "$PGPORT" ]; then
PGPORTOPT = ""
else
PGPORTOPT = "-p $PGPORT"
fi
psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "create database $dbname" template1
if [ $? -ne 0 ]
echo "$CMDNAME: database creation failed on $dbname." echo "$CMDNAME: database creation failed on $dbname."
exit 1 exit 1
} fi
exit 0 exit 0
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.2 1996/11/11 13:39:40 bryanh Exp $ # $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.3 1996/11/14 10:24:48 bryanh Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -15,14 +15,12 @@ SRCDIR= ../.. ...@@ -15,14 +15,12 @@ SRCDIR= ../..
include ../../Makefile.global include ../../Makefile.global
SEDSCRIPT= \ SEDSCRIPT= \
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" \
-e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \ -e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g" -e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
all: createuser all: createuser
createuser: createuser: createuser.sh
sed $(SEDSCRIPT) <createuser.sh >createuser sed $(SEDSCRIPT) <createuser.sh >createuser
install: createuser install: createuser
......
...@@ -8,25 +8,12 @@ ...@@ -8,25 +8,12 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.5 1996/10/04 20:29:35 scrappy Exp $ # $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.6 1996/11/14 10:24:54 bryanh Exp $
# #
# Note - this should NOT be setuid. # Note - this should NOT be setuid.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# ----------------
# Set paths from environment or default values.
# The _fUnKy_..._sTuFf_ gets set when the script is installed
# from the default value for this build.
# Currently the only thing we look for from the environment is
# PGDATA, PGHOST, and PGPORT
#
# ----------------
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
[ -z "$PGHOST" ] && PGHOST=localhost
BINDIR=_fUnKy_BINDIR_sTuFf_
PATH=$BINDIR:$PATH
CMDNAME=`basename $0` CMDNAME=`basename $0`
if [ -z "$USER" ]; then if [ -z "$USER" ]; then
...@@ -52,10 +39,25 @@ do ...@@ -52,10 +39,25 @@ do
shift; shift;
done done
AUTHOPT="-a $AUTHSYS" if [-z "$AUTHSYS" ]; then
[ -z "$AUTHSYS" ] && AUTHOPT="" AUTHOPT = ""
else
AUTHOPT = "-a $AUTHSYS"
fi
if [-z "$PGHOST" ]; then
PGHOSTOPT = ""
else
PGHOSTOPT = "-h $PGHOST"
fi
if [-z "$PGPORT" ]; then
PGPORTOPT = ""
else
PGPORTOPT = "-p $PGPORT"
fi
PARGS="-tq $AUTHOPT -h $PGHOST -p $PGPORT" PARGS="-tq $AUTHOPT $PGHOSTOPT $PGPORTOPT
# #
# generate the first part of the actual monitor command # generate the first part of the actual monitor command
......
...@@ -7,21 +7,17 @@ ...@@ -7,21 +7,17 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.2 1996/11/11 13:39:47 bryanh Exp $ # $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.3 1996/11/14 10:25:10 bryanh Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
SRCDIR= ../.. SRCDIR= ../..
include ../../Makefile.global include ../../Makefile.global
SEDSCRIPT= \
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
all: destroydb all: destroydb
destroydb: destroydb: destroydb.sh
sed $(SEDSCRIPT) <destroydb.sh >destroydb cp destroydb.sh destroydb
install: destroydb install: destroydb
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
......
...@@ -11,23 +11,10 @@ ...@@ -11,23 +11,10 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.4 1996/09/21 06:24:24 scrappy Exp $ # $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.5 1996/11/14 10:25:14 bryanh Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# ----------------
# Set paths from environment or default values.
# The _fUnKy_..._sTuFf_ gets set when the script is installed
# from the default value for this build.
# Currently the only thing we look for from the environment is
# PGDATA, PGHOST, and PGPORT
#
# ----------------
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
[ -z "$PGHOST" ] && PGHOST=localhost
BINDIR=_fUnKy_BINDIR_sTuFf_
PATH=$BINDIR:$PATH
CMDNAME=`basename $0` CMDNAME=`basename $0`
if [ -z "$USER" ]; then if [ -z "$USER" ]; then
...@@ -55,10 +42,25 @@ do ...@@ -55,10 +42,25 @@ do
shift; shift;
done done
AUTHOPT="-a $AUTHSYS" if [-z "$AUTHSYS" ]; then
[ -z "$AUTHSYS" ] && AUTHOPT="" AUTHOPT = ""
else
AUTHOPT = "-a $AUTHSYS"
fi
if [-z "$PGHOST" ]; then
PGHOSTOPT = ""
else
PGHOSTOPT = "-h $PGHOST"
fi
if [-z "$PGPORT" ]; then
PGPORTOPT = ""
else
PGPORTOPT = "-p $PGPORT"
fi
psql -tq -h $PGHOST -p $PGPORT -c "drop database $dbname" template1 psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "drop database $dbname" template1
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -159,6 +159,14 @@ ...@@ -159,6 +159,14 @@
/* OIDNAMELEN should be set to NAMEDATALEN + sizeof(Oid) */ /* OIDNAMELEN should be set to NAMEDATALEN + sizeof(Oid) */
#define OIDNAMELEN 36 #define OIDNAMELEN 36
/*
* DEF_PGPORT is the TCP port number on which the Postmaster listens by
* default. This can be overriden by command options, environment variables,
* and the postconfig hook.
*/
#define DEF_PGPORT "5432"
/* turn this on if you prefer European style dates instead of American /* turn this on if you prefer European style dates instead of American
* style dates * style dates
*/ */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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