RIP BOOL. Convert BOOL -> bool. I found a few interesting
[samba.git] / source3 / utils / nmblookup.c
index 8bb80239174e5e273a912b19a524f0e51b19aa94..6d17fb7982930b0c2825b42e707dc5623607c800 100644 (file)
 
 #include "includes.h"
 
-extern BOOL AllowDebugChange;
+extern bool AllowDebugChange;
 
-static BOOL give_flags = False;
-static BOOL use_bcast = True;
-static BOOL got_bcast = False;
+static bool give_flags = False;
+static bool use_bcast = True;
+static bool got_bcast = False;
 static struct in_addr bcast_addr;
-static BOOL recursion_desired = False;
-static BOOL translate_addresses = False;
+static bool recursion_desired = False;
+static bool translate_addresses = False;
 static int ServerFD= -1;
 static int RootPort = False;
-static BOOL find_status=False;
+static bool find_status=False;
 
 /****************************************************************************
   open the socket communication
   **************************************************************************/
-static BOOL open_sockets(void)
+static bool open_sockets(void)
 {
   ServerFD = open_socket_in( SOCK_DGRAM,
                              (RootPort ? 137 : 0),
@@ -130,7 +130,7 @@ static void do_node_status(int fd, const char *name, int type, struct in_addr ip
 /****************************************************************************
 send out one query
 ****************************************************************************/
-static BOOL query_one(const char *lookup, unsigned int lookup_type)
+static bool query_one(const char *lookup, unsigned int lookup_type)
 {
        int j, count, flags = 0;
        struct in_addr *ip_list=NULL;
@@ -141,11 +141,14 @@ static BOOL query_one(const char *lookup, unsigned int lookup_type)
                                     use_bcast?True:recursion_desired,
                                     bcast_addr,&count, &flags, NULL);
        } else {
-               struct in_addr *bcast;
+               const struct in_addr *bcast;
                for (j=iface_count() - 1;
                     !ip_list && j >= 0;
                     j--) {
-                       bcast = iface_n_bcast(j);
+                       bcast = iface_n_bcast_v4(j);
+                       if (!bcast) {
+                               continue;
+                       }
                        d_printf("querying %s on %s\n", 
                               lookup, inet_ntoa(*bcast));
                        ip_list = name_query(ServerFD,lookup,lookup_type,
@@ -190,9 +193,10 @@ int main(int argc,char *argv[])
   int opt;
   unsigned int lookup_type = 0x0;
   fstring lookup;
-  static BOOL find_master=False;
-  static BOOL lookup_by_ip = False;
+  static bool find_master=False;
+  static bool lookup_by_ip = False;
   poptContext pc;
+  TALLOC_CTX *frame = talloc_stackframe();
 
   struct poptOption long_options[] = {
          POPT_AUTOHELP
@@ -292,6 +296,6 @@ int main(int argc,char *argv[])
   }
 
   poptFreeContext(pc);
-
+  TALLOC_FREE(frame);
   return(0);
 }