Team Fortress 2 Source Code as on 22/4/2020
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.

41 lines
588 B

  1. use String::CRC32;
  2. sub ReadInputFileWithIncludes
  3. {
  4. local( $filename ) = shift;
  5. local( *INPUT );
  6. local( $output );
  7. open INPUT, "<$filename" || die;
  8. local( $line );
  9. local( $linenum ) = 1;
  10. while( $line = <INPUT> )
  11. {
  12. if( $line =~ m/\#include\s+\"(.*)\"/i )
  13. {
  14. $output.= ReadInputFileWithIncludes( $1 );
  15. }
  16. else
  17. {
  18. $output .= $line;
  19. }
  20. }
  21. close INPUT;
  22. return $output;
  23. }
  24. if( !scalar( @ARGV ) )
  25. {
  26. die "Usage: crc32filewithincludes.pl filename\n";
  27. }
  28. $data = &ReadInputFileWithIncludes( shift );
  29. #print "data: $data\n";
  30. $crc = crc32( $data );
  31. print $crc;
  32. exit 0;