OSDN Git Service

collect some files' permissions
[yamy/yamy.git] / tools / checkversion
1 #!/usr/bin/perl -w
2
3 if ( $#ARGV < 0 ) {
4   print <<'__EOM__';
5 usage:  checkversion FILENAME.EXE [EXCLUDE_TEXT]
6 example:
7         C:> tools/checkversion mayu.exe "Windows 95 or later"
8         This outputs imported APIs that are not supported on Windows 95.
9 required:       
10         DUMPBIN.EXE
11         %MSDevDir%\..\..\VC98\Lib\/WIN32API.CSV
12 __EOM__
13   exit(1);
14 }
15
16 open(IMPORTS, "dumpbin.exe -imports $ARGV[0]|") || die;
17
18 while (<IMPORTS>) {
19   chomp;
20   if ( /^\s+\S+\s+(\S+)$/ ) {
21     my ($name) = $1;
22     $IMPORTS{$name} = 1;
23     if ( $name =~ /(U|A)$/ ) {
24       chop($name);
25       $IMPORTS{$name} = 1;
26     }
27   }
28 }
29
30 open(WIN32API, "<$ENV{MSDevDir}/../../VC98/Lib/WIN32API.CSV") || die;
31
32 $items = <WIN32API>;
33 chomp($items);
34 @items = split(/,/, $items);
35
36 while (<WIN32API>) {
37   chomp;
38   my (@API) = split(/,/, $_);
39   if ( $IMPORTS{$API[0]} ) {
40
41     next if ( 1 <= $#ARGV && /$ARGV[1]/ ); # filter by $ARGV[1];
42     
43     my ($i);
44     for ($i = 0; $i <= $#items; ++ $i) {
45       printf('%-20s%s' . "\n", $items[$i] . ":", $API[$i]);
46     }
47     print "\n";
48   }
49 }