pkgsrc/comms/pilotmgr/patches/patch-ab
tron df05f07be8 - Add patch for Backup conduit supplied by Alan Harder which fixes
problems with databases with slashes in their names.
- Bump version number to 1.107p1.
1999-10-22 23:31:51 +00:00

114 lines
2.6 KiB
Text

$NetBSD: patch-ab,v 1.1 1999/10/22 23:31:53 tron Exp $
--- /usr/pkg/lib/pilotmgr/Backup.pm Tue Jul 6 21:41:45 1999
+++ Backup.pm Thu Oct 21 08:14:38 1999
@@ -33,7 +33,7 @@
my ($DEBUG) = 1; # Debug mode on/off
my ($DEBUGFILE); # Location of debug file
my ($RCFILE); # Location of resource file
-my ($VERSION) = "1.007"; # Version number
+my ($VERSION) = "1.007+"; # Version number
my ($PREFS); # Preferences
my ($MAXARCHIVES) = 7; # Max number of archives
my ($MANIFEST) = ".archive_manifest"; # Tag to help protect
@@ -626,7 +626,7 @@
if (&fetchDB($dlp, "$PREFS->{gBackupDir}/$arch", $dbname, $info))
{
$PREFS->{"backuprecord"}->{$dbname} = time;
- push(@success, $dbname);
+ push(@success, &makeFilename($dbname, $info));
$STATS{"success"}++;
}
else
@@ -655,13 +655,9 @@
my $dir = shift @archList;
next if ($dir eq $arch);
- $file = "$dbname.pdb"
- if (-f "$dir/$dbname.pdb");
+ $file = &makeFilename($dbname, $info);
- $file = "$dbname.prc"
- if (-f "$dir/$dbname.prc");
-
- if ($file)
+ if (-f "$dir/$file")
{
PilotMgr::status("$dbname [from archive]",
int(100 * $count / $count_max));
@@ -690,7 +686,7 @@
$dbname, $info))
{
$PREFS->{"backuprecord"}->{$dbname} = time;
- push(@success, $dbname);
+ push(@success, &makeFilename($dbname, $info));
$STATS{"success"}++;
}
else
@@ -705,7 +701,7 @@
{
# Update the backup manifest
#
- push(@success, $dbname);
+ push(@success, &makeFilename($dbname, $info));
}
}
@@ -797,13 +793,10 @@
{
while (<FD>)
{
- chop;
-
- unlink "$dir/$_.pdb"
- if (-f "$dir/$_.pdb");
+ chomp;
- unlink "$dir/$_.prc"
- if (-f "$dir/$_.prc");
+ unlink "$dir/$_"
+ if (-f "$dir/$_");
}
close(FD);
@@ -840,7 +833,7 @@
{
chomp($buf);
- chop($time = `date +"%D %T`);
+ chomp($time = `date +"%D %T`);
$time .= " ";
$pad = " " x length($time);
$buf =~ s/\n/\n$pad/g;
@@ -857,11 +850,9 @@
return Dumper($obj);
}
-sub fetchDB
+sub makeFilename
{
- my ($dlp, $dir, $filename, $info) = @_;
- my ($file);
- my ($err);
+ my ($filename, $info) = @_;
# Protect any special characters
$filename =~ s|=|=3D|g;
@@ -875,7 +866,16 @@
{
$filename .= ".pdb";
}
- $filename = $dir . "/" . $filename;
+ return $filename;
+}
+
+sub fetchDB
+{
+ my ($dlp, $dir, $filename, $info) = @_;
+ my ($file);
+ my ($err);
+
+ $filename = $dir . "/" . &makeFilename($filename, $info);
$file = PDA::Pilot::File::create($filename, $info);
$dlp->getStatus();