diff -urNad nbtscan-1.5.1~/list.c nbtscan-1.5.1/list.c
--- nbtscan-1.5.1~/list.c	2008-05-08 14:10:54.000000000 +0200
+++ nbtscan-1.5.1/list.c	2008-05-08 14:12:29.000000000 +0200
@@ -49,7 +49,7 @@
 	if(item1==NULL) return 1;
 	if(item1->content == item2->content) return 0;
 	if(item1->content > item2->content) return 1;
-	if(item1->content < item2->content) return -1;
+	return -1;
 };
 
 int insert(struct list* lst, unsigned long content) {
@@ -95,11 +95,11 @@
 		free(item);
 		return ERROR;
 	};
+	return 0;
 };
 
 int in_list(struct list* lst, unsigned long content) {
 	struct list_item *temp_item, *item;
-        int cmp;
 
 	item = new_list_item(content);
 	if(lst->head==NULL) return 0;
diff -urNad nbtscan-1.5.1~/nbtscan.c nbtscan-1.5.1/nbtscan.c
--- nbtscan-1.5.1~/nbtscan.c	2008-05-08 14:10:54.000000000 +0200
+++ nbtscan-1.5.1/nbtscan.c	2008-05-08 14:12:29.000000000 +0200
@@ -5,6 +5,8 @@
 #include <stdlib.h>
 #include <sys/time.h>
 #include <string.h>
+#include <unistd.h>
+#include <getopt.h>
 #if HAVE_STDINT_H
 #include <stdint.h>
 #endif
@@ -16,7 +18,12 @@
 
 int quiet=0;
 
-print_banner() {
+char* getnbservicename(my_uint8_t service, int unique, char* name);
+struct nb_host_info* parse_response(char* buff, int buffsize);
+int in_list(struct list* lst, unsigned long content);
+void send_query(int sock, struct in_addr dest_addr, my_uint32_t rtt_base);
+
+void print_banner(void) {
   printf("\nNBTscan version 1.5.1. Copyright (C) 1999-2003 Alla Bezroutchko.\n");
   printf("This is a free software and it comes with absolutely no warranty.\n");
   printf("You can use, distribute and modify it under terms of GNU GPL.\n\n");
@@ -77,13 +84,13 @@
   return 0;
 };
 
-int print_header() {
+void print_header(void) {
   printf("%-17s%-17s%-10s%-17s%-17s\n", "IP address", "NetBIOS Name", 
 	 "Server", "User", "MAC address");
   printf("------------------------------------------------------------------------------\n");
 };
 
-int d_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo) {
+void d_print_hostinfo(struct in_addr addr, const struct nb_host_info* hostinfo) {
   int i;
   unsigned char service; /* 16th byte of NetBIOS name */
   char name[16];
@@ -117,7 +124,7 @@
   };
 	
   if(hostinfo->footer) {
-    printf("Adapter address: %02x-%02x-%02x-%02x-%02x-%02x\n", 
+    printf("Adapter address: %02x:%02x:%02x:%02x:%02x:%02x\n", 
 	   hostinfo->footer->adapter_address[0], hostinfo->footer->adapter_address[1],
 	   hostinfo->footer->adapter_address[2], hostinfo->footer->adapter_address[3],
 	   hostinfo->footer->adapter_address[4], hostinfo->footer->adapter_address[5]); 
@@ -150,7 +157,6 @@
   int i, unique;
   my_uint8_t service; /* 16th byte of NetBIOS name */
   char name[16];
-  char* sname;
 
   if(!sf) {
     printf("\nNetBIOS Name Table for Host %s:\n\n", inet_ntoa(addr));
@@ -189,7 +195,7 @@
   if(hostinfo->footer) {
     if(sf) printf("%s%sMAC%s", inet_ntoa(addr), sf, sf); 
     else printf("\nAdapter address: ");
-    printf("%02x-%02x-%02x-%02x-%02x-%02x\n",
+    printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
 	   hostinfo->footer->adapter_address[0], hostinfo->footer->adapter_address[1],
 	   hostinfo->footer->adapter_address[2], hostinfo->footer->adapter_address[3],
 	   hostinfo->footer->adapter_address[4], hostinfo->footer->adapter_address[5]);	
@@ -238,7 +244,7 @@
     printf("%-17s", user_name);
   };
   if(hostinfo->footer) {
-    printf("%02x-%02x-%02x-%02x-%02x-%02x\n",
+    printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
 	   hostinfo->footer->adapter_address[0], hostinfo->footer->adapter_address[1],
 	   hostinfo->footer->adapter_address[2], hostinfo->footer->adapter_address[3],
 	   hostinfo->footer->adapter_address[4], hostinfo->footer->adapter_address[5]);
@@ -251,11 +257,10 @@
 /* Print hostinfo in /etc/hosts or lmhosts format */
 /* If l is true adds #PRE to each line of output (for lmhosts) */
 
-int l_print_hostinfo(struct in_addr addr, struct nb_host_info* hostinfo, int l) {
+void l_print_hostinfo(struct in_addr addr, struct nb_host_info* hostinfo, int l) {
   int i;
   unsigned char service; /* 16th byte of NetBIOS name */
   char comp_name[16];
-  int is_server=0;
   int unique;
   int first_name=1;
 
@@ -299,7 +304,7 @@
   struct nb_host_info* hostinfo;
   fd_set* fdsr;
   fd_set* fdsw;
-  int sel, size;
+  int size;
   struct list* scanned;
   my_uint32_t rtt_base; /* Base time (seconds) for round trip time calculations */
   float rtt; /* most recent measured RTT, seconds */
@@ -386,27 +391,27 @@
 
   if(dump && lmhosts) {
     printf("Cannot be used with both dump (-d) and lmhosts (-l) options.\n");
-    usage;
+    usage();
   };
 
   if(dump && etc_hosts) {
     printf("Cannot be used with both dump (-d) and /etc/hosts (-e) options.\n");
-    usage;
+    usage();
   };
 
   if(verbose && lmhosts){
     printf("Cannot be used with both verbose (-v) and lmhosts (-l) options.\n");
-    usage;
+    usage();
   };
 
   if(verbose && etc_hosts){
     printf("Cannot be used with both verbose (-v) and /etc/hosts (-e) options.\n");
-    usage;
+    usage();
   };
 
   if(lmhosts && etc_hosts){
     printf("Cannot be used with both lmhosts (-l) and /etc/hosts (-e) options.\n");
-    usage;
+    usage();
   };
 
 	
@@ -476,8 +481,8 @@
   FD_SET(sock, fdsw);
 
   /* timeout is in milliseconds */
-  select_timeout.tv_sec = timeout / 1000;
-  select_timeout.tv_usec = (timeout % 1000) * 1000; /* Microseconds */
+  select_timeout.tv_sec = 60; /* Default 1 min to survive ARP timeouts */
+  select_timeout.tv_usec = 0; 
 
   addr_size = sizeof(struct sockaddr_in);
 
diff -urNad nbtscan-1.5.1~/range.c nbtscan-1.5.1/range.c
--- nbtscan-1.5.1~/range.c	2008-05-08 14:10:54.000000000 +0200
+++ nbtscan-1.5.1/range.c	2008-05-08 14:12:29.000000000 +0200
@@ -35,14 +35,14 @@
    Returns 1 on success, 0 on failure */
 int is_range1(char* string, struct ip_range* range) {
 	char* separator;
-	unsigned long mask;
+	unsigned int mask;
 	char* ip;
 
 	if((ip = (char *)malloc(strlen(string)+1))==NULL) 
 		err_die("Malloc failed", quiet);
 
 	if (strlen(string)>19) return 0;
-	if(separator=(char*)strchr(string,'/')) {
+	if((separator=(char*)strchr(string,'/'))) {
 		separator++;
 		mask=atoi(separator);
 		if(mask<=0 || mask>32) return 0;
@@ -98,7 +98,7 @@
 		err_die("Malloc failed", quiet);
 	strcpy(ip,string);
 
-	if(separator = (char*)strchr(ip,'-')) {
+	if((separator = (char*)strchr(ip,'-'))) {
 		*separator=0;
 		separator++;
 		last_octet = atoi(separator);
@@ -124,7 +124,7 @@
 	return 0;
 };
 
-int print_range(const struct ip_range* range) {
+void print_range(const struct ip_range* range) {
 	struct in_addr *addr;
 	
 	if((addr = (struct in_addr*)malloc(sizeof(struct in_addr)))==NULL) 
diff -urNad nbtscan-1.5.1~/range.h nbtscan-1.5.1/range.h
--- nbtscan-1.5.1~/range.h	2008-05-08 14:10:54.000000000 +0200
+++ nbtscan-1.5.1/range.h	2008-05-08 14:12:29.000000000 +0200
@@ -36,6 +36,6 @@
    Returns 1 on success, 0 on failure */
 int is_range2(char* string, struct ip_range* range);
 
-int print_range(const struct ip_range* range); 
+void print_range(const struct ip_range* range); 
 
 #endif /* RANGE_H */
diff -urNad nbtscan-1.5.1~/statusq.c nbtscan-1.5.1/statusq.c
--- nbtscan-1.5.1~/statusq.c	2008-05-08 14:10:54.000000000 +0200
+++ nbtscan-1.5.1/statusq.c	2008-05-08 14:12:29.000000000 +0200
@@ -1,5 +1,5 @@
 /* This file contains a portion of code from Samba package, *
-/* which contains the following license:                    *
+/  which contains the following license:                    *
 /
    Unix SMB/Netbios implementation
    Version 1.9
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <stddef.h>
+#include <ctype.h>
 #include "errors.h"
 
 extern int quiet;
@@ -89,7 +90,7 @@
 /* end of code from Samba */
 
 
-int send_query(int sock, struct in_addr dest_addr, my_uint32_t rtt_base) {
+void send_query(int sock, struct in_addr dest_addr, my_uint32_t rtt_base) {
         struct nbname_request request;
 	struct sockaddr_in dest_sockaddr;
 	int status;
@@ -119,7 +120,7 @@
                 (struct sockaddr *)&dest_sockaddr, sizeof(dest_sockaddr));
 	if(status==-1) {
 	        snprintf(errmsg, 80, "%s\tSendto failed", inet_ntoa(dest_addr));
-	        err_print(errmsg, quiet); return(-1);
+	        err_print(errmsg, quiet);
         };
 };
 
@@ -329,41 +330,41 @@
 };
 
 nb_service_t services[] = {
-"__MSBROWSE__", 0x01, 0, "Master Browser",
-"INet~Services", 0x1C, 0, "IIS",
-"IS~", 0x00, 1, "IIS",
-"", 0x00, 1, "Workstation Service",
-"", 0x01, 1, "Messenger Service",
-"", 0x03, 1, "Messenger Service",
-"", 0x06, 1, "RAS Server Service",
-"", 0x1F, 1, "NetDDE Service",
-"", 0x20, 1, "File Server Service",
-"", 0x21, 1, "RAS Client Service",
-"", 0x22, 1, "Microsoft Exchange Interchange(MSMail Connector)",
-"", 0x23, 1, "Microsoft Exchange Store",
-"", 0x24, 1, "Microsoft Exchange Directory",
-"", 0x30, 1, "Modem Sharing Server Service",
-"", 0x31, 1, "Modem Sharing Client Service",
-"", 0x43, 1, "SMS Clients Remote Control",
-"", 0x44, 1, "SMS Administrators Remote Control Tool",
-"", 0x45, 1, "SMS Clients Remote Chat",
-"", 0x46, 1, "SMS Clients Remote Transfer",
-"", 0x4C, 1, "DEC Pathworks TCPIP service on Windows NT",
-"", 0x52, 1, "DEC Pathworks TCPIP service on Windows NT",
-"", 0x87, 1, "Microsoft Exchange MTA",
-"", 0x6A, 1, "Microsoft Exchange IMC",
-"", 0xBE, 1, "Network Monitor Agent",
-"", 0xBF, 1, "Network Monitor Application",
-"", 0x03, 1, "Messenger Service",
-"", 0x00, 0, "Domain Name",
-"", 0x1B, 1, "Domain Master Browser",
-"", 0x1C, 0, "Domain Controllers",
-"", 0x1D, 1, "Master Browser",
-"", 0x1E, 0, "Browser Service Elections",
-"", 0x2B, 1, "Lotus Notes Server Service",
-"IRISMULTICAST", 0x2F, 0, "Lotus Notes",
-"IRISNAMESERVER", 0x33, 0, "Lotus Notes",
-"Forte_$ND800ZA", 0x20, 1, "DCA IrmaLan Gateway Server Service"
+{"__MSBROWSE__", 0x01, 0, "Master Browser"},
+{"INet~Services", 0x1C, 0, "IIS"},
+{"IS~", 0x00, 1, "IIS"},
+{"", 0x00, 1, "Workstation Service"},
+{"", 0x01, 1, "Messenger Service"},
+{"", 0x03, 1, "Messenger Service"},
+{"", 0x06, 1, "RAS Server Service"},
+{"", 0x1F, 1, "NetDDE Service"},
+{"", 0x20, 1, "File Server Service"},
+{"", 0x21, 1, "RAS Client Service"},
+{"", 0x22, 1, "Microsoft Exchange Interchange(MSMail Connector)"},
+{"", 0x23, 1, "Microsoft Exchange Store"},
+{"", 0x24, 1, "Microsoft Exchange Directory"},
+{"", 0x30, 1, "Modem Sharing Server Service"},
+{"", 0x31, 1, "Modem Sharing Client Service"},
+{"", 0x43, 1, "SMS Clients Remote Control"},
+{"", 0x44, 1, "SMS Administrators Remote Control Tool"},
+{"", 0x45, 1, "SMS Clients Remote Chat"},
+{"", 0x46, 1, "SMS Clients Remote Transfer"},
+{"", 0x4C, 1, "DEC Pathworks TCPIP service on Windows NT"},
+{"", 0x52, 1, "DEC Pathworks TCPIP service on Windows NT"},
+{"", 0x87, 1, "Microsoft Exchange MTA"},
+{"", 0x6A, 1, "Microsoft Exchange IMC"},
+{"", 0xBE, 1, "Network Monitor Agent"},
+{"", 0xBF, 1, "Network Monitor Application"},
+{"", 0x03, 1, "Messenger Service"},
+{"", 0x00, 0, "Domain Name"},
+{"", 0x1B, 1, "Domain Master Browser"},
+{"", 0x1C, 0, "Domain Controllers"},
+{"", 0x1D, 1, "Master Browser"},
+{"", 0x1E, 0, "Browser Service Elections"},
+{"", 0x2B, 1, "Lotus Notes Server Service"},
+{"IRISMULTICAST", 0x2F, 0, "Lotus Notes"},
+{"IRISNAMESERVER", 0x33, 0, "Lotus Notes"},
+{"Forte_$ND800ZA", 0x20, 1, "DCA IrmaLan Gateway Server Service"}
 };
 
 char* getnbservicename(my_uint8_t service, int unique, char* name) {
