Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.4 KiB

  1. $inroot = '\rtl\crt';
  2. $outroot = '\rtl\tmp';
  3. while ($_ = $ARGV[0], /^-/) {
  4. shift;
  5. if (/^-i/) { $inroot = $ARGV[0]; shift; }
  6. if (/^-o/) { $outroot = $ARGV[0]; shift; }
  7. if (/^-v/) { $verbose++; }
  8. }
  9. chdir "$inroot" or die "Can't chdir to $inroot: $!\n";
  10. system "delnode /q $outroot";
  11. system "xcopy /ti $inroot $outroot";
  12. open FILELIST, "sd files ...#have |" or die "Can't run sd files: $!\n";
  13. for (<FILELIST>) {
  14. chop;
  15. s|^//depot/VCBranch/VC/crt/||;
  16. s|#\d+ - .*||;
  17. next if /^log\.txt$/;
  18. next if /fixcopyright\.pl$/;
  19. $INFILE = $_;
  20. open INFILE or die "Can't open $INFILE: $!\n";
  21. $OUTFILE = "$outroot\\$INFILE";
  22. open OUTFILE, ">$OUTFILE" or die "Can't open $OUTFILE: $!\n";
  23. $found_copyright = 0;
  24. $other_copyright = 0;
  25. $detab = 0;
  26. @format_errs = ();
  27. for (<INFILE>) {
  28. $detab = 1 if /\t/;
  29. if (/copyright/i && /Microsoft/) {
  30. ++$found_copyright;
  31. if (/2001/) {
  32. print "Warning: $INFILE:\tCopyright already current\n";
  33. } elsif (/ (19|20)\d\d[ ,."]/) {
  34. s/( (19|20)\d\d)([ ,."])/$1-2001$3/;
  35. } elsif (/ (19|20)\d\d-(19|20)\d\d[ ,."]/) {
  36. s/( (19|20)\d\d)-(19|20)\d\d([ ,."])/$1-2001$4/;
  37. } elsif (/ (19|20)\d\d$/) {
  38. s/( (19|20)\d\d)$/$1-2001/;
  39. } elsif (/ (19|20)\d\d-(19|20)\d\d$/) {
  40. s/( (19|20)\d\d)-(19|20)\d\d$/$1-2001/;
  41. } else {
  42. print "Error: $INFILE: Unparsable copyright line\n";
  43. print "\t $_";
  44. }
  45. if (!/Copyright \([cC]\) \d{4}(-\d{4})?,? Microsoft Corporation\.\s+All rights reserved\./) {
  46. if ( $INFILE !~ q|/sources(\.nt)?$|
  47. && $INFILE !~ q|dirs$|
  48. ) {
  49. push @format_errs, $_;
  50. }
  51. }
  52. }
  53. elsif (/copyright/i && (/Digital Equipment/ || /Intel/)) {
  54. ++$other_copyright;
  55. }
  56. print OUTFILE $_;
  57. }
  58. while ($_ = pop @format_errs) {
  59. # missing "All rights reserved" OK if other copyrights present
  60. next if $other_copyright &&
  61. /Copyright \([cC]\) \d{4}(-\d{4})?,? Microsoft Corporation/;
  62. # .rc files are allowed to have a different format
  63. next if $INFILE =~ /\.rc$/ &&
  64. /Copyright \([cC]\) Microsoft Corporation\.\s+\d{4}(-\d{4})?"/;
  65. print "Error: $INFILE: Incorrect copyright format\n";
  66. print "\t $_";
  67. }
  68. if ($verbose) {
  69. print "Warning: $INFILE:\tdetab!\n" if $detab;
  70. print "Warning: $INFILE:\tmultiple copyrights\n" if $found_copyright > 1;
  71. print "Warning: $INFILE:\tno copyright\n" if !$found_copyright;
  72. }
  73. close INFILE;
  74. close OUTFILE;
  75. unlink $OUTFILE if !$found_copyright;
  76. }
  77. close FILELIST;