Leaked source code of windows server 2003
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.

58 lines
1.4 KiB

  1. #####################################################
  2. # Compares the non-[Strings] portion of file1 and file2
  3. #
  4. # Requires two(2) arguments
  5. #####################################################
  6. $argc = @ARGV;
  7. $PGM = "Compare";
  8. die "Usage: $PGM file1 file2\n" if ( $argc < 2 );
  9. $file1 = $ARGV[0];
  10. $file2 = $ARGV[1];
  11. $sErrorMsg = "";
  12. if ((-e $file1) && (-e $file2)){
  13. open(FILE1, "<$file1");
  14. open(FILE2, "<$file2");
  15. while($sErrorMsg eq ""){
  16. if ($line1 = <FILE1>){
  17. if ($line2 = <FILE2>){
  18. if ($line1 eq $line2){
  19. if ($line1 eq "[Strings]"){
  20. last;
  21. }
  22. }
  23. else{
  24. $sErrorMsg = "Files are different ($file1)";
  25. }
  26. }
  27. else{
  28. $sErrorMsg = "Files are different ($file2 terminates early)";
  29. }
  30. }
  31. else{
  32. if ($line2 = <FILE2>){
  33. $sErrorMsg = "Files are different ($file1 terminates early)";
  34. }
  35. last;
  36. }
  37. }
  38. close(FILE1);
  39. close(FILE2);
  40. }
  41. elsif (-e $file1){
  42. $sErrorMsg = "File $file1 exists, but $file2 does not.";
  43. }
  44. elsif (-e $file2){
  45. $sErrorMsg = "File $file2 exists, but $file1 does not.";
  46. }
  47. if ($sErrorMsg ne ""){
  48. die "Build_Status fatal error : $PGM : $sErrorMsg\n";
  49. }