Commit 17befd6c authored by Bryan Henderson's avatar Bryan Henderson

Use new utils/version.c instead of backend/utils/init/magic.c.

parent bbe89089
......@@ -34,7 +34,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.14 1996/11/03 09:05:30 bryanh Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.15 1996/11/12 06:46:04 bryanh Exp $
#
#-------------------------------------------------------------------------
......@@ -131,7 +131,8 @@ OBJS = access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o \
lib/SUBSYS.o libpq/SUBSYS.o main/SUBSYS.o nodes/SUBSYS.o \
optimizer/SUBSYS.o parser/SUBSYS.o port/SUBSYS.o \
postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o \
storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o
storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o \
../utils/version.o
ifdef TIOGA
OBJS += tioga/SUBSYS.o
......@@ -139,7 +140,7 @@ endif
all: postgres global1.bki.source local1_template1.bki.source
postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4
postgres: postgres_group1 postgres_group2 postgres_group3 postgres_group4
$(CC) $(LDFLAGS) -o postgres $(OBJS) $(LDADD)
postgres_group1:
......@@ -167,6 +168,7 @@ postgres_group4:
ifdef TIOGA
$(MAKE) -C tioga all
endif
$(MAKE) -C ../utils version.o
global1.bki.source local1_template1.bki.source:
$(MAKE) -C catalog $@
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.23 1996/11/10 03:01:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.24 1996/11/12 06:46:36 bryanh Exp $
*
* NOTES
*
......@@ -75,6 +75,7 @@
#include "libpq/auth.h"
#include "libpq/pqcomm.h"
#include "miscadmin.h"
#include "version.h"
#include "lib/dllist.h"
#include "nodes/nodes.h"
#include "utils/mcxt.h"
......@@ -1186,18 +1187,27 @@ checkDataDir(void)
SEP_CHAR);
if ((fp=fopen(path, "r")) == NULL) {
fprintf(stderr, "%s does not find the database. Expected to find it "
"in the PGDATA directory \"%s\", but unable to open directory "
"in the PGDATA directory \"%s\", but unable to open file "
"with pathname \"%s\".\n",
progname, DataDir, path);
exit(2);
}
fclose(fp);
#ifndef WIN32
if (!ValidPgVersion(DataDir)) {
fprintf(stderr, "%s: data base in \"%s\" is of a different version.\n",
progname, DataDir);
exit(2);
#ifndef WIN32
{
char *reason; /* reason ValidatePgVersion failed. NULL if didn't */
ValidatePgVersion(DataDir, &reason);
if (reason) {
fprintf(stderr,
"Database system in directory %s "
"is not compatible with this version of "
"Postgres, or we are unable to read the PG_VERSION file. "
"Explanation from ValidatePgVersion: %s\n",
DataDir, reason);
free(reason);
exit(2);
}
}
#endif /* WIN32 */
}
......
......@@ -4,7 +4,7 @@
# Makefile for utils/init
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.2 1996/11/09 06:23:41 momjian Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.3 1996/11/12 06:46:40 bryanh Exp $
#
#-------------------------------------------------------------------------
......@@ -20,7 +20,7 @@ CFLAGS += $(INCLUDE_OPT)
CFLAGS += -DPOSTGRESDIR='"$(POSTGRESDIR)"' -DPGDATADIR='"$(DATADIR)"' \
-DPOSTPORT='"$(POSTPORT)"'
OBJS = enbl.o findbe.o globals.o magic.o miscinit.o postinit.o
OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o
all: SUBSYS.o
......
This diff is collapsed.
......@@ -7,20 +7,34 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:14 scrappy Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/Makefile,v 1.2 1996/11/12 06:46:54 bryanh Exp $
#
#-------------------------------------------------------------------------
PROG= pg_version
MKDIR= ../../mk
include $(MKDIR)/postgres.mk
SRCDIR= ../..
include ../Makefile.global
include ../../Makefile.global
OBJS= pg_version.o ../../utils/version.o
all: pg_version
pg_version: submake $(OBJS)
$(CC) $(LDFLAGS) -o pg_version $(OBJS) $(LD_ADD)
.PHONY: submake
submake:
$(MAKE) -C ../../utils version.o
VPATH:=$(VPATH):$(srcdir)/backend/utils/init
SRCS= pg_version.c magic.c
install: pg_version
$(INSTALL) $(INSTL_EXE_OPTS) pg_version $(DESTDIR)$(BINDIR)/pg_version
CFLAGS+= -I$(srcdir)/backend/port/$(PORTNAME)
depend dep:
$(CC) -MM $(INCLUDE_OPT) *.c >depend
include $(MKDIR)/postgres.prog.mk
clean:
rm -f pg_version pg_version.o
ifeq (depend,$(wildcard depend))
include depend
endif
......@@ -7,38 +7,34 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/pg_version.c,v 1.5 1996/11/10 03:04:02 momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/pg_version.c,v 1.6 1996/11/12 06:47:00 bryanh Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdlib.h>
#include <stdio.h>
int Noversion = 0;
char *DataDir = (char *) NULL;
#include <version.h> /* interface to SetPgVersion */
extern void SetPgVersion(const char *);
int
main(int argc, char **argv)
{
int retcode; /* our eventual return code */
char *reason; /* Reason that SetPgVersion failed, NULL if it didn't. */
if (argc < 2) {
fprintf(stderr, "pg_version: missing argument\n");
exit(1);
}
SetPgVersion(argv[1]);
return(0);
}
void elog(void); /* make compiler happy */
void
elog(void) {}
int GetDataHome(void); /* make compiler happy */
int
GetDataHome(void)
{
return(0);
SetPgVersion(argv[1], &reason);
if (reason) {
fprintf(stderr,
"pg_version is unable to create the PG_VERSION file. "
"SetPgVersion gave this reason: %s\n",
reason);
retcode = 10;
} else retcode = 0;
return(retcode);
}
......@@ -12,7 +12,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: miscadmin.h,v 1.2 1996/11/06 10:28:59 scrappy Exp $
* $Id: miscadmin.h,v 1.3 1996/11/12 06:47:10 bryanh Exp $
*
* NOTES
* some of the information in this file will be moved to
......@@ -69,14 +69,6 @@ extern Oid LastOidProcessed; /* for query rewrite */
*/
#define NDBUFS 64
/*****************************************************************************
* magic.h - definitions of the indexes of the magic numbers *
*****************************************************************************/
#define PG_RELEASE 6
#define PG_VERSION 0
#define PG_VERFILE "PG_VERSION"
/*****************************************************************************
* pdir.h -- *
* POSTGRES directory path definitions. *
......@@ -148,7 +140,6 @@ typedef int16 ExitStatus;
/* in utils/init/postinit.c */
extern void InitMyDatabaseId(void);
extern void DoChdirAndInitDatabaseNameAndPath(char *name, char *path);
extern void InitUserid(void);
extern void InitCommunication(void);
extern void InitStdio(void);
......@@ -170,12 +161,4 @@ extern bool IsNormalProcessingMode(void);
extern void SetProcessingMode(ProcessingMode mode);
extern ProcessingMode GetProcessingMode(void);
/*
* Prototypes for utils/init/magic.c
*/
extern int DatabaseMetaGunkIsConsistent(const char *database, char *path);
extern int ValidPgVersion(const char *path);
extern void SetPgVersion(const char *path);
#endif /* MISCADMIN_H */
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