Change 11453 by jhi@alpha on 2001/07/23 21:06:42
Subject: win32\sncfnmcs.pl corrections
From: "Konovalov, Vadim Vladimirovich (Vadim)" <[EMAIL PROTECTED]>
Date: Mon, 23 Jul 2001 12:56:54 +0200
Message-ID: <E3FB32585BF1D411B9E900805FF51A080C1C5D@RU0022EXCH001U>
Rename the script a little bit more sensibly.
Affected files ...
... //depot/perl/MANIFEST#508 edit
... //depot/perl/README.win32#51 edit
... //depot/perl/win32/sncfnmcs.pl#2 delete
... //depot/perl/win32/sync_ext.pl#1 add
Differences ...
==== //depot/perl/MANIFEST#508 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST.~1~ Mon Jul 23 15:15:05 2001
+++ perl/MANIFEST Mon Jul 23 15:15:05 2001
@@ -2235,8 +2235,8 @@
win32/perllib.c Win32 port
win32/pod.mak Win32 port
win32/runperl.c Win32 port
-win32/sncfnmcs.pl Win32 port
win32/splittree.pl Win32 port
+win32/sync_ext.pl Win32 port
win32/vdir.h Perl "host" virtual directory manager
win32/vmem.h Perl "host" memory manager
win32/win32.c Win32 port
==== //depot/perl/README.win32#51 (text) ====
Index: perl/README.win32
--- perl/README.win32.~1~ Mon Jul 23 15:15:05 2001
+++ perl/README.win32 Mon Jul 23 15:15:05 2001
@@ -85,7 +85,7 @@
to bring files up to date, it will try to recompile such files again.
For example, Tk distribution has a lot of such files, resulting in
needless recompiles everytime dmake is invoked. To avoid this, you
-may use the script "sncfnmcs.pl" after a successful build. It is
+may use the script "sync_ext.pl" after a successful build. It is
available in the win32 subdirectory of the Perl source distribution.
=item Command Shell
==== //depot/perl/win32/sync_ext.pl#1 (text) ====
Index: perl/win32/sync_ext.pl
--- perl/win32/sync_ext.pl.~1~ Mon Jul 23 15:15:05 2001
+++ perl/win32/sync_ext.pl Mon Jul 23 15:15:05 2001
@@ -0,0 +1,64 @@
+=comment
+
+Synchronize filename cases for extensions.
+
+This script takes two arguments - first and second extensions to
+synchronize filename cases with.
+
+There may be specified following options:
+ --verbose <== say everything what is going on
+ --recurse <== recurse subdirectories
+ --dummy <== do not perform actual renaming
+ --say-subdir
+Every such option can be specified with an optional "no" prefix to negate it.
+
+Typically, it is invoked as:
+ perl sync_ext.pl c obj --verbose
+
+=cut
+
+use strict;
+
+my ($ext1, $ext2) = map {quotemeta} grep {!/^--/} @ARGV;
+my %opts = (
+ #defaults
+ 'verbose' => 0,
+ 'recurse' => 1,
+ 'dummy' => 0,
+ 'say-subdir' => 0,
+ #options itself
+ (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth
+ (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt
+--no-opt --noopt
+ );
+
+my $sp = '';
+sub xx {
+ opendir DIR, '.';
+ my @t = readdir DIR;
+ my @f = map {/^(.*)\.$ext1$/i} @t;
+ my %f = map {lc($_)=>$_} map {/^(.*)\.$ext2$/i} @t;
+ for (@f) {
+ my $lc = lc($_);
+ if (exists $f{$lc} and $f{$lc} ne $_) {
+ print STDERR "$sp$f{$lc}.$ext2 <==> $_.$ext1\n" if $opts{verbose};
+ if ($opts{dummy}) {
+ print STDERR "ren $f{$lc}.$ext2 $_.$ext2\n";
+ }
+ else {
+ system "ren $f{$lc}.$ext2 $_.$ext2";
+ }
+ }
+ }
+ if ($opts{recurse}) {
+ for (grep {-d&&!/^\.\.?$/} @t) {
+ print STDERR "$sp\\$_\n" if $opts{'say-subdir'};
+ $sp .= ' ';
+ chdir $_ or die;
+ xx();
+ chdir ".." or die;
+ chop $sp;
+ }
+ }
+}
+
+xx();
End of Patch.