aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuo Ishii <ishii@postgresql.org>2001-02-27 08:13:31 +0000
committerTatsuo Ishii <ishii@postgresql.org>2001-02-27 08:13:31 +0000
commitdf247b821d811abcfc0ac707e1a3af9dfce474c9 (patch)
treedbc50e5ce1f0f4ab332e3810bef8c56921308e92 /src
parent919ace07d59f1a0fbb237b0ca348e4a7574b4042 (diff)
downloadpostgresql-df247b821d811abcfc0ac707e1a3af9dfce474c9.tar.gz
postgresql-df247b821d811abcfc0ac707e1a3af9dfce474c9.zip
Massive commits for SunOS4 port.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.global.in3
-rw-r--r--src/Makefile.shlib7
-rw-r--r--src/backend/utils/adt/formatting.c10
-rw-r--r--src/bin/pg_dump/Makefile21
-rw-r--r--src/bin/pg_dump/pg_restore.c7
-rw-r--r--src/bin/pg_id/pg_id.c12
-rw-r--r--src/bin/psql/Makefile9
-rw-r--r--src/bin/psql/input.c6
-rw-r--r--src/bin/psql/print.c4
-rw-r--r--src/bin/psql/stringutils.c3
-rw-r--r--src/include/config.h.in10
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c3
-rw-r--r--src/makefiles/Makefile.sunos45
13 files changed, 78 insertions, 22 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 67800397a43..4bbe3bb1820 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,5 +1,5 @@
# -*-makefile-*-
-# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.119 2001/02/20 19:20:28 petere Exp $
+# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.120 2001/02/27 08:13:29 ishii Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -288,6 +288,7 @@ INET_ATON = @INET_ATON@
STRERROR = @STRERROR@
SNPRINTF = @SNPRINTF@
STRDUP = @STRDUP@
+STRTOUL = @STRTOUL@
##########################################################################
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 461eb8d697c..156a8af0369 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.45 2001/02/20 19:20:28 petere Exp $
+# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.46 2001/02/27 08:13:29 ishii Exp $
#
#-------------------------------------------------------------------------
@@ -184,6 +184,11 @@ ifeq ($(PORTNAME), solaris)
SHLIB_LINK += -lm -lc
endif
+ifeq ($(PORTNAME), sunos4)
+ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+ LINK.shared = $(LD) -assert pure-text -Bdynamic
+endif
+
ifeq ($(PORTNAME), osf)
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LINK.shared = $(LD) -shared -expect_unresolved '*'
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index a6cb25e3cab..bef39d2da53 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.32 2001/02/12 12:52:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.33 2001/02/27 08:13:28 ishii Exp $
*
*
* Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
@@ -1398,7 +1398,7 @@ int4len(int4 num)
{
char b[16];
- return sprintf(b, "%d", num);
+ return snprintf(b, sizeof(b), "%d", num);
}
/* ----------
@@ -3211,7 +3211,7 @@ int_to_roman(int number)
fill_str(result, '#', 15);
return result;
}
- len = sprintf(numstr, "%d", number);
+ len = snprintf(numstr, sizeof(numstr), "%d", number);
for (p = numstr; *p != '\0'; p++, --len)
{
@@ -4013,7 +4013,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
Np->inout_p += strlen(Np->inout_p) - 1;
}
else
- Np->inout_p += sprintf(Np->inout_p, "%15s", Np->number_p) - 1;
+ Np->inout_p += snprintf(Np->inout_p, plen - (Np->inout_p - Np->inout), "%15s", Np->number_p) - 1;
break;
case NUM_rn:
@@ -4023,7 +4023,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
Np->inout_p += strlen(Np->inout_p) - 1;
}
else
- Np->inout_p += sprintf(Np->inout_p, "%15s", str_tolower(Np->number_p)) - 1;
+ Np->inout_p += snprintf(Np->inout_p, plen - (Np->inout_p - Np->inout), "%15s", str_tolower(Np->number_p)) - 1;
break;
case NUM_th:
diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile
index 406816a1346..ac453df7a3b 100644
--- a/src/bin/pg_dump/Makefile
+++ b/src/bin/pg_dump/Makefile
@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.29 2001/02/20 19:20:28 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.30 2001/02/27 08:13:28 ishii Exp $
#
#-------------------------------------------------------------------------
@@ -14,7 +14,21 @@ top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o pg_backup_files.o \
- pg_backup_null.o pg_backup_tar.o $(STRDUP)
+ pg_backup_null.o pg_backup_tar.o
+
+ifdef STRDUP
+OBJS+=$(top_builddir)/src/utils/strdup.o
+
+$(top_builddir)/src/utils/strdup.o:
+ $(MAKE) -C $(top_builddir)/src/utils strdup.o
+endif
+
+ifdef STRTOUL
+OBJS+=$(top_builddir)/src/backend/port/strtoul.o
+
+$(top_builddir)/src/backend/port/strtoul.o:
+ $(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
+endif
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
@@ -26,9 +40,6 @@ pg_dump: pg_dump.o common.o $(OBJS) $(libpq_builddir)/libpq.a
pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@
-../../utils/strdup.o:
- $(MAKE) -C ../../utils strdup.o
-
pg_dumpall: pg_dumpall.sh
sed -e 's,@VERSION@,$(VERSION),g' \
-e 's,@MULTIBYTE@,$(MULTIBYTE),g' \
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 851688ef1e5..7e446ac21f4 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -68,8 +68,13 @@
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
+#ifdef HAVE_OPTARG_DECL
#include <unistd.h>
-#endif
+#else
+extern char *optarg;
+extern int optind, opterr, optopt;
+#endif /* HAVE_OPTARG_DECL */
+#endif /* HAVE_GETOPT_H */
/* Forward decls */
static void usage(const char *progname);
diff --git a/src/bin/pg_id/pg_id.c b/src/bin/pg_id/pg_id.c
index e5a3ec3fd6b..325d6d6b142 100644
--- a/src/bin/pg_id/pg_id.c
+++ b/src/bin/pg_id/pg_id.c
@@ -6,13 +6,21 @@
*
* Copyright (C) 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.17 2001/02/10 02:31:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.18 2001/02/27 08:13:28 ishii Exp $
*/
#include "postgres_fe.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
-#endif
+#else
+#ifdef HAVE_OPTARG_DECL
+#include <unistd.h>
+#else
+extern char *optarg;
+extern int optind, opterr, optopt;
+#endif /* HAVE_OPTARG_DECL */
+#endif /* HAVE_GETOPT_H */
+
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/bin/psql/Makefile b/src/bin/psql/Makefile
index 0d0d0ec9e9a..8c653103308 100644
--- a/src/bin/psql/Makefile
+++ b/src/bin/psql/Makefile
@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.29 2001/02/20 19:20:29 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.30 2001/02/27 08:13:27 ishii Exp $
#
#-------------------------------------------------------------------------
@@ -46,6 +46,13 @@ $(top_builddir)/src/backend/port/snprintf.o:
$(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
endif
+ifdef STRTOUL
+OBJS+=$(top_builddir)/src/backend/port/strtoul.o
+
+$(top_builddir)/src/backend/port/strtoul.o:
+ $(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
+endif
+
# End of hacks for picking up backend 'port' modules
psql: $(OBJS) $(libpq_builddir)/libpq.a
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index b3fdd55c132..894fc8d4547 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/input.c,v 1.15 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/input.c,v 1.16 2001/02/27 08:13:27 ishii Exp $
*/
#include "postgres_fe.h"
#include "input.h"
@@ -151,7 +151,11 @@ initializeInput(int flags)
}
#endif
+#ifdef HAVE_ATEXIT
atexit(finishInput);
+#else
+ on_exit(finishInput);
+#endif
}
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index 681d47b14b0..f5daa5c5922 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.15 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.16 2001/02/27 08:13:27 ishii Exp $
*/
#include "postgres_fe.h"
#include "print.h"
@@ -21,6 +21,8 @@
#include "pqsignal.h"
#include "libpq-fe.h"
+#include "settings.h"
+
#ifndef __CYGWIN__
#define DEFAULT_PAGER "more"
#else
diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c
index 083b582c274..a3b44e8bf17 100644
--- a/src/bin/psql/stringutils.c
+++ b/src/bin/psql/stringutils.c
@@ -3,10 +3,11 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.27 2001/02/10 02:31:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.28 2001/02/27 08:13:27 ishii Exp $
*/
#include "postgres_fe.h"
#include "stringutils.h"
+#include "settings.h"
#include <ctype.h>
#include <assert.h>
diff --git a/src/include/config.h.in b/src/include/config.h.in
index 68e15d067b7..bae18263567 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure.
*
- * $Id: config.h.in,v 1.158 2001/02/18 04:39:42 tgl Exp $
+ * $Id: config.h.in,v 1.159 2001/02/27 08:13:27 ishii Exp $
*/
#ifndef CONFIG_H
@@ -579,6 +579,9 @@ extern int fdatasync(int fildes);
/* Set to 1 if you have getopt_long() (GNU long options) */
#undef HAVE_GETOPT_LONG
+/* Set to 1 if optarg is declared in unistd.h */
+#undef HAVE_OPTARG_DECL
+
/* Set to 1 if you have union semun */
#undef HAVE_UNION_SEMUN
@@ -651,6 +654,11 @@ extern int fdatasync(int fildes);
# define HAVE_STRTOULL 1
#endif
+/* Define if you have atexit() */
+#undef HAVE_ATEXIT
+
+/* Define if you have on_exit() */
+#undef HAVE_ON_EXIT
/*
*------------------------------------------------------------------------
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index cfd71f32e6b..c3f29294791 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -8,6 +8,9 @@
#ifdef HAVE_GETOPT_H
#include "getopt.h"
+#else
+extern char *optarg;
+extern int optind, opterr, optopt;
#endif
#include "extern.h"
diff --git a/src/makefiles/Makefile.sunos4 b/src/makefiles/Makefile.sunos4
index 00bf9064ef9..c45f44d0998 100644
--- a/src/makefiles/Makefile.sunos4
+++ b/src/makefiles/Makefile.sunos4
@@ -2,7 +2,7 @@ AROPT = cr
DLSUFFIX = .so
ifeq ($(GCC), yes)
-CFLAGS_SL = -fPIC
+CFLAGS_SL = -fpic
else
CFLAGS_SL = -PIC
endif
@@ -13,4 +13,5 @@ CXXFLAGS_SL = -PIC
endif
%.so: %.o
- $(LD) -dc -dp -Bdynamic -o $@ $<
+ $(LD) -assert pure-text -Bdynamic -o $@ $<
+