summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmailutils/url/accessor.h15
-rw-r--r--libmailutils/url/get-auth.c1
-rw-r--r--libmailutils/url/get-host.c1
3 files changed, 15 insertions, 2 deletions
diff --git a/libmailutils/url/accessor.h b/libmailutils/url/accessor.h
index 309a7aa63..fa3ed7e6e 100644
--- a/libmailutils/url/accessor.h
+++ b/libmailutils/url/accessor.h
@@ -31,14 +31,14 @@
#include <mailutils/util.h>
#include <mailutils/cstr.h>
#include <mailutils/sys/url.h>
/* General accessors: */
#define AC2(a,b) a ## b
-#define METHOD(pfx,part) AC2(pfx,part)
#define AC4(a,b,c,d) a ## b ## c ## d
+#define METHOD(pfx,part) AC2(pfx,part)
#define ACCESSOR(action,field) AC4(mu_url_,action,_,field)
/* Define a `static get' accessor */
int
ACCESSOR(sget,URL_PART) (mu_url_t url, char const **sptr)
{
@@ -120,12 +120,23 @@ ACCESSOR(aget, URL_PART) (mu_url_t url, char **buf)
}
else
*buf = NULL;
return status;
}
+#ifndef URL_PART_CMP
+# ifndef URL_PART_CMP_ICASE
+# define URL_PART_CMP_ICASE 0
+# endif
+# if URL_PART_CMP_ICASE
+# define URL_PART_CMP mu_c_strcasecmp
+# else
+# define URL_PART_CMP strcmp
+# endif
+#endif
+
/* Define a comparator */
int
ACCESSOR(is_same,URL_PART) (mu_url_t url1, mu_url_t url2)
{
const char *s1, *s2;
int status1, status2;
@@ -136,8 +147,8 @@ ACCESSOR(is_same,URL_PART) (mu_url_t url1, mu_url_t url2)
status2 = ACCESSOR(sget, URL_PART) (url2, &s2);
if (status2 && status2 != MU_ERR_NOENT)
return 0;
if (status1 || status2)
return status1 == status2; /* Both fields are missing */
- return mu_c_strcasecmp (s1, s2) == 0;
+ return URL_PART_CMP (s1, s2) == 0;
}
diff --git a/libmailutils/url/get-auth.c b/libmailutils/url/get-auth.c
index b9650a53c..c8c7ca7aa 100644
--- a/libmailutils/url/get-auth.c
+++ b/libmailutils/url/get-auth.c
@@ -1,3 +1,4 @@
#define URL_PART auth
+#define URL_PART_CMP_ICASE 1
#include "accessor.h"
diff --git a/libmailutils/url/get-host.c b/libmailutils/url/get-host.c
index 6de6b564e..9ef6db853 100644
--- a/libmailutils/url/get-host.c
+++ b/libmailutils/url/get-host.c
@@ -1,2 +1,3 @@
#define URL_PART host
+#define URL_PART_CMP_ICASE 1
#include "accessor.h"

Return to:

Send suggestions and report system problems to the System administrator.