tar2usermap: GNU tar support
authorTony Finch <dot@dotat.at>
Tue, 19 Jul 2016 14:17:55 +0000 (15:17 +0100)
committerTony Finch <dot@dotat.at>
Tue, 19 Jul 2016 14:17:55 +0000 (15:17 +0100)
tar2usermap

index 119850c..df58525 100755 (executable)
@@ -16,8 +16,8 @@ output using Perl Data::Dumper.
 USAGE
 }
 
-sub shite { die "files2rcs: @_: $!\n"; }
-sub shit  { die "files2rcs: @_\n"; }
+sub shite { die "tar2usermap: @_: $!\n"; }
+sub shit  { die "tar2usermap: @_\n"; }
 
 usage unless @ARGV > 0 || @ARGV < 3;
 usage unless $ARGV[0] =~ m{^-m(.*)};
@@ -38,10 +38,11 @@ if (-f $f) {
 }
 
 while (<>) {
-       m{^[-dl][-r][-w][-sx][-r][-w][-sx][-r][-w][-sx]\s+
-         \d+\s+(\S+)\s+\S+\s+\d+\s+
-          [A-Z][a-z][a-z]\s+\d+\s+[12]\d{3}\s+
-         $remove(.*)$
+       m{^[-dlh][-r][-w][-sx][-r][-w][-sx][-r][-w][-sx]\s+
+         (?:\d+\s+)?(\S+)(?:\s+|/)\S+\s+\d+\s+
+          (?:[A-Z][a-z][a-z]\s+\d+\s+[12]\d{3}
+           |\d{4}(?:-\d\d){2}\s+\d\d:\d\d)\s+
+         $remove(.*?)(?: link to .*)?$
           }x
              or shit "could not parse $_";
        $usermap->{"$insert$2"} = $1;