Re: function memrchr no defined on solaris systems

John Merryweather Cooper <[email protected]> Sat, 24 Jan 2004 11:55:08 -0800
Newsgroups gmane.comp.lib.libesmtp
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------090701070809010201050108
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

FreeBSD has the same issue.  As a temporary hack, try adapting the 
attached patch.

jmc

Oliver Stecklina wrote:
> Hi,
> 
> I try to use the new esmtp-library 1.0.2 for balsa 2.0.16, but the library uses
> the function memrchr(...), which is not defined on Solaris 9.
> 
> I can compile and install the esmtp-library, but the function is an undefined
> symbol, so that I'm unable to use the library for any program.
> 
> Is this function really necessary or is exists anothor inmplementation, that I
> can use instead of.
> 
> Thanx for answer
> Oliver
> 
> --
> ---------------------------------------------------
> -
> -   Oliver Stecklina
> -
> -   URL: http://www.stecklina.net
> -   e-Mail: [email protected]
> -
> ---------------------------------------------------
> 
> 
> _______________________________________________
> libesmtp-devel mailing list
> [email protected]
> http://community.uklinux.net/mailman/listinfo/libesmtp-devel
> 

--------------090701070809010201050108
Content-Type: text/plain;
 name="patch-smtp-tls.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-smtp-tls.c"

--- smtp-tls.c.orig	Mon Jan 19 02:36:32 2004
+++ smtp-tls.c	Mon Jan 19 02:41:25 2004
@@ -450,6 +450,20 @@
   return 1;
 }
 
+#if defined(__FreeBSD__)
+void *
+memrchr(const void *v, int c, size_t size)
+{
+	const unsigned char *p = (const unsigned char *) v + size;
+
+	while (size-- > 0) {
+		if (*--p == c)
+			return (void *) p;
+	}
+	return NULL;
+}
+#endif
+
 /* Perform a domain name comparison where the reference may contain
    wildcards.  This implements the comparison from RFC 2818.
    Each component of the domain name is matched separately, working from

--------------090701070809010201050108--