On 20/10/09 11:27, Matthew Booth wrote:
On 20/10/09 10:39, Richard W.M. Jones wrote:
+sub set_mode_x +{ + die __"virt-tar: extract/upload mode specified twice on the command line\n" + if $mode; + $mode = "x"; +} + +sub set_mode_u +{ + die __"virt-tar: extract/upload mode specified twice on the command line\n" + if $mode; + $mode = "u"; +}
I'm not going to change your mind on this, am I? ;)
+# Note: 'pop' reads arguments right to left. +my ($tarball, $directory); +if ($mode eq "x") { + $tarball = pop @ARGV; + $directory = pop @ARGV; +} else { # $mode eq "u" + $directory = pop @ARGV; + $tarball = pop @ARGV; + die __"virt-tar: $tarball: file not found\n" unless -f $tarball; +} +die __"virt-tar: $directory: directory name must start with '/' character\n" + unless substr ($directory, 0, 1) eq "/";
Good call.
ACK.
Ah, wait. What happens to Windows directories here? Can the user specify 'C:\Temp'? Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team M: +44 (0)7977 267231 GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490