From 5928c293ff5d0b864172b559cb82d1aa089d9a4a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 11 Apr 2002 15:27:22 +0000 Subject: added strndup() for systems that don't have it (This used to be commit 7e92fb7453e4dbf1fe0c32c3dcc1e994cb95b5ea) --- source3/lib/util_str.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source3/lib/util_str.c') diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index e3dd3124a5..6fdca658cd 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -982,3 +982,22 @@ int fstr_sprintf(fstring s, const char *fmt, ...) va_end(ap); return ret; } + + +#ifndef HAVE_STRNDUP +/******************************************************************* +some platforms don't have strndup +********************************************************************/ + char *strndup(const char *s, size_t n) +{ + char *ret; + int i; + for (i=0;s[i] && i