[BACK]Return to example3.pl CVS log [TXT][DIR] Up to [local] / palm / Palm-Keyring / examples

Diff for /palm/Palm-Keyring/examples/example3.pl between version 1.4 and 1.5

version 1.4, 2007/02/10 16:24:16 version 1.5, 2007/08/10 05:13:31
Line 1 
Line 1 
 #!/usr/bin/perl  #!/usr/bin/perl
 # $RedRiver$  # $RedRiver: example3.pl,v 1.4 2007/02/10 16:24:16 andrew Exp $
 ########################################################################  ########################################################################
 # palmkeyring.pl *** a command line client for Keyring databases.  # palmkeyring.pl *** a command line client for Keyring databases.
 #  #
Line 57 
Line 57 
 sub show_list  sub show_list
 {  {
         print "Showing List\n";          print "Showing List\n";
         foreach (0..$#{ $pdb->{'records'} }) {          foreach my $r (@{ $pdb->{records} }) {
         next if $_ == 0;  
         my $r = $pdb->{'records'}->[$_];  
                 my $category =                  my $category =
                         $pdb->{'appinfo'}->{'categories'}->[ $r->{'category'} ]->{'name'};                          $pdb->{appinfo}->{categories}->[ $r->{category} ]->{name};
   
                 my $matched = 0;                  my $matched = 0;
                 foreach my $cat (@{ $Categories }) {                  foreach my $cat (@{ $Categories }) {
Line 73 
Line 71 
                 next if ( @{ $Categories } || @{ $Names } ) && not $matched;                  next if ( @{ $Categories } || @{ $Names } ) && not $matched;
   
                 # XXX Fix up formatting                  # XXX Fix up formatting
                 print $r->{'name'} .                  print $r->{decrypted}->{0}->{data} .
                         ":" .                          ":" .
                         $r->{'category'} .                          $r->{category} .
                         ":" .                          ":" .
                         $category .                          $category .
                         "\n";                          "\n";
Line 108 
Line 106 
                         $matched++ if uc($category) eq uc($cat);                          $matched++ if uc($category) eq uc($cat);
                 }                  }
                 foreach my $name (@{ $Names}) {                  foreach my $name (@{ $Names}) {
                         $matched++ if uc($r->{'name'}) eq uc($name);                          $matched++ if uc($r->{decrypted}->{0}->{data}) eq uc($name);
                 }                  }
                 next if ( @{ $Categories } || @{ $Names } ) && not $matched;                  next if ( @{ $Categories } || @{ $Names } ) && not $matched;
   
         my $a = $pdb->Decrypt($r);          my $a = $pdb->Decrypt($r);
   
                 # XXX Fix up formatting                  # XXX Fix up formatting
                 print $r->{'name'} .  "\n\t" .                  print $a->{0}->{data} .  "\n\t" .
                         "Category: " . $category .  "\n\t" .                          "Category: " . $category .  "\n\t" .
                         "Account:  " . $a->{'account'} .  "\n\t" .                          "Account:  " . $a->{1}->{data} .  "\n\t" .
                         "Password: " . $a->{'password'} .  "\n";                          "Password: " . $a->{2}->{data} .  "\n";
                         print "\tNotes: " . $a->{'notes'} . "\n" if $a->{'notes'};                          print "\tNotes: " . $a->{255}->{data} . "\n" if $a->{255}->{data};
         }          }
   
 }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>