From 92c92f5b13c7689d6596b2e78903b1d9ac9a6191 Mon Sep 17 00:00:00 2001 From: Leeland Heins Date: Thu, 28 Feb 2019 10:13:42 -0600 Subject: [PATCH] Added prorename, prodelete & procopy --- ProDOS.pm | 33 +++++++++++++++++++++++++++++++++ README | 8 ++++---- procopy.pl | 34 ++++++++++++++++++++++++++++++++++ prodelete.pl | 33 +++++++++++++++++++++++++++++++++ prorename.pl | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 procopy.pl create mode 100644 prodelete.pl create mode 100644 prorename.pl diff --git a/ProDOS.pm b/ProDOS.pm index d004aad..57649d9 100644 --- a/ProDOS.pm +++ b/ProDOS.pm @@ -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; diff --git a/README b/README index 318d1f5..90204e4 100644 --- a/README +++ b/README @@ -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 diff --git a/procopy.pl b/procopy.pl new file mode 100644 index 0000000..548bf9e --- /dev/null +++ b/procopy.pl @@ -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; + diff --git a/prodelete.pl b/prodelete.pl new file mode 100644 index 0000000..1b971fa --- /dev/null +++ b/prodelete.pl @@ -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; + diff --git a/prorename.pl b/prorename.pl new file mode 100644 index 0000000..c7327b9 --- /dev/null +++ b/prorename.pl @@ -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; +