create_data_file.php 399 B

1234567891011121314151617
  1. /* This is a generated file, do not modify */
  2. /* Usage: php create_data_file.php /path/to/magic.mgc > data_file.c */
  3. <?php
  4. $dta = file_get_contents( $argv[1] );
  5. $dta_l = strlen($dta);
  6. $j = 0;
  7. echo "const unsigned char php_magic_database[$dta_l] = {\n";
  8. for ($i = 0; $i < $dta_l; $i++) {
  9. printf("0x%02X, ", ord($dta[$i]));
  10. if ($j % 16 == 15) {
  11. echo "\n";
  12. }
  13. $j++;
  14. }
  15. echo "};\n";
  16. ?>