15 # This should be fixed...
20 # Print out only one user,
22 # Or specifiy printing in hours, minutes, or seconds (default)
24 GetOptions ('user=s' => \$user,
26 'file=s' => \$filename,
27 'hours' => sub { $divisor = 3600 },
28 'minutes' => sub { $divisor = 60 },
29 'seconds' => sub { $divisor = 1 } );
32 # For now, this must be specified by hand.
34 if ($filename eq '') {
35 die "You MUST specify the DB filename via: --file = <filename>\n";
41 my $db = tie(%hash, 'GDBM_File', $filename, O_RDONLY, 0666) or die "Cannot open$filename: $!\n";
44 # If given one name, give the seconds
47 print $user, "\t\t", int ( unpack('L',$hash{$user}) / $divisor), "\n";
55 # This may be faster, but unordered.
56 #while (($key,$val) = each %hash) {
58 foreach $key (sort keys %hash) {
61 next if ($key eq "DEFAULT1");
62 next if ($key eq "DEFAULT2");
65 # Allow user names matching a regex.
67 next if ($key !~ /$match/);
70 # Print out the names...
71 print $key, "\t\t", int ( unpack('L',$hash{$key}) / $divisor), "\n";