summaryrefslogtreecommitdiff
path: root/src/backend/main
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1996-07-09 06:22:35 +0000
committerMarc G. Fournier <scrappy@hub.org>1996-07-09 06:22:35 +0000
commitd31084e9d1118b25fd16580d9d8c2924b5740dff (patch)
tree3179e66307d54df9c7b966543550e601eb55e668 /src/backend/main
downloadpostgresql-d31084e9d1118b25fd16580d9d8c2924b5740dff.tar.gz
Postgres95 1.01 Distribution - Virgin SourcesPG95-1_01
Diffstat (limited to 'src/backend/main')
-rw-r--r--src/backend/main/Makefile.inc16
-rw-r--r--src/backend/main/main.c45
2 files changed, 61 insertions, 0 deletions
diff --git a/src/backend/main/Makefile.inc b/src/backend/main/Makefile.inc
new file mode 100644
index 0000000000..1e66ad03ca
--- /dev/null
+++ b/src/backend/main/Makefile.inc
@@ -0,0 +1,16 @@
+#-------------------------------------------------------------------------
+#
+# Makefile.inc--
+# Makefile for the main() of the postgres backend
+#
+# Copyright (c) 1994, Regents of the University of California
+#
+#
+# IDENTIFICATION
+# $Header: /cvsroot/pgsql/src/backend/main/Attic/Makefile.inc,v 1.1.1.1 1996/07/09 06:21:31 scrappy Exp $
+#
+#-------------------------------------------------------------------------
+
+VPATH:= $(VPATH):$(CURDIR)/main
+
+SRCS_MAIN= main.c
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
new file mode 100644
index 0000000000..0c8dbc478d
--- /dev/null
+++ b/src/backend/main/main.c
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------
+ *
+ * main.c--
+ * Stub main() routine for the postgres backend.
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.1.1.1 1996/07/09 06:21:32 scrappy Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#include <string.h>
+#include "c.h"
+#include "miscadmin.h"
+#include "bootstrap/bootstrap.h" /* for BootstrapMain() */
+#include "tcop/tcopprot.h" /* for PostgresMain() */
+#include "port-protos.h" /* for init_address_fixup() */
+
+int
+main(int argc, char *argv[])
+{
+ int len;
+#if defined(NOFIXADE) || defined(NOPRINTADE)
+ /*
+ * Must be first so that the bootstrap code calls it, too.
+ * (Only needed on some RISC architectures.)
+ */
+ init_address_fixup();
+#endif /* NOFIXADE || NOPRINTADE */
+
+ /* use one executable for both postgres and postmaster,
+ invoke one or the other depending on the name of the executable */
+ len = strlen(argv[0]);
+ if(len >= 10 && ! strcmp(argv[0] + len - 10, "postmaster"))
+ exit(PostmasterMain(argc, argv));
+
+ /* if the first argument is "-boot", then invoke the backend in
+ bootstrap mode */
+ if (argc > 1 && strcmp(argv[1], "-boot") == 0)
+ exit(BootstrapMain(argc-1, argv+1)); /* remove the -boot arg from the command line */
+ else
+ exit(PostgresMain(argc, argv));
+}