summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbryanh1996-11-28 03:32:18 +0000
committerbryanh1996-11-28 03:32:18 +0000
commit1c6e392d19640bced3e0eb722702c81c2750c14e (patch)
tree4713b35837003ae6994a6a3a93334636b206ad7c
parent3054a8a244d35e2ecc72e362d9fe1289bd4818c2 (diff)
Make strdup work for Ultrix. Thanks Erik Bertelsen
-rw-r--r--src/bin/pg_dump/Makefile2
-rw-r--r--src/interfaces/libpq/fe-connect.c14
-rw-r--r--src/utils/strdup.c5
3 files changed, 4 insertions, 17 deletions
diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile
index 6387a9d717..7276ab16a5 100644
--- a/src/bin/pg_dump/Makefile
+++ b/src/bin/pg_dump/Makefile
@@ -27,7 +27,7 @@ pg_dump: $(OBJS) $(LIBPQDIR)/libpq.a
$(CC) $(LDFLAGS) -o pg_dump -L$(LIBPQDIR) $(OBJS) -lpq $(LD_ADD)
../../utils/strdup.o:
- $(MAKE) -C ../../utils/strdup.o
+ $(MAKE) -C ../../utils strdup.o
.PHONY: submake
submake:
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index d1d3049151..00caab1708 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -34,20 +34,6 @@
#include "strdup.h"
#endif
-#if defined(ultrix4) || defined(next)
- /* ultrix is lame and doesn't have strdup in libc for some reason */
- /* [TRH] So doesn't NEXTSTEP. But whaddaya expect for a non-ANSI
-standard function? (My, my. Touchy today, are we?) */
-char *
-strdup(const char *string)
-{
- char *nstr;
-
- if ((nstr = malloc(strlen(string)+1)) != NULL)
- strcpy(nstr, string);
- return nstr;
-}
-#endif
/* use a local version instead of the one found in pqpacket.c */
static ConnStatusType connectDB(PGconn *conn);
diff --git a/src/utils/strdup.c b/src/utils/strdup.c
index fab0f063c4..ebb9d6e467 100644
--- a/src/utils/strdup.c
+++ b/src/utils/strdup.c
@@ -12,13 +12,14 @@
*-------------------------------------------------------------------------
*/
#include <string.h>
+#include <stdlib.h>
#include "strdup.h"
char *
-strdup(char *string)
+strdup(char const *string)
{
char *nstr;
- nstr = strcpy((char *)palloc(strlen(string)+1), string);
+ nstr = strcpy((char *)malloc(strlen(string)+1), string);
return nstr;
}