From de9e52085ecde8375bbc1e4859f086ec2bb28f5c Mon Sep 17 00:00:00 2001 From: hpa Date: Thu, 24 Oct 2002 04:05:47 +0000 Subject: [PATCH] Add option to display the generated filesystem offset --- mkdiskimage.in | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/mkdiskimage.in b/mkdiskimage.in index d0d8703..009a043 100755 --- a/mkdiskimage.in +++ b/mkdiskimage.in @@ -5,12 +5,24 @@ use Fcntl; -($file,$c,$h,$s) = @ARGV; +%opt = (); +@args = (); + +for $a ( @ARGV ) { + if ( $a =~ /^\-/ ) { + $opt{$'} = 1; + } else { + push(@args, $a); + } +} + +($file,$c,$h,$s) = @args; $c += 0; $h += 0; $s += 0; if ( !$file || $c < 1 || $c > 1024 || $h < 1 || $h > 256 || $s < 1 || $s > 63 ) { - print STDERR "Usage: $0 file c h s (max: 1024 256 63)\n"; + print STDERR "Usage: $0 [-o] file c h s (max: 1024 256 63)\n"; + print STDERR " -o print filesystem offset to stdout\n"; exit 1; } @@ -78,6 +90,11 @@ print MCONFIG "sectors=${s}\n"; print MCONFIG "offset=${offset}\n"; close(MCONFIG); +# Output the filesystem offset to stdout if appropriate +if ( $opt{'o'} ) { + print $offset, "\n"; +} + $ENV{'MTOOLSRC'} = $tmpfile; system('mformat', 'z:'); -- 2.7.4