diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile
index 2427f8417c1b994af6a5fef89669eace6a05336e..0ac178249fe3759bf8c4f42de92c407e70ab195e 100644
--- a/src/backend/utils/adt/Makefile
+++ b/src/backend/utils/adt/Makefile
@@ -4,14 +4,15 @@
 #    Makefile for utils/adt
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.2 1996/11/03 06:52:59 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.3 1996/11/06 10:30:35 scrappy Exp $
 #
 #-------------------------------------------------------------------------
 
 SRCDIR = ../../..
 include ../../../Makefile.global
 
-INCLUDE_OPT = -I../../port/$(PORTNAME) \
+INCLUDE_OPT = -I../.. \
+              -I../../port/$(PORTNAME) \
               -I../../../include
 
 CFLAGS+=$(INCLUDE_OPT)
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 74e70285c074ca203e89799a9a5b8410d6dc3dcb..e6494ea1349973f8e01da533443c83d0309a6e20 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -7,17 +7,18 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.4 1996/11/06 06:49:34 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.5 1996/11/06 10:30:36 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <ctype.h>
 #include <string.h>
 #include "postgres.h"
+
+#include <utils/memutils.h>
 #include "utils/acl.h"
 #include "catalog/pg_user.h"
 #include "utils/syscache.h"
-#include "utils/palloc.h"
 #include "miscadmin.h"
 
 static char *getid(char *s, char *n);
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index fca9fe083ae3f179b6998926ea7b81c266dacc6a..71431fd337a7925a27a84ecd83a9aad03edbd138 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -7,13 +7,14 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.8 1996/11/06 06:49:36 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.9 1996/11/06 10:30:38 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include <ctype.h>
 #include <stdio.h>
+#include <string.h>
 
 #include "postgres.h"
 
@@ -21,7 +22,6 @@
 #include "catalog/pg_type.h"
 
 #include "utils/syscache.h"
-#include "utils/palloc.h"
 #include "utils/memutils.h"
 #include "storage/fd.h"		/* for SEEK_ */
 #include "fmgr.h"
