ossp-pkg/as/as-gui/as_uuid.cpp 1.1 -> 1.2
--- as_uuid.cpp 2002/12/03 10:01:56 1.1
+++ as_uuid.cpp 2002/12/03 11:54:03 1.2
@@ -7,22 +7,47 @@
* Library General Public License.
*/
+#include <stdio.h>
+#include <string.h>
#include <fcntl.h>
#include <errno.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
#include "as_uuidgen.h"
-#ifndef max
- /* Define a general use max macro */
- #define max(a,b) ((a) > (b) ? (a) : (b))
+/* Include whatever autoconf found */
+#ifdef HAVE_CONFIG_H
+#include "ac_config.h"
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
#endif
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif /* HAVE_SYS_SOCKIO_H */
#ifdef HAVE_NET_IF_H
- #include <net/if.h> /* For use in get_node_id() */
+#include <net/if.h>
+#endif /* HAVE_NET_IF_H */
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif /* HAVE_NETINET_IN_H */
- /* Define the size of a interface address */
- #define ifreq_size(i) max(sizeof(struct ifreq), sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
-#endif
+#ifndef max
+/* Define a general use max macro */
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif /* max */
+
+#ifdef HAVE_NET_IF_H
+/* Define the size of a interface address */
+#define ifreq_size(i) max(sizeof(struct ifreq), sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
+#endif /* HAVE_NET_IF_H */
static int get_random_fd(void)
@@ -104,7 +129,7 @@
return -1;
}
n = ifc.ifc_len;
- for (i = 0; i < n; i+= ifreq_size(*ifr) ) {
+ for (i = 0; i < n; i+= ifreq_size(ifr)) {
ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
#ifdef HAVE_SIOCGIFHWADDR
|
|