--- bin/BackupPC_dump.old	2009-08-13 11:50:30.000000000 -0700
+++ bin/BackupPC_dump	2009-08-13 11:48:14.000000000 -0700
@@ -85,7 +85,7 @@
 
 use strict;
 no  utf8;
-use lib "__INSTALLDIR__/lib";
+use lib "/usr/local/BackupPC/lib";
 use BackupPC::Lib;
 use BackupPC::FileZIO;
 use BackupPC::Storage;
@@ -108,6 +108,7 @@
 my $Hosts;
 my $SigName;
 my $Abort;
+my $BonjourHost;
 
 $bpc->ChildInit();
 
@@ -323,7 +324,7 @@
         # Allow blackout to span midnight (specified by hourBegin
         # being greater than hourEnd)
         #
-        next if ( ref($p->{weekDays}) ne "ARRAY" 
+        next if ( ref($p->{weekDays}) ne "ARRAY"
                     || !defined($p->{hourBegin})
                     || !defined($p->{hourEnd})
                 );
@@ -492,21 +493,32 @@
     } else {
         $host = $client;
     }
-    if ( !defined(gethostbyname($host)) ) {
-        #
-        # Ok, NS doesn't know about it.  Maybe it is a NetBios name
-        # instead.
-        #
-	print(STDERR "Name server doesn't know about $host; trying NetBios\n")
-			if ( $opts{v} );
-        if ( !defined($hostIP = $bpc->NetBiosHostIPFind($host)) ) {
-	    print(LOG $bpc->timeStamp, "Can't find host $host via netbios\n");
-            print("host not found\n");
-            exit(1);
-        }
+    # first check if host is a Bonjour client
+    my $BonjourHost = "$host.local";
+    my $delay = $bpc->CheckHostAlive($BonjourHost);
+    if ( $delay > 0 && $delay < $Conf{PingMaxMsec} ){
+      $hostIP = $BonjourHost;
+      $host = $hostIP;
+      print(STDERR "Found Bonjour Client: $BonjourHost\n") if ( $opts{v} );
     } else {
-        $hostIP = $host;
+      if ( !defined(gethostbyname($host)) ) {
+          #
+          # Ok, NS doesn't know about it.  Maybe it is a NetBios name
+          # instead.
+          #
+          print(STDERR "Name server doesn't know about $host; trying NetBios\n")
+              if ( $opts{v} );
+          if ( !defined($hostIP = $bpc->NetBiosHostIPFind($host)) ) {
+              print(LOG $bpc->timeStamp, "Can't find host $host via netbios\n");
+              print("host not found\n");
+              exit(1);
+          }
+      } else {
+          $hostIP = $host;
+      }
+
     }
+
 }
 
 #
@@ -537,7 +549,6 @@
 } elsif ( $opts{d} ) {
     print(LOG $bpc->timeStamp, "$host is dhcp $hostIP, user is $user\n");
 }
-
 #
 # Get a clean directory $Dir/new
 #
@@ -1271,7 +1282,7 @@
             # Only delete an incr backup if the Conf settings are satisfied
             # for all $cntIncrDel incrementals.  Since BackupRemove() does
             # a splice() we need to do the deletes in the reverse order.
-            # 
+            #
             for ( my $i = $firstIncr + $cntIncrDel - 1 ;
                     $i >= $firstIncr ; $i-- ) {
                 print(LOG $bpc->timeStamp,
@@ -1314,7 +1325,7 @@
             # recent one, or the next backup is filled.
             # (We can't deleted a full backup if the next backup is not
             # filled.)
-            # 
+            #
 	    print(LOG $bpc->timeStamp,
                    "removing old full backup $Backups[$firstFull]{num}\n");
             BackupRemove($client, \@Backups, $firstFull);
@@ -1372,7 +1383,7 @@
         #
         my $noDelete = $i + 1 < @$Backups ? $Backups->[$i+1]{noFill} : 0;
 
-        if ( !$noDelete && 
+        if ( !$noDelete &&
               ($fullKeepIdx >= @$fullKeepCnt
               || $k > 0
                  && $fullKeepIdx > 0
