You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.5 KiB
71 lines
1.5 KiB
From 67d54003b8075b8ea8102bc4a808df4543ab113a Mon Sep 17 00:00:00 2001
|
|
From: John Lindgren <john.lindgren@tds.net>
|
|
Date: Thu, 19 Nov 2015 13:39:27 +0100
|
|
Subject: [PATCH 3/8] Fix build if strndup() is missing
|
|
|
|
---
|
|
configure.in | 1 +
|
|
src/uri.c | 27 +++++++++++++++++++++++++++
|
|
2 files changed, 28 insertions(+)
|
|
|
|
diff --git a/configure.in b/configure.in
|
|
index 86b0e08..9209523 100755
|
|
--- a/configure.in
|
|
+++ b/configure.in
|
|
@@ -14,6 +14,7 @@ AC_PROG_INSTALL
|
|
|
|
dnl Checks for header files.
|
|
AC_CHECK_HEADERS([sys/socket.h netinet/in.h netdb.h windows.h winsock2.h])
|
|
+AC_CHECK_FUNCS([strndup])
|
|
|
|
case $host in
|
|
*beos*)
|
|
diff --git a/src/uri.c b/src/uri.c
|
|
index a96b900..ec28f3c 100644
|
|
--- a/src/uri.c
|
|
+++ b/src/uri.c
|
|
@@ -17,6 +17,10 @@
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
+#ifdef HAVE_CONFIG_H
|
|
+#include "config.h"
|
|
+#endif
|
|
+
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
@@ -125,6 +129,29 @@ for ($i = 0; $i < 32; $i++)
|
|
#define ISSPACE(C) (((C) >= 9 && (C) <= 13) || (C) == ' ')
|
|
|
|
|
|
+/* Implement the strndup function.
|
|
+ Copyright (C) 2005 Free Software Foundation, Inc.
|
|
+ Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>. */
|
|
+#ifndef HAVE_STRNDUP
|
|
+char *
|
|
+strndup (const char *s, size_t n)
|
|
+{
|
|
+ char *result;
|
|
+ size_t len = strlen (s);
|
|
+
|
|
+ if (n < len)
|
|
+ len = n;
|
|
+
|
|
+ result = (char *) malloc (len + 1);
|
|
+ if (!result)
|
|
+ return 0;
|
|
+
|
|
+ result[len] = '\0';
|
|
+ return (char *) memcpy (result, s, len);
|
|
+}
|
|
+#endif
|
|
+
|
|
+
|
|
static int split_user_passwd(const char* in, char** user, char** passwd)
|
|
{
|
|
char *pass, *tmp = g_strdup(in);
|
|
--
|
|
2.39.2
|
|
|