cygwin does not have getaddrinfo so I added a compatibility
implementation in src/ikarus-getaddrinfo.[ch]
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ ikarus_SOURCES = ikarus-collect.c ikarus-exec.c ikarus-fasl.c \
|
||||
ikarus-runtime.c ikarus-symbol-table.c ikarus-verify-integrity.c \
|
||||
ikarus-weak-pairs.c ikarus-winmmap.c ikarus-data.h \
|
||||
ikarus-winmmap.h ikarus-enter.s cpu_has_sse2.s ikarus-io.c \
|
||||
ikarus-process.c
|
||||
ikarus-process.c ikarus-getaddrinfo.h ikarus-getaddrinfo.c
|
||||
|
||||
scheme_script_SOURCES = scheme-script.c
|
||||
|
||||
|
||||
+5
-4
@@ -54,7 +54,7 @@ am_ikarus_OBJECTS = ikarus-collect.$(OBJEXT) ikarus-exec.$(OBJEXT) \
|
||||
ikarus-verify-integrity.$(OBJEXT) ikarus-weak-pairs.$(OBJEXT) \
|
||||
ikarus-winmmap.$(OBJEXT) ikarus-enter.$(OBJEXT) \
|
||||
cpu_has_sse2.$(OBJEXT) ikarus-io.$(OBJEXT) \
|
||||
ikarus-process.$(OBJEXT)
|
||||
ikarus-process.$(OBJEXT) ikarus-getaddrinfo.$(OBJEXT)
|
||||
nodist_ikarus_OBJECTS =
|
||||
ikarus_OBJECTS = $(am_ikarus_OBJECTS) $(nodist_ikarus_OBJECTS)
|
||||
ikarus_LDADD = $(LDADD)
|
||||
@@ -180,7 +180,7 @@ ikarus_SOURCES = ikarus-collect.c ikarus-exec.c ikarus-fasl.c \
|
||||
ikarus-runtime.c ikarus-symbol-table.c ikarus-verify-integrity.c \
|
||||
ikarus-weak-pairs.c ikarus-winmmap.c ikarus-data.h \
|
||||
ikarus-winmmap.h ikarus-enter.s cpu_has_sse2.s ikarus-io.c \
|
||||
ikarus-process.c
|
||||
ikarus-process.c ikarus-getaddrinfo.h ikarus-getaddrinfo.c
|
||||
|
||||
scheme_script_SOURCES = scheme-script.c
|
||||
nodist_ikarus_SOURCES = bootfileloc.h
|
||||
@@ -200,9 +200,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
$(AUTOMAKE) --foreign src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
@@ -260,6 +260,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikarus-exec.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikarus-fasl.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikarus-flonums.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikarus-getaddrinfo.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikarus-io.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikarus-main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikarus-numerics.Po@am__quote@
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#ifndef IKARUS_H
|
||||
#define IKARUS_H
|
||||
#include "ikarus-getaddrinfo.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Ikarus Scheme -- A compiler for R6RS Scheme.
|
||||
* Copyright (C) 2006,2007 Abdulaziz Ghuloum
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#if (!HAVE_GETADDRINFO)
|
||||
#include "ikarus-getaddrinfo.h"
|
||||
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <cygwin/in.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
getaddrinfo(const char *hostname, const char* servname,
|
||||
const struct addrinfo* hints, struct addrinfo** res){
|
||||
/* hints not used */
|
||||
struct servent* sent = getservbyname(servname, "tcp");
|
||||
if(sent == 0) return -1;
|
||||
struct hostent* hent = gethostbyname(hostname);
|
||||
if (!hent){
|
||||
return -1;
|
||||
}
|
||||
struct addrinfo* r = malloc(sizeof(struct addrinfo));
|
||||
if(r == 0) return -1;
|
||||
r->ai_family = hent->h_addrtype;
|
||||
r->ai_socktype = SOCK_STREAM;
|
||||
r->ai_protocol = 0;
|
||||
r->ai_addrlen = sizeof(struct sockaddr_in);
|
||||
r->ai_addr = malloc(r->ai_addrlen);
|
||||
if (r->ai_addr == 0){
|
||||
free(r);
|
||||
return -1;
|
||||
}
|
||||
struct sockaddr_in* sa_in = (struct sockaddr_in *)r->ai_addr;
|
||||
memset(sa_in, 0, sizeof(struct sockaddr_in));
|
||||
sa_in->sin_family = PF_INET;
|
||||
sa_in->sin_port = sent->s_port;
|
||||
struct in_addr** ap = (struct in_addr **)hent->h_addr_list;
|
||||
memcpy(&sa_in->sin_addr, *ap, sizeof(struct in_addr));
|
||||
r->ai_next = NULL;
|
||||
*res = r;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
freeaddrinfo(struct addrinfo *ai){
|
||||
free(ai->ai_addr);
|
||||
free(ai);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Ikarus Scheme -- A compiler for R6RS Scheme.
|
||||
* Copyright (C) 2006,2007 Abdulaziz Ghuloum
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#if (!HAVE_GETADDRINFO)
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
|
||||
struct addrinfo {
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
|
||||
extern int
|
||||
getaddrinfo(const char *hostname, const char* servname,
|
||||
const struct addrinfo* hints, struct addrinfo** res);
|
||||
|
||||
extern void
|
||||
freeaddrinfo(struct addrinfo *ai);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user