projects
/
cloudstore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove obsolete init file
[cloudstore.git]
/
user-md5sum.pl
diff --git
a/user-md5sum.pl
b/user-md5sum.pl
index
618198b
..
f704268
100755
(executable)
--- a/
user-md5sum.pl
+++ b/
user-md5sum.pl
@@
-5,21
+5,27
@@
use strict;
use TokyoCabinet;
use Data::Dump qw(dump);
use TokyoCabinet;
use Data::Dump qw(dump);
-my $user = shift @ARGV || die "usage: $0 u2001\n";
+my ($user,$path) = @ARGV;
+die "usage: $0 u2001 [path]\n" unless $user;
my $dir = (getpwnam($user))[7];
die "$dir: $!" unless -d $dir;
my $dir = (getpwnam($user))[7];
die "$dir: $!" unless -d $dir;
-my $
path
= "$dir/.md5";
+my $
md5
= "$dir/.md5";
-die "$
path: $!\n" unless -r $path
;
+die "$
md5: $!\n" unless -r $md5
;
my %h;
my %h;
-tie %h, "TokyoCabinet::HDB", $
path
|| die $!;
+tie %h, "TokyoCabinet::HDB", $
md5
|| die $!;
-while( my($k,$v) = each(%h) ) {
- $k = "$dir/$k" if $ENV{FULL};
- print "$v $k\n";
-}
+if ( $path ) {
+ print $h{$path}, " $path\n";
+} else {
+
+ while( my($k,$v) = each(%h) ) {
+ $k = "$dir/$k" if $ENV{FULL};
+ print "$v $k\n";
+ }
+}