]> Creatis software - gdcm.git/blobdiff - src/gdcmUtil.cxx
BUG: Fix patch for HAVE_SA_LEN wasnt working on linux anymore
[gdcm.git] / src / gdcmUtil.cxx
index 5ff44cde93200bd6b18f3ea9848c75f5c1338f2f..f0b9def9a836880cb03391b0c1656accf8561cd5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmUtil.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/17 16:41:18 $
-  Version:   $Revision: 1.103 $
+  Date:      $Date: 2005/01/17 23:11:25 $
+  Version:   $Revision: 1.109 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
    #include <sys/types.h>
 #endif
 
-// How do I do that in CMake ?
-#ifdef __APPLE__
-   #define HAVE_SA_LEN
-   #define CMAKE_HAVE_NET_IF_DL_H
-   #define CMAKE_HAVE_NETINET_IN_H
-   #define CMAKE_HAVE_NET_IF_H
-#endif //APPLE
-
 #ifdef CMAKE_HAVE_SYS_IOCTL_H
    #include <sys/ioctl.h>  // For SIOCGIFCONF on Linux
 #endif
@@ -75,8 +67,7 @@
 #ifdef CMAKE_HAVE_NET_IF_DL_H
    #include <net/if_dl.h>
 #endif
-#ifdef __sun
-   //#if defined(CMAKE_HAVE_NET_IF_ARP_H) && defined(__sun)
+#if defined(CMAKE_HAVE_NET_IF_ARP_H) && defined(__sun)
    // This is absolutely necesseray on SunOS
    #include <net/if_arp.h>
 #endif
@@ -437,8 +428,9 @@ int GetMacAddrSys ( unsigned char *addr )
    SNMP_oidcpy(&varBind[0].name, &MIB_ifEntryNum);
    ret = m_Query(ASN_RFC1157_GETNEXTREQUEST, &varBindList, &errorStatus,
                  &errorIndex);
-   printf("# of adapters in this system : %i\n",
-          varBind[0].value.asnValue.number); varBindList.len = 2;
+//   printf("# of adapters in this system : %i\n",
+//          varBind[0].value.asnValue.number);
+   varBindList.len = 2;
 
    // Copy in the OID of ifType, the type of interface
    SNMP_oidcpy(&varBind[0].name, &MIB_ifEntryType);
@@ -564,7 +556,7 @@ int GetMacAddrSys ( unsigned char *addr )
    char buf[1024];
    int      n, i;
    unsigned char    *a;
-#ifdef AF_LINK
+#if defined(AF_LINK) && (!defined(SIOCGIFHWADDR) && !defined(SIOCGENADDR))
    struct sockaddr_dl *sdlp;
 #endif
 
@@ -640,6 +632,9 @@ int GetMacAddrSys ( unsigned char *addr )
    }
    close(sd);
 #endif
+   /* Not implemented platforms */
+   perror("There was a configuration problem on your plateform");
+   memset(addr,0,6);
    return -1;
 #endif //__sun
 }