]> git.saurik.com Git - apt.git/blobdiff - methods/rfc2553emu.cc
New ah_GET_GETCONF macro, better abstraction in the rest.
[apt.git] / methods / rfc2553emu.cc
index 1b0628f98457487b422941a43d4091f6b9cf74b7..05d9f0c3250a56f57d6b09167834a8ba131b9f3c 100644 (file)
@@ -1,19 +1,23 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: rfc2553emu.cc,v 1.2 1999/05/26 04:08:39 jgg Exp $
+// $Id: rfc2553emu.cc,v 1.6 1999/12/11 02:11:10 jgg Exp $
 /* ######################################################################
 
    RFC 2553 Emulation - Provides emulation for RFC 2553 getaddrinfo,
                         freeaddrinfo and getnameinfo
+
+   This is really C code, it just has a .cc extensions to play nicer with
+   the rest of APT.
    
    Originally written by Jason Gunthorpe <jgg@debian.org> and placed into
    the Public Domain, do with it what you will.
-   
+
    ##################################################################### */
                                                                        /*}}}*/
 #include "rfc2553emu.h"
 #include <stdlib.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
 #include <string.h>
 #include <stdio.h>
 
@@ -25,7 +29,7 @@ int getaddrinfo(const char *nodename, const char *servname,
                const struct addrinfo *hints,
                struct addrinfo **res)
 {
-   struct addrinfo **Result;
+   struct addrinfo **Result = res;
    hostent *Addr;
    unsigned int Port;
    int Proto;
@@ -54,7 +58,7 @@ int getaddrinfo(const char *nodename, const char *servname,
       Proto = hints->ai_socktype;
    
    // Not a number, must be a name.
-   if (End != servname + strlen(End))
+   if (End != servname + strlen(servname))
    {
       struct servent *Srv = 0;
       
@@ -156,7 +160,7 @@ int getnameinfo(const struct sockaddr *sa, socklen_t salen,
 {
    struct sockaddr_in *sin = (struct sockaddr_in *)sa;
    
-   // This routine only support internet addresses
+   // This routine only supports internet addresses
    if (sa->sa_family != AF_INET)
       return EAI_ADDRFAMILY;