[Ultrapossum-cvs 1117] utils/misc/ldifdiff 1.13,1.14,ldifdiff

アーカイブの一覧に戻る

Masato Taruishi taru****@users*****
2004年 11月 5日 (金) 12:45:27 JST


===================================================================
RCS file: utils/misc/ldifdiff/ldifdiff,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- utils/misc/ldifdiff/ldifdiff	2004/10/31 06:26:05	1.13
+++ utils/misc/ldifdiff/ldifdiff	2004/11/05 03:45:27	1.14
@@ -8,7 +8,7 @@
 
 =head1 SYNOPSIS
 
-B<ldifdiff> <old> <new>
+B<ldifdiff> [<options..>] <old> <new>
 
 =head1 DESCRIPTION
 
@@ -21,6 +21,28 @@
 the new ldif file. So, you can use this program to synchronize
 two LDAP servers.
 
+=head1 OPTIONS
+
+=head2 --include-attrs=<attrs> | e=<attrs>
+
+Specify the comma-separated list of attributes to check. The specified
+attributes here are checked even if you specify it in B<--exclude-attrs>.
+
+=head2 --exclude-attrs=<attrs> | e=<attrs>
+
+Specify the comma-separated list of additional attributes to be
+excluded from checking.
+By default, the following attributes are excluded. If you want to check
+these attributes, then specify the attributes in B<--include-attrs>.
+
+  modifyTimestamp
+  modifiersName
+  entryCSN
+  entryUUID
+  createTimestamp
+  creatorsName
+  structuralObjectClass
+
 =head1 SEE ALSO
 
 slapd.replog(5), ldapmodify(1), ldif(5)
@@ -46,6 +68,8 @@
   "structuralObjectClass" => 1,
 );
 
+my %include_attr = ();
+
 sub usage {
 	print STDERR <<EOF;
 Usage: ldifdiff <old> <new>
@@ -56,9 +80,21 @@
 # print STDERR join('\n', @_ );
 }
 
-GetOptions(
+my $exattrs = "";
+my $incattrs = "";
+
+GetOptions('exclude-attrs|e=s' => \$exattrs,
+           'include-attrs|i=s' => \$incattrs
 );
 
+foreach ( split(/,/, $exattrs) ) {
+  $exclude_attr{$_} = 1;
+}
+
+foreach ( split(/,/, $incattrs) ) {
+  $include_attr{$_} = 1;
+}
+
 # sub <in>
 sub entry {
   my $in = shift;
@@ -70,11 +106,15 @@
         goto BREAK if !($_ eq "");
       } else {
         if( $_ =~ /^([^:]+):/ ) {
-          $buf = $buf . $_ if ! $exclude_attr{$1};
+	  if( $include_attr{$1} ) {
+            $buf = $buf . $_;
+	  } elsif( ! $exclude_attr{$1} ) {
+            $buf = $buf . $_;
+	  }
         } else {
           if ( $_ =~ /^\s+(.*)/ ) {
             chomp $buf;
-            $buf = $buf . $1;
+            $buf = $buf . $1 . "\n";
           }
         }
       }



Ultrapossum-cvs メーリングリストの案内
アーカイブの一覧に戻る