Added prorename, prodelete & procopy

This commit is contained in:
Leeland Heins 2019-02-28 10:13:42 -06:00 committed by GitHub
parent ec36bb1ca3
commit 92c92f5b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 138 additions and 4 deletions

View File

@ -1401,5 +1401,38 @@ sub write_file {
print "pofile=$pofile filename=$filename mode=$mode conv=$conv apple_filename=$apple_filename\n" if $debug;
}
#
# Rename a file
#
sub rename_file {
my ($pofile, $filename, $new_filename, $dbg) = @_;
$debug = 1 if defined $dbg && $dbg;
print "pofile=$pofile filename=$filename new_filename=$new_filename\n" if $debug;
}
#
# Delete a file
#
sub delete_file {
my ($pofile, $filename, $dbg) = @_;
$debug = 1 if defined $dbg && $dbg;
print "pofile=$pofile filename=$filename\n" if $debug;
}
#
# Copy a file
#
sub copy_file {
my ($pofile, $filename, $copy_filename, $dbg) = @_;
$debug = 1 if defined $dbg && $dbg;
print "pofile=$pofile filename=$filename copy_filename=$copy_filename\n" if $debug;
}
1;

8
README
View File

@ -2,10 +2,10 @@ TODO:
prozap.pl -- partially working
procat.pl -- partially working
profree.pl -- partially working
profree.pl -- mostly working
proread.pl -- partially working
prowrite.pl -- started
prorename.pl
prodelete.pl
procopy.pl
prorename.pl -- started
prodelete.pl -- started
procopy.pl -- started

34
procopy.pl Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/perl -w
#
# procopy.pl:
#
# Utility to copy a file on an Apple II ProDOS .po disk image.
#
# 20190228 LSH
#
use strict;
use ProDOS;
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 $pofile = shift or die "Must supply .po filename\n";
my $filename = shift or die "Must supply filename (on disk image)\n";
my $copy_filename = shift or die "Must supply copy filename (on disk image)\n";
copy_file($pofile, $filename, $copy_filename, $debug);
1;

33
prodelete.pl Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/perl -w
#
# prodelete.pl:
#
# Utility to delete a file on an Apple II ProDOS .po disk image.
#
# 20190228 LSH
#
use strict;
use ProDOS;
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 $pofile = shift or die "Must supply .po filename\n";
my $filename = shift or die "Must supply filename (on disk image)\n";
delete_file($pofile, $filename, $debug);
1;

34
prorename.pl Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/perl -w
#
# prorename.pl:
#
# Utility to rename a file on an Apple II ProDOS .po disk image.
#
# 20190228 LSH
#
use strict;
use ProDOS;
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 $pofile = shift or die "Must supply .po filename\n";
my $filename = shift or die "Must supply filename (on disk image)\n";
my $new_filename = shift or die "Must supply new filename (on disk image)\n";
rename_file($pofile, $filename, $new_filename, $debug);
1;