X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=rfc1006%2Fmakensap.c;fp=rfc1006%2Fmakensap.c;h=0000000000000000000000000000000000000000;hp=ca1bd7d0c3c49eff9addb5074daa8c341cc6f1d8;hb=f26962f9dfdbcd23a08a7f0880b1d9f8a36cbaf9;hpb=02c239d1b4b0ea8b03bfb64d08605efdc9f96705 diff --git a/rfc1006/makensap.c b/rfc1006/makensap.c deleted file mode 100644 index ca1bd7d..0000000 --- a/rfc1006/makensap.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * A quick little implementation of the makensap function of the - * xtimosi package. It's needed to make the demo apps work. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static struct sockaddr_in *tcpip_strtoaddr(const char *str); - -/* - * text format is | ':' . No spaces. - * The binary form is a struct sockaddr_ip. - */ -int makensap(char *text, unsigned char *binary) -{ - struct sockaddr_in *addr; - - fprintf(stderr, "Mapping textform NSAP '%s'\n", text); - if (!(addr = tcpip_strtoaddr(text))) - { - fprintf(stderr, "Failed to resolve '%s'\n", text); - return -1; - } - memcpy(binary, addr, sizeof(struct sockaddr_in)); - return sizeof(struct sockaddr_in); -} - -/* - * This is the address mapper from the comstack submodule of YAZ. - */ -static struct sockaddr_in *tcpip_strtoaddr(const char *str) -{ - static struct sockaddr_in add; - struct hostent *hp; - char *p, buf[512]; - short int port = 210; - unsigned long tmpadd; - - add.sin_family = AF_INET; - strcpy(buf, str); - if ((p = strchr(buf, ':'))) - { - *p = 0; - port = atoi(p + 1); - } - add.sin_port = htons(port); - if ((hp = gethostbyname(buf))) - memcpy(&add.sin_addr.s_addr, *hp->h_addr_list, sizeof(struct in_addr)); - else if ((tmpadd = inet_addr(buf)) != 0) - memcpy(&add.sin_addr.s_addr, &tmpadd, sizeof(struct in_addr)); - else - return 0; - return &add; -} -/* - * Local variables: - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - * vim: shiftwidth=4 tabstop=8 expandtab - */ -