aboutsummaryrefslogtreecommitdiff
path: root/src/backend/main/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/main/main.c')
-rw-r--r--src/backend/main/main.c71
1 files changed, 40 insertions, 31 deletions
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index c3bb0793394..b70be2a08c4 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* main.c--
- * Stub main() routine for the postgres backend.
+ * 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.7 1997/04/24 20:30:09 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.8 1997/09/07 04:42:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,11 +16,11 @@
#include <unistd.h>
#include "postgres.h"
-#ifdef USE_LOCALE
-# include <locale.h>
+#ifdef USE_LOCALE
+#include <locale.h>
#endif
#include "miscadmin.h"
-#include "bootstrap/bootstrap.h" /* for BootstrapMain() */
+#include "bootstrap/bootstrap.h"/* for BootstrapMain() */
#include "tcop/tcopprot.h" /* for PostgresMain() */
#include "port-protos.h" /* for init_address_fixup() */
@@ -34,36 +34,45 @@ echo \"postmaster -B 256 >/var/log/pglog 2>&1 &\" | su - postgres\n\n"
int
main(int argc, char *argv[])
{
- int len;
+ int len;
+
#ifdef USE_LOCALE
- setlocale(LC_CTYPE,""); /* take locale information from an environment */
- setlocale(LC_COLLATE,"");
- setlocale(LC_MONETARY,"");
+ setlocale(LC_CTYPE, ""); /* take locale information from an
+ * environment */
+ setlocale(LC_COLLATE, "");
+ setlocale(LC_MONETARY, "");
#endif
#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 (!geteuid()) {
- fprintf(stderr, "%s", NOROOTEXEC);
- exit(1);
- }
+ /*
+ * 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 (!geteuid())
+ {
+ fprintf(stderr, "%s", NOROOTEXEC);
+ exit(1);
+ }
- if(len >= 10 && ! strcmp(argv[0] + len - 10, "postmaster"))
- exit(PostmasterMain(argc, argv));
+ 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));
+ /*
+ * 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));
}