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.

59 lines
1.0 KiB

  1. #Copyright (c) 1992-2000 Microsoft Corporation
  2. #
  3. #Module Name:
  4. #
  5. # gnbugcds.pl
  6. #
  7. #Revision History:
  8. #
  9. # Kshitix K. Sharma (kksharma)
  10. #
  11. #
  12. # Parse bugcodes.w file to generate bugcodes.txt
  13. #
  14. # This removes all comments from the file which shouldn't be visible to public
  15. # Comments are lines starting with '%'
  16. #
  17. #
  18. sub next_line;
  19. #
  20. # main
  21. #
  22. $NumLine = 0;
  23. while ($arg = shift) {
  24. if ($arg eq "-o") {
  25. $OutFileName = shift;
  26. } elsif ($arg eq "-i") {
  27. $BugCheckTxtFile = shift;
  28. } else {
  29. $BugCheckTxtFile = $arg;
  30. }
  31. }
  32. die "Cannot open file $BugCheckTxtFile\n" if !open(BUGC_FILE, $BugCheckTxtFile);
  33. die "Cannot open file $OutFileName\n" if !open(OUT_FILE, ">" . $OutFileName);
  34. while (next_line ) {
  35. print OUT_FILE $line;
  36. } continue {
  37. close BUGC_FILE if eof;
  38. }
  39. close OUT_FILE;
  40. #
  41. # Subroutines
  42. #
  43. sub next_line {
  44. $line = <BUGC_FILE>;
  45. $NumLine++;
  46. while ($line =~ /\s*\%.*$/) {
  47. # Skip commented lines - ones which beging with %
  48. $line = <BUGC_FILE>;
  49. $NumLine++;
  50. }
  51. return $line;
  52. }