summaryrefslogtreecommitdiff
path: root/devtools/bin/crc32filewithincludes.pl
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /devtools/bin/crc32filewithincludes.pl
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'devtools/bin/crc32filewithincludes.pl')
-rw-r--r--devtools/bin/crc32filewithincludes.pl41
1 files changed, 41 insertions, 0 deletions
diff --git a/devtools/bin/crc32filewithincludes.pl b/devtools/bin/crc32filewithincludes.pl
new file mode 100644
index 0000000..6c90778
--- /dev/null
+++ b/devtools/bin/crc32filewithincludes.pl
@@ -0,0 +1,41 @@
+use String::CRC32;
+
+sub ReadInputFileWithIncludes
+{
+ local( $filename ) = shift;
+
+ local( *INPUT );
+ local( $output );
+
+ open INPUT, "<$filename" || die;
+
+ local( $line );
+ local( $linenum ) = 1;
+ while( $line = <INPUT> )
+ {
+ if( $line =~ m/\#include\s+\"(.*)\"/i )
+ {
+ $output.= ReadInputFileWithIncludes( $1 );
+ }
+ else
+ {
+ $output .= $line;
+ }
+ }
+
+ close INPUT;
+ return $output;
+}
+
+if( !scalar( @ARGV ) )
+{
+ die "Usage: crc32filewithincludes.pl filename\n";
+}
+
+$data = &ReadInputFileWithIncludes( shift );
+
+#print "data: $data\n";
+
+$crc = crc32( $data );
+print $crc;
+exit 0;