Fossil SCM
Get this branch working with mingw and on Mac
Commit
f55c0fdc30ffde683a33918c619b65499a1e359fb2b1faf3849dfab265f024a0
Parent
fe29fe7d24957c1…
2 files changed
+9
-5
+1
-2
+9
-5
| --- src/smtp.c | ||
| +++ src/smtp.c | ||
| @@ -19,18 +19,21 @@ | ||
| 19 | 19 | ** to RFC 5321. |
| 20 | 20 | */ |
| 21 | 21 | #include "config.h" |
| 22 | 22 | #include "smtp.h" |
| 23 | 23 | #include <assert.h> |
| 24 | -#if !defined(_WIN32) | |
| 24 | +#if defined(__linux__) | |
| 25 | 25 | # include <sys/types.h> |
| 26 | 26 | # include <netinet/in.h> |
| 27 | 27 | # include <arpa/nameser.h> |
| 28 | 28 | # include <resolv.h> |
| 29 | -#else | |
| 29 | +# define FOSSIL_UNIX_STYLE_DNS 1 | |
| 30 | +#endif | |
| 31 | +#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) | |
| 30 | 32 | # include <windows.h> |
| 31 | 33 | # include <windns.h> |
| 34 | +# define FOSSIL_WINDOWS_STYLE_DNS 1 | |
| 32 | 35 | #endif |
| 33 | 36 | |
| 34 | 37 | |
| 35 | 38 | /* |
| 36 | 39 | ** Find the hostname for receiving email for the domain given |
| @@ -40,11 +43,11 @@ | ||
| 40 | 43 | ** |
| 41 | 44 | ** The returned string is obtained from fossil_malloc() |
| 42 | 45 | ** and should be released using fossil_free(). |
| 43 | 46 | */ |
| 44 | 47 | char *smtp_mx_host(const char *zDomain){ |
| 45 | -#if !defined(_WIN32) | |
| 48 | +#if defined(FOSSIL_UNIX_STYLE_DNS) | |
| 46 | 49 | int nDns; /* Length of the DNS reply */ |
| 47 | 50 | int rc; /* Return code from various APIs */ |
| 48 | 51 | int i; /* Loop counter */ |
| 49 | 52 | int iBestPriority = 9999999; /* Best priority */ |
| 50 | 53 | int nRec; /* Number of answers */ |
| @@ -79,11 +82,12 @@ | ||
| 79 | 82 | ns_name_uncompress(aDns, aDns+nDns, pBest+2, |
| 80 | 83 | zHostname, sizeof(zHostname)); |
| 81 | 84 | return fossil_strdup(zHostname); |
| 82 | 85 | } |
| 83 | 86 | return 0; |
| 84 | -#else /* !defined(_WIN32) */ | |
| 87 | +#endif /* defined(FOSSIL_UNIX_SYTLE_DNS) */ | |
| 88 | +#if defined(FOSSIL_WINDOWS_STYLE_DNS) | |
| 85 | 89 | DNS_STATUS status; /* Return status */ |
| 86 | 90 | PDNS_RECORDA pDnsRecord, p; /* Pointer to DNS_RECORD structure */ |
| 87 | 91 | int iBestPriority = 9999999; /* Best priority */ |
| 88 | 92 | char *pBest = 0; /* RDATA for the best answer */ |
| 89 | 93 | |
| @@ -106,11 +110,11 @@ | ||
| 106 | 110 | if( pBest ){ |
| 107 | 111 | pBest = fossil_strdup(pBest); |
| 108 | 112 | } |
| 109 | 113 | DnsRecordListFree(pDnsRecord, DnsFreeRecordListDeep); |
| 110 | 114 | return pBest; |
| 111 | -#endif /* !defined(_WIN32) */ | |
| 115 | +#endif /* defined(FOSSIL_WINDOWS_STYLE_DNS) */ | |
| 112 | 116 | } |
| 113 | 117 | |
| 114 | 118 | /* |
| 115 | 119 | ** COMMAND: test-find-mx |
| 116 | 120 | ** |
| 117 | 121 |
| --- src/smtp.c | |
| +++ src/smtp.c | |
| @@ -19,18 +19,21 @@ | |
| 19 | ** to RFC 5321. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "smtp.h" |
| 23 | #include <assert.h> |
| 24 | #if !defined(_WIN32) |
| 25 | # include <sys/types.h> |
| 26 | # include <netinet/in.h> |
| 27 | # include <arpa/nameser.h> |
| 28 | # include <resolv.h> |
| 29 | #else |
| 30 | # include <windows.h> |
| 31 | # include <windns.h> |
| 32 | #endif |
| 33 | |
| 34 | |
| 35 | /* |
| 36 | ** Find the hostname for receiving email for the domain given |
| @@ -40,11 +43,11 @@ | |
| 40 | ** |
| 41 | ** The returned string is obtained from fossil_malloc() |
| 42 | ** and should be released using fossil_free(). |
| 43 | */ |
| 44 | char *smtp_mx_host(const char *zDomain){ |
| 45 | #if !defined(_WIN32) |
| 46 | int nDns; /* Length of the DNS reply */ |
| 47 | int rc; /* Return code from various APIs */ |
| 48 | int i; /* Loop counter */ |
| 49 | int iBestPriority = 9999999; /* Best priority */ |
| 50 | int nRec; /* Number of answers */ |
| @@ -79,11 +82,12 @@ | |
| 79 | ns_name_uncompress(aDns, aDns+nDns, pBest+2, |
| 80 | zHostname, sizeof(zHostname)); |
| 81 | return fossil_strdup(zHostname); |
| 82 | } |
| 83 | return 0; |
| 84 | #else /* !defined(_WIN32) */ |
| 85 | DNS_STATUS status; /* Return status */ |
| 86 | PDNS_RECORDA pDnsRecord, p; /* Pointer to DNS_RECORD structure */ |
| 87 | int iBestPriority = 9999999; /* Best priority */ |
| 88 | char *pBest = 0; /* RDATA for the best answer */ |
| 89 | |
| @@ -106,11 +110,11 @@ | |
| 106 | if( pBest ){ |
| 107 | pBest = fossil_strdup(pBest); |
| 108 | } |
| 109 | DnsRecordListFree(pDnsRecord, DnsFreeRecordListDeep); |
| 110 | return pBest; |
| 111 | #endif /* !defined(_WIN32) */ |
| 112 | } |
| 113 | |
| 114 | /* |
| 115 | ** COMMAND: test-find-mx |
| 116 | ** |
| 117 |
| --- src/smtp.c | |
| +++ src/smtp.c | |
| @@ -19,18 +19,21 @@ | |
| 19 | ** to RFC 5321. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "smtp.h" |
| 23 | #include <assert.h> |
| 24 | #if defined(__linux__) |
| 25 | # include <sys/types.h> |
| 26 | # include <netinet/in.h> |
| 27 | # include <arpa/nameser.h> |
| 28 | # include <resolv.h> |
| 29 | # define FOSSIL_UNIX_STYLE_DNS 1 |
| 30 | #endif |
| 31 | #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) |
| 32 | # include <windows.h> |
| 33 | # include <windns.h> |
| 34 | # define FOSSIL_WINDOWS_STYLE_DNS 1 |
| 35 | #endif |
| 36 | |
| 37 | |
| 38 | /* |
| 39 | ** Find the hostname for receiving email for the domain given |
| @@ -40,11 +43,11 @@ | |
| 43 | ** |
| 44 | ** The returned string is obtained from fossil_malloc() |
| 45 | ** and should be released using fossil_free(). |
| 46 | */ |
| 47 | char *smtp_mx_host(const char *zDomain){ |
| 48 | #if defined(FOSSIL_UNIX_STYLE_DNS) |
| 49 | int nDns; /* Length of the DNS reply */ |
| 50 | int rc; /* Return code from various APIs */ |
| 51 | int i; /* Loop counter */ |
| 52 | int iBestPriority = 9999999; /* Best priority */ |
| 53 | int nRec; /* Number of answers */ |
| @@ -79,11 +82,12 @@ | |
| 82 | ns_name_uncompress(aDns, aDns+nDns, pBest+2, |
| 83 | zHostname, sizeof(zHostname)); |
| 84 | return fossil_strdup(zHostname); |
| 85 | } |
| 86 | return 0; |
| 87 | #endif /* defined(FOSSIL_UNIX_SYTLE_DNS) */ |
| 88 | #if defined(FOSSIL_WINDOWS_STYLE_DNS) |
| 89 | DNS_STATUS status; /* Return status */ |
| 90 | PDNS_RECORDA pDnsRecord, p; /* Pointer to DNS_RECORD structure */ |
| 91 | int iBestPriority = 9999999; /* Best priority */ |
| 92 | char *pBest = 0; /* RDATA for the best answer */ |
| 93 | |
| @@ -106,11 +110,11 @@ | |
| 110 | if( pBest ){ |
| 111 | pBest = fossil_strdup(pBest); |
| 112 | } |
| 113 | DnsRecordListFree(pDnsRecord, DnsFreeRecordListDeep); |
| 114 | return pBest; |
| 115 | #endif /* defined(FOSSIL_WINDOWS_STYLE_DNS) */ |
| 116 | } |
| 117 | |
| 118 | /* |
| 119 | ** COMMAND: test-find-mx |
| 120 | ** |
| 121 |
+1
-2
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -410,11 +410,11 @@ | ||
| 410 | 410 | LIB += -lkernel32 -lws2_32 |
| 411 | 411 | endif |
| 412 | 412 | |
| 413 | 413 | #### Library required for DNS lookups. |
| 414 | 414 | # |
| 415 | -LIB += ldnsapi | |
| 415 | +LIB += -ldnsapi | |
| 416 | 416 | |
| 417 | 417 | #### Tcl shell for use in running the fossil test suite. This is only |
| 418 | 418 | # used for testing. |
| 419 | 419 | # |
| 420 | 420 | TCLSH = tclsh |
| @@ -2420,6 +2420,5 @@ | ||
| 2420 | 2420 | $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c |
| 2421 | 2421 | $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@ |
| 2422 | 2422 | |
| 2423 | 2423 | $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c |
| 2424 | 2424 | $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@ |
| 2425 | - | |
| 2426 | 2425 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -410,11 +410,11 @@ | |
| 410 | LIB += -lkernel32 -lws2_32 |
| 411 | endif |
| 412 | |
| 413 | #### Library required for DNS lookups. |
| 414 | # |
| 415 | LIB += ldnsapi |
| 416 | |
| 417 | #### Tcl shell for use in running the fossil test suite. This is only |
| 418 | # used for testing. |
| 419 | # |
| 420 | TCLSH = tclsh |
| @@ -2420,6 +2420,5 @@ | |
| 2420 | $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c |
| 2421 | $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@ |
| 2422 | |
| 2423 | $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c |
| 2424 | $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@ |
| 2425 | |
| 2426 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -410,11 +410,11 @@ | |
| 410 | LIB += -lkernel32 -lws2_32 |
| 411 | endif |
| 412 | |
| 413 | #### Library required for DNS lookups. |
| 414 | # |
| 415 | LIB += -ldnsapi |
| 416 | |
| 417 | #### Tcl shell for use in running the fossil test suite. This is only |
| 418 | # used for testing. |
| 419 | # |
| 420 | TCLSH = tclsh |
| @@ -2420,6 +2420,5 @@ | |
| 2420 | $(OBJDIR)/th_tcl.o: $(SRCDIR)/th_tcl.c |
| 2421 | $(XTCC) -c $(SRCDIR)/th_tcl.c -o $@ |
| 2422 | |
| 2423 | $(OBJDIR)/miniz.o: $(SRCDIR)/miniz.c |
| 2424 | $(XTCC) $(MINIZ_OPTIONS) -c $(SRCDIR)/miniz.c -o $@ |
| 2425 |