Added undelete and init

This commit is contained in:
Leeland Heins 2019-03-10 14:51:12 -05:00 committed by GitHub
parent ed14524fbb
commit a0a7cfb193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 101 additions and 1 deletions

View File

@ -1157,5 +1157,31 @@ $debug = 1;
}
}
#
# Undelete a file
#
sub undelete_file {
my ($dskfile, $filename, $dbg) = @_;
$debug = 1 if (defined $dbg && $dbg);
print "dskfile=$dskfile filename=$filename\n";
return 1;
}
#
# Initialize a disk image.
#
sub init {
my ($dskfile, $volume, $dbg) = @_;
$debug = 1 if (defined $dbg && $dbg);
print "dskfile=$dskfile volume=$volume\n";
return 1;
}
1;

4
README
View File

@ -4,10 +4,12 @@ catalog.pl -- mostly working
freemap.pl -- mostly working
dos33read.pl -- mostly working for simple text files
dos33write.pl -- in progress
dos33umlock.pl -- mostly working
dos33unlock.pl -- mostly working
dos33lock.pl -- mostly working
dos33rename.pl -- mostly working
dos33delete.pl -- in progress
dos33copy.pl -- started
zap.pl -- partially working
dos33undelete.pl -- started
dos33init.pl -- started

39
dos33init.pl Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/perl -w
#
# dos33init.pl:
#
# Utility to initialize an Apple II DOS 3.3 disk image.
#
# 20190310 LSH
#
use strict;
use DOS33;
my $debug = 0;
my $volume = 254;
while (defined $ARGV[0] && $ARGV[0] =~ /^-/) {
# Volume
if ($ARGV[0] eq '-v' && defined $ARGV[1] && $ARGV[1] =~ /^\d+$/) {
$volume = $ARGV[1];
shift;
shift;
# Debug
} elsif ($ARGV[0] eq '-d') {
$debug = 1;
shift;
} else {
die "Unknown command line argument $ARGV[0]\n";
}
}
my $dskfile = shift or die "Must supply .dsk filename\n";
die "Volume must be 1-254\n" if $volume < 1 || $volume > 254;
init($dskfile, $volume, $debug);
1;

33
dos33undelete.pl Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/perl -w
#
# dos33undelete.pl:
#
# Utility to undelete a file on an Apple II DOS 3.3 disk image.
#
# 20190310 LSH
#
use strict;
use DOS33;
my $debug = 0;
while (defined $ARGV[0] && $ARGV[0] =~ /^-/) {
# Debug
if ($ARGV[0] eq '-d') {
$debug = 1;
shift;
} else {
die "Unknown command line argument $ARGV[0]\n";
}
}
my $dskfile = shift or die "Must supply .dsk filename\n";
my $filename = shift or die "Must supply filename (on disk image)\n";
undelete_file($dskfile, $filename, $debug);
1;