diff --git a/ProDOS.pm b/ProDOS.pm index 57649d9..1c1a3b4 100644 --- a/ProDOS.pm +++ b/ProDOS.pm @@ -1434,5 +1434,27 @@ sub copy_file { print "pofile=$pofile filename=$filename copy_filename=$copy_filename\n" if $debug; } +# +# Lock a file +# +sub lock_file { + my ($pofile, $filename, $dbg) = @_; + + $debug = 1 if defined $dbg && $dbg; + + print "pofile=$pofile filename=$filename\n" if $debug; +} + +# +# Unlock a file +# +sub unlock_file { + my ($pofile, $filename, $dbg) = @_; + + $debug = 1 if defined $dbg && $dbg; + + print "pofile=$pofile filename=$filename\n" if $debug; +} + 1; diff --git a/README b/README index 90204e4..6665eb6 100644 --- a/README +++ b/README @@ -8,4 +8,6 @@ prowrite.pl -- started prorename.pl -- started prodelete.pl -- started procopy.pl -- started +prolock.pl -- started +prounlock.pl -- started diff --git a/prolock.pl b/prolock.pl new file mode 100644 index 0000000..913a44a --- /dev/null +++ b/prolock.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +# +# prolock.pl: +# +# Utility to 'lock' 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"; + +lock_file($pofile, $filename, $debug); + +1; + diff --git a/prounlock.pl b/prounlock.pl new file mode 100644 index 0000000..9e64394 --- /dev/null +++ b/prounlock.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +# +# prounlock.pl: +# +# Utility to 'unlock' 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"; + +unlock_file($pofile, $filename, $debug); + +1; +