msgused.pl 847 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/perl
  2. #
  3. # find not used messages
  4. unlink("./msgidx.inc");
  5. unlink("./msgtxt.inc");
  6. @compiler_src = (glob("./*.inc"),
  7. glob("./*.pas"));
  8. open(MESSAGE_FILE, "< ./msg/errore.msg") or
  9. die "Couldn't open <./msg/errore.msg> for reading: $!\n";
  10. open(FOUND, "> MSG-OK.TXT") or
  11. die "Couldn't open <MSG-OK.TXT> for writing: $!\n";
  12. select FOUND; $| = 1;
  13. open(NOT_FOUND, "> MSG_BAD.TXT") or
  14. die "Couldn't open <MSG_BAD.TXT> for writing: $!\n";
  15. select NOT_FOUND; $| = 1;
  16. while (<MESSAGE_FILE>)
  17. {
  18. if (/^(\w\w\w*?_\w\w*?_\w\w*?)=/)
  19. {
  20. $msg = $1;
  21. $found = `grep -il $msg @compiler_src`;
  22. if ($found) {
  23. print stderr "$msg\n";
  24. print FOUND $msg . "\n";
  25. }
  26. else {
  27. print stderr "NOT FOUND \t $msg\n";
  28. print NOT_FOUND $msg . "\n";
  29. }
  30. }
  31. }
  32. close(IN);
  33. close(FOUND);
  34. close(NOT_FOUND);