* Several improvements to restore: cancel now reports the correct
[BackupPC.git] / bin / BackupPC_tarCreate
index 3ba3bbc..9966469 100755 (executable)
@@ -48,7 +48,7 @@
 #
 #========================================================================
 #
-# Version 2.0.0_CVS, released 18 Jan 2003.
+# Version 2.0.0beta3, released 1 Jun 2003.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -69,16 +69,15 @@ my $BinDir = $bpc->BinDir();
 my %Conf   = $bpc->Conf();
 
 my %opts;
-getopts("th:n:p:r:s:", \%opts);
 
-if ( @ARGV < 1 ) {
+if ( !getopts("th:n:p:r:s:", \%opts) || @ARGV < 1 ) {
     print(STDERR "usage: $0 [-t] [-h host] [-n dumpNum] [-s shareName]"
                . " [-r pathRemove] [-p pathAdd]"
                . " files/directories...\n");
     exit(1);
 }
 
-if ( $opts{h} !~ /^([\w\.-\s]+)$/ ) {
+if ( $opts{h} !~ /^([\w\.\s-]+)$/ ) {
     print(STDERR "$0: bad host name '$opts{h}'\n");
     exit(1);
 }
@@ -227,13 +226,13 @@ sub TarWrite
     my $done = $WriteBufSz - length($WriteBuf);
     if ( syswrite($fh, $WriteBuf . substr($$dataRef, 0, $done))
                                 != $WriteBufSz ) {
-        print(STDERR "Unable to write to output file\n");
+        print(STDERR "Unable to write to output file ($!)\n");
         exit(1);
     }
     while ( $done + $WriteBufSz <= length($$dataRef) ) {
         if ( syswrite($fh, substr($$dataRef, $done, $WriteBufSz))
                             != $WriteBufSz ) {
-            print(STDERR "Unable to write to output file\n");
+            print(STDERR "Unable to write to output file ($!)\n");
             exit(1);
         }
         $done += $WriteBufSz;