@@ -783,7 +783,10 @@ array_clip(ArrayType *array,
     mda_get_range(n, span, lowerIndx, upperIndx);
     
     if (ARR_IS_LO(array)) {
-        char * lo_name, * newname;
+#ifdef LOARRAY
+        char * lo_name;
+#endif
+	char * newname;
         int fd, newfd, isDestLO = true, rsize;
 	
         if (len < 0) 
@@ -906,12 +909,13 @@ array_set(ArrayType *array,
     
     if (ARR_IS_LO(array)) {
         int fd;
-        char * lo_name;
         struct varlena *v;
 	
         /* We are assuming fixed element lengths here */
         offset *= elmlen;
 #ifdef LOARRAY
+        char * lo_name;
+
         lo_name = ARR_DATA_PTR(array);
         if ((fd = LOopen(lo_name, ARR_IS_INV(array)?INV_WRITE:O_WRONLY)) < 0)
             return((char *)array);
@@ -1013,10 +1017,11 @@ array_assgn(ArrayType *array,
             elog(WARN, "lowerIndex larger than upperIndx"); 
     
     if (ARR_IS_LO(array)) {
-        char * lo_name;
         int fd, newfd;
 	
 #ifdef LOARRAY
+        char * lo_name;
+
         lo_name = (char *)ARR_DATA_PTR(array);
         if ((fd = LOopen(lo_name,  ARR_IS_INV(array)?INV_WRITE:O_WRONLY)) < 0)
             return((char *)array);
diff --git a/src/backend/utils/adt/chunk.c b/src/backend/utils/adt/chunk.c
index f3ae8e996c3dc038fca509cd857943d4a3ad1621..f6d3952289be5825ede6b042505157fe240cf2d3 100644
--- a/src/backend/utils/adt/chunk.c
+++ b/src/backend/utils/adt/chunk.c
@@ -6,12 +6,14 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.2 1996/11/06 06:49:43 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.3 1996/11/06 10:30:40 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <ctype.h>
 #include "postgres.h"
+
+#include <libpq/be-fsstubs.h>
 #include "utils/memutils.h"
 #include "libpq/libpq-fs.h"
 
@@ -19,11 +21,16 @@
 
 #include "catalog/pg_type.h"
 
-#include "utils/palloc.h"
 #include "fmgr.h"
 #include "utils/array.h"
 
 #include "optimizer/internal.h"
+#ifndef HAVE_MEMMOVE
+# include <regex/utils.h>
+#else
+# include <string.h>
+#endif
+
 
 #define INFTY 500000000
 #define MANY  10000
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 5ef0e723d8311ea39cf14911a42cf86ed4f6bf56..20a3aeeddb8563bf81791a32f64cb6ee3f195c8a 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.2 1996/11/06 06:49:44 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.3 1996/11/06 10:30:44 scrappy Exp $
  *
  * NOTES
  *   This code is actually (almost) unused.
@@ -88,10 +88,6 @@
 #define ABSTIMEMIN(t1, t2) abstimele((t1),(t2)) ? (t1) : (t2)
 #define ABSTIMEMAX(t1, t2) abstimelt((t1),(t2)) ? (t2) : (t1)
 
-static char	*month_name[] = {
-	"Jan","Feb","Mar","Apr","May","Jun","Jul",
-	"Aug","Sep","Oct","Nov","Dec" };
-
 static	char 	*unit_tab[] = {
 	"second", "seconds", "minute", "minutes",
 	"hour", "hours", "day", "days", "week", "weeks",
@@ -113,8 +109,6 @@ static	int	unit_max_quantity[] = {
 
 
 struct timeb *TimeDifferenceFromGMT = NULL;
-static bool TimeDiffIsInited = false;
-static char *timezonename = NULL;
 
 /*
  * Function prototypes -- internal to this file only
diff --git a/src/backend/utils/adt/filename.c b/src/backend/utils/adt/filename.c
index c569041dd39f1aa6812ba2dda719f09ed0bc306b..351a8e769351c2b4caa61def152c427369f0e732 100644
--- a/src/backend/utils/adt/filename.c
+++ b/src/backend/utils/adt/filename.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.3 1996/11/03 06:53:05 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.4 1996/11/06 10:30:51 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,7 +21,7 @@
 #include <sys/param.h>
 
 #include "postgres.h"
-#include "utils/palloc.h"
+#include <miscadmin.h>
 #include "utils/builtins.h"	/* where function declarations go */
 
 char *
diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c
index 07cdce82e4b399ed38b7f66803a8611c11f8f065..5e32238d2dcb9755761e7ef3f3ac7c20d0d3f546 100644
--- a/src/backend/utils/adt/int.c
+++ b/src/backend/utils/adt/int.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.2 1996/11/06 06:49:49 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.3 1996/11/06 10:30:55 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -28,11 +28,11 @@
  * XXX makes massive and possibly unwarranted type promotion assumptions.
  * fix me when we figure out what we want to do about ANSIfication...
  */
+#include <stdio.h>
 
 #include "postgres.h"
 #include "fmgr.h"
 #include "utils/builtins.h"	/* where the declarations go */
-#include "utils/palloc.h"
 
 /***************************************************************************** 
  *   USER I/O ROUTINES                                                       *
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index c654c63d372284dc9eac617ec4a80d31351ad50d..fafcc69273a0ddd1a0155d30d86cb487650b2c23 100644
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.5 1996/11/06 06:49:54 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.6 1996/11/06 10:30:58 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,6 +19,11 @@
 #include <math.h>
 #include "postgres.h"
 #include "utils/builtins.h"		/* where the declarations go */
+#ifndef HAVE_MEMMOVE
+# include <regex/utils.h>
+#else
+# include <string.h>
+#endif
 
 int32
 pg_atoi(char *s, int size, int c)
diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c
index d423853da15f10da6f4f1de8d499fcb3b2177cb2..04bf4690392023393b8c8ed80fe62913780a5e1a 100644
--- a/src/backend/utils/adt/oid.c
+++ b/src/backend/utils/adt/oid.c
@@ -7,12 +7,14 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.2 1996/11/06 06:49:55 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.3 1996/11/06 10:31:01 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
+
+#include <stdio.h>
+
 #include "postgres.h"
-#include "utils/palloc.h"
 #include "utils/builtins.h"	/* where function declarations go */
 
 /***************************************************************************** 
diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c
index 80da6e0f4319f06f0925cd5e584115fd700b6cc7..deec436c510b87711b242ff66f53068176787063 100644
--- a/src/backend/utils/adt/regexp.c
+++ b/src/backend/utils/adt/regexp.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.3 1996/11/06 06:49:58 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.4 1996/11/06 10:31:04 scrappy Exp $
  *
  *      Alistair Crooks added the code for the regex caching
  *	agc - cached the regular expressions used - there's a good chance
@@ -29,7 +29,9 @@
  */
 #include <string.h>
 #include "postgres.h"		/* postgres system include file */
-#include "utils/palloc.h"
+
+#include <regex/regex.h>
+
 #include "utils/builtins.h"	/* where the function declarations go */
 
 #if defined(DISABLE_XOPEN_NLS)
diff --git a/src/backend/utils/cache/Makefile b/src/backend/utils/cache/Makefile
index e6dfb24841f516f97a80da4e4d7ecbf50c9d125b..f7f15c59f97850a7f2637755af590f3a9616d750 100644
--- a/src/backend/utils/cache/Makefile
+++ b/src/backend/utils/cache/Makefile
@@ -4,14 +4,15 @@
 #    Makefile for utils/cache
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.2 1996/11/03 06:53:14 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/backend/utils/cache/Makefile,v 1.3 1996/11/06 10:31:16 scrappy Exp $
 #
 #-------------------------------------------------------------------------
 
 SRCDIR = ../../..
 include ../../../Makefile.global
 
-INCLUDE_OPT = -I../../port/$(PORTNAME) \
+INCLUDE_OPT = -I../.. \
+              -I../../port/$(PORTNAME) \
               -I../../../include
 
 CFLAGS+=$(INCLUDE_OPT)
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index 2f2b76bf27604ba5d1aacd8529edba764cf45653..f4c5ef3e90746b289c75d6855501e3ec6d60d007 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -7,11 +7,15 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.2 1996/11/03 06:53:17 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.3 1996/11/06 10:31:22 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
+
+#include <nodes/parsenodes.h>
+#include <fmgr.h>
+
 #include "access/htup.h"
 #include "utils/catcache.h"
 #include "utils/syscache.h"
@@ -22,9 +26,13 @@
 #include "parser/parsetree.h"		/* for getrelname() */
 #include "utils/builtins.h"
 #include "utils/fcache.h"
-#include "utils/palloc.h"
 #include "nodes/primnodes.h"
 #include "nodes/execnodes.h"
+#ifndef HAVE_MEMMOVE
+# include <regex/utils.h>
+#else
+# include <string.h>
+#endif
 
 static Oid GetDynamicFuncArgType(Var *arg, ExprContext *econtext);
 static FunctionCachePtr init_fcache(Oid foid,
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 7bd214d085b195c294dd26cd899da75a406aef26..39c7e238e3cbbe0a8497c4546511681c76880480 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -7,13 +7,16 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.1.1.1 1996/07/09 06:22:06 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.2 1996/11/06 10:31:24 scrappy Exp $
  *
  * Note - this code is real crufty...
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
+
+#include <miscadmin.h>
+
 #include "access/heapam.h"	/* XXX to support hacks below */
 #include "access/htup.h"
 #include "catalog/catalog.h"
@@ -23,7 +26,6 @@
 #include "storage/sinval.h"
 #include "utils/catcache.h"
 #include "utils/inval.h"
-#include "utils/elog.h"
 #include "utils/rel.h"
 #include "utils/relcache.h"
 #include "catalog/catname.h"	/* XXX to support hacks below */
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 81d9ca59898c3bb81e26489cd64d18ceb612c08f..b72cc02cf50c70a46cefac3fb20737bafdb3179f 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.3 1996/10/24 07:55:29 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.4 1996/11/06 10:31:27 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,8 @@
 #include "postgres.h"
 #include "miscadmin.h"
 
-#include "access/attnum.h"
+#include <storage/smgr.h>
+
 #include "access/genam.h"
 #include "access/heapam.h"
 #include "access/htup.h"
@@ -45,7 +46,6 @@
 #include "access/itup.h"
 #include "access/skey.h"
 #include "utils/builtins.h"
-#include "utils/tqual.h"	/* for NowTimeQual */
 #include "access/tupdesc.h"
 #include "access/tupmacs.h"
 #include "access/xact.h"
@@ -54,17 +54,14 @@
 #include "storage/fd.h"		/* for SEEK_ */
 #include "storage/lmgr.h"
 #include "storage/bufmgr.h"
-
  
 #include "lib/hasht.h"
  
 #include "utils/memutils.h"
-#include "utils/elog.h"
 #include "utils/mcxt.h"
 #include "utils/rel.h"
 #include "utils/relcache.h"
 #include "utils/hsearch.h"
-#include "utils/palloc.h"
 #include "utils/relcache.h"
  
 #include "catalog/catname.h"
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index c4dc5ac8eb9e8e1dcebfe34cde5a3e56c8d8defd..460e8d40af01b3f6966436e0edf6f69f19637b97 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.3 1996/11/03 06:53:19 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.4 1996/11/06 10:31:29 scrappy Exp $
  *
  * NOTES
  *    These routines allow the parser/planner/executor to perform
@@ -23,8 +23,12 @@
 #include "access/htup.h"
 #include "catalog/catname.h"
 #include "utils/catcache.h"
-#include "utils/palloc.h"
-#include "nodes/pg_list.h"
+#ifndef HAVE_MEMMOVE
+# include <regex/utils.h>
+#else
+# include <string.h>
+#endif
+
  
 /* ----------------
  *	hardwired attribute information comes from system catalog files.
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index f8a08998545a166c1d0a7b80f1cf635cf493fb1d..17440ec1488fa7b282e29d9115678ef54f8614f8 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.7 1996/10/31 10:23:26 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.8 1996/11/06 10:31:33 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,10 +21,11 @@
 #include <sys/types.h>
 #include <stdarg.h>
 #include <errno.h>
+#include <unistd.h>
+#include <signal.h>
 
 #include "postgres.h"
 #include "miscadmin.h"
-#include "utils/elog.h"
 #include "libpq/libpq.h"
 #include "storage/proc.h"
 
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index 83efc5ea5c21f800af177fbd7164a9b8d1ad0938..f62f2ad47e0af419aa9707ab6bbf67127d02bc4f 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.2 1996/11/03 06:54:13 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.3 1996/11/06 10:31:43 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -70,6 +70,7 @@ static uint32 call_hash(HTAB *hashp, char *k, int len);
 static SEG_OFFSET seg_alloc(HTAB *hashp);
 static int bucket_alloc(HTAB *hashp);
 static int dir_realloc(HTAB *hashp);
+static int my_log2(long num);
 
 typedef long * ((*dhalloc_ptr)());
 
diff --git a/src/backend/utils/init/findbe.c b/src/backend/utils/init/findbe.c
index 4a82105490b9dff5dc683617f4d579930f57d3b4..b20e6541e1a2540cd92bc4b6821acc465910c41c 100644
--- a/src/backend/utils/init/findbe.c
+++ b/src/backend/utils/init/findbe.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.1.1.1 1996/07/09 06:22:08 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.2 1996/11/06 10:31:52 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -20,8 +20,9 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
-#include "c.h"
+#include "postgres.h"
 #include "miscadmin.h"	/* for DebugLvl */
 
 #ifndef S_IRUSR			/* XXX [TRH] should be in a header */
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index ad8a75a90a2f4fbefa8a79c46b312c80ed1e80af..aafec5dc3ae096fff5eddc5ff44363b102f1a71c 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.1.1.1 1996/07/09 06:22:08 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.2 1996/11/06 10:31:54 scrappy Exp $
  *
  * NOTES
  *    Globals used all over the place should be declared here and not
@@ -21,10 +21,12 @@
 #include <sys/file.h>
 #include <sys/types.h>
 #include <math.h>
+#include <unistd.h>
 
 #include "postgres.h"
 #include "miscadmin.h"		/* where the declarations go */
 
+#include <storage/backendid.h>
 #include "access/heapam.h"
 #include "utils/tqual.h"
 #include "storage/sinval.h"
diff --git a/src/backend/utils/init/magic.c b/src/backend/utils/init/magic.c
index c56de3769b520dda4ca036afb0eb69acaf702f38..83404be039b5136733853341af44236d7d125dba 100644
--- a/src/backend/utils/init/magic.c
+++ b/src/backend/utils/init/magic.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/magic.c,v 1.2 1996/10/07 03:29:30 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/magic.c,v 1.3 1996/11/06 10:31:56 scrappy Exp $
  *
  * NOTES
  *	XXX eventually, should be able to handle version identifiers
@@ -23,10 +23,10 @@
 #include <ctype.h>
 #include <string.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include "postgres.h"
 
-#include "utils/elog.h"
 #include "miscadmin.h"		/* for global decls */
 
 #include "storage/fd.h"		/* for O_ */
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 6f19210048fbe929a3a1fea4b71f16a320a766a9..aaaaf00ab9164680112a340ca823b2c75738eebb 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.1.1.1 1996/07/09 06:22:09 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.2 1996/11/06 10:31:57 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,6 +17,7 @@
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <stdio.h>
+#include <unistd.h>
 #ifndef WIN32
 #include <grp.h>		/* for getgrgid */
 #include <pwd.h>		/* for getpwuid */
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index e327c4f1ca7b44b3a13713c8de3044cdbf7491e7..430bfb04ecbedecd5edfddcdaa99bee97607fb6a 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.3 1996/10/31 05:55:44 momjian Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.4 1996/11/06 10:31:59 scrappy Exp $
  *
  * NOTES
  *	InitPostgres() is the function called from PostgresMain
@@ -33,9 +33,16 @@
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <math.h>
+#include <unistd.h>
 
 #include "postgres.h"
 
+#include <storage/backendid.h>
+#include <storage/buf_internals.h>
+#include <storage/smgr.h>
+#include <storage/proc.h>
+#include <utils/relcache.h>
+
 #include "access/heapam.h"
 #include "access/xact.h"
 #include "storage/bufmgr.h"
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index bbb7cd66f201f758ce9f14c61594f06b0b05f3bf..5b6ca2092559756e07e57563fae87443354967bd 100644
--- a/src/backend/utils/mmgr/aset.c
+++ b/src/backend/utils/mmgr/aset.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.1.1.1 1996/07/09 06:22:09 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.2 1996/11/06 10:32:04 scrappy Exp $
  *
  * NOTE
  *    XXX This is a preliminary implementation which lacks fail-fast
@@ -16,11 +16,14 @@
  *-------------------------------------------------------------------------
  */
 #include <stdio.h>
-#include "c.h"
+#include "postgres.h"
 #include "utils/excid.h"	/* for ExhaustedMemory */
 #include "utils/memutils.h"	/* where funnction declarations go */
-#include "utils/elog.h"
-#include "utils/palloc.h"
+#ifndef HAVE_MEMMOVE
+# include <regex/utils.h>
+#else
+# include <string.h>
+#endif
 
 #undef AllocSetReset
 #undef malloc
diff --git a/src/backend/utils/sort/psort.c b/src/backend/utils/sort/psort.c
index a85e5bc8d38ccb9470991afcea014095311357e3..cac308b97fdebd000b527d9bd9e50a41d0fb5b78 100644
--- a/src/backend/utils/sort/psort.c
+++ b/src/backend/utils/sort/psort.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.2 1996/11/03 06:54:38 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.3 1996/11/06 10:32:10 scrappy Exp $
  *
  * NOTES
  *	Sorts the first relation into the second relation.  The sort may
@@ -21,6 +21,7 @@
  */
 #include <stdio.h>
 #include <math.h>
+#include <unistd.h>
 
 #include "postgres.h"
 
@@ -41,6 +42,12 @@
 
 #include "storage/fd.h"
 
+#ifndef HAVE_MEMMOVE
+# include <regex/utils.h>
+#else
+# include <string.h>
+#endif
+
 #define	TEMPDIR	"./"
 
 int			Nkeys;