summaryrefslogtreecommitdiff
path: root/usr.bin/make/util.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1996-08-13 16:41:15 +0000
committerchristos <christos@NetBSD.org>1996-08-13 16:41:15 +0000
commit22770fe8ea7588e6844e8487ccf4f68dc1902feb (patch)
tree9cbbf34471b0c669cfa376464d86ffe059db539a /usr.bin/make/util.c
parentba78477e9d7f584e8dafcc65149466dd43b56d86 (diff)
Add strdup() since ultrix is missing it.
From Larry Schwimmer <rosebud@cyclone.Stanford.EDU>
Diffstat (limited to 'usr.bin/make/util.c')
-rw-r--r--usr.bin/make/util.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c
index a4395755aca..f74627d5456 100644
--- a/usr.bin/make/util.c
+++ b/usr.bin/make/util.c
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.5 1995/11/22 17:40:17 christos Exp $ */
+/* $NetBSD: util.c,v 1.6 1996/08/13 16:41:15 christos Exp $ */
/*
* Missing stuff from OS's
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: util.c,v 1.5 1995/11/22 17:40:17 christos Exp $";
+static char rcsid[] = "$Id: util.c,v 1.6 1996/08/13 16:41:15 christos Exp $";
#endif
#include <stdio.h>
@@ -39,7 +39,32 @@ strerror(e)
}
#endif
-#if defined(sun) || defined(__hpux)
+#ifdef ultrix
+#include <string.h>
+
+/* strdup
+ *
+ * Make a duplicate of a string.
+ * For systems which lack this function.
+ */
+char *
+strdup(str)
+ const char *str;
+{
+ size_t len;
+
+ if (str == NULL)
+ return NULL;
+ len = strlen(str) + 1;
+ if ((p = malloc(len)) == NULL)
+ return NULL;
+
+ return memcpy(p, str, len);
+}
+
+#endif
+
+#if defined(sun) || defined(__hpux) || defined(__sgi)
int
setenv(name, value, dum)