php-src/ext/fileinfo/create_data_file.php
Nikita Popov 58b17906f5 Apply tidy formatting
Mostly reindent PHP scripts to spaces.
2020-02-03 13:41:31 +01:00

19 lines
472 B
PHP
Executable File

#!/usr/bin/env php
/* This is a generated file, do not modify */
/* Usage: php create_data_file.php /path/to/magic.mgc > data_file.c */
<?php
$dta = file_get_contents( $argv[1] );
$dta_l = strlen($dta);
$j = 0;
echo "const unsigned char php_magic_database[$dta_l] = {\n";
for ($i = 0; $i < $dta_l; $i++) {
printf("0x%02X, ", ord($dta[$i]));
if ($j % 16 == 15) {
echo "\n";
}
$j++;
}
echo "};\n";
?>