trunk
Rev | Line | |
---|
[68d6d5b] | 1 | #! /usr/bin/perl -w |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use utf8; |
---|
| 6 | use encoding 'utf-8'; |
---|
| 7 | |
---|
| 8 | use Unicode::Normalize qw(NFC NFKC); |
---|
| 9 | |
---|
| 10 | my $top = shift @ARGV || exit; |
---|
| 11 | if (! -d $top) { exit; } |
---|
| 12 | |
---|
| 13 | checkdir($top); |
---|
| 14 | |
---|
[1f4b1b5] | 15 | sub match { |
---|
[68d6d5b] | 16 | my $str = shift @_; |
---|
| 17 | |
---|
| 18 | if ($str ne NFC($str)) { |
---|
| 19 | return 1; |
---|
| 20 | } |
---|
| 21 | if ($str ne NFKC($str)) { |
---|
| 22 | return 1; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | return ''; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | sub checkdir { |
---|
| 29 | my $target = shift @_; |
---|
| 30 | |
---|
| 31 | print STDERR "checking '$target'\n"; |
---|
| 32 | opendir(my $dir, $target) || return $target; |
---|
| 33 | my @entries = sort readdir($dir); |
---|
| 34 | closedir($dir); |
---|
| 35 | |
---|
| 36 | my @dirs; |
---|
| 37 | while (my $entry = shift @entries) { |
---|
| 38 | next if ($entry =~ /^\.+$/); |
---|
[1f4b1b5] | 39 | if (match($entry)) { |
---|
[68d6d5b] | 40 | print "'$target/$entry' can be composed\n"; |
---|
| 41 | next; |
---|
| 42 | } |
---|
| 43 | if (-d "$target/$entry") { |
---|
| 44 | push @dirs, $entry; |
---|
| 45 | next; |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | while (my $entry = pop @dirs) { |
---|
| 50 | checkdir("$target/$entry"); |
---|
| 51 | } |
---|
| 52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.