summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-02-11 00:10:36 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2018-02-11 00:14:41 +0000
commitd8710e24c47bf5d7c3dc3a77127d08e4568dc335 (patch)
tree343088ebdaf95ee9cecf84e8536fb826f6631e20
parentf9ba5e2255cf18092750fffacb6a9603571a2be5 (diff)
Solaris 10 compatability
-rw-r--r--src/OS/os.c-SunOS513
-rw-r--r--src/OS/os.h-SunOS52
2 files changed, 14 insertions, 1 deletions
diff --git a/src/OS/os.c-SunOS5 b/src/OS/os.c-SunOS5
index 162486958..69305e2cc 100644
--- a/src/OS/os.c-SunOS5
+++ b/src/OS/os.c-SunOS5
@@ -3,7 +3,7 @@
*************************************************/
/* Copyright (c) University of Cambridge 2016 */
-/* Copyright (c) Jeremy Harris 2016 */
+/* Copyright (c) Jeremy Harris 2018 */
/* See the file NOTICE for conditions of use and distribution. */
/* Solaris-specific code. This is concatenated onto the generic
@@ -13,4 +13,15 @@ src/os.c file. */
# include "setenv.c"
#endif
+/* This is missing in Solaris 10, present in Solaris 11.
+A feature-test would be good. */
+
+char *
+strndup(const char * s, size_t n)
+{
+char * dest;
+if (!(dest = malloc(n))) return NULL;
+return strncpy(dest, s, n);
+}
+
/* End of os.c-SunOS5 */
diff --git a/src/OS/os.h-SunOS5 b/src/OS/os.h-SunOS5
index dfbd8f1af..f51b009ef 100644
--- a/src/OS/os.h-SunOS5
+++ b/src/OS/os.h-SunOS5
@@ -48,4 +48,6 @@ a buffer */
# define MAX(a,b) (((a)>(b))?(a):(b))
#endif
+extern char * strndup(const char *, size_t);
+
/* End